changeset 442:88ae0e53a5da tonioni

Reset audio generator when clearing ring buffers -- because we are about to jump back in time to the start of the buffered area, so any pending note-offs won't happen until much later, so we should drop the pending notes entirely
author Chris Cannam
date Tue, 24 Mar 2015 16:41:38 +0000
parents aa6fb3516e28
children 345d41a3567f
files audioio/AudioCallbackPlaySource.cpp audioio/AudioGenerator.cpp audioio/ClipMixer.cpp
diffstat 3 files changed, 7 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/audioio/AudioCallbackPlaySource.cpp	Mon Mar 23 11:26:28 2015 +0000
+++ b/audioio/AudioCallbackPlaySource.cpp	Tue Mar 24 16:41:38 2015 +0000
@@ -388,6 +388,8 @@
 	m_writeBuffers->push_back(new RingBuffer<float>(m_ringBufferSize));
     }
 
+    m_audioGenerator->reset();
+    
 //    cout << "AudioCallbackPlaySource::clearRingBuffers: Created "
 //	      << count << " write buffers" << endl;
 
--- a/audioio/AudioGenerator.cpp	Mon Mar 23 11:26:28 2015 +0000
+++ b/audioio/AudioGenerator.cpp	Tue Mar 24 16:41:38 2015 +0000
@@ -526,8 +526,9 @@
     sv_frame_t got = blocks * m_processingBlockSize;
 
 #ifdef DEBUG_AUDIO_GENERATOR
-    cout << "mixModel [clip]: frames " << frames
-	      << ", blocks " << blocks << endl;
+    cout << "mixModel [clip]: start " << startFrame << ", frames " << frames
+         << ", blocks " << blocks << ", have " << m_noteOffs.size()
+         << " note-offs" << endl;
 #endif
 
     ClipMixer::NoteStart on;
--- a/audioio/ClipMixer.cpp	Mon Mar 23 11:26:28 2015 +0000
+++ b/audioio/ClipMixer.cpp	Tue Mar 24 16:41:38 2015 +0000
@@ -20,6 +20,8 @@
 
 #include "base/Debug.h"
 
+//#define DEBUG_CLIP_MIXER 1
+
 ClipMixer::ClipMixer(int channels, sv_samplerate_t sampleRate, sv_frame_t blockSize) :
     m_channels(channels),
     m_sampleRate(sampleRate),