summaryrefslogtreecommitdiffstats
path: root/kmix/mixertoolbox.cpp
diff options
context:
space:
mode:
authorMichele Calgaro <michele.calgaro@yahoo.it>2020-09-16 23:34:21 +0900
committerMichele Calgaro <michele.calgaro@yahoo.it>2020-09-16 23:34:21 +0900
commit00105125e3010438663b1355f6f1579476ee9510 (patch)
tree51e43d62f7c9900c007c92ad5e226bdc4bf9d4bc /kmix/mixertoolbox.cpp
parentf0e311f71b7f02fb20e5db21a297a2c4caee9153 (diff)
downloadtdemultimedia-00105125e3010438663b1355f6f1579476ee9510.tar.gz
tdemultimedia-00105125e3010438663b1355f6f1579476ee9510.zip
This is a temporary commit to save WIP done on this topic.feat/kmix/mixer-detection
Development of this feature will only resume after the release of R14.1.0. Relates to bug 3159. NOTE: this commit needs to be completed/reworked. It should not be merged to master as is. Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
Diffstat (limited to 'kmix/mixertoolbox.cpp')
-rw-r--r--kmix/mixertoolbox.cpp20
1 files changed, 13 insertions, 7 deletions
diff --git a/kmix/mixertoolbox.cpp b/kmix/mixertoolbox.cpp
index 1021fd8c..25836ae3 100644
--- a/kmix/mixertoolbox.cpp
+++ b/kmix/mixertoolbox.cpp
@@ -249,7 +249,6 @@ void MixerToolBox::initMixer(TQPtrList<Mixer> &mixers, bool multiDriverMode, TQS
}
-
/*
* Clean up and free all resources of all found Mixers, which were found in the initMixer() call
*/
@@ -279,10 +278,6 @@ void MixerToolBox::deinitMixer(TQPtrList<Mixer> &mixers)
}
/**
- * Clean up and free all resources of the given mixers
- * @par mixers The list of mixers to deinitialize.
- */
-/**
* Scan for Mixers in the System and update the given list. No longer existing mixers
* will be deinitialized.
* @par mixers The list where to add the found Mixers. This parameter is superfluous
@@ -291,12 +286,15 @@ void MixerToolBox::deinitMixer(TQPtrList<Mixer> &mixers)
* @par multiDriverMode Whether the Mixer scan should try more all backendends.
* '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.
+ * @return true if any change in the mixers list has been detected.
*/
-void MixerToolBox::updateMixer(TQPtrList<Mixer> &mixers, bool multiDriverMode, TQString& ref_hwInfoString)
+bool MixerToolBox::updateMixer(TQPtrList<Mixer> &mixers, bool multiDriverMode, TQString& ref_hwInfoString)
{
+ bool changesDetected = false;
TQPtrList<Mixer> newMixers;
// Scan for new mixers
initMixer(newMixers, multiDriverMode, ref_hwInfoString);
+tqWarning("MIKE <updateMixer> OLD mixer=%d NEW=%d",mixers.count(),newMixers.count());
// Remove no longer existing mixers
TQPtrList<Mixer> mixersToDeinit;
Mixer *searchMixer = NULL;
@@ -314,13 +312,16 @@ void MixerToolBox::updateMixer(TQPtrList<Mixer> &mixers, bool multiDriverMode, T
}
if (!searchMixer)
{
+ changesDetected = true;
mixers.take();
mixersToDeinit.append(currMixer);
+tqWarning("MIKE <updateMixer> remove mixer=("+currMixer->id()+")="+currMixer->mixerName());
}
currMixer = mixers.next();
}
deinitMixer(mixersToDeinit);
// Add newly found mixers
+ int insertLocation = 0;
searchMixer = newMixers.first();
while (searchMixer)
{
@@ -336,11 +337,16 @@ void MixerToolBox::updateMixer(TQPtrList<Mixer> &mixers, bool multiDriverMode, T
if (!currMixer)
{
// New mixer, append to existing list
+ changesDetected = true;
newMixers.take();
- mixers.append(searchMixer);
+ mixers.insert(insertLocation, searchMixer);
+tqWarning("MIKE <updateMixer> add new mixer=("+searchMixer->id()+")="+searchMixer->mixerName());
}
searchMixer = newMixers.next();
+ ++insertLocation;
}
// Deallocate duplicated mixers
deinitMixer(newMixers);
+
+ return changesDetected;
}