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 * |
* Copyright (C) 2005 - 2007 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 * |
23 |
|
|
24 |
#include "AudioOutputDeviceFactory.h" |
#include "AudioOutputDeviceFactory.h" |
25 |
#include "AudioOutputDevice.h" |
#include "AudioOutputDevice.h" |
26 |
|
#include "../../common/global_private.h" |
27 |
|
|
28 |
namespace LinuxSampler { |
namespace LinuxSampler { |
29 |
|
|
57 |
return true; |
return true; |
58 |
} |
} |
59 |
|
|
60 |
void AudioOutputDevice::ParameterActive::OnSetValue(bool b) throw (LinuxSamplerException) { |
void AudioOutputDevice::ParameterActive::OnSetValue(bool b) throw (Exception) { |
61 |
if (b) ((AudioOutputDevice*)pDevice)->Play(); |
if (b) ((AudioOutputDevice*)pDevice)->Play(); |
62 |
else ((AudioOutputDevice*)pDevice)->Stop(); |
else ((AudioOutputDevice*)pDevice)->Stop(); |
63 |
} |
} |
110 |
return std::vector<int>(); |
return std::vector<int>(); |
111 |
} |
} |
112 |
|
|
113 |
void AudioOutputDevice::ParameterSampleRate::OnSetValue(int i) throw (LinuxSamplerException) { |
void AudioOutputDevice::ParameterSampleRate::OnSetValue(int i) throw (Exception) { |
114 |
/* cannot happen, as parameter is fix */ |
/* cannot happen, as parameter is fix */ |
115 |
} |
} |
116 |
|
|
151 |
} |
} |
152 |
|
|
153 |
optional<int> AudioOutputDevice::ParameterChannels::RangeMinAsInt(std::map<String,String> Parameters) { |
optional<int> AudioOutputDevice::ParameterChannels::RangeMinAsInt(std::map<String,String> Parameters) { |
154 |
return optional<int>::nothing; |
return 1; |
155 |
} |
} |
156 |
|
|
157 |
optional<int> AudioOutputDevice::ParameterChannels::RangeMaxAsInt(std::map<String,String> Parameters) { |
optional<int> AudioOutputDevice::ParameterChannels::RangeMaxAsInt(std::map<String,String> Parameters) { |
158 |
return optional<int>::nothing; |
return 100; |
159 |
} |
} |
160 |
|
|
161 |
std::vector<int> AudioOutputDevice::ParameterChannels::PossibilitiesAsInt(std::map<String,String> Parameters) { |
std::vector<int> AudioOutputDevice::ParameterChannels::PossibilitiesAsInt(std::map<String,String> Parameters) { |
162 |
return std::vector<int>(); |
return std::vector<int>(); |
163 |
} |
} |
164 |
|
|
165 |
void AudioOutputDevice::ParameterChannels::OnSetValue(int i) throw (LinuxSamplerException) { |
void AudioOutputDevice::ParameterChannels::OnSetValue(int i) throw (Exception) { |
166 |
((AudioOutputDevice*)pDevice)->AcquireChannels(i); |
((AudioOutputDevice*)pDevice)->AcquireChannels(i); |
167 |
} |
} |
168 |
|
|
175 |
// *************** AudioOutputDevice *************** |
// *************** AudioOutputDevice *************** |
176 |
// * |
// * |
177 |
|
|
178 |
AudioOutputDevice::AudioOutputDevice(std::map<String,DeviceCreationParameter*> DriverParameters) { |
AudioOutputDevice::AudioOutputDevice(std::map<String,DeviceCreationParameter*> DriverParameters) |
179 |
|
: EnginesReader(Engines) { |
180 |
this->Parameters = DriverParameters; |
this->Parameters = DriverParameters; |
181 |
} |
} |
182 |
|
|
234 |
} |
} |
235 |
} |
} |
236 |
|
|
237 |
|
uint AudioOutputDevice::ChannelCount() { |
238 |
|
return Channels.size(); |
239 |
|
} |
240 |
|
|
241 |
std::map<String,DeviceCreationParameter*> AudioOutputDevice::DeviceParameters() { |
std::map<String,DeviceCreationParameter*> AudioOutputDevice::DeviceParameters() { |
242 |
return Parameters; |
return Parameters; |
243 |
} |
} |
256 |
int result = 0; |
int result = 0; |
257 |
|
|
258 |
// let all connected engines render audio for the current audio fragment cycle |
// let all connected engines render audio for the current audio fragment cycle |
259 |
const std::set<Engine*>& engines = Engines.Lock(); |
const std::set<Engine*>& engines = EnginesReader.Lock(); |
260 |
#if CONFIG_RT_EXCEPTIONS |
#if CONFIG_RT_EXCEPTIONS |
261 |
try |
try |
262 |
#endif // CONFIG_RT_EXCEPTIONS |
#endif // CONFIG_RT_EXCEPTIONS |
275 |
} |
} |
276 |
#endif // CONFIG_RT_EXCEPTIONS |
#endif // CONFIG_RT_EXCEPTIONS |
277 |
|
|
278 |
Engines.Unlock(); |
EnginesReader.Unlock(); |
279 |
return result; |
return result; |
280 |
} |
} |
281 |
|
|