Diffstat (limited to 'libopie2/opiemm/osoundsystem.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | libopie2/opiemm/osoundsystem.cpp | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/libopie2/opiemm/osoundsystem.cpp b/libopie2/opiemm/osoundsystem.cpp index 13b26e6..09fd28f 100644 --- a/libopie2/opiemm/osoundsystem.cpp +++ b/libopie2/opiemm/osoundsystem.cpp | |||
@@ -191,13 +191,13 @@ OMixerInterface::~OMixerInterface() | |||
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 " << name() << 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 ) |
@@ -236,12 +236,18 @@ void OMixerInterface::init() | |||
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 | devmask = 0; | ||
243 | if ( ioctl( _fd, SOUND_MIXER_READ_STEREODEVS, &devmask ) != -1 ) | ||
244 | { | ||
245 | odebug << "stereomask = " << devmask << oendl; | ||
246 | } | ||
247 | |||
242 | /* ChannelIterator it; | 248 | /* ChannelIterator it; |
243 | for ( it = _channels.begin(); it != _channels.end(); ++it ) | 249 | for ( it = _channels.begin(); it != _channels.end(); ++it ) |
244 | { | 250 | { |
245 | odebug << "Channel " << it.key() << " available (bit " << it.data() << ")" << oendl; | 251 | odebug << "Channel " << it.key() << " available (bit " << it.data() << ")" << oendl; |
246 | odebug << " +--- Volume: " << volume( it.key() ) & 0xff << " | " << volume( it.key() ) >> 8 << "" << oendl; | 252 | odebug << " +--- Volume: " << volume( it.key() ) & 0xff << " | " << volume( it.key() ) >> 8 << "" << oendl; |
247 | } | 253 | } |
@@ -272,18 +278,33 @@ QStringList OMixerInterface::playChannels() const | |||
272 | { | 278 | { |
273 | owarn << "NYI" << oendl; | 279 | owarn << "NYI" << oendl; |
274 | return QStringList(); | 280 | return QStringList(); |
275 | } | 281 | } |
276 | 282 | ||
277 | 283 | ||
278 | bool OMixerInterface::hasChannel( const QString& channel ) | 284 | bool OMixerInterface::hasChannel( const QString& channel ) const |
279 | { | 285 | { |
280 | return _channels.contains( channel ); | 286 | return _channels.contains( channel ); |
281 | } | 287 | } |
282 | 288 | ||
283 | 289 | ||
290 | bool OMixerInterface::isStereo( const QString& channel ) const | ||
291 | { | ||
292 | bool result = false; | ||
293 | if ( _channels.contains( channel ) ) | ||
294 | { | ||
295 | int devmask = 0; | ||
296 | if ( ioctl( _fd, SOUND_MIXER_READ_STEREODEVS, &devmask ) != -1 ) | ||
297 | { | ||
298 | result = devmask & ( 1 << _channels[channel] ); | ||
299 | } | ||
300 | } | ||
301 | return result; | ||
302 | } | ||
303 | |||
304 | |||
284 | void OMixerInterface::setVolume( const QString& channel, int left, int right ) | 305 | void OMixerInterface::setVolume( const QString& channel, int left, int right ) |
285 | { | 306 | { |
286 | int volume = left; | 307 | int volume = left; |
287 | volume |= ( right == -1 ) ? left << 8 : right << 8; | 308 | volume |= ( right == -1 ) ? left << 8 : right << 8; |
288 | 309 | ||
289 | if ( _channels.contains( channel ) ) | 310 | if ( _channels.contains( channel ) ) |