-
Notifications
You must be signed in to change notification settings - Fork 0
/
read_wav_markers.cpp
46 lines (35 loc) · 974 Bytes
/
read_wav_markers.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
#ifndef RRRR_H
#define RRRR_H
#include <QString>
#include "regionwavereader.h"
#include "mex.h"
static RegionWaveReader regionReader;
static void read_wav_regions(QString name) {
regionReader.setFileName(name);
regionReader.read();
}
void mexFunction(int nlhs,mxArray *plhs[],
int nrhs,const mxArray *prhs[])
{
char *str;
if (!(mxIsChar(prhs[0]))){
mexErrMsgTxt("Input must be of type string.\n.");
}
str = mxArrayToString(prhs[0]);
QString fileName (str);
// regionReader.setFileName(fileName);
mxFree(str);
read_wav_regions(fileName);
MarkerList* markers = regionReader.getMarkers();
if (nlhs!=1) {
mexErrMsgTxt("read_wav_markers should have only one output parametr (array).\n.");
}
plhs[0] = mxCreateDoubleMatrix(1, markers->size(), mxREAL);
double* data = mxGetPr(plhs[0]);
// Marker* m;
// foreach(m, *markers){ }
for (int i=0; i<markers->size(); i++){
*(data+i) = markers->at(i)->position;
}
}
#endif // RRRR_H