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 * |
201 |
} |
} |
202 |
} |
} |
203 |
|
|
204 |
void AudioOutputDevice::Connect(Engine* pEngine) { |
void AudioOutputDevice::Connect(EngineChannel* pEngineChannel) { |
205 |
if (Engines.find(pEngine) == Engines.end()) { |
if (EngineChannels.find(pEngineChannel) == EngineChannels.end()) { |
206 |
pEngine->Connect(this); |
pEngineChannel->Connect(this); |
207 |
Engines.insert(pEngine); |
EngineChannels.insert(pEngineChannel); |
208 |
} |
} |
209 |
} |
} |
210 |
|
|
211 |
void AudioOutputDevice::Disconnect(Engine* pEngine) { |
void AudioOutputDevice::Disconnect(EngineChannel* pEngineChannel) { |
212 |
if (Engines.find(pEngine) != Engines.end()) { // if clause to prevent disconnect loop |
if (EngineChannels.find(pEngineChannel) != EngineChannels.end()) { // if clause to prevent disconnect loop |
213 |
Engines.erase(pEngine); |
EngineChannels.erase(pEngineChannel); |
214 |
pEngine->DisconnectAudioOutputDevice(); |
pEngineChannel->DisconnectAudioOutputDevice(); |
215 |
} |
} |
216 |
} |
} |
217 |
|
|
249 |
try |
try |
250 |
#endif // USE_EXCEPTIONS |
#endif // USE_EXCEPTIONS |
251 |
{ |
{ |
252 |
std::set<Engine*>::iterator iterEngine = Engines.begin(); |
std::set<EngineChannel*>::iterator iterEngineCh = EngineChannels.begin(); |
253 |
std::set<Engine*>::iterator end = Engines.end(); |
std::set<EngineChannel*>::iterator end = EngineChannels.end(); |
254 |
for (; iterEngine != end; iterEngine++) { |
for (; iterEngineCh != end; iterEngineCh++) { |
255 |
int res = (*iterEngine)->RenderAudio(Samples); |
int res = (*iterEngineCh)->RenderAudio(Samples); |
256 |
if (res != 0) result = res; |
if (res != 0) result = res; |
257 |
} |
} |
258 |
} |
} |