58 |
*/ |
*/ |
59 |
class ParameterActive : public DeviceCreationParameterBool { |
class ParameterActive : public DeviceCreationParameterBool { |
60 |
public: |
public: |
61 |
ParameterActive( void ) : DeviceCreationParameterBool() { InitWithDefault(); } |
ParameterActive(); |
62 |
ParameterActive( String s ) : DeviceCreationParameterBool(s) {} |
ParameterActive(String s); |
63 |
virtual String Description() { return "Enable / disable device"; } |
virtual String Description(); |
64 |
virtual bool Fix() { return false; } |
virtual bool Fix(); |
65 |
virtual bool Mandatory() { return false; } |
virtual bool Mandatory(); |
66 |
virtual std::map<String,DeviceCreationParameter*> DependsAsParameters() { return std::map<String,DeviceCreationParameter*>(); } |
virtual std::map<String,DeviceCreationParameter*> DependsAsParameters(); |
67 |
virtual optional<bool> DefaultAsBool(std::map<String,String> Parameters) { return true; } |
virtual optional<bool> DefaultAsBool(std::map<String,String> Parameters); |
68 |
virtual void OnSetValue(bool b) throw (LinuxSamplerException) { if (b) ((AudioOutputDevice*)pDevice)->Play(); else ((AudioOutputDevice*)pDevice)->Stop(); } |
virtual void OnSetValue(bool b) throw (LinuxSamplerException); |
69 |
static String Name() { return "ACTIVE"; } |
static String Name(); |
70 |
}; |
}; |
71 |
|
|
72 |
/** Device Parameter 'SAMPLERATE' |
/** Device Parameter 'SAMPLERATE' |
75 |
*/ |
*/ |
76 |
class ParameterSampleRate : public DeviceCreationParameterInt { |
class ParameterSampleRate : public DeviceCreationParameterInt { |
77 |
public: |
public: |
78 |
ParameterSampleRate() : DeviceCreationParameterInt() { InitWithDefault(); } |
ParameterSampleRate(); |
79 |
ParameterSampleRate( String s ) : DeviceCreationParameterInt(s) {} |
ParameterSampleRate(String s); |
80 |
virtual String Description() { return "Output sample rate"; } |
virtual String Description(); |
81 |
virtual bool Fix() { return true; } |
virtual bool Fix(); |
82 |
virtual bool Mandatory() { return false; } |
virtual bool Mandatory(); |
83 |
virtual std::map<String,DeviceCreationParameter*> DependsAsParameters() { return std::map<String,DeviceCreationParameter*>(); } |
virtual std::map<String,DeviceCreationParameter*> DependsAsParameters(); |
84 |
virtual optional<int> DefaultAsInt(std::map<String,String> Parameters) { return 44100; } |
virtual optional<int> DefaultAsInt(std::map<String,String> Parameters); |
85 |
virtual optional<int> RangeMinAsInt(std::map<String,String> Parameters) { return optional<int>::nothing; } |
virtual optional<int> RangeMinAsInt(std::map<String,String> Parameters); |
86 |
virtual optional<int> RangeMaxAsInt(std::map<String,String> Parameters) { return optional<int>::nothing; } |
virtual optional<int> RangeMaxAsInt(std::map<String,String> Parameters); |
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); |
88 |
virtual void OnSetValue(int i) throw (LinuxSamplerException) { /* cannot happen, as parameter is fix */ } |
virtual void OnSetValue(int i) throw (LinuxSamplerException); |
89 |
static String Name() { return "SAMPLERATE"; } |
static String Name(); |
90 |
}; |
}; |
91 |
|
|
92 |
/** Device Parameters 'CHANNELS' |
/** Device Parameters 'CHANNELS' |
96 |
*/ |
*/ |
97 |
class ParameterChannels : public DeviceCreationParameterInt { |
class ParameterChannels : public DeviceCreationParameterInt { |
98 |
public: |
public: |
99 |
ParameterChannels() : DeviceCreationParameterInt() { InitWithDefault(); } |
ParameterChannels(); |
100 |
ParameterChannels( String s ) : DeviceCreationParameterInt(s) {} |
ParameterChannels(String s); |
101 |
virtual String Description() { return "Number of output channels"; } |
virtual String Description(); |
102 |
virtual bool Fix() { return false; } |
virtual bool Fix(); |
103 |
virtual bool Mandatory() { return false; } |
virtual bool Mandatory(); |
104 |
virtual std::map<String,DeviceCreationParameter*> DependsAsParameters() { return std::map<String,DeviceCreationParameter*>(); } |
virtual std::map<String,DeviceCreationParameter*> DependsAsParameters(); |
105 |
virtual optional<int> DefaultAsInt(std::map<String,String> Parameters) { return 2; } |
virtual optional<int> DefaultAsInt(std::map<String,String> Parameters); |
106 |
virtual optional<int> RangeMinAsInt(std::map<String,String> Parameters) { return optional<int>::nothing; } |
virtual optional<int> RangeMinAsInt(std::map<String,String> Parameters); |
107 |
virtual optional<int> RangeMaxAsInt(std::map<String,String> Parameters) { return optional<int>::nothing; } |
virtual optional<int> RangeMaxAsInt(std::map<String,String> Parameters); |
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); |
109 |
virtual void OnSetValue(int i) throw (LinuxSamplerException) { ((AudioOutputDevice*)pDevice)->AcquireChannels(i); } |
virtual void OnSetValue(int i) throw (LinuxSamplerException); |
110 |
static String Name() { return "CHANNELS"; } |
static String Name(); |
111 |
}; |
}; |
112 |
|
|
113 |
|
|
146 |
virtual void Stop() = 0; |
virtual void Stop() = 0; |
147 |
|
|
148 |
/** |
/** |
|
* This method will usually be called by the sampler engines that |
|
|
* are connected to this audio device to inform the audio device |
|
|
* how much audio channels the engine(s) need. It's the |
|
|
* responsibility of the audio device to offer that amount of |
|
|
* audio channels - again: this is not an option this is a must! |
|
|
* The engines will assume to be able to access those audio |
|
|
* channels right after. If the audio driver is not able to offer |
|
|
* that much channels, it can simply create mix channels which |
|
|
* are then just mixed to the 'real' audio channels. See |
|
|
* AudioChannel.h for details about channels and mix channels. |
|
|
* |
|
|
* @param Channels - amount of output channels required by |
|
|
* a sampler engine |
|
|
* @throws AudioOutputException if desired amount of channels |
|
|
* cannot be offered |
|
|
* @see AudioChannel |
|
|
*/ |
|
|
virtual void AcquireChannels(uint Channels) = 0; |
|
|
|
|
|
/** |
|
149 |
* Maximum amount of sample points the implementing audio |
* Maximum amount of sample points the implementing audio |
150 |
* device will ever demand the sampler engines to write in one |
* device will ever demand the sampler engines to write in one |
151 |
* fragment cycle / period. Simple audio device drivers usually |
* fragment cycle / period. Simple audio device drivers usually |
166 |
virtual uint SampleRate() = 0; |
virtual uint SampleRate() = 0; |
167 |
|
|
168 |
/** |
/** |
169 |
* Return the audio output device driver type name. |
* Return the audio output device driver name. |
170 |
*/ |
*/ |
171 |
virtual String Driver() = 0; |
virtual String Driver() = 0; |
172 |
|
|
173 |
|
/** |
174 |
|
* Create new audio channel. This will be called by |
175 |
|
* AcquireChannels(). Each driver must implement it. |
176 |
|
*/ |
177 |
|
virtual AudioChannel* CreateChannel(uint ChannelNr) = 0; |
178 |
|
|
179 |
|
|
180 |
|
|
181 |
///////////////////////////////////////////////////////////////// |
///////////////////////////////////////////////////////////////// |
182 |
// normal methods |
// normal methods |
183 |
// (usually not to be overriden by descendant) |
// (usually not to be overriden by descendant) |
208 |
AudioChannel* Channel(uint ChannelIndex); |
AudioChannel* Channel(uint ChannelIndex); |
209 |
|
|
210 |
/** |
/** |
211 |
|
* This method will usually be called by the sampler engines that |
212 |
|
* are connected to this audio device to inform the audio device |
213 |
|
* how much audio channels the engine(s) need. It's the |
214 |
|
* responsibility of the audio device to offer that amount of |
215 |
|
* audio channels - again: this is not an option this is a must! |
216 |
|
* The engines will assume to be able to access those audio |
217 |
|
* channels right after. If the audio driver is not able to offer |
218 |
|
* that much channels, it can simply create mix channels which |
219 |
|
* are then just mixed to the 'real' audio channels. See |
220 |
|
* AudioChannel.h for details about channels and mix channels. |
221 |
|
* |
222 |
|
* @param Channels - amount of output channels required by |
223 |
|
* a sampler engine |
224 |
|
* @throws AudioOutputException if desired amount of channels |
225 |
|
* cannot be offered |
226 |
|
* @see AudioChannel |
227 |
|
*/ |
228 |
|
void AcquireChannels(uint Channels); |
229 |
|
|
230 |
|
/** |
231 |
* Returns all device parameter settings. |
* Returns all device parameter settings. |
232 |
*/ |
*/ |
233 |
std::map<String,DeviceCreationParameter*> DeviceParameters(); |
std::map<String,DeviceCreationParameter*> DeviceParameters(); |