--- linuxsampler/trunk/src/Sampler.cpp 2005/05/21 01:10:12 556 +++ linuxsampler/trunk/src/Sampler.cpp 2005/06/17 19:49:30 660 @@ -51,7 +51,7 @@ if (pMidiInputPort) pMidiInputPort->Disconnect(pEngineChannel); if (pEngineChannel) { if (pAudioOutputDevice) pEngineChannel->DisconnectAudioOutputDevice(); - delete pEngineChannel; + EngineChannelFactory::Destroy(pEngineChannel); } } } @@ -63,13 +63,16 @@ EngineChannel* pNewEngineChannel = EngineChannelFactory::Create(EngineType); if (!pNewEngineChannel) throw LinuxSamplerException("Unknown engine type"); + //FIXME: hack to allow fast retrieval of engine channel's sampler channel index + pNewEngineChannel->iSamplerChannelIndex = Index(); + // dereference midi input port. MidiInputPort* pMidiInputPort = GetMidiInputDevicePort(this->midiPort); // disconnect old engine if (pEngineChannel) { if (pMidiInputPort) pMidiInputPort->Disconnect(pEngineChannel); if (pAudioOutputDevice) pEngineChannel->DisconnectAudioOutputDevice(); - delete pEngineChannel; + EngineChannelFactory::Destroy(pEngineChannel); } // connect new engine channel