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 * |
203 |
|
|
204 |
void AudioOutputDevice::Connect(Engine* pEngine) { |
void AudioOutputDevice::Connect(Engine* pEngine) { |
205 |
if (Engines.find(pEngine) == Engines.end()) { |
if (Engines.find(pEngine) == Engines.end()) { |
|
pEngine->Connect(this); |
|
206 |
Engines.insert(pEngine); |
Engines.insert(pEngine); |
207 |
|
// make sure the engine knows about the connection |
208 |
|
//pEngine->Connect(this); |
209 |
} |
} |
210 |
} |
} |
211 |
|
|
212 |
void AudioOutputDevice::Disconnect(Engine* pEngine) { |
void AudioOutputDevice::Disconnect(Engine* pEngine) { |
213 |
if (Engines.find(pEngine) != Engines.end()) { // if clause to prevent disconnect loop |
if (Engines.find(pEngine) != Engines.end()) { // if clause to prevent disconnect loop |
214 |
Engines.erase(pEngine); |
Engines.erase(pEngine); |
215 |
pEngine->DisconnectAudioOutputDevice(); |
// make sure the engine knows about the disconnection |
216 |
|
//pEngine->DisconnectAudioOutputDevice(); |
217 |
} |
} |
218 |
} |
} |
219 |
|
|
247 |
int result = 0; |
int result = 0; |
248 |
|
|
249 |
// let all connected engines render audio for the current audio fragment cycle |
// let all connected engines render audio for the current audio fragment cycle |
250 |
#if USE_EXCEPTIONS |
#if CONFIG_RT_EXCEPTIONS |
251 |
try |
try |
252 |
#endif // USE_EXCEPTIONS |
#endif // CONFIG_RT_EXCEPTIONS |
253 |
{ |
{ |
254 |
std::set<Engine*>::iterator iterEngine = Engines.begin(); |
std::set<Engine*>::iterator iterEngine = Engines.begin(); |
255 |
std::set<Engine*>::iterator end = Engines.end(); |
std::set<Engine*>::iterator end = Engines.end(); |
258 |
if (res != 0) result = res; |
if (res != 0) result = res; |
259 |
} |
} |
260 |
} |
} |
261 |
#if USE_EXCEPTIONS |
#if CONFIG_RT_EXCEPTIONS |
262 |
catch (std::runtime_error se) { |
catch (std::runtime_error se) { |
263 |
std::cerr << "std::runtime_error: " << se.what() << std::endl << std::flush; |
std::cerr << "std::runtime_error: " << se.what() << std::endl << std::flush; |
264 |
exit(EXIT_FAILURE); |
exit(EXIT_FAILURE); |
265 |
} |
} |
266 |
#endif // USE_EXCEPTIONS |
#endif // CONFIG_RT_EXCEPTIONS |
267 |
|
|
268 |
return result; |
return result; |
269 |
} |
} |