diff plugin/DSSIPluginInstance.cpp @ 10:ec6886f0e673

* Fix update and play limits for play-selection mode when not looping * Fix playback in loop mode when no selection -- but the GUI update for this is still wrong on the flyback * Various fixes and improvements to making selections, particularly during playback * Draw selection under non-opaque non-scrollable layers, so as to improve cacheing * Show selection limits as text when drawing selection * Allow user to find missing audio files when loading session * Cross-fade selections when in play-selection mode -- mostly. We don't cross-fade on a processing block boundary, and unfortunately with short selections the selection boundary is quite likely to coincide with a block boundary.
author Chris Cannam
date Wed, 25 Jan 2006 17:46:28 +0000
parents d86891498eef
children cb05ba39664a
line wrap: on
line diff
--- a/plugin/DSSIPluginInstance.cpp	Tue Jan 24 16:20:58 2006 +0000
+++ b/plugin/DSSIPluginInstance.cpp	Wed Jan 25 17:46:28 2006 +0000
@@ -60,7 +60,8 @@
     m_latencyPort(0),
     m_run(false),
     m_bypassed(false),
-    m_grouped(false)
+    m_grouped(false),
+    m_haveLastEventSendTime(false)
 {
 #ifdef DEBUG_DSSI
     std::cerr << "DSSIPluginInstance::DSSIPluginInstance(" << identifier << ")"
@@ -788,6 +789,11 @@
 DSSIPluginInstance::sendEvent(const RealTime &eventTime,
 			      const void *e)
 {
+    if (m_haveLastEventSendTime &&
+	m_lastEventSendTime > eventTime) {
+	clearEvents();
+    }
+
     snd_seq_event_t *event = (snd_seq_event_t *)e;
 #ifdef DEBUG_DSSI_PROCESS
     std::cerr << "DSSIPluginInstance::sendEvent at " << eventTime << std::endl;
@@ -803,6 +809,13 @@
     m_eventBuffer.write(&ev, 1);
 }
 
+void
+DSSIPluginInstance::clearEvents()
+{
+    m_haveLastEventSendTime = false;
+    m_eventBuffer.reset();
+}
+
 bool
 DSSIPluginInstance::handleController(snd_seq_event_t *ev)
 {
@@ -858,6 +871,7 @@
 
     if (!m_descriptor || !m_descriptor->run_synth) {
 	m_eventBuffer.skip(m_eventBuffer.getReadSpace());
+	m_haveLastEventSendTime = false;
 	if (m_descriptor->LADSPA_Plugin->run) {
 	    m_descriptor->LADSPA_Plugin->run(m_instanceHandle, m_blockSize);
 	} else {
@@ -901,7 +915,13 @@
 #endif
 
 	if (frameOffset >= int(m_blockSize)) break;
-	if (frameOffset < 0) frameOffset = 0;
+	if (frameOffset < 0) {
+	    frameOffset = 0;
+	    if (ev->type == SND_SEQ_EVENT_NOTEON) {
+		m_eventBuffer.skip(1);
+		continue;
+	    }
+	}
 
 	ev->time.tick = frameOffset;
 	m_eventBuffer.skip(1);