-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathchrip.cpp
54 lines (44 loc) · 1.09 KB
/
chrip.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#include "chrip.h"
Chrip::Chrip()
{
// load chrip in memory
loadChrip();
}
void Chrip::loadChrip()
{
int numberOfPulse = 1;
int spacingBetweenPulses = 30;
QFile file("Data/Chirp.csv");
if (!file.open(QIODevice::ReadOnly))
{
qDebug() << file.errorString();
return;
}
file.readLine(); // remove first column
while (!file.atEnd())
{
QByteArray line = file.readLine();
QList<QByteArray> strings = line.split(',');
time.append(strings[0].toFloat());
amplitude.append(strings[1].toFloat());
// qDebug() << "Word list : |" << strings[0].toFloat() << "| : |" << strings[1].toFloat() << "|";
}
int chirp_len = amplitude.length();
// multiple pulses
for(int i = 1; i < numberOfPulse; i ++){
for(int j = 0; j < spacingBetweenPulses; j++){
amplitude.append(0);
}
for(int j = 0; j < chirp_len; j++){
amplitude.append(amplitude[j]);
}
}
}
QList<float> Chrip::getChrip()
{
return amplitude;
}
QList<float> Chrip::getTime()
{
return time;
}