Fix occasional Sinnah hang

This commit is contained in:
Dominic Clark
2018-11-25 15:55:38 +00:00
committed by Oskar Wallgren
parent 277e8b6444
commit 3a94ed3f3f
2 changed files with 10 additions and 8 deletions

View File

@@ -42,14 +42,7 @@ public:
virtual void play( sampleFrame * _working_buffer )
{
// if the instrument is midi-based, we can safely render right away
if( m_instrument->flags() & Instrument::IsMidiBased )
{
m_instrument->play( _working_buffer );
return;
}
// if not, we need to ensure that all our nph's have been processed first
// ensure that all our nph's have been processed first
ConstNotePlayHandleList nphv = NotePlayHandle::nphsOfInstrumentTrack( m_instrument->instrumentTrack(), true );
bool nphsLeft;

View File

@@ -63,6 +63,7 @@
#define USE_WS_PREFIX
#include <windows.h>
#include <algorithm>
#include <vector>
#include <queue>
#include <string>
@@ -900,6 +901,14 @@ void RemoteVstPlugin::process( const sampleFrame * _in, sampleFrame * _out )
static char eventsBuffer[sizeof( VstEvents ) + sizeof( VstMidiEvent * ) * MIDI_EVENT_BUFFER_COUNT];
static VstMidiEvent vme[MIDI_EVENT_BUFFER_COUNT];
// first sort events chronologically, since some plugins
// (e.g. Sinnah) can hang if they're out of order
std::stable_sort( m_midiEvents.begin(), m_midiEvents.end(),
[]( const VstMidiEvent &a, const VstMidiEvent &b )
{
return a.deltaFrames < b.deltaFrames;
} );
VstEvents* events = (VstEvents *) eventsBuffer;
events->reserved = 0;
events->numEvents = m_midiEvents.size();