/[svn]/linuxsampler/trunk/src/Sampler.cpp
ViewVC logotype

Diff of /linuxsampler/trunk/src/Sampler.cpp

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

revision 837 by persson, Thu Feb 9 20:03:03 2006 UTC revision 840 by persson, Sun Feb 26 13:00:08 2006 UTC
# Line 48  namespace LinuxSampler { Line 48  namespace LinuxSampler {
48    
49      SamplerChannel::~SamplerChannel() {      SamplerChannel::~SamplerChannel() {
50          if (pEngineChannel) {          if (pEngineChannel) {
51                Engine* engine = pEngineChannel->GetEngine();
52                if (pAudioOutputDevice) pAudioOutputDevice->Disconnect(engine);
53    
54              MidiInputPort* pMidiInputPort = (pEngineChannel) ? pEngineChannel->GetMidiInputPort() : __GetMidiInputDevicePort(GetMidiInputChannel());              MidiInputPort* pMidiInputPort = (pEngineChannel) ? pEngineChannel->GetMidiInputPort() : __GetMidiInputDevicePort(GetMidiInputChannel());
55              if (pMidiInputPort) pMidiInputPort->Disconnect(pEngineChannel);              if (pMidiInputPort) pMidiInputPort->Disconnect(pEngineChannel);
56              if (pEngineChannel) {              if (pEngineChannel) {
57                  if (pAudioOutputDevice) pEngineChannel->DisconnectAudioOutputDevice();                  if (pAudioOutputDevice) pEngineChannel->DisconnectAudioOutputDevice();
58                  EngineChannelFactory::Destroy(pEngineChannel);                  EngineChannelFactory::Destroy(pEngineChannel);
59    
60                    // reconnect engine if it still exists
61                    const std::set<Engine*>& engines = EngineFactory::EngineInstances();
62                    if (engines.find(engine) != engines.end()) pAudioOutputDevice->Connect(engine);
63              }              }
64          }          }
65      }      }
# Line 71  namespace LinuxSampler { Line 78  namespace LinuxSampler {
78          MidiInputPort* pMidiInputPort = __GetMidiInputDevicePort(GetMidiInputPort());          MidiInputPort* pMidiInputPort = __GetMidiInputDevicePort(GetMidiInputPort());
79          // disconnect old engine channel          // disconnect old engine channel
80          if (pEngineChannel) {          if (pEngineChannel) {
81                Engine* engine = pEngineChannel->GetEngine();
82                if (pAudioOutputDevice) pAudioOutputDevice->Disconnect(engine);
83    
84              if (pMidiInputPort) pMidiInputPort->Disconnect(pEngineChannel);              if (pMidiInputPort) pMidiInputPort->Disconnect(pEngineChannel);
85              if (pAudioOutputDevice) pEngineChannel->DisconnectAudioOutputDevice();              if (pAudioOutputDevice) pEngineChannel->DisconnectAudioOutputDevice();
86              EngineChannelFactory::Destroy(pEngineChannel);              EngineChannelFactory::Destroy(pEngineChannel);
87    
88                // reconnect engine if it still exists
89                const std::set<Engine*>& engines = EngineFactory::EngineInstances();
90                if (engines.find(engine) != engines.end()) pAudioOutputDevice->Connect(engine);
91          }          }
92    
93          // connect new engine channel          // connect new engine channel
# Line 95  namespace LinuxSampler { Line 109  namespace LinuxSampler {
109    
110      void SamplerChannel::SetAudioOutputDevice(AudioOutputDevice* pDevice) {      void SamplerChannel::SetAudioOutputDevice(AudioOutputDevice* pDevice) {
111          // disconnect old device          // disconnect old device
112          if (pAudioOutputDevice && pEngineChannel) pEngineChannel->DisconnectAudioOutputDevice();          if (pAudioOutputDevice && pEngineChannel) {
113                Engine* engine = pEngineChannel->GetEngine();
114                pAudioOutputDevice->Disconnect(engine);
115    
116                pEngineChannel->DisconnectAudioOutputDevice();
117    
118                // reconnect engine if it still exists
119                const std::set<Engine*>& engines = EngineFactory::EngineInstances();
120                if (engines.find(engine) != engines.end()) pAudioOutputDevice->Connect(engine);
121            }
122    
123          // connect new device          // connect new device
124          pAudioOutputDevice = pDevice;          pAudioOutputDevice = pDevice;
125          if (pEngineChannel) {          if (pEngineChannel) {

Legend:
Removed from v.837  
changed lines
  Added in v.840

  ViewVC Help
Powered by ViewVC