mirror of
https://bitbucket.org/smil3y/kde-extraapps.git
synced 2025-02-24 02:42:52 +00:00
kmix: indent and format
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
parent
6e46680bb4
commit
45c5bc5a6f
2 changed files with 241 additions and 248 deletions
|
@ -65,7 +65,8 @@ const char* MixerDevNames[32]={
|
||||||
I18N_NOOP("PhoneOut"), I18N_NOOP("Video"), I18N_NOOP("Radio"),
|
I18N_NOOP("PhoneOut"), I18N_NOOP("Video"), I18N_NOOP("Radio"),
|
||||||
I18N_NOOP("Monitor"), I18N_NOOP("3D-depth"), I18N_NOOP("3D-center"),
|
I18N_NOOP("Monitor"), I18N_NOOP("3D-depth"), I18N_NOOP("3D-center"),
|
||||||
I18N_NOOP("unknown"), I18N_NOOP("unknown"), I18N_NOOP("unknown"),
|
I18N_NOOP("unknown"), I18N_NOOP("unknown"), I18N_NOOP("unknown"),
|
||||||
I18N_NOOP("unknown") , I18N_NOOP("unused") };
|
I18N_NOOP("unknown") , I18N_NOOP("unused")
|
||||||
|
};
|
||||||
|
|
||||||
const MixDevice::ChannelType MixerChannelTypes[32] = {
|
const MixDevice::ChannelType MixerChannelTypes[32] = {
|
||||||
MixDevice::VOLUME, MixDevice::BASS, MixDevice::TREBLE,
|
MixDevice::VOLUME, MixDevice::BASS, MixDevice::TREBLE,
|
||||||
|
@ -78,7 +79,8 @@ const MixDevice::ChannelType MixerChannelTypes[32] = {
|
||||||
MixDevice::EXTERNAL, MixDevice::VIDEO, MixDevice::EXTERNAL,
|
MixDevice::EXTERNAL, MixDevice::VIDEO, MixDevice::EXTERNAL,
|
||||||
MixDevice::EXTERNAL, MixDevice::VOLUME, MixDevice::VOLUME,
|
MixDevice::EXTERNAL, MixDevice::VOLUME, MixDevice::VOLUME,
|
||||||
MixDevice::UNKNOWN, MixDevice::UNKNOWN, MixDevice::UNKNOWN,
|
MixDevice::UNKNOWN, MixDevice::UNKNOWN, MixDevice::UNKNOWN,
|
||||||
MixDevice::UNKNOWN, MixDevice::UNKNOWN };
|
MixDevice::UNKNOWN, MixDevice::UNKNOWN
|
||||||
|
};
|
||||||
|
|
||||||
Mixer_Backend* OSS_getMixer( Mixer* mixer, int device )
|
Mixer_Backend* OSS_getMixer( Mixer* mixer, int device )
|
||||||
{
|
{
|
||||||
|
@ -87,11 +89,10 @@ Mixer_Backend* OSS_getMixer( Mixer* mixer, int device )
|
||||||
return l_mixer;
|
return l_mixer;
|
||||||
}
|
}
|
||||||
|
|
||||||
Mixer_OSS::Mixer_OSS(Mixer* mixer, int device) :
|
Mixer_OSS::Mixer_OSS(Mixer* mixer, int device)
|
||||||
Mixer_Backend(mixer, device)
|
: Mixer_Backend(mixer, device)
|
||||||
{
|
|
||||||
if (device == -1)
|
|
||||||
{
|
{
|
||||||
|
if (device == -1) {
|
||||||
m_devnum = 0;
|
m_devnum = 0;
|
||||||
}
|
}
|
||||||
m_fd = -1; // point to an invalid FD
|
m_fd = -1; // point to an invalid FD
|
||||||
|
@ -107,21 +108,20 @@ int Mixer_OSS::open()
|
||||||
QString finalDeviceName;
|
QString finalDeviceName;
|
||||||
finalDeviceName = deviceName( m_devnum );
|
finalDeviceName = deviceName( m_devnum );
|
||||||
kDebug() << "OSS open() " << finalDeviceName;
|
kDebug() << "OSS open() " << finalDeviceName;
|
||||||
if ((m_fd= ::open( finalDeviceName.toAscii().data(), O_RDWR)) < 0)
|
if ((m_fd= ::open( finalDeviceName.toAscii().data(), O_RDWR)) < 0) {
|
||||||
{
|
if ( errno == EACCES ) {
|
||||||
if ( errno == EACCES )
|
|
||||||
return Mixer::ERR_PERM;
|
return Mixer::ERR_PERM;
|
||||||
else {
|
} else {
|
||||||
finalDeviceName = deviceNameDevfs( m_devnum );
|
finalDeviceName = deviceNameDevfs( m_devnum );
|
||||||
if ((m_fd= ::open( finalDeviceName.toAscii().data(), O_RDWR)) < 0)
|
if ((m_fd= ::open( finalDeviceName.toAscii().data(), O_RDWR)) < 0) {
|
||||||
{
|
if ( errno == EACCES ) {
|
||||||
if ( errno == EACCES )
|
|
||||||
return Mixer::ERR_PERM;
|
return Mixer::ERR_PERM;
|
||||||
else
|
} else {
|
||||||
return Mixer::ERR_OPEN;
|
return Mixer::ERR_OPEN;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
_udi = KMixDeviceManager::instance()->getUDI_OSS(finalDeviceName);
|
_udi = KMixDeviceManager::instance()->getUDI_OSS(finalDeviceName);
|
||||||
if ( _udi.isEmpty() ) {
|
if ( _udi.isEmpty() ) {
|
||||||
|
@ -132,24 +132,27 @@ int Mixer_OSS::open()
|
||||||
}
|
}
|
||||||
int devmask, recmask, i_recsrc, stereodevs;
|
int devmask, recmask, i_recsrc, stereodevs;
|
||||||
// Mixer is open. Now define properties
|
// Mixer is open. Now define properties
|
||||||
if (ioctl(m_fd, SOUND_MIXER_READ_DEVMASK, &devmask) == -1)
|
if (ioctl(m_fd, SOUND_MIXER_READ_DEVMASK, &devmask) == -1) {
|
||||||
return Mixer::ERR_READ;
|
return Mixer::ERR_READ;
|
||||||
if (ioctl(m_fd, SOUND_MIXER_READ_RECMASK, &recmask) == -1)
|
}
|
||||||
|
if (ioctl(m_fd, SOUND_MIXER_READ_RECMASK, &recmask) == -1) {
|
||||||
return Mixer::ERR_READ;
|
return Mixer::ERR_READ;
|
||||||
if (ioctl(m_fd, SOUND_MIXER_READ_RECSRC, &i_recsrc) == -1)
|
}
|
||||||
|
if (ioctl(m_fd, SOUND_MIXER_READ_RECSRC, &i_recsrc) == -1) {
|
||||||
return Mixer::ERR_READ;
|
return Mixer::ERR_READ;
|
||||||
if (ioctl(m_fd, SOUND_MIXER_READ_STEREODEVS, &stereodevs) == -1)
|
}
|
||||||
|
if (ioctl(m_fd, SOUND_MIXER_READ_STEREODEVS, &stereodevs) == -1) {
|
||||||
return Mixer::ERR_READ;
|
return Mixer::ERR_READ;
|
||||||
|
}
|
||||||
|
|
||||||
int idx = 0;
|
int idx = 0;
|
||||||
while( devmask && idx < MAX_MIXDEVS )
|
while( devmask && idx < MAX_MIXDEVS ) {
|
||||||
{
|
if( devmask & ( 1 << idx ) ) { // device active?
|
||||||
if( devmask & ( 1 << idx ) ) // device active?
|
|
||||||
{
|
|
||||||
Volume playbackVol( 100, 1, true, false );
|
Volume playbackVol( 100, 1, true, false );
|
||||||
playbackVol.addVolumeChannel(VolumeChannel(Volume::LEFT));
|
playbackVol.addVolumeChannel(VolumeChannel(Volume::LEFT));
|
||||||
if ( stereodevs & ( 1 << idx ) )
|
if ( stereodevs & ( 1 << idx ) ) {
|
||||||
playbackVol.addVolumeChannel(VolumeChannel(Volume::RIGHT));
|
playbackVol.addVolumeChannel(VolumeChannel(Volume::RIGHT));
|
||||||
|
}
|
||||||
|
|
||||||
QString id;
|
QString id;
|
||||||
id.setNum(idx);
|
id.setNum(idx);
|
||||||
|
@ -174,11 +177,9 @@ int Mixer_OSS::open()
|
||||||
|
|
||||||
#if defined(SOUND_MIXER_INFO)
|
#if defined(SOUND_MIXER_INFO)
|
||||||
struct mixer_info l_mix_info;
|
struct mixer_info l_mix_info;
|
||||||
if (ioctl(m_fd, SOUND_MIXER_INFO, &l_mix_info) != -1)
|
if (ioctl(m_fd, SOUND_MIXER_INFO, &l_mix_info) != -1) {
|
||||||
{
|
|
||||||
registerCard(l_mix_info.name);
|
registerCard(l_mix_info.name);
|
||||||
}
|
} else
|
||||||
else
|
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
registerCard("OSS Audio Mixer");
|
registerCard("OSS Audio Mixer");
|
||||||
|
@ -201,50 +202,54 @@ int Mixer_OSS::close()
|
||||||
QString Mixer_OSS::deviceName(int devnum)
|
QString Mixer_OSS::deviceName(int devnum)
|
||||||
{
|
{
|
||||||
switch (devnum) {
|
switch (devnum) {
|
||||||
case 0:
|
case 0: {
|
||||||
return QString("/dev/mixer");
|
return QString("/dev/mixer");
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
default:
|
default: {
|
||||||
QString devname("/dev/mixer%1");
|
QString devname("/dev/mixer%1");
|
||||||
return devname.arg(devnum);
|
return devname.arg(devnum);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
QString Mixer_OSS::deviceNameDevfs(int devnum)
|
QString Mixer_OSS::deviceNameDevfs(int devnum)
|
||||||
{
|
{
|
||||||
switch (devnum) {
|
switch (devnum) {
|
||||||
case 0:
|
case 0: {
|
||||||
return QString("/dev/sound/mixer");
|
return QString("/dev/sound/mixer");
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
default:
|
default: {
|
||||||
QString devname("/dev/sound/mixer");
|
QString devname("/dev/sound/mixer");
|
||||||
devname += ('0'+devnum);
|
devname += ('0'+devnum);
|
||||||
return devname;
|
return devname;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
QString Mixer_OSS::errorText(int mixer_error)
|
QString Mixer_OSS::errorText(int mixer_error)
|
||||||
{
|
{
|
||||||
QString l_s_errmsg;
|
QString l_s_errmsg;
|
||||||
switch (mixer_error)
|
switch (mixer_error) {
|
||||||
{
|
case Mixer::ERR_PERM: {
|
||||||
case Mixer::ERR_PERM:
|
|
||||||
l_s_errmsg = i18n("kmix: You do not have permission to access the mixer device.\n" \
|
l_s_errmsg = i18n("kmix: You do not have permission to access the mixer device.\n" \
|
||||||
"Login as root and do a 'chmod a+rw /dev/mixer*' to allow the access.");
|
"Login as root and do a 'chmod a+rw /dev/mixer*' to allow the access.");
|
||||||
break;
|
break;
|
||||||
case Mixer::ERR_OPEN:
|
}
|
||||||
|
case Mixer::ERR_OPEN: {
|
||||||
l_s_errmsg = i18n("kmix: Mixer cannot be found.\n" \
|
l_s_errmsg = i18n("kmix: Mixer cannot be found.\n" \
|
||||||
"Please check that the soundcard is installed and the\n" \
|
"Please check that the soundcard is installed and the\n" \
|
||||||
"soundcard driver is loaded.\n" \
|
"soundcard driver is loaded.\n" \
|
||||||
"On Linux you might need to use 'insmod' to load the driver.\n" \
|
"On Linux you might need to use 'insmod' to load the driver.\n" \
|
||||||
"Use 'soundon' when using commercial OSS.");
|
"Use 'soundon' when using commercial OSS.");
|
||||||
break;
|
break;
|
||||||
default:
|
}
|
||||||
|
default: {
|
||||||
l_s_errmsg = Mixer_Backend::errorText(mixer_error);
|
l_s_errmsg = Mixer_Backend::errorText(mixer_error);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return l_s_errmsg;
|
return l_s_errmsg;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -254,13 +259,13 @@ void print_recsrc(int recsrc)
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
QString msg;
|
QString msg;
|
||||||
for (i = 0; i < SOUND_MIXER_NRDEVICES; i++)
|
for (i = 0; i < SOUND_MIXER_NRDEVICES; i++) {
|
||||||
{
|
if ((1 << i) & recsrc) {
|
||||||
if ((1 << i) & recsrc)
|
|
||||||
msg += '+';
|
msg += '+';
|
||||||
else
|
} else {
|
||||||
msg += '.';
|
msg += '.';
|
||||||
}
|
}
|
||||||
|
}
|
||||||
kDebug() << msg;
|
kDebug() << msg;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -268,8 +273,7 @@ int Mixer_OSS::setRecsrcToOSS( const QString& id, bool on )
|
||||||
{
|
{
|
||||||
int i_recsrc; //, oldrecsrc;
|
int i_recsrc; //, oldrecsrc;
|
||||||
int devnum = id2num(id);
|
int devnum = id2num(id);
|
||||||
if (ioctl(m_fd, SOUND_MIXER_READ_RECSRC, &i_recsrc) == -1)
|
if (ioctl(m_fd, SOUND_MIXER_READ_RECSRC, &i_recsrc) == -1) {
|
||||||
{
|
|
||||||
errormsg(Mixer::ERR_READ);
|
errormsg(Mixer::ERR_READ);
|
||||||
return Mixer::ERR_READ;
|
return Mixer::ERR_READ;
|
||||||
}
|
}
|
||||||
|
@ -279,8 +283,7 @@ int Mixer_OSS::setRecsrcToOSS( const QString& id, bool on )
|
||||||
// (i_recsrc & ~(1 << devnum ));
|
// (i_recsrc & ~(1 << devnum ));
|
||||||
|
|
||||||
// Change status of record source(s)
|
// Change status of record source(s)
|
||||||
if (ioctl(m_fd, SOUND_MIXER_WRITE_RECSRC, &i_recsrc) == -1)
|
if (ioctl(m_fd, SOUND_MIXER_WRITE_RECSRC, &i_recsrc) == -1) {
|
||||||
{
|
|
||||||
errormsg (Mixer::ERR_WRITE);
|
errormsg (Mixer::ERR_WRITE);
|
||||||
// don't return here. It is much better to re-read the capture switch states.
|
// don't return here. It is much better to re-read the capture switch states.
|
||||||
}
|
}
|
||||||
|
@ -299,27 +302,26 @@ int Mixer_OSS::setRecsrcToOSS( const QString& id, bool on )
|
||||||
// If the record source is supposed to be on, but wasn't set, explicitly
|
// If the record source is supposed to be on, but wasn't set, explicitly
|
||||||
// set the record source. Not all cards support multiple record sources.
|
// set the record source. Not all cards support multiple record sources.
|
||||||
// As a result, we also need to do the read & write again.
|
// As a result, we also need to do the read & write again.
|
||||||
if (((i_recsrc & ( 1<<devnum)) == 0) && on)
|
if (((i_recsrc & ( 1<<devnum)) == 0) && on) {
|
||||||
{
|
|
||||||
// Setting the new device failed => Try to enable it *exclusively*
|
// Setting the new device failed => Try to enable it *exclusively*
|
||||||
|
|
||||||
// oldrecsrc = i_recsrc = 1 << devnum;
|
// oldrecsrc = i_recsrc = 1 << devnum;
|
||||||
|
|
||||||
if (ioctl(m_fd, SOUND_MIXER_WRITE_RECSRC, &i_recsrc) == -1)
|
if (ioctl(m_fd, SOUND_MIXER_WRITE_RECSRC, &i_recsrc) == -1) {
|
||||||
errormsg (Mixer::ERR_WRITE);
|
errormsg (Mixer::ERR_WRITE);
|
||||||
if (ioctl(m_fd, SOUND_MIXER_READ_RECSRC, &i_recsrc) == -1)
|
}
|
||||||
|
if (ioctl(m_fd, SOUND_MIXER_READ_RECSRC, &i_recsrc) == -1) {
|
||||||
errormsg(Mixer::ERR_READ);
|
errormsg(Mixer::ERR_READ);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Re-read status of record source(s). Just in case the hardware/driver has
|
// Re-read status of record source(s). Just in case the hardware/driver has
|
||||||
// some limitaton (like exclusive switches)
|
// some limitaton (like exclusive switches)
|
||||||
int recsrcMask;
|
int recsrcMask;
|
||||||
if (ioctl(m_fd, SOUND_MIXER_READ_RECSRC, &recsrcMask) == -1)
|
if (ioctl(m_fd, SOUND_MIXER_READ_RECSRC, &recsrcMask) == -1) {
|
||||||
errormsg(Mixer::ERR_READ);
|
errormsg(Mixer::ERR_READ);
|
||||||
else
|
} else {
|
||||||
{
|
for(int i=0; i< m_mixDevices.count() ; i++ ) {
|
||||||
for(int i=0; i< m_mixDevices.count() ; i++ )
|
|
||||||
{
|
|
||||||
std::shared_ptr<MixDevice> md = m_mixDevices[i];
|
std::shared_ptr<MixDevice> md = m_mixDevices[i];
|
||||||
bool isRecsrc = ( (recsrcMask & ( 1<<devnum)) != 0 );
|
bool isRecsrc = ( (recsrcMask & ( 1<<devnum)) != 0 );
|
||||||
md->setRecSource(isRecsrc);
|
md->setRecSource(isRecsrc);
|
||||||
|
@ -327,7 +329,6 @@ int Mixer_OSS::setRecsrcToOSS( const QString& id, bool on )
|
||||||
} // reading newrecsrcmask is OK
|
} // reading newrecsrcmask is OK
|
||||||
|
|
||||||
return Mixer::OK;
|
return Mixer::OK;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -360,18 +361,14 @@ int Mixer_OSS::readVolumeFromHW( const QString& id, std::shared_ptr<MixDevice> m
|
||||||
|
|
||||||
if ( vol.hasVolume() ) {
|
if ( vol.hasVolume() ) {
|
||||||
int volume;
|
int volume;
|
||||||
if (ioctl(m_fd, MIXER_READ( devnum ), &volume) == -1)
|
if (ioctl(m_fd, MIXER_READ( devnum ), &volume) == -1) {
|
||||||
{
|
|
||||||
/* Oops, can't read mixer */
|
/* Oops, can't read mixer */
|
||||||
errormsg(Mixer::ERR_READ);
|
errormsg(Mixer::ERR_READ);
|
||||||
ret = Mixer::ERR_READ;
|
ret = Mixer::ERR_READ;
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
|
|
||||||
int volLeft = (volume & 0x7f);
|
int volLeft = (volume & 0x7f);
|
||||||
int volRight = ((volume>>8) & 0x7f);
|
int volRight = ((volume>>8) & 0x7f);
|
||||||
//
|
|
||||||
// if ( md->id() == "0" )
|
// if ( md->id() == "0" )
|
||||||
// kDebug() << md->id() << ": " << "volLeft=" << volLeft << ", volRight" << volRight;
|
// kDebug() << md->id() << ": " << "volLeft=" << volLeft << ", volRight" << volRight;
|
||||||
|
|
||||||
|
@ -381,25 +378,27 @@ int Mixer_OSS::readVolumeFromHW( const QString& id, std::shared_ptr<MixDevice> m
|
||||||
// Muted is represented in OSS by value 0. We don't want to write the value 0 as a volume,
|
// Muted is represented in OSS by value 0. We don't want to write the value 0 as a volume,
|
||||||
// but instead we only mark it muted (see setMuted() above).
|
// but instead we only mark it muted (see setMuted() above).
|
||||||
|
|
||||||
foreach (VolumeChannel vc, vol.getVolumes() )
|
foreach (VolumeChannel vc, vol.getVolumes() ) {
|
||||||
{
|
|
||||||
long volOld = 0;
|
long volOld = 0;
|
||||||
long volNew = 0;
|
long volNew = 0;
|
||||||
switch(vc.chid) {
|
switch(vc.chid) {
|
||||||
case Volume::LEFT:
|
case Volume::LEFT: {
|
||||||
volOld = vol.getVolume(Volume::LEFT);
|
volOld = vol.getVolume(Volume::LEFT);
|
||||||
volNew = volLeft;
|
volNew = volLeft;
|
||||||
vol.setVolume( Volume::LEFT, volNew );
|
vol.setVolume( Volume::LEFT, volNew );
|
||||||
break;
|
break;
|
||||||
case Volume::RIGHT:
|
}
|
||||||
|
case Volume::RIGHT: {
|
||||||
volOld = vol.getVolume(Volume::RIGHT);
|
volOld = vol.getVolume(Volume::RIGHT);
|
||||||
volNew = volRight;
|
volNew = volRight;
|
||||||
vol.setVolume( Volume::RIGHT, volNew );
|
vol.setVolume( Volume::RIGHT, volNew );
|
||||||
break;
|
break;
|
||||||
default:
|
}
|
||||||
|
default: {
|
||||||
// not supported by OSSv3
|
// not supported by OSSv3
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if ( volOld != volNew ) {
|
if ( volOld != volNew ) {
|
||||||
controlChanged = true;
|
controlChanged = true;
|
||||||
|
@ -410,37 +409,29 @@ int Mixer_OSS::readVolumeFromHW( const QString& id, std::shared_ptr<MixDevice> m
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// --- RECORD SWITCH ---
|
// --- RECORD SWITCH ---
|
||||||
//Volume& captureVol = md->captureVolume();
|
//Volume& captureVol = md->captureVolume();
|
||||||
int recsrcMask;
|
int recsrcMask;
|
||||||
if (ioctl(m_fd, SOUND_MIXER_READ_RECSRC, &recsrcMask) == -1)
|
if (ioctl(m_fd, SOUND_MIXER_READ_RECSRC, &recsrcMask) == -1) {
|
||||||
ret = Mixer::ERR_READ;
|
ret = Mixer::ERR_READ;
|
||||||
else
|
} else {
|
||||||
{
|
|
||||||
bool isRecsrcOld = md->isRecSource();
|
bool isRecsrcOld = md->isRecSource();
|
||||||
// test if device bit is set in record bit mask
|
// test if device bit is set in record bit mask
|
||||||
bool isRecsrc = ( (recsrcMask & ( 1<<devnum)) != 0 );
|
bool isRecsrc = ( (recsrcMask & ( 1<<devnum)) != 0 );
|
||||||
md->setRecSource(isRecsrc);
|
md->setRecSource(isRecsrc);
|
||||||
if ( isRecsrcOld != isRecsrc )
|
if ( isRecsrcOld != isRecsrc ) {
|
||||||
controlChanged = true;
|
controlChanged = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( ret== 0)
|
if ( ret== 0) {
|
||||||
{
|
if ( controlChanged ) {
|
||||||
if ( controlChanged )
|
|
||||||
{
|
|
||||||
//kDebug() << "FINE! " << ret;
|
//kDebug() << "FINE! " << ret;
|
||||||
return Mixer::OK;
|
return Mixer::OK;
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
return Mixer::OK_UNCHANGED;
|
return Mixer::OK_UNCHANGED;
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
//kDebug() << "SHIT! " << ret;
|
//kDebug() << "SHIT! " << ret;
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -454,30 +445,32 @@ int Mixer_OSS::writeVolumeToHW( const QString& id, std::shared_ptr<MixDevice> md
|
||||||
int devnum = id2num(id);
|
int devnum = id2num(id);
|
||||||
|
|
||||||
Volume& vol = md->playbackVolume();
|
Volume& vol = md->playbackVolume();
|
||||||
if( md->isMuted() )
|
if( md->isMuted() ) {
|
||||||
volume = 0;
|
volume = 0;
|
||||||
else
|
} else {
|
||||||
{
|
if ( vol.getVolumes().count() > 1 ) {
|
||||||
if ( vol.getVolumes().count() > 1 )
|
|
||||||
volume = (vol.getVolume(Volume::LEFT) + (vol.getVolume(Volume::RIGHT)<<8));
|
volume = (vol.getVolume(Volume::LEFT) + (vol.getVolume(Volume::RIGHT)<<8));
|
||||||
else
|
} else {
|
||||||
volume = vol.getVolume(Volume::LEFT);
|
volume = vol.getVolume(Volume::LEFT);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (ioctl(m_fd, MIXER_WRITE( devnum ), &volume) == -1)
|
if (ioctl(m_fd, MIXER_WRITE( devnum ), &volume) == -1) {
|
||||||
return Mixer::ERR_WRITE;
|
return Mixer::ERR_WRITE;
|
||||||
|
}
|
||||||
|
|
||||||
setRecsrcToOSS( id, md->isRecSource() );
|
setRecsrcToOSS( id, md->isRecSource() );
|
||||||
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString OSS_getDriverName() {
|
QString OSS_getDriverName()
|
||||||
|
{
|
||||||
return "OSS";
|
return "OSS";
|
||||||
}
|
}
|
||||||
|
|
||||||
QString Mixer_OSS::getDriverName() {
|
QString Mixer_OSS::getDriverName()
|
||||||
|
{
|
||||||
return "OSS";
|
return "OSS";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue