Index: linuxsampler/src/engines/gig/EngineChannel.cpp =================================================================== RCS file: /var/cvs/linuxsampler/linuxsampler/src/engines/gig/EngineChannel.cpp,v retrieving revision 1.45 diff -u -2 -r1.45 EngineChannel.cpp --- linuxsampler/src/engines/gig/EngineChannel.cpp 21 Feb 2009 17:08:18 -0000 1.45 +++ linuxsampler/src/engines/gig/EngineChannel.cpp 22 Feb 2009 10:36:15 -0000 @@ -4,5 +4,5 @@ * * * Copyright (C) 2003, 2004 by Benno Senoner and Christian Schoenebeck * - * Copyright (C) 2005 - 2008 Christian Schoenebeck * + * Copyright (C) 2005 - 2009 Christian Schoenebeck * * * * This program is free software; you can redistribute it and/or modify * @@ -345,4 +345,6 @@ if (pEngine) { // if clause to prevent disconnect loops + ResetInternal(); + // delete the structures used for instrument change RTList< ::gig::DimensionRegion*>* d = InstrumentChangeCommand.GetConfigForUpdate().pDimRegionsInUse; @@ -350,28 +352,11 @@ EngineChannel::instrument_change_command_t& cmd = InstrumentChangeCommand.SwitchConfig(); d = cmd.pDimRegionsInUse; + if (d) delete d; if (cmd.pInstrument) { // release the currently loaded instrument - Engine::instruments.HandBackInstrument(cmd.pInstrument, this, d); - } - - if (d) delete d; - - // release all active dimension regions to resource - // manager - RTList::Iterator iuiKey = pActiveKeys->first(); - RTList::Iterator end = pActiveKeys->end(); - while (iuiKey != end) { // iterate through all active keys - midi_key_info_t* pKey = &pMIDIKeyInfo[*iuiKey]; - ++iuiKey; - - RTList::Iterator itVoice = pKey->pActiveVoices->first(); - RTList::Iterator itVoicesEnd = pKey->pActiveVoices->end(); - for (; itVoice != itVoicesEnd; ++itVoice) { // iterate through all voices on this key - Engine::instruments.HandBackDimReg(itVoice->pDimRgn); - } + Engine::instruments.HandBack(cmd.pInstrument, this); } - ResetInternal(); if (pEvents) { delete pEvents; @@ -388,5 +373,4 @@ } } - Engine* oldEngine = pEngine; AudioOutputDevice* oldAudioDevice = pEngine->pAudioOutputDevice; pEngine = NULL;