--- linuxsampler/trunk/src/engines/EngineBase.h 2017/05/28 22:22:56 3246 +++ linuxsampler/trunk/src/engines/EngineBase.h 2017/06/21 20:59:06 3283 @@ -379,9 +379,8 @@ } pVoicePool->clear(); - // (re)create event generator - if (pEventGenerator) delete pEventGenerator; - pEventGenerator = new EventGenerator(pAudioOut->SampleRate()); + // update event generator + pEventGenerator->SetSampleRate(pAudioOut->SampleRate()); dmsg(1,("Starting disk thread...")); pDiskThread->StartThread(); @@ -1296,7 +1295,10 @@ RTList::Iterator itScriptEvent = pEngineChannel->pScript->pEvents->allocAppend(); + itScriptEvent->cause = pEventGenerator->CreateEvent(0); + itScriptEvent->cause.Type = (Event::type_t) -1; // some invalid type to avoid random event processing itScriptEvent->cause.pEngineChannel = pEngineChannel; + itScriptEvent->cause.pMidiInputPort = pEngineChannel->GetMidiInputPort(); itScriptEvent->handlers[0] = pEngineChannel->pScript->handlerInit; itScriptEvent->handlers[1] = NULL; itScriptEvent->currentHandler = 0;