Mercurial > hg > btrack
comparison modules-and-plug-ins/python-module/btrack_python_module.cpp @ 15:2b94d3d2fb9d develop
Reformatted comments, removed the OnsetDetectionFunction constructor with no arguments, removed a number of unused variables and made changes to the python module to fix some casting problems and removed some unused variables there also. Still getting the same results, so no overall changes to the algorithm.
author | Adam <adamstark.uk@gmail.com> |
---|---|
date | Wed, 22 Jan 2014 01:13:45 +0000 |
parents | 18fc3c248436 |
children | a31841af2bbc |
comparison
equal
deleted
inserted
replaced
14:18fc3c248436 | 15:2b94d3d2fb9d |
---|---|
26 | 26 |
27 // get data as array | 27 // get data as array |
28 double* data = (double*) PyArray_DATA(arr1); | 28 double* data = (double*) PyArray_DATA(arr1); |
29 | 29 |
30 // get array size | 30 // get array size |
31 int signal_length = PyArray_Size((PyObject*)arr1); | 31 long signal_length = PyArray_Size((PyObject*)arr1); |
32 //int k = (int) theSize; | 32 //int k = (int) theSize; |
33 | 33 |
34 // get data type | 34 // get data type |
35 char type = PyArray_DESCR(arr1)->type; | 35 //char type = PyArray_DESCR(arr1)->type; |
36 | 36 |
37 ////////// BEGIN PROCESS /////////////////// | 37 ////////// BEGIN PROCESS /////////////////// |
38 int hsize = 512; | 38 int hsize = 512; |
39 int fsize = 1024; | 39 int fsize = 1024; |
40 int df_type = 6; | 40 int df_type = 6; |
126 | 126 |
127 // get data as array | 127 // get data as array |
128 double* data = (double*) PyArray_DATA(arr1); | 128 double* data = (double*) PyArray_DATA(arr1); |
129 | 129 |
130 // get array size | 130 // get array size |
131 int signal_length = PyArray_Size((PyObject*)arr1); | 131 long signal_length = PyArray_Size((PyObject*)arr1); |
132 //int k = (int) theSize; | 132 //int k = (int) theSize; |
133 | 133 |
134 // get data type | 134 // get data type |
135 char type = PyArray_DESCR(arr1)->type; | 135 //char type = PyArray_DESCR(arr1)->type; |
136 | 136 |
137 ////////// BEGIN PROCESS /////////////////// | 137 ////////// BEGIN PROCESS /////////////////// |
138 int hsize = 512; | 138 int hsize = 512; |
139 int fsize = 1024; | 139 int fsize = 1024; |
140 int df_type = 6; | 140 int df_type = 6; |
250 | 250 |
251 // get data as array | 251 // get data as array |
252 double* data = (double*) PyArray_DATA(arr1); | 252 double* data = (double*) PyArray_DATA(arr1); |
253 | 253 |
254 // get array size | 254 // get array size |
255 int numframes = PyArray_Size((PyObject*)arr1); | 255 long numframes = PyArray_Size((PyObject*)arr1); |
256 //int k = (int) theSize; | 256 //int k = (int) theSize; |
257 | 257 |
258 // get data type | 258 // get data type |
259 char type = PyArray_DESCR(arr1)->type; | 259 //char type = PyArray_DESCR(arr1)->type; |
260 | 260 |
261 ////////// BEGIN PROCESS /////////////////// | 261 ////////// BEGIN PROCESS /////////////////// |
262 int hsize = 512; | 262 int hsize = 512; |
263 | 263 |
264 BTrack b; | 264 BTrack b; |
273 float df_val; | 273 float df_val; |
274 | 274 |
275 /////////////////////////////////////////// | 275 /////////////////////////////////////////// |
276 //////// Begin Processing Loop //////////// | 276 //////// Begin Processing Loop //////////// |
277 | 277 |
278 for (int i=0;i < numframes;i++) | 278 for (long i=0;i < numframes;i++) |
279 { | 279 { |
280 df_val = (float) (data[i] + 0.0001); | 280 df_val = (float) (data[i] + 0.0001); |
281 | 281 |
282 b.process(df_val); // process df sample in beat tracker | 282 b.process(df_val); // process df sample in beat tracker |
283 | 283 |