Mercurial > hg > btrack
comparison modules-and-plug-ins/python-module/btrack_python_module.cpp @ 20:baf35f208814 develop
Replaced switch statements in OnsetDetectionFunction with enums. Renamed lots of functions so that they have better names, in camel case. Added some unit tests for initialisation of BTrack.
author | Adam <adamstark.uk@gmail.com> |
---|---|
date | Thu, 23 Jan 2014 15:31:11 +0000 |
parents | 450c53430540 |
children | a8e3e95d14e4 |
comparison
equal
deleted
inserted
replaced
19:88c8d3862eee | 20:baf35f208814 |
---|---|
149 | 149 |
150 // process the current audio frame | 150 // process the current audio frame |
151 b.processAudioFrame(buffer); | 151 b.processAudioFrame(buffer); |
152 | 152 |
153 // if a beat is currently scheduled | 153 // if a beat is currently scheduled |
154 if (b.playbeat == 1) | 154 if (b.beatDueInCurrentFrame()) |
155 { | 155 { |
156 //beats[beatnum] = (((double) hopSize) / 44100) * ((double) i); | |
157 beats[beatnum] = BTrack::getBeatTimeInSeconds(i,hopSize,44100); | 156 beats[beatnum] = BTrack::getBeatTimeInSeconds(i,hopSize,44100); |
158 beatnum = beatnum + 1; | 157 beatnum = beatnum + 1; |
159 } | 158 } |
160 | 159 |
161 } | 160 } |
239 { | 238 { |
240 df_val = data[i] + 0.0001; | 239 df_val = data[i] + 0.0001; |
241 | 240 |
242 b.processOnsetDetectionFunctionSample(df_val); // process df sample in beat tracker | 241 b.processOnsetDetectionFunctionSample(df_val); // process df sample in beat tracker |
243 | 242 |
244 if (b.playbeat == 1) | 243 if (b.beatDueInCurrentFrame()) |
245 { | 244 { |
246 //beats[beatnum] = (((double) hopSize) / 44100) * ((double) i); | |
247 beats[beatnum] = BTrack::getBeatTimeInSeconds(i,hopSize,44100); | 245 beats[beatnum] = BTrack::getBeatTimeInSeconds(i,hopSize,44100); |
248 beatnum = beatnum + 1; | 246 beatnum = beatnum + 1; |
249 } | 247 } |
250 | 248 |
251 } | 249 } |