/[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 551 by schoenebeck, Tue May 17 18:16:54 2005 UTC revision 660 by schoenebeck, Fri Jun 17 19:49:30 2005 UTC
# Line 51  namespace LinuxSampler { Line 51  namespace LinuxSampler {
51              if (pMidiInputPort) pMidiInputPort->Disconnect(pEngineChannel);              if (pMidiInputPort) pMidiInputPort->Disconnect(pEngineChannel);
52              if (pEngineChannel) {              if (pEngineChannel) {
53                  if (pAudioOutputDevice) pEngineChannel->DisconnectAudioOutputDevice();                  if (pAudioOutputDevice) pEngineChannel->DisconnectAudioOutputDevice();
54                  delete pEngineChannel;                  EngineChannelFactory::Destroy(pEngineChannel);
55              }              }
56          }          }
57      }      }
# Line 63  namespace LinuxSampler { Line 63  namespace LinuxSampler {
63          EngineChannel* pNewEngineChannel = EngineChannelFactory::Create(EngineType);          EngineChannel* pNewEngineChannel = EngineChannelFactory::Create(EngineType);
64          if (!pNewEngineChannel) throw LinuxSamplerException("Unknown engine type");          if (!pNewEngineChannel) throw LinuxSamplerException("Unknown engine type");
65    
66            //FIXME: hack to allow fast retrieval of engine channel's sampler channel index
67            pNewEngineChannel->iSamplerChannelIndex = Index();
68    
69          // dereference midi input port.          // dereference midi input port.
70          MidiInputPort* pMidiInputPort = GetMidiInputDevicePort(this->midiPort);          MidiInputPort* pMidiInputPort = GetMidiInputDevicePort(this->midiPort);
71          // disconnect old engine          // disconnect old engine
72          if (pEngineChannel) {          if (pEngineChannel) {
73              if (pMidiInputPort) pMidiInputPort->Disconnect(pEngineChannel);              if (pMidiInputPort) pMidiInputPort->Disconnect(pEngineChannel);
74              if (pAudioOutputDevice) pEngineChannel->DisconnectAudioOutputDevice();              if (pAudioOutputDevice) pEngineChannel->DisconnectAudioOutputDevice();
75              delete pEngineChannel;              EngineChannelFactory::Destroy(pEngineChannel);
76          }          }
77    
78          // connect new engine channel          // connect new engine channel
# Line 185  namespace LinuxSampler { Line 188  namespace LinuxSampler {
188          if (!mSamplerChannels.size()) {          if (!mSamplerChannels.size()) {
189              SamplerChannel* pChannel = new SamplerChannel(this);              SamplerChannel* pChannel = new SamplerChannel(this);
190              mSamplerChannels[0] = pChannel;              mSamplerChannels[0] = pChannel;
191              LSCPServer::SendLSCPNotify(LSCPEvent(LSCPEvent::event_channels, 1));              LSCPServer::SendLSCPNotify(LSCPEvent(LSCPEvent::event_channel_count, 1));
192              return pChannel;              return pChannel;
193          }          }
194    
# Line 200  namespace LinuxSampler { Line 203  namespace LinuxSampler {
203                  // we found an unused index, so insert the new channel there                  // we found an unused index, so insert the new channel there
204                  SamplerChannel* pChannel = new SamplerChannel(this);                  SamplerChannel* pChannel = new SamplerChannel(this);
205                  mSamplerChannels[i] = pChannel;                  mSamplerChannels[i] = pChannel;
206                  LSCPServer::SendLSCPNotify(LSCPEvent(LSCPEvent::event_channels, i));                  LSCPServer::SendLSCPNotify(LSCPEvent(LSCPEvent::event_channel_count, i));
207                  return pChannel;                  return pChannel;
208              }              }
209              throw LinuxSamplerException("Internal error: could not find unoccupied sampler channel index.");              throw LinuxSamplerException("Internal error: could not find unoccupied sampler channel index.");
# Line 209  namespace LinuxSampler { Line 212  namespace LinuxSampler {
212          // we have not reached the index limit so we just add the channel past the highest index          // we have not reached the index limit so we just add the channel past the highest index
213          SamplerChannel* pChannel = new SamplerChannel(this);          SamplerChannel* pChannel = new SamplerChannel(this);
214          mSamplerChannels[lastIndex + 1] = pChannel;          mSamplerChannels[lastIndex + 1] = pChannel;
215          LSCPServer::SendLSCPNotify(LSCPEvent(LSCPEvent::event_channels, lastIndex + 1));          LSCPServer::SendLSCPNotify(LSCPEvent(LSCPEvent::event_channel_count, lastIndex + 1));
216          return pChannel;          return pChannel;
217      }      }
218    
# Line 227  namespace LinuxSampler { Line 230  namespace LinuxSampler {
230              if (iterChan->second == pSamplerChannel) {              if (iterChan->second == pSamplerChannel) {
231                  mSamplerChannels.erase(iterChan);                  mSamplerChannels.erase(iterChan);
232                  delete pSamplerChannel;                  delete pSamplerChannel;
233                  LSCPServer::SendLSCPNotify(LSCPEvent(LSCPEvent::event_channels, mSamplerChannels.size()));                  LSCPServer::SendLSCPNotify(LSCPEvent(LSCPEvent::event_channel_count, mSamplerChannels.size()));
234                  return;                  return;
235              }              }
236          }          }

Legend:
Removed from v.551  
changed lines
  Added in v.660

  ViewVC Help
Powered by ViewVC