/[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 221 by schoenebeck, Fri Aug 20 17:25:19 2004 UTC revision 359 by senkov, Sun Feb 6 21:01:38 2005 UTC
# Line 27  Line 27 
27  #include "drivers/audio/AudioOutputDeviceFactory.h"  #include "drivers/audio/AudioOutputDeviceFactory.h"
28  #include "drivers/midi/MidiInputDeviceFactory.h"  #include "drivers/midi/MidiInputDeviceFactory.h"
29  #include "engines/gig/Engine.h"  #include "engines/gig/Engine.h"
30    #include "network/lscpserver.h"
31    
32  namespace LinuxSampler {  namespace LinuxSampler {
33    
# Line 181  namespace LinuxSampler { Line 182  namespace LinuxSampler {
182          if (!mSamplerChannels.size()) {          if (!mSamplerChannels.size()) {
183              SamplerChannel* pChannel = new SamplerChannel(this);              SamplerChannel* pChannel = new SamplerChannel(this);
184              mSamplerChannels[0] = pChannel;              mSamplerChannels[0] = pChannel;
185                LSCPServer::SendLSCPNotify(LSCPEvent(LSCPEvent::event_channels, 1));
186              return pChannel;              return pChannel;
187          }          }
188    
# Line 195  namespace LinuxSampler { Line 197  namespace LinuxSampler {
197                  // we found an unused index, so insert the new channel there                  // we found an unused index, so insert the new channel there
198                  SamplerChannel* pChannel = new SamplerChannel(this);                  SamplerChannel* pChannel = new SamplerChannel(this);
199                  mSamplerChannels[i] = pChannel;                  mSamplerChannels[i] = pChannel;
200                    LSCPServer::SendLSCPNotify(LSCPEvent(LSCPEvent::event_channels, i));
201                  return pChannel;                  return pChannel;
202              }              }
203              throw LinuxSamplerException("Internal error: could not find unoccupied sampler channel index.");              throw LinuxSamplerException("Internal error: could not find unoccupied sampler channel index.");
# Line 203  namespace LinuxSampler { Line 206  namespace LinuxSampler {
206          // 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
207          SamplerChannel* pChannel = new SamplerChannel(this);          SamplerChannel* pChannel = new SamplerChannel(this);
208          mSamplerChannels[lastIndex + 1] = pChannel;          mSamplerChannels[lastIndex + 1] = pChannel;
209            LSCPServer::SendLSCPNotify(LSCPEvent(LSCPEvent::event_channels, lastIndex + 1));
210          return pChannel;          return pChannel;
211      }      }
212    
# Line 220  namespace LinuxSampler { Line 224  namespace LinuxSampler {
224              if (iterChan->second == pSamplerChannel) {              if (iterChan->second == pSamplerChannel) {
225                  mSamplerChannels.erase(iterChan);                  mSamplerChannels.erase(iterChan);
226                  delete pSamplerChannel;                  delete pSamplerChannel;
227                    LSCPServer::SendLSCPNotify(LSCPEvent(LSCPEvent::event_channels, mSamplerChannels.size()));
228                  return;                  return;
229              }              }
230          }          }
# Line 324  namespace LinuxSampler { Line 329  namespace LinuxSampler {
329      void Sampler::Reset() {      void Sampler::Reset() {
330          // delete sampler channels          // delete sampler channels
331          try {          try {
332              SamplerChannelMap::iterator iter = mSamplerChannels.begin();              while (true) {
333              for (; iter != mSamplerChannels.end(); iter++) {                      SamplerChannelMap::iterator iter = mSamplerChannels.begin();
334                  RemoveSamplerChannel(iter->second);                      if (iter == mSamplerChannels.end()) break;
335                        RemoveSamplerChannel(iter->second);
336              }              }
337          }          }
338          catch(...) {          catch(...) {
# Line 336  namespace LinuxSampler { Line 342  namespace LinuxSampler {
342    
343          // delete midi input devices          // delete midi input devices
344          try {          try {
345              MidiInputDeviceMap::iterator iter = mMidiInputDevices.begin();              while (true) {
346              for (; iter != mMidiInputDevices.end(); iter++) {                      MidiInputDeviceMap::iterator iter = mMidiInputDevices.begin();
347                  DestroyMidiInputDevice(iter->second);                      if (iter == mMidiInputDevices.end()) break;
348                        DestroyMidiInputDevice(iter->second);
349              }              }
350          }          }
351          catch(...) {          catch(...) {
# Line 348  namespace LinuxSampler { Line 355  namespace LinuxSampler {
355    
356          // delete audio output devices          // delete audio output devices
357          try {          try {
358              AudioOutputDeviceMap::iterator iter = mAudioOutputDevices.begin();              while (true) {
359              for (; iter != mAudioOutputDevices.end(); iter++) {                      AudioOutputDeviceMap::iterator iter = mAudioOutputDevices.begin();
360                  DestroyAudioOutputDevice(iter->second);                      if (iter == mAudioOutputDevices.end()) break;
361                        DestroyAudioOutputDevice(iter->second);
362              }              }
363          }          }
364          catch(...) {          catch(...) {

Legend:
Removed from v.221  
changed lines
  Added in v.359

  ViewVC Help
Powered by ViewVC