summaryrefslogtreecommitdiffstats
path: root/kmix/mixertoolbox.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'kmix/mixertoolbox.cpp')
-rw-r--r--kmix/mixertoolbox.cpp25
1 files changed, 15 insertions, 10 deletions
diff --git a/kmix/mixertoolbox.cpp b/kmix/mixertoolbox.cpp
index 4a19673b..f91fe9ad 100644
--- a/kmix/mixertoolbox.cpp
+++ b/kmix/mixertoolbox.cpp
@@ -3,6 +3,7 @@
*
*
* Copyright (C) 2004 Christian Esken <esken@kde.org>
+ * Copyright (C) 2017,2020 Roman Savochenko <roman@oscada.org>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
@@ -64,7 +65,7 @@ extern MixerFactory g_mixerFactories[];
* 'true' means to scan all backends. 'false' means: After scanning the
* current backend the next backend is only scanned if no Mixers were found yet.
*/
-void MixerToolBox::initMixer(TQPtrList<Mixer> &mixers, bool multiDriverMode, TQString& ref_hwInfoString)
+void MixerToolBox::initMixer(TQPtrList<Mixer> &mixers, bool multiDriverMode, TQString& ref_hwInfoString, bool isLight)
{
//kdDebug(67100) << "IN MixerToolBox::initMixer()"<<endl;
@@ -115,12 +116,13 @@ void MixerToolBox::initMixer(TQPtrList<Mixer> &mixers, bool multiDriverMode, TQS
// approach doesn't work for the one or other user.
int devNumMax = 19;
getDevIteratorFunc* f = g_mixerFactories[drv].getDevIterator;
- for( DevIterator* I = f ? f() : new DevIterator(); !I->end(); I->next())
+ DevIterator *I = f ? f() : new DevIterator();
+ for( ; !I->end(); I->next())
{
int dev = I->getdev();
Mixer *mixer = new Mixer( drv, dev );
if ( mixer->isValid() ) {
- mixer->open();
+ if(!isLight) mixer->open();
Mixer* m;
if (dev >= 0) {
for (m = mixers.first(); m; m = mixers.next())
@@ -131,7 +133,7 @@ void MixerToolBox::initMixer(TQPtrList<Mixer> &mixers, bool multiDriverMode, TQS
if (mixer->devnum() == m->devnum())
#endif
break;
- if (m) continue;
+ if (m) { delete mixer; continue; }
}
mixers.append( mixer );
// Count mixer nums for every mixer name to identify mixers with equal names.
@@ -145,6 +147,7 @@ void MixerToolBox::initMixer(TQPtrList<Mixer> &mixers, bool multiDriverMode, TQS
* %2, the mixer name, is typically coming from an OS driver. It could contain colons.
* %3, the mixer number, is a number: it does not contain colons.
*/
+ if(!isLight) {
TQString mixerName = mixer->mixerName();
mixerName.replace(":","_");
TQString primaryKeyOfMixer = TQString("%1::%2:%3")
@@ -158,6 +161,7 @@ void MixerToolBox::initMixer(TQPtrList<Mixer> &mixers, bool multiDriverMode, TQS
primaryKeyOfMixer.replace("=","_");
mixer->setID(primaryKeyOfMixer);
+ }
} // valid
else
@@ -174,7 +178,7 @@ void MixerToolBox::initMixer(TQPtrList<Mixer> &mixers, bool multiDriverMode, TQS
else {
// In No-multiDriver-mode we only need to check after we reached devNumMax
if ( dev == devNumMax ) {
- if ( Mixer::mixers().count() != 0 ) {
+ if ( mixers.count() != 0 ) {
// highest device number of driver and a Mixer => finished
autodetectionFinished = true;
}
@@ -182,7 +186,7 @@ void MixerToolBox::initMixer(TQPtrList<Mixer> &mixers, bool multiDriverMode, TQS
} // !multiDriver
// append driverName (used drivers)
- if ( !drvInfoAppended )
+ if ( !drvInfoAppended && !isLight )
{
drvInfoAppended = true;
TQString driverName = Mixer::driverName(drv);
@@ -211,9 +215,10 @@ void MixerToolBox::initMixer(TQPtrList<Mixer> &mixers, bool multiDriverMode, TQS
} // !multipleDriversActive
} // loop over sound card devices of current driver
+ delete I;
} // loop over soundcard drivers
- if (Mixer::masterCard() == 0)
+ if (Mixer::masterCard() == 0 && !isLight)
{
// We have no master card yet. This actually only happens when there was
// not one defined in the kmixrc.
@@ -252,15 +257,15 @@ void MixerToolBox::initMixer(TQPtrList<Mixer> &mixers, bool multiDriverMode, TQS
/*
* Clean up and free all ressources of all found Mixers, which were found in the initMixer() call
*/
-void MixerToolBox::deinitMixer()
+void MixerToolBox::deinitMixer(TQPtrList<Mixer> &mixers)
{
//kdDebug(67100) << "IN MixerToolBox::deinitMixer()"<<endl;
Mixer *mixer;
- while ( (mixer=Mixer::mixers().first()) != 0)
+ while ( (mixer=mixers.first()) != 0)
{
//kdDebug(67100) << "MixerToolBox::deinitMixer() Remove Mixer" << endl;
mixer->close();
- Mixer::mixers().remove(mixer);
+ mixers.remove(mixer);
delete mixer;
}
// kdDebug(67100) << "OUT MixerToolBox::deinitMixer()"<<endl;