Mercurial > hg > multitrack-audio-matcher
comparison src/LiveAudioInput.cpp @ 1:852173ca8365
Added class to hold recorded mulitracks
author | Andrew N Robertson <andrew.robertson@eecs.qmul.ac.uk> |
---|---|
date | Tue, 31 Jan 2012 17:35:30 +0000 |
parents | c4f9e49226eb |
children | 5e188c0035b6 |
comparison
equal
deleted
inserted
replaced
0:c4f9e49226eb | 1:852173ca8365 |
---|---|
7 * | 7 * |
8 */ | 8 */ |
9 | 9 |
10 #include "LiveAudioInput.h" | 10 #include "LiveAudioInput.h" |
11 | 11 |
12 const double hopsize = 512;//check to see it agrees with ofxAubioOnsetDetector | |
13 | |
12 LiveAudioInput::LiveAudioInput(){ | 14 LiveAudioInput::LiveAudioInput(){ |
15 numberOfEvents = 0; | |
16 | |
17 } | |
13 | 18 |
19 | |
20 | |
21 | |
22 void LiveAudioInput::addPitchEvent(const double& pitch, const double& time){ | |
23 | |
24 AudioEvent e; | |
25 e.millisTime = time; | |
26 e.frameTime = millisToFrames(time); | |
27 e.pitch = pitch; | |
28 liveEvents.push_back(e); | |
29 printf("live input pitch %f time %f ms == %f frames\n", pitch, time, e.frameTime); | |
30 numberOfEvents++; | |
31 | |
14 } | 32 } |
33 | |
34 | |
35 | |
36 double LiveAudioInput::framesToMillis(const double& frameCount){ | |
37 return ((frameCount*hopsize*1000.0)/44100.0); | |
38 } | |
39 | |
40 | |
41 double LiveAudioInput::millisToFrames(const double& millis){ | |
42 return ((millis*44100.0)/(hopsize*1000.0)); | |
43 } |