52 |
///////////////////////////////////////////////////////////////// |
///////////////////////////////////////////////////////////////// |
53 |
// Device parameters |
// Device parameters |
54 |
|
|
55 |
|
/** Device Parameter 'ACTIVE' |
56 |
|
* |
57 |
|
* Used to activate / deactivate the audio output device. |
58 |
|
*/ |
59 |
class ParameterActive : public DeviceCreationParameterBool { |
class ParameterActive : public DeviceCreationParameterBool { |
60 |
public: |
public: |
61 |
ParameterActive( void ) : DeviceCreationParameterBool() { InitWithDefault(); } |
ParameterActive( void ) : DeviceCreationParameterBool() { InitWithDefault(); } |
66 |
virtual std::map<String,DeviceCreationParameter*> DependsAsParameters() { return std::map<String,DeviceCreationParameter*>(); } |
virtual std::map<String,DeviceCreationParameter*> DependsAsParameters() { return std::map<String,DeviceCreationParameter*>(); } |
67 |
virtual optional<bool> DefaultAsBool(std::map<String,String> Parameters) { return true; } |
virtual optional<bool> DefaultAsBool(std::map<String,String> Parameters) { return true; } |
68 |
virtual void OnSetValue(bool b) throw (LinuxSamplerException) { if (b) ((AudioOutputDevice*)pDevice)->Play(); else ((AudioOutputDevice*)pDevice)->Stop(); } |
virtual void OnSetValue(bool b) throw (LinuxSamplerException) { if (b) ((AudioOutputDevice*)pDevice)->Play(); else ((AudioOutputDevice*)pDevice)->Stop(); } |
69 |
static String Name( void ) { return "active"; } |
static String Name() { return "ACTIVE"; } |
70 |
}; |
}; |
71 |
|
|
72 |
|
/** Device Parameter 'SAMPLERATE' |
73 |
|
* |
74 |
|
* Used to set the sample rate of the audio output device. |
75 |
|
*/ |
76 |
class ParameterSampleRate : public DeviceCreationParameterInt { |
class ParameterSampleRate : public DeviceCreationParameterInt { |
77 |
public: |
public: |
78 |
ParameterSampleRate() : DeviceCreationParameterInt() { InitWithDefault(); } |
ParameterSampleRate() : DeviceCreationParameterInt() { InitWithDefault(); } |
86 |
virtual optional<int> RangeMaxAsInt(std::map<String,String> Parameters) { return optional<int>::nothing; } |
virtual optional<int> RangeMaxAsInt(std::map<String,String> Parameters) { return optional<int>::nothing; } |
87 |
virtual std::vector<int> PossibilitiesAsInt(std::map<String,String> Parameters) { return std::vector<int>(); } |
virtual std::vector<int> PossibilitiesAsInt(std::map<String,String> Parameters) { return std::vector<int>(); } |
88 |
virtual void OnSetValue(int i) throw (LinuxSamplerException) { /* cannot happen, as parameter is fix */ } |
virtual void OnSetValue(int i) throw (LinuxSamplerException) { /* cannot happen, as parameter is fix */ } |
89 |
static String Name( void ) { return "samplerate"; } |
static String Name() { return "SAMPLERATE"; } |
90 |
}; |
}; |
91 |
|
|
92 |
|
/** Device Parameters 'CHANNELS' |
93 |
|
* |
94 |
|
* Used to increase / decrease the number of audio channels of |
95 |
|
* audio output device. |
96 |
|
*/ |
97 |
class ParameterChannels : public DeviceCreationParameterInt { |
class ParameterChannels : public DeviceCreationParameterInt { |
98 |
public: |
public: |
99 |
ParameterChannels() : DeviceCreationParameterInt() { InitWithDefault(); } |
ParameterChannels() : DeviceCreationParameterInt() { InitWithDefault(); } |
107 |
virtual optional<int> RangeMaxAsInt(std::map<String,String> Parameters) { return optional<int>::nothing; } |
virtual optional<int> RangeMaxAsInt(std::map<String,String> Parameters) { return optional<int>::nothing; } |
108 |
virtual std::vector<int> PossibilitiesAsInt(std::map<String,String> Parameters) { return std::vector<int>(); } |
virtual std::vector<int> PossibilitiesAsInt(std::map<String,String> Parameters) { return std::vector<int>(); } |
109 |
virtual void OnSetValue(int i) throw (LinuxSamplerException) { ((AudioOutputDevice*)pDevice)->AcquireChannels(i); } |
virtual void OnSetValue(int i) throw (LinuxSamplerException) { ((AudioOutputDevice*)pDevice)->AcquireChannels(i); } |
110 |
static String Name( void ) { return "channels"; } |
static String Name() { return "CHANNELS"; } |
111 |
}; |
}; |
112 |
|
|
113 |
|
|
114 |
|
|
115 |
///////////////////////////////////////////////////////////////// |
///////////////////////////////////////////////////////////////// |
116 |
// abstract methods |
// abstract methods |
117 |
// (these have to be implemented by the descendant) |
// (these have to be implemented by the descendant) |
219 |
*/ |
*/ |
220 |
AudioChannel* Channel(uint ChannelIndex); |
AudioChannel* Channel(uint ChannelIndex); |
221 |
|
|
222 |
|
/** |
223 |
|
* Returns all device parameter settings. |
224 |
|
*/ |
225 |
std::map<String,DeviceCreationParameter*> DeviceParameters(); |
std::map<String,DeviceCreationParameter*> DeviceParameters(); |
226 |
|
|
|
|
|
227 |
protected: |
protected: |
228 |
std::set<Engine*> Engines; ///< All sampler engines that are connected to the audio output device. |
std::set<Engine*> Engines; ///< All sampler engines that are connected to the audio output device. |
229 |
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. |