/[svn]/linuxsampler/trunk/src/engines/gig/EngineChannel.cpp
ViewVC logotype

Diff of /linuxsampler/trunk/src/engines/gig/EngineChannel.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1843 by iliev, Sat Feb 21 17:08:18 2009 UTC revision 1844 by persson, Mon Feb 23 18:29:50 2009 UTC
# Line 3  Line 3 
3   *   LinuxSampler - modular, streaming capable sampler                     *   *   LinuxSampler - modular, streaming capable sampler                     *
4   *                                                                         *   *                                                                         *
5   *   Copyright (C) 2003, 2004 by Benno Senoner and Christian Schoenebeck   *   *   Copyright (C) 2003, 2004 by Benno Senoner and Christian Schoenebeck   *
6   *   Copyright (C) 2005 - 2008 Christian Schoenebeck                       *   *   Copyright (C) 2005 - 2009 Christian Schoenebeck                       *
7   *                                                                         *   *                                                                         *
8   *   This program is free software; you can redistribute it and/or modify  *   *   This program is free software; you can redistribute it and/or modify  *
9   *   it under the terms of the GNU General Public License as published by  *   *   it under the terms of the GNU General Public License as published by  *
# Line 344  namespace LinuxSampler { namespace gig { Line 344  namespace LinuxSampler { namespace gig {
344      void EngineChannel::DisconnectAudioOutputDevice() {      void EngineChannel::DisconnectAudioOutputDevice() {
345          if (pEngine) { // if clause to prevent disconnect loops          if (pEngine) { // if clause to prevent disconnect loops
346    
347                ResetInternal();
348    
349              // delete the structures used for instrument change              // delete the structures used for instrument change
350              RTList< ::gig::DimensionRegion*>* d = InstrumentChangeCommand.GetConfigForUpdate().pDimRegionsInUse;              RTList< ::gig::DimensionRegion*>* d = InstrumentChangeCommand.GetConfigForUpdate().pDimRegionsInUse;
351              if (d) delete d;              if (d) delete d;
352              EngineChannel::instrument_change_command_t& cmd = InstrumentChangeCommand.SwitchConfig();              EngineChannel::instrument_change_command_t& cmd = InstrumentChangeCommand.SwitchConfig();
353              d = cmd.pDimRegionsInUse;              d = cmd.pDimRegionsInUse;
354                if (d) delete d;
355    
356              if (cmd.pInstrument) {              if (cmd.pInstrument) {
357                  // release the currently loaded instrument                  // release the currently loaded instrument
358                  Engine::instruments.HandBackInstrument(cmd.pInstrument, this, d);                  Engine::instruments.HandBack(cmd.pInstrument, this);
             }  
   
             if (d) delete d;  
   
             // release all active dimension regions to resource  
             // manager  
             RTList<uint>::Iterator iuiKey = pActiveKeys->first();  
             RTList<uint>::Iterator end    = pActiveKeys->end();  
             while (iuiKey != end) { // iterate through all active keys  
                 midi_key_info_t* pKey = &pMIDIKeyInfo[*iuiKey];  
                 ++iuiKey;  
   
                 RTList<Voice>::Iterator itVoice     = pKey->pActiveVoices->first();  
                 RTList<Voice>::Iterator itVoicesEnd = pKey->pActiveVoices->end();  
                 for (; itVoice != itVoicesEnd; ++itVoice) { // iterate through all voices on this key  
                     Engine::instruments.HandBackDimReg(itVoice->pDimRgn);  
                 }  
359              }              }
360    
             ResetInternal();  
361              if (pEvents) {              if (pEvents) {
362                  delete pEvents;                  delete pEvents;
363                  pEvents = NULL;                  pEvents = NULL;
# Line 387  namespace LinuxSampler { namespace gig { Line 372  namespace LinuxSampler { namespace gig {
372                      pMIDIKeyInfo[i].pEvents = NULL;                      pMIDIKeyInfo[i].pEvents = NULL;
373                  }                  }
374              }              }
             Engine* oldEngine = pEngine;  
375              AudioOutputDevice* oldAudioDevice = pEngine->pAudioOutputDevice;              AudioOutputDevice* oldAudioDevice = pEngine->pAudioOutputDevice;
376              pEngine = NULL;              pEngine = NULL;
377              Engine::FreeEngine(this, oldAudioDevice);              Engine::FreeEngine(this, oldAudioDevice);

Legend:
Removed from v.1843  
changed lines
  Added in v.1844

  ViewVC Help
Powered by ViewVC