summaryrefslogtreecommitdiff
path: root/libopie2/opiemm/osoundsystem.cpp
Side-by-side diff
Diffstat (limited to 'libopie2/opiemm/osoundsystem.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opiemm/osoundsystem.cpp25
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()
void OMixerInterface::init()
{
// open the device
_fd = ::open( name(), O_RDWR );
if ( _fd == -1 )
{
- owarn << "OMixerInterface::init(): Can't open mixer." << oendl;
+ owarn << "OMixerInterface::init(): Can't open mixer " << name() << oendl;
return;
}
// construct the device capabilities
int devmask = 0;
if ( ioctl( _fd, SOUND_MIXER_READ_DEVMASK, &devmask ) != -1 )
@@ -236,12 +236,18 @@ void OMixerInterface::init()
if ( devmask & ( 1 << SOUND_MIXER_RECLEV ) ) _channels.insert( "RecRecord", SOUND_MIXER_RECLEV );
if ( devmask & ( 1 << SOUND_MIXER_IGAIN ) ) _channels.insert( "RecInputGain", SOUND_MIXER_IGAIN );
if ( devmask & ( 1 << SOUND_MIXER_OGAIN ) ) _channels.insert( "RecOutputGain", SOUND_MIXER_OGAIN );
//odebug << "recmask available and constructed." << oendl;
}
+ devmask = 0;
+ if ( ioctl( _fd, SOUND_MIXER_READ_STEREODEVS, &devmask ) != -1 )
+ {
+ odebug << "stereomask = " << devmask << oendl;
+ }
+
/* ChannelIterator it;
for ( it = _channels.begin(); it != _channels.end(); ++it )
{
odebug << "Channel " << it.key() << " available (bit " << it.data() << ")" << oendl;
odebug << " +--- Volume: " << volume( it.key() ) & 0xff << " | " << volume( it.key() ) >> 8 << "" << oendl;
}
@@ -272,18 +278,33 @@ QStringList OMixerInterface::playChannels() const
{
owarn << "NYI" << oendl;
return QStringList();
}
-bool OMixerInterface::hasChannel( const QString& channel )
+bool OMixerInterface::hasChannel( const QString& channel ) const
{
return _channels.contains( channel );
}
+bool OMixerInterface::isStereo( const QString& channel ) const
+{
+ bool result = false;
+ if ( _channels.contains( channel ) )
+ {
+ int devmask = 0;
+ if ( ioctl( _fd, SOUND_MIXER_READ_STEREODEVS, &devmask ) != -1 )
+ {
+ result = devmask & ( 1 << _channels[channel] );
+ }
+ }
+ return result;
+}
+
+
void OMixerInterface::setVolume( const QString& channel, int left, int right )
{
int volume = left;
volume |= ( right == -1 ) ? left << 8 : right << 8;
if ( _channels.contains( channel ) )