/[svn]/linuxsampler/trunk/src/drivers/audio/AudioOutputDevice.cpp
ViewVC logotype

Diff of /linuxsampler/trunk/src/drivers/audio/AudioOutputDevice.cpp

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

revision 226 by schoenebeck, Wed Aug 25 22:00:33 2004 UTC revision 836 by persson, Wed Feb 8 20:28:46 2006 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 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 182  namespace LinuxSampler { Line 183  namespace LinuxSampler {
183          {          {
184              std::vector<AudioChannel*>::iterator iter = Channels.begin();              std::vector<AudioChannel*>::iterator iter = Channels.begin();
185              while (iter != Channels.end()) {              while (iter != Channels.end()) {
                 Channels.erase(iter);  
186                  delete *iter;                  delete *iter;
187                  iter++;                  iter++;
188              }              }
189                Channels.clear();
190          }          }
191    
192          // delete all device parameters          // delete all device parameters
193          {          {
194              std::map<String,DeviceCreationParameter*>::iterator iter = Parameters.begin();              std::map<String,DeviceCreationParameter*>::iterator iter = Parameters.begin();
195              while (iter != Parameters.end()) {              while (iter != Parameters.end()) {
                 Parameters.erase(iter);  
196                  delete iter->second;                  delete iter->second;
197                  iter++;                  iter++;
198              }              }
199                Parameters.clear();
200          }          }
201      }      }
202    
203      void AudioOutputDevice::Connect(Engine* pEngine) {      void AudioOutputDevice::Connect(Engine* pEngine) {
204          if (Engines.find(pEngine) == Engines.end()) {          if (Engines.find(pEngine) == Engines.end()) {
             pEngine->Connect(this);  
205              Engines.insert(pEngine);              Engines.insert(pEngine);
206                // make sure the engine knows about the connection
207                //pEngine->Connect(this);
208          }          }
209      }      }
210    
211      void AudioOutputDevice::Disconnect(Engine* pEngine) {      void AudioOutputDevice::Disconnect(Engine* pEngine) {
212          if (Engines.find(pEngine) != Engines.end()) { // if clause to prevent disconnect loop          if (Engines.find(pEngine) != Engines.end()) { // if clause to prevent disconnect loop
213              Engines.erase(pEngine);              Engines.erase(pEngine);
214              pEngine->DisconnectAudioOutputDevice();              // make sure the engine knows about the disconnection
215                //pEngine->DisconnectAudioOutputDevice();
216          }          }
217      }      }
218    
# Line 244  namespace LinuxSampler { Line 246  namespace LinuxSampler {
246          int result = 0;          int result = 0;
247    
248          // let all connected engines render audio for the current audio fragment cycle          // let all connected engines render audio for the current audio fragment cycle
249            #if CONFIG_RT_EXCEPTIONS
250            try
251            #endif // CONFIG_RT_EXCEPTIONS
252          {          {
253              std::set<Engine*>::iterator iterEngine = Engines.begin();              std::set<Engine*>::iterator iterEngine = Engines.begin();
254              std::set<Engine*>::iterator end        = Engines.end();              std::set<Engine*>::iterator end        = Engines.end();
# Line 252  namespace LinuxSampler { Line 257  namespace LinuxSampler {
257                  if (res != 0) result = res;                  if (res != 0) result = res;
258              }              }
259          }          }
260            #if CONFIG_RT_EXCEPTIONS
261            catch (std::runtime_error se) {
262                std::cerr << "std::runtime_error: " << se.what() << std::endl << std::flush;
263                exit(EXIT_FAILURE);
264            }
265            #endif // CONFIG_RT_EXCEPTIONS
266    
267          return result;          return result;
268      }      }

Legend:
Removed from v.226  
changed lines
  Added in v.836

  ViewVC Help
Powered by ViewVC