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 - 2010 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 * |
30 |
#include <stdexcept> |
#include <stdexcept> |
31 |
|
|
32 |
#include "../../common/global.h" |
#include "../../common/global.h" |
33 |
#include "../../common/LinuxSamplerException.h" |
#include "../../common/Exception.h" |
34 |
#include "../Device.h" |
#include "../Device.h" |
35 |
#include "../DeviceParameter.h" |
#include "../DeviceParameter.h" |
36 |
#include "../../engines/common/Engine.h" |
#include "../../engines/Engine.h" |
37 |
#include "AudioChannel.h" |
#include "AudioChannel.h" |
38 |
#include "../../common/SynchronizedConfig.h" |
#include "../../common/SynchronizedConfig.h" |
39 |
|
#include "../../effects/EffectChain.h" |
40 |
|
|
41 |
namespace LinuxSampler { |
namespace LinuxSampler { |
42 |
|
|
43 |
// just symbol prototyping |
// just symbol prototyping |
44 |
class Engine; |
class Engine; |
45 |
|
class AudioOutputDeviceFactory; |
46 |
|
class IDGenerator; |
47 |
|
|
48 |
/** Abstract base class for audio output drivers in LinuxSampler |
/** Abstract base class for audio output drivers in LinuxSampler |
49 |
* |
* |
70 |
virtual bool Mandatory(); |
virtual bool Mandatory(); |
71 |
virtual std::map<String,DeviceCreationParameter*> DependsAsParameters(); |
virtual std::map<String,DeviceCreationParameter*> DependsAsParameters(); |
72 |
virtual optional<bool> DefaultAsBool(std::map<String,String> Parameters); |
virtual optional<bool> DefaultAsBool(std::map<String,String> Parameters); |
73 |
virtual void OnSetValue(bool b) throw (LinuxSamplerException); |
virtual void OnSetValue(bool b) throw (Exception); |
74 |
static String Name(); |
static String Name(); |
75 |
}; |
}; |
76 |
|
|
90 |
virtual optional<int> RangeMinAsInt(std::map<String,String> Parameters); |
virtual optional<int> RangeMinAsInt(std::map<String,String> Parameters); |
91 |
virtual optional<int> RangeMaxAsInt(std::map<String,String> Parameters); |
virtual optional<int> RangeMaxAsInt(std::map<String,String> Parameters); |
92 |
virtual std::vector<int> PossibilitiesAsInt(std::map<String,String> Parameters); |
virtual std::vector<int> PossibilitiesAsInt(std::map<String,String> Parameters); |
93 |
virtual void OnSetValue(int i) throw (LinuxSamplerException); |
virtual int ValueAsInt(); |
94 |
|
virtual void OnSetValue(int i) throw (Exception); |
95 |
static String Name(); |
static String Name(); |
96 |
}; |
}; |
97 |
|
|
112 |
virtual optional<int> RangeMinAsInt(std::map<String,String> Parameters); |
virtual optional<int> RangeMinAsInt(std::map<String,String> Parameters); |
113 |
virtual optional<int> RangeMaxAsInt(std::map<String,String> Parameters); |
virtual optional<int> RangeMaxAsInt(std::map<String,String> Parameters); |
114 |
virtual std::vector<int> PossibilitiesAsInt(std::map<String,String> Parameters); |
virtual std::vector<int> PossibilitiesAsInt(std::map<String,String> Parameters); |
115 |
virtual void OnSetValue(int i) throw (LinuxSamplerException); |
virtual void OnSetValue(int i) throw (Exception); |
116 |
static String Name(); |
static String Name(); |
117 |
}; |
}; |
118 |
|
|
234 |
void AcquireChannels(uint Channels); |
void AcquireChannels(uint Channels); |
235 |
|
|
236 |
/** |
/** |
237 |
|
* Returns the amount of audio channels (including the so called |
238 |
|
* "mix channels") the device is currently providing. |
239 |
|
*/ |
240 |
|
uint ChannelCount(); |
241 |
|
|
242 |
|
/** |
243 |
* Returns all device parameter settings. |
* Returns all device parameter settings. |
244 |
*/ |
*/ |
245 |
std::map<String,DeviceCreationParameter*> DeviceParameters(); |
std::map<String,DeviceCreationParameter*> DeviceParameters(); |
246 |
|
|
247 |
|
/** |
248 |
|
* Add a chain of send effects to this AudioOutputDevice. |
249 |
|
* You actually have to add effects to that chain afterwards. |
250 |
|
*/ |
251 |
|
EffectChain* AddSendEffectChain(); |
252 |
|
|
253 |
|
/** |
254 |
|
* Remove the send effect chain given by @a iChain . |
255 |
|
* |
256 |
|
* @throws Exception - if given send effect chain doesn't exist |
257 |
|
*/ |
258 |
|
void RemoveSendEffectChain(uint iChain) throw (Exception); |
259 |
|
|
260 |
|
/** |
261 |
|
* Returns send effect chain given by @a iChain or @c NULL if |
262 |
|
* there's no such effect chain. |
263 |
|
*/ |
264 |
|
EffectChain* SendEffectChain(uint iChain) const; |
265 |
|
|
266 |
|
/** |
267 |
|
* Returns amount of send effect chains this AudioOutputDevice |
268 |
|
* currently provides. |
269 |
|
*/ |
270 |
|
uint SendEffectChainCount() const; |
271 |
|
|
272 |
|
/** |
273 |
|
* @deprecated This method will be removed, use AddSendEffectChain() instead! |
274 |
|
*/ |
275 |
|
EffectChain* AddMasterEffectChain() DEPRECATED_API; |
276 |
|
|
277 |
|
/** |
278 |
|
* @deprecated This method will be removed, use RemoveSendEffectChain() instead! |
279 |
|
*/ |
280 |
|
void RemoveMasterEffectChain(uint iChain) throw (Exception) DEPRECATED_API; |
281 |
|
|
282 |
|
/** |
283 |
|
* @deprecated This method will be removed, use SendEffectChain() instead! |
284 |
|
*/ |
285 |
|
EffectChain* MasterEffectChain(uint iChain) const DEPRECATED_API; |
286 |
|
|
287 |
|
/** |
288 |
|
* @deprecated This method will be removed, use SendEffectChainCount() instead! |
289 |
|
*/ |
290 |
|
uint MasterEffectChainCount() const DEPRECATED_API; |
291 |
|
|
292 |
protected: |
protected: |
293 |
SynchronizedConfig<std::set<Engine*> > Engines; ///< All sampler engines that are connected to the audio output device. |
SynchronizedConfig<std::set<Engine*> > Engines; ///< All sampler engines that are connected to the audio output device. |
294 |
|
SynchronizedConfig<std::set<Engine*> >::Reader EnginesReader; ///< Audio thread access to Engines. |
295 |
std::vector<AudioChannel*> Channels; ///< All audio channels of the audio output device. This is just a container; the descendant has to create channels by himself. |
std::vector<AudioChannel*> Channels; ///< All audio channels of the audio output device. This is just a container; the descendant has to create channels by himself. |
296 |
std::map<String,DeviceCreationParameter*> Parameters; ///< All device parameters. |
std::map<String,DeviceCreationParameter*> Parameters; ///< All device parameters. |
297 |
|
std::vector<EffectChain*> vEffectChains; |
298 |
|
IDGenerator* EffectChainIDs; |
299 |
|
|
300 |
AudioOutputDevice(std::map<String,DeviceCreationParameter*> DriverParameters); |
AudioOutputDevice(std::map<String,DeviceCreationParameter*> DriverParameters); |
301 |
|
|
326 |
*/ |
*/ |
327 |
int RenderSilence(uint Samples); |
int RenderSilence(uint Samples); |
328 |
|
|
329 |
friend class Sampler; // allow Sampler class to destroy audio devices |
friend class AudioOutputDeviceFactory; // allow AudioOutputDeviceFactory class to destroy audio devices |
330 |
|
|
331 |
}; |
}; |
332 |
|
|
336 |
* (which should be done in the constructor of the AudioOutputDevice |
* (which should be done in the constructor of the AudioOutputDevice |
337 |
* descendant). |
* descendant). |
338 |
*/ |
*/ |
339 |
class AudioOutputException : public LinuxSamplerException { |
class AudioOutputException : public Exception { |
340 |
public: |
public: |
341 |
AudioOutputException(const std::string& msg) : LinuxSamplerException(msg) {} |
AudioOutputException(const std::string& msg) : Exception(msg) {} |
342 |
}; |
}; |
343 |
} |
} |
344 |
|
|