diff audioio/ClipMixer.h @ 310:8c59cc68eabd tonioni

Initial implementation of clip note mix
author Chris Cannam
date Tue, 07 Jan 2014 17:11:14 +0000
parents 289d65722123
children faee60602049
line wrap: on
line diff
--- a/audioio/ClipMixer.h	Tue Jan 07 15:52:47 2014 +0000
+++ b/audioio/ClipMixer.h	Tue Jan 07 17:11:14 2014 +0000
@@ -40,15 +40,15 @@
     //!!! AudioGenerator's NoteOff?
 
     struct NoteStart {
-	int frameOffset; // in current processing block
+	int frameOffset; // within current processing block
 	float frequency; // Hz
 	float level; // volume in range (0,1]
 	float pan; // range [-1,1]
     };
 
     struct NoteEnd {
+	int frameOffset; // in current processing block
         float frequency; // matching note start
-	int frameOffset; // in current processing block
     };
 
     void mix(float **toBuffers, 
@@ -67,6 +67,18 @@
     int m_clipLength;
     float m_clipF0;
     float m_clipRate;
+
+    std::vector<NoteStart> m_playing;
+
+    float getResampleRatioFor(float frequency);
+    int getResampledClipDuration(float frequency);
+
+    void mixNote(float **toBuffers, 
+                 float *levels,
+                 float frequency,
+                 int sourceOffset, // within resampled note
+                 int targetOffset, // within target buffer
+                 int sampleCount);
 };