author | mickeyl <mickeyl> | 2005-01-24 18:56:14 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2005-01-24 18:56:14 (UTC) |
commit | fa3041f9acfd171b62c0ab73cde8b9d0f0772a9c (patch) (unidiff) | |
tree | c2ba9f2aaa744abaf4ac698eeeb27311dd81a50b | |
parent | 176a421ade3f5baf07be9327cbdbfedea41fdd3c (diff) | |
download | opie-fa3041f9acfd171b62c0ab73cde8b9d0f0772a9c.zip opie-fa3041f9acfd171b62c0ab73cde8b9d0f0772a9c.tar.gz opie-fa3041f9acfd171b62c0ab73cde8b9d0f0772a9c.tar.bz2 |
add isStereo to OMixerInterface to gather whether a given channel is a stereo or mono channel
-rw-r--r-- | libopie2/examples/opiemm/osoundsystemdemo/osoundsystemdemo.cpp | 3 | ||||
-rw-r--r-- | libopie2/opiemm/osoundsystem.cpp | 25 | ||||
-rw-r--r-- | libopie2/opiemm/osoundsystem.h | 6 |
3 files changed, 30 insertions, 4 deletions
diff --git a/libopie2/examples/opiemm/osoundsystemdemo/osoundsystemdemo.cpp b/libopie2/examples/opiemm/osoundsystemdemo/osoundsystemdemo.cpp index b522441..f74a1b9 100644 --- a/libopie2/examples/opiemm/osoundsystemdemo/osoundsystemdemo.cpp +++ b/libopie2/examples/opiemm/osoundsystemdemo/osoundsystemdemo.cpp | |||
@@ -57,3 +57,4 @@ int main( int argc, char** argv ) | |||
57 | { | 57 | { |
58 | odebug << "OSSDEMO: Mixer has channel " << *it << "" << oendl; | 58 | bool stereo = mixer->isStereo( *it ); |
59 | odebug << "OSSDEMO: Mixer has channel " << *it << ( stereo ? "[stereo]" : "[mono]" ) << oendl; | ||
59 | odebug << "OSSDEMO: +--- volume " << ( mixer->volume( *it ) & 0xff ) | 60 | odebug << "OSSDEMO: +--- volume " << ( mixer->volume( *it ) & 0xff ) |
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 | |||
@@ -196,3 +196,3 @@ void OMixerInterface::init() | |||
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; |
@@ -241,2 +241,8 @@ void OMixerInterface::init() | |||
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; |
@@ -277,3 +283,3 @@ QStringList OMixerInterface::playChannels() const | |||
277 | 283 | ||
278 | bool OMixerInterface::hasChannel( const QString& channel ) | 284 | bool OMixerInterface::hasChannel( const QString& channel ) const |
279 | { | 285 | { |
@@ -283,2 +289,17 @@ bool OMixerInterface::hasChannel( const QString& channel ) | |||
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 ) |
diff --git a/libopie2/opiemm/osoundsystem.h b/libopie2/opiemm/osoundsystem.h index bd69114..ac7a5a7 100644 --- a/libopie2/opiemm/osoundsystem.h +++ b/libopie2/opiemm/osoundsystem.h | |||
@@ -204,3 +204,7 @@ class OMixerInterface : public QObject | |||
204 | */ | 204 | */ |
205 | bool hasChannel( const QString& channel ); | 205 | bool hasChannel( const QString& channel ) const; |
206 | /** | ||
207 | * @returns true, if @a channel is stereo. | ||
208 | */ | ||
209 | bool isStereo( const QString& channel ) const; | ||
206 | 210 | ||