author | wimpie <wimpie> | 2005-01-04 01:31:53 (UTC) |
---|---|---|
committer | wimpie <wimpie> | 2005-01-04 01:31:53 (UTC) |
commit | 42638ffd708a5236ad9a1f06a40b9d8b7919277c (patch) (unidiff) | |
tree | 687d61c6e2d5ddd20dff42cf6e1b18afbe81633f | |
parent | 0f3d74b472817e6b4f9d80adc122281b84629c1f (diff) | |
download | opie-42638ffd708a5236ad9a1f06a40b9d8b7919277c.zip opie-42638ffd708a5236ad9a1f06a40b9d8b7919277c.tar.gz opie-42638ffd708a5236ad9a1f06a40b9d8b7919277c.tar.bz2 |
CONTROL file :changed VERSION string
-rw-r--r-- | libopie2/opiemm/libopiemm2.control | 2 | ||||
-rw-r--r-- | libopie2/opiemm/osoundsystem.cpp | 2 | ||||
-rw-r--r-- | libopie2/opiemm/osoundsystem.h | 1 |
3 files changed, 1 insertions, 4 deletions
diff --git a/libopie2/opiemm/libopiemm2.control b/libopie2/opiemm/libopiemm2.control index d0f34a8..0dd2df2 100644 --- a/libopie2/opiemm/libopiemm2.control +++ b/libopie2/opiemm/libopiemm2.control | |||
@@ -1,10 +1,10 @@ | |||
1 | Package: libopiemm2 | 1 | Package: libopiemm2 |
2 | Files: lib/libopiemm2.so.* | 2 | Files: lib/libopiemm2.so.* |
3 | Priority: optional | 3 | Priority: optional |
4 | Section: opie/system | 4 | Section: opie/system |
5 | Maintainer: Opie Team <opie@handhelds.org> | 5 | Maintainer: Opie Team <opie@handhelds.org> |
6 | Architecture: arm | 6 | Architecture: arm |
7 | Version: 1.8.2-$SUB_VERSION.2 | 7 | Version: $QPE_VERSION$EXTRAVERSION |
8 | Depends: libqpe1, libopiecore2 (1.8.2) | 8 | Depends: libqpe1, libopiecore2 (1.8.2) |
9 | Provides: libopiemm2 | 9 | Provides: libopiemm2 |
10 | Description: Opie library 2.0 MM | 10 | Description: Opie library 2.0 MM |
diff --git a/libopie2/opiemm/osoundsystem.cpp b/libopie2/opiemm/osoundsystem.cpp index 17e5cb0..13b26e6 100644 --- a/libopie2/opiemm/osoundsystem.cpp +++ b/libopie2/opiemm/osoundsystem.cpp | |||
@@ -129,194 +129,192 @@ OSoundCard::OSoundCard( QObject* parent, const char* name ) | |||
129 | init(); | 129 | init(); |
130 | } | 130 | } |
131 | 131 | ||
132 | 132 | ||
133 | OSoundCard::~OSoundCard() | 133 | OSoundCard::~OSoundCard() |
134 | { | 134 | { |
135 | } | 135 | } |
136 | 136 | ||
137 | 137 | ||
138 | void OSoundCard::init() | 138 | void OSoundCard::init() |
139 | { | 139 | { |
140 | #ifdef QT_QWS_DEVFS | 140 | #ifdef QT_QWS_DEVFS |
141 | _audio = new OAudioInterface( this, "/dev/sound/dsp" ); | 141 | _audio = new OAudioInterface( this, "/dev/sound/dsp" ); |
142 | _mixer = new OMixerInterface( this, "/dev/sound/mixer" ); | 142 | _mixer = new OMixerInterface( this, "/dev/sound/mixer" ); |
143 | #else | 143 | #else |
144 | _audio = new OAudioInterface( this, "/dev/dsp" ); | 144 | _audio = new OAudioInterface( this, "/dev/dsp" ); |
145 | _mixer = new OMixerInterface( this, "/dev/mixer" ); | 145 | _mixer = new OMixerInterface( this, "/dev/mixer" ); |
146 | #endif | 146 | #endif |
147 | } | 147 | } |
148 | 148 | ||
149 | 149 | ||
150 | /*====================================================================================== | 150 | /*====================================================================================== |
151 | * OAudioInterface | 151 | * OAudioInterface |
152 | *======================================================================================*/ | 152 | *======================================================================================*/ |
153 | 153 | ||
154 | OAudioInterface::OAudioInterface( QObject* parent, const char* name ) | 154 | OAudioInterface::OAudioInterface( QObject* parent, const char* name ) |
155 | :QObject( parent, name ), _sfd(0) | 155 | :QObject( parent, name ), _sfd(0) |
156 | { | 156 | { |
157 | odebug << "OAudioInterface::OAudioInterface()" << oendl; | 157 | odebug << "OAudioInterface::OAudioInterface()" << oendl; |
158 | init(); | 158 | init(); |
159 | } | 159 | } |
160 | 160 | ||
161 | 161 | ||
162 | OAudioInterface::~OAudioInterface() | 162 | OAudioInterface::~OAudioInterface() |
163 | { | 163 | { |
164 | } | 164 | } |
165 | 165 | ||
166 | 166 | ||
167 | void OAudioInterface::init() | 167 | void OAudioInterface::init() |
168 | { | 168 | { |
169 | 169 | ||
170 | 170 | ||
171 | } | 171 | } |
172 | 172 | ||
173 | 173 | ||
174 | /*====================================================================================== | 174 | /*====================================================================================== |
175 | * OMixerInterface | 175 | * OMixerInterface |
176 | *======================================================================================*/ | 176 | *======================================================================================*/ |
177 | 177 | ||
178 | OMixerInterface::OMixerInterface( QObject* parent, const char* name ) | 178 | OMixerInterface::OMixerInterface( QObject* parent, const char* name ) |
179 | :QObject( parent, name ) | 179 | :QObject( parent, name ) |
180 | { | 180 | { |
181 | odebug << "OMixerInterface::OMixerInterface()" << oendl; | 181 | odebug << "OMixerInterface::OMixerInterface()" << oendl; |
182 | init(); | 182 | init(); |
183 | } | 183 | } |
184 | 184 | ||
185 | 185 | ||
186 | OMixerInterface::~OMixerInterface() | 186 | OMixerInterface::~OMixerInterface() |
187 | { | 187 | { |
188 | } | 188 | } |
189 | 189 | ||
190 | 190 | ||
191 | void OMixerInterface::init() | 191 | void OMixerInterface::init() |
192 | { | 192 | { |
193 | // open the device | 193 | // open the device |
194 | _fd = ::open( name(), O_RDWR ); | 194 | _fd = ::open( name(), O_RDWR ); |
195 | if ( _fd == -1 ) | 195 | if ( _fd == -1 ) |
196 | { | 196 | { |
197 | owarn << "OMixerInterface::init(): Can't open mixer." << oendl; | 197 | owarn << "OMixerInterface::init(): Can't open mixer." << oendl; |
198 | return; | 198 | return; |
199 | } | 199 | } |
200 | 200 | ||
201 | // construct the device capabilities | 201 | // construct the device capabilities |
202 | int devmask = 0; | 202 | int devmask = 0; |
203 | if ( ioctl( _fd, SOUND_MIXER_READ_DEVMASK, &devmask ) != -1 ) | 203 | if ( ioctl( _fd, SOUND_MIXER_READ_DEVMASK, &devmask ) != -1 ) |
204 | { | 204 | { |
205 | if ( devmask & ( 1 << SOUND_MIXER_VOLUME ) ) _channels.insert( "PlayVolume", SOUND_MIXER_VOLUME ); | 205 | if ( devmask & ( 1 << SOUND_MIXER_VOLUME ) ) _channels.insert( "PlayVolume", SOUND_MIXER_VOLUME ); |
206 | if ( devmask & ( 1 << SOUND_MIXER_BASS ) ) _channels.insert( "PlayBass", SOUND_MIXER_BASS ); | 206 | if ( devmask & ( 1 << SOUND_MIXER_BASS ) ) _channels.insert( "PlayBass", SOUND_MIXER_BASS ); |
207 | if ( devmask & ( 1 << SOUND_MIXER_TREBLE ) ) _channels.insert( "PlayTreble", SOUND_MIXER_TREBLE ); | 207 | if ( devmask & ( 1 << SOUND_MIXER_TREBLE ) ) _channels.insert( "PlayTreble", SOUND_MIXER_TREBLE ); |
208 | if ( devmask & ( 1 << SOUND_MIXER_SYNTH ) ) _channels.insert( "PlaySynth", SOUND_MIXER_SYNTH ); | 208 | if ( devmask & ( 1 << SOUND_MIXER_SYNTH ) ) _channels.insert( "PlaySynth", SOUND_MIXER_SYNTH ); |
209 | if ( devmask & ( 1 << SOUND_MIXER_PCM ) ) _channels.insert( "PlayPCM", SOUND_MIXER_PCM ); | 209 | if ( devmask & ( 1 << SOUND_MIXER_PCM ) ) _channels.insert( "PlayPCM", SOUND_MIXER_PCM ); |
210 | if ( devmask & ( 1 << SOUND_MIXER_SPEAKER ) ) _channels.insert( "PlaySpeaker", SOUND_MIXER_SPEAKER ); | 210 | if ( devmask & ( 1 << SOUND_MIXER_SPEAKER ) ) _channels.insert( "PlaySpeaker", SOUND_MIXER_SPEAKER ); |
211 | if ( devmask & ( 1 << SOUND_MIXER_LINE ) ) _channels.insert( "PlayLine", SOUND_MIXER_LINE ); | 211 | if ( devmask & ( 1 << SOUND_MIXER_LINE ) ) _channels.insert( "PlayLine", SOUND_MIXER_LINE ); |
212 | if ( devmask & ( 1 << SOUND_MIXER_MIC ) ) _channels.insert( "PlayMic", SOUND_MIXER_MIC ); | 212 | if ( devmask & ( 1 << SOUND_MIXER_MIC ) ) _channels.insert( "PlayMic", SOUND_MIXER_MIC ); |
213 | if ( devmask & ( 1 << SOUND_MIXER_CD ) ) _channels.insert( "PlayCD", SOUND_MIXER_CD ); | 213 | if ( devmask & ( 1 << SOUND_MIXER_CD ) ) _channels.insert( "PlayCD", SOUND_MIXER_CD ); |
214 | if ( devmask & ( 1 << SOUND_MIXER_IMIX ) ) _channels.insert( "PlayInputMix", SOUND_MIXER_IMIX ); | 214 | if ( devmask & ( 1 << SOUND_MIXER_IMIX ) ) _channels.insert( "PlayInputMix", SOUND_MIXER_IMIX ); |
215 | if ( devmask & ( 1 << SOUND_MIXER_ALTPCM ) ) _channels.insert( "PlayAltPCM", SOUND_MIXER_ALTPCM ); | 215 | if ( devmask & ( 1 << SOUND_MIXER_ALTPCM ) ) _channels.insert( "PlayAltPCM", SOUND_MIXER_ALTPCM ); |
216 | if ( devmask & ( 1 << SOUND_MIXER_RECLEV ) ) _channels.insert( "PlayRecord", SOUND_MIXER_RECLEV ); | 216 | if ( devmask & ( 1 << SOUND_MIXER_RECLEV ) ) _channels.insert( "PlayRecord", SOUND_MIXER_RECLEV ); |
217 | if ( devmask & ( 1 << SOUND_MIXER_IGAIN ) ) _channels.insert( "PlayInputGain", SOUND_MIXER_IGAIN ); | 217 | if ( devmask & ( 1 << SOUND_MIXER_IGAIN ) ) _channels.insert( "PlayInputGain", SOUND_MIXER_IGAIN ); |
218 | if ( devmask & ( 1 << SOUND_MIXER_OGAIN ) ) _channels.insert( "PlayOutputGain", SOUND_MIXER_OGAIN ); | 218 | if ( devmask & ( 1 << SOUND_MIXER_OGAIN ) ) _channels.insert( "PlayOutputGain", SOUND_MIXER_OGAIN ); |
219 | //odebug << "devmask available and constructed." << oendl; | 219 | //odebug << "devmask available and constructed." << oendl; |
220 | } | 220 | } |
221 | 221 | ||
222 | devmask = 0; | 222 | devmask = 0; |
223 | if ( ioctl( _fd, SOUND_MIXER_READ_RECMASK, &devmask ) != -1 ) | 223 | if ( ioctl( _fd, SOUND_MIXER_READ_RECMASK, &devmask ) != -1 ) |
224 | { | 224 | { |
225 | if ( devmask & ( 1 << SOUND_MIXER_VOLUME ) ) _channels.insert( "RecVolume", SOUND_MIXER_VOLUME ); | 225 | if ( devmask & ( 1 << SOUND_MIXER_VOLUME ) ) _channels.insert( "RecVolume", SOUND_MIXER_VOLUME ); |
226 | if ( devmask & ( 1 << SOUND_MIXER_BASS ) ) _channels.insert( "RecBass", SOUND_MIXER_BASS ); | 226 | if ( devmask & ( 1 << SOUND_MIXER_BASS ) ) _channels.insert( "RecBass", SOUND_MIXER_BASS ); |
227 | if ( devmask & ( 1 << SOUND_MIXER_TREBLE ) ) _channels.insert( "RecTreble", SOUND_MIXER_TREBLE ); | 227 | if ( devmask & ( 1 << SOUND_MIXER_TREBLE ) ) _channels.insert( "RecTreble", SOUND_MIXER_TREBLE ); |
228 | if ( devmask & ( 1 << SOUND_MIXER_SYNTH ) ) _channels.insert( "RecSynth", SOUND_MIXER_SYNTH ); | 228 | if ( devmask & ( 1 << SOUND_MIXER_SYNTH ) ) _channels.insert( "RecSynth", SOUND_MIXER_SYNTH ); |
229 | if ( devmask & ( 1 << SOUND_MIXER_PCM ) ) _channels.insert( "RecPCM", SOUND_MIXER_PCM ); | 229 | if ( devmask & ( 1 << SOUND_MIXER_PCM ) ) _channels.insert( "RecPCM", SOUND_MIXER_PCM ); |
230 | if ( devmask & ( 1 << SOUND_MIXER_SPEAKER ) ) _channels.insert( "RecSpeaker", SOUND_MIXER_SPEAKER ); | 230 | if ( devmask & ( 1 << SOUND_MIXER_SPEAKER ) ) _channels.insert( "RecSpeaker", SOUND_MIXER_SPEAKER ); |
231 | if ( devmask & ( 1 << SOUND_MIXER_LINE ) ) _channels.insert( "RecLine", SOUND_MIXER_LINE ); | 231 | if ( devmask & ( 1 << SOUND_MIXER_LINE ) ) _channels.insert( "RecLine", SOUND_MIXER_LINE ); |
232 | if ( devmask & ( 1 << SOUND_MIXER_MIC ) ) _channels.insert( "RecMic", SOUND_MIXER_MIC ); | 232 | if ( devmask & ( 1 << SOUND_MIXER_MIC ) ) _channels.insert( "RecMic", SOUND_MIXER_MIC ); |
233 | if ( devmask & ( 1 << SOUND_MIXER_CD ) ) _channels.insert( "RecCD", SOUND_MIXER_CD ); | 233 | if ( devmask & ( 1 << SOUND_MIXER_CD ) ) _channels.insert( "RecCD", SOUND_MIXER_CD ); |
234 | if ( devmask & ( 1 << SOUND_MIXER_IMIX ) ) _channels.insert( "RecInputMix", SOUND_MIXER_IMIX ); | 234 | if ( devmask & ( 1 << SOUND_MIXER_IMIX ) ) _channels.insert( "RecInputMix", SOUND_MIXER_IMIX ); |
235 | if ( devmask & ( 1 << SOUND_MIXER_ALTPCM ) ) _channels.insert( "RecAltPCM", SOUND_MIXER_ALTPCM ); | 235 | if ( devmask & ( 1 << SOUND_MIXER_ALTPCM ) ) _channels.insert( "RecAltPCM", SOUND_MIXER_ALTPCM ); |
236 | if ( devmask & ( 1 << SOUND_MIXER_RECLEV ) ) _channels.insert( "RecRecord", SOUND_MIXER_RECLEV ); | 236 | if ( devmask & ( 1 << SOUND_MIXER_RECLEV ) ) _channels.insert( "RecRecord", SOUND_MIXER_RECLEV ); |
237 | if ( devmask & ( 1 << SOUND_MIXER_IGAIN ) ) _channels.insert( "RecInputGain", SOUND_MIXER_IGAIN ); | 237 | if ( devmask & ( 1 << SOUND_MIXER_IGAIN ) ) _channels.insert( "RecInputGain", SOUND_MIXER_IGAIN ); |
238 | if ( devmask & ( 1 << SOUND_MIXER_OGAIN ) ) _channels.insert( "RecOutputGain", SOUND_MIXER_OGAIN ); | 238 | if ( devmask & ( 1 << SOUND_MIXER_OGAIN ) ) _channels.insert( "RecOutputGain", SOUND_MIXER_OGAIN ); |
239 | //odebug << "recmask available and constructed." << oendl; | 239 | //odebug << "recmask available and constructed." << oendl; |
240 | } | 240 | } |
241 | 241 | ||
242 | /* ChannelIterator it; | 242 | /* ChannelIterator it; |
243 | for ( it = _channels.begin(); it != _channels.end(); ++it ) | 243 | for ( it = _channels.begin(); it != _channels.end(); ++it ) |
244 | { | 244 | { |
245 | odebug << "Channel " << it.key() << " available (bit " << it.data() << ")" << oendl; | 245 | odebug << "Channel " << it.key() << " available (bit " << it.data() << ")" << oendl; |
246 | odebug << " +--- Volume: " << volume( it.key() ) & 0xff << " | " << volume( it.key() ) >> 8 << "" << oendl; | 246 | odebug << " +--- Volume: " << volume( it.key() ) & 0xff << " | " << volume( it.key() ) >> 8 << "" << oendl; |
247 | } | 247 | } |
248 | */ | 248 | */ |
249 | } | 249 | } |
250 | 250 | ||
251 | QStringList OMixerInterface::allChannels() const | 251 | QStringList OMixerInterface::allChannels() const |
252 | { | 252 | { |
253 | ChannelIterator it = _channels.begin(); | 253 | ChannelIterator it = _channels.begin(); |
254 | QStringList channels; | 254 | QStringList channels; |
255 | while ( it != _channels.end() ) | 255 | while ( it != _channels.end() ) |
256 | { | 256 | { |
257 | channels += it.key(); | 257 | channels += it.key(); |
258 | it++; | 258 | it++; |
259 | } | 259 | } |
260 | return channels; | 260 | return channels; |
261 | } | 261 | } |
262 | 262 | ||
263 | 263 | ||
264 | QStringList OMixerInterface::recChannels() const | 264 | QStringList OMixerInterface::recChannels() const |
265 | { | 265 | { |
266 | owarn << "NYI" << oendl; | 266 | owarn << "NYI" << oendl; |
267 | return QStringList(); | 267 | return QStringList(); |
268 | } | 268 | } |
269 | 269 | ||
270 | 270 | ||
271 | QStringList OMixerInterface::playChannels() const | 271 | QStringList OMixerInterface::playChannels() const |
272 | { | 272 | { |
273 | owarn << "NYI" << oendl; | 273 | owarn << "NYI" << oendl; |
274 | return QStringList(); | 274 | return QStringList(); |
275 | } | 275 | } |
276 | 276 | ||
277 | 277 | ||
278 | bool OMixerInterface::hasChannel( const QString& channel ) | 278 | bool OMixerInterface::hasChannel( const QString& channel ) |
279 | { | 279 | { |
280 | return _channels.contains( channel ); | 280 | return _channels.contains( channel ); |
281 | } | 281 | } |
282 | 282 | ||
283 | 283 | ||
284 | void OMixerInterface::setVolume( const QString& channel, int left, int right ) | 284 | void OMixerInterface::setVolume( const QString& channel, int left, int right ) |
285 | { | 285 | { |
286 | int volume = left; | 286 | int volume = left; |
287 | volume |= ( right == -1 ) ? left << 8 : right << 8; | 287 | volume |= ( right == -1 ) ? left << 8 : right << 8; |
288 | 288 | ||
289 | if ( _channels.contains( channel ) ) | 289 | if ( _channels.contains( channel ) ) |
290 | { | 290 | { |
291 | int result = ioctl( _fd, MIXER_WRITE( _channels[channel] ), &volume ); | 291 | int result = ioctl( _fd, MIXER_WRITE( _channels[channel] ), &volume ); |
292 | if ( result == -1 ) | 292 | if ( result == -1 ) |
293 | { | 293 | { |
294 | owarn << "Can't set volume: " << strerror( errno ) << oendl; | 294 | owarn << "Can't set volume: " << strerror( errno ) << oendl; |
295 | } | 295 | } |
296 | else | 296 | else |
297 | { | 297 | { |
298 | if ( result & 0xff != left ) | 298 | if ( result & 0xff != left ) |
299 | { | 299 | { |
300 | owarn << "Device adjusted volume from " << left << " to " << (result & 0xff) << oendl; | 300 | owarn << "Device adjusted volume from " << left << " to " << (result & 0xff) << oendl; |
301 | } | 301 | } |
302 | } | 302 | } |
303 | } | 303 | } |
304 | } | 304 | } |
305 | 305 | ||
306 | 306 | ||
307 | int OMixerInterface::volume( const QString& channel ) const | 307 | int OMixerInterface::volume( const QString& channel ) const |
308 | { | 308 | { |
309 | int volume; | 309 | int volume; |
310 | 310 | ||
311 | if ( _channels.contains( channel ) ) | 311 | if ( _channels.contains( channel ) ) |
312 | { | 312 | { |
313 | if ( ioctl( _fd, MIXER_READ( _channels[channel] ), &volume ) == -1 ) | 313 | if ( ioctl( _fd, MIXER_READ( _channels[channel] ), &volume ) == -1 ) |
314 | { | 314 | { |
315 | owarn << "Can't get volume: " << strerror( errno ) << oendl; | 315 | owarn << "Can't get volume: " << strerror( errno ) << oendl; |
316 | } | 316 | } |
317 | else return volume; | 317 | else return volume; |
318 | } | 318 | } |
319 | return -1; | 319 | return -1; |
320 | } | 320 | } |
321 | |||
322 | |||
diff --git a/libopie2/opiemm/osoundsystem.h b/libopie2/opiemm/osoundsystem.h index 3c3b622..bd69114 100644 --- a/libopie2/opiemm/osoundsystem.h +++ b/libopie2/opiemm/osoundsystem.h | |||
@@ -41,193 +41,192 @@ namespace MM { | |||
41 | 41 | ||
42 | class OAudioInterface; | 42 | class OAudioInterface; |
43 | class OMixerInterface; | 43 | class OMixerInterface; |
44 | class OSoundCard; | 44 | class OSoundCard; |
45 | 45 | ||
46 | /*====================================================================================== | 46 | /*====================================================================================== |
47 | * OSoundSystem | 47 | * OSoundSystem |
48 | *======================================================================================*/ | 48 | *======================================================================================*/ |
49 | 49 | ||
50 | /** | 50 | /** |
51 | * @brief A container class for all audio interfaces | 51 | * @brief A container class for all audio interfaces |
52 | * | 52 | * |
53 | * This class provides access to all available audio/midi/sequencer interfaces of your computer. | 53 | * This class provides access to all available audio/midi/sequencer interfaces of your computer. |
54 | * | 54 | * |
55 | * @author Michael 'Mickey' Lauer <mickey@tm.informatik.uni-frankfurt.de> | 55 | * @author Michael 'Mickey' Lauer <mickey@tm.informatik.uni-frankfurt.de> |
56 | */ | 56 | */ |
57 | class OSoundSystem : public QObject | 57 | class OSoundSystem : public QObject |
58 | { | 58 | { |
59 | Q_OBJECT | 59 | Q_OBJECT |
60 | 60 | ||
61 | public: | 61 | public: |
62 | typedef QDict<OSoundCard> CardMap; | 62 | typedef QDict<OSoundCard> CardMap; |
63 | typedef QDictIterator<OSoundCard> CardIterator; | 63 | typedef QDictIterator<OSoundCard> CardIterator; |
64 | 64 | ||
65 | public: | 65 | public: |
66 | /** | 66 | /** |
67 | * @returns the number of available interfaces | 67 | * @returns the number of available interfaces |
68 | */ | 68 | */ |
69 | int count() const; | 69 | int count() const; |
70 | /** | 70 | /** |
71 | * @returns a pointer to the (one and only) @ref ONetwork instance. | 71 | * @returns a pointer to the (one and only) @ref ONetwork instance. |
72 | */ | 72 | */ |
73 | static OSoundSystem* instance(); | 73 | static OSoundSystem* instance(); |
74 | /** | 74 | /** |
75 | * @returns an iterator usable for iterating through all network interfaces. | 75 | * @returns an iterator usable for iterating through all network interfaces. |
76 | */ | 76 | */ |
77 | CardIterator iterator() const; | 77 | CardIterator iterator() const; |
78 | /** | 78 | /** |
79 | * @returns a pointer to the @ref OAudioInterface object for the specified @a interface or 0, if not found | 79 | * @returns a pointer to the @ref OAudioInterface object for the specified @a interface or 0, if not found |
80 | * @see OAudioInterface | 80 | * @see OAudioInterface |
81 | */ | 81 | */ |
82 | OSoundCard* card( const QString& interface ) const; | 82 | OSoundCard* card( const QString& interface ) const; |
83 | /** | 83 | /** |
84 | * @internal Rebuild the internal interface database | 84 | * @internal Rebuild the internal interface database |
85 | * @note Sometimes it might be useful to call this from client code, | 85 | * @note Sometimes it might be useful to call this from client code, |
86 | * e.g. after issuing a cardctl insert | 86 | * e.g. after issuing a cardctl insert |
87 | */ | 87 | */ |
88 | void synchronize(); | 88 | void synchronize(); |
89 | 89 | ||
90 | protected: | 90 | protected: |
91 | OSoundSystem(); | 91 | OSoundSystem(); |
92 | 92 | ||
93 | private: | 93 | private: |
94 | static OSoundSystem* _instance; | 94 | static OSoundSystem* _instance; |
95 | CardMap _interfaces; | 95 | CardMap _interfaces; |
96 | class Private; | 96 | class Private; |
97 | Private *d; | 97 | Private *d; |
98 | }; | 98 | }; |
99 | 99 | ||
100 | 100 | ||
101 | /*====================================================================================== | 101 | /*====================================================================================== |
102 | * OSoundCard | 102 | * OSoundCard |
103 | *======================================================================================*/ | 103 | *======================================================================================*/ |
104 | 104 | ||
105 | class OSoundCard : public QObject | 105 | class OSoundCard : public QObject |
106 | { | 106 | { |
107 | Q_OBJECT | 107 | Q_OBJECT |
108 | 108 | ||
109 | public: | 109 | public: |
110 | /** | 110 | /** |
111 | * Constructor. Normally you don't create @ref OSoundCard objects yourself, | 111 | * Constructor. Normally you don't create @ref OSoundCard objects yourself, |
112 | * but access them via @ref OSoundSystem::card(). | 112 | * but access them via @ref OSoundSystem::card(). |
113 | */ | 113 | */ |
114 | OSoundCard( QObject* parent, const char* name ); | 114 | OSoundCard( QObject* parent, const char* name ); |
115 | /** | 115 | /** |
116 | * Destructor. | 116 | * Destructor. |
117 | */ | 117 | */ |
118 | virtual ~OSoundCard(); | 118 | virtual ~OSoundCard(); |
119 | 119 | ||
120 | bool hasMixer() const { return _audio; }; | 120 | bool hasMixer() const { return _audio; }; |
121 | bool hasAudio() const { return _mixer; }; | 121 | bool hasAudio() const { return _mixer; }; |
122 | 122 | ||
123 | OAudioInterface* audio() const { return _audio; }; | 123 | OAudioInterface* audio() const { return _audio; }; |
124 | OMixerInterface* mixer() const { return _mixer; }; | 124 | OMixerInterface* mixer() const { return _mixer; }; |
125 | 125 | ||
126 | protected: | 126 | protected: |
127 | OAudioInterface* _audio; | 127 | OAudioInterface* _audio; |
128 | OMixerInterface* _mixer; | 128 | OMixerInterface* _mixer; |
129 | 129 | ||
130 | private: | 130 | private: |
131 | void init(); | 131 | void init(); |
132 | private: | 132 | private: |
133 | class Private; | 133 | class Private; |
134 | Private *d; | 134 | Private *d; |
135 | }; | 135 | }; |
136 | 136 | ||
137 | /*====================================================================================== | 137 | /*====================================================================================== |
138 | * OAudioInterface | 138 | * OAudioInterface |
139 | *======================================================================================*/ | 139 | *======================================================================================*/ |
140 | 140 | ||
141 | class OAudioInterface : public QObject | 141 | class OAudioInterface : public QObject |
142 | { | 142 | { |
143 | Q_OBJECT | 143 | Q_OBJECT |
144 | 144 | ||
145 | public: | 145 | public: |
146 | /** | 146 | /** |
147 | * Constructor. Normally you don't create @ref OAudioInterface objects yourself, | 147 | * Constructor. Normally you don't create @ref OAudioInterface objects yourself, |
148 | * but access them via the @ref OSoundCard interface. | 148 | * but access them via the @ref OSoundCard interface. |
149 | */ | 149 | */ |
150 | OAudioInterface( QObject* parent, const char* name ); | 150 | OAudioInterface( QObject* parent, const char* name ); |
151 | /** | 151 | /** |
152 | * Destructor. | 152 | * Destructor. |
153 | */ | 153 | */ |
154 | virtual ~OAudioInterface(); | 154 | virtual ~OAudioInterface(); |
155 | 155 | ||
156 | protected: | 156 | protected: |
157 | const int _sfd; | 157 | const int _sfd; |
158 | 158 | ||
159 | private: | 159 | private: |
160 | void init(); | 160 | void init(); |
161 | private: | 161 | private: |
162 | class Private; | 162 | class Private; |
163 | Private *d; | 163 | Private *d; |
164 | }; | 164 | }; |
165 | 165 | ||
166 | 166 | ||
167 | /*====================================================================================== | 167 | /*====================================================================================== |
168 | * OMixerInterface | 168 | * OMixerInterface |
169 | *======================================================================================*/ | 169 | *======================================================================================*/ |
170 | 170 | ||
171 | class OMixerInterface : public QObject | 171 | class OMixerInterface : public QObject |
172 | { | 172 | { |
173 | Q_OBJECT | 173 | Q_OBJECT |
174 | 174 | ||
175 | public: | 175 | public: |
176 | 176 | ||
177 | typedef QMap<QString,int>::ConstIterator ChannelIterator; | 177 | typedef QMap<QString,int>::ConstIterator ChannelIterator; |
178 | 178 | ||
179 | /** | 179 | /** |
180 | * Constructor. Normally you don't create @ref OMixerInterface objects yourself, | 180 | * Constructor. Normally you don't create @ref OMixerInterface objects yourself, |
181 | * but access them via the @ref OSoundCard interface. | 181 | * but access them via the @ref OSoundCard interface. |
182 | */ | 182 | */ |
183 | OMixerInterface( QObject* parent, const char* name ); | 183 | OMixerInterface( QObject* parent, const char* name ); |
184 | /** | 184 | /** |
185 | * Destructor. | 185 | * Destructor. |
186 | */ | 186 | */ |
187 | virtual ~OMixerInterface(); | 187 | virtual ~OMixerInterface(); |
188 | 188 | ||
189 | /** | 189 | /** |
190 | * @returns all available channels. | 190 | * @returns all available channels. |
191 | */ | 191 | */ |
192 | QStringList allChannels() const; | 192 | QStringList allChannels() const; |
193 | /** | 193 | /** |
194 | * @returns recordable channels. | 194 | * @returns recordable channels. |
195 | */ | 195 | */ |
196 | QStringList recChannels() const; | 196 | QStringList recChannels() const; |
197 | /** | 197 | /** |
198 | * @returns playable channels. | 198 | * @returns playable channels. |
199 | */ | 199 | */ |
200 | QStringList playChannels() const; | 200 | QStringList playChannels() const; |
201 | 201 | ||
202 | /** | 202 | /** |
203 | * @returns true, if @a channel exists. | 203 | * @returns true, if @a channel exists. |
204 | */ | 204 | */ |
205 | bool hasChannel( const QString& channel ); | 205 | bool hasChannel( const QString& channel ); |
206 | 206 | ||
207 | /** | 207 | /** |
208 | * Set the @a left and @a right volumes for @a channel. | 208 | * Set the @a left and @a right volumes for @a channel. |
209 | * If no value for right is given, the value for left is taken for that. | 209 | * If no value for right is given, the value for left is taken for that. |
210 | */ | 210 | */ |
211 | void setVolume( const QString& channel, int left, int right = -1 ); | 211 | void setVolume( const QString& channel, int left, int right = -1 ); |
212 | /** | 212 | /** |
213 | * @returns the volume of @a channel or -1, if the channel doesn't exist. | 213 | * @returns the volume of @a channel or -1, if the channel doesn't exist. |
214 | * @note You might want to use @ref hasChannel() to check if a channel exists. | 214 | * @note You might want to use @ref hasChannel() to check if a channel exists. |
215 | */ | 215 | */ |
216 | int volume( const QString& channel ) const; | 216 | int volume( const QString& channel ) const; |
217 | 217 | ||
218 | protected: | 218 | protected: |
219 | int _fd; | 219 | int _fd; |
220 | QMap<QString, int> _channels; | 220 | QMap<QString, int> _channels; |
221 | 221 | ||
222 | private: | 222 | private: |
223 | void init(); | 223 | void init(); |
224 | private: | 224 | private: |
225 | class Private; | 225 | class Private; |
226 | Private *d; | 226 | Private *d; |
227 | }; | 227 | }; |
228 | 228 | ||
229 | } | 229 | } |
230 | } | 230 | } |
231 | 231 | ||
232 | #endif // OSOUNDSYSTEM_H | 232 | #endif // OSOUNDSYSTEM_H |
233 | |||