diff 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
line wrap: on
line diff
--- a/src/LiveAudioInput.cpp	Tue Jan 31 13:54:17 2012 +0000
+++ b/src/LiveAudioInput.cpp	Tue Jan 31 17:35:30 2012 +0000
@@ -9,6 +9,35 @@
 
 #include "LiveAudioInput.h"
 
+const double hopsize = 512;//check to see it agrees with ofxAubioOnsetDetector
+
 LiveAudioInput::LiveAudioInput(){
+	numberOfEvents = 0;
+	
+}
 
+
+
+
+void LiveAudioInput::addPitchEvent(const double& pitch, const double& time){
+
+	AudioEvent e;
+	e.millisTime = time;
+	e.frameTime = millisToFrames(time);
+	e.pitch = pitch;
+	liveEvents.push_back(e);
+	printf("live input pitch %f time %f ms == %f frames\n", pitch, time, e.frameTime);
+	numberOfEvents++;
+	
+}
+
+
+
+double LiveAudioInput::framesToMillis(const double& frameCount){
+	return ((frameCount*hopsize*1000.0)/44100.0);
+}
+
+
+double LiveAudioInput::millisToFrames(const double& millis){
+	return ((millis*44100.0)/(hopsize*1000.0));
 }
\ No newline at end of file