@ -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
* Clean up and free all resources of all found Mixers , which were found in the initMixer ( ) call
*/
*/
@ -278,10 +277,6 @@ void MixerToolBox::deinitMixer(TQPtrList<Mixer> &mixers)
// kdDebug(67100) << "OUT MixerToolBox::deinitMixer(TQPtrList<Mixer> &mixers)" << endl;
// kdDebug(67100) << "OUT MixerToolBox::deinitMixer(TQPtrList<Mixer> &mixers)" << endl;
}
}
/**
* 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
* Scan for Mixers in the System and update the given list . No longer existing mixers
* will be deinitialized .
* will be deinitialized .
@ -291,12 +286,15 @@ void MixerToolBox::deinitMixer(TQPtrList<Mixer> &mixers)
* @ par multiDriverMode Whether the Mixer scan should try more all backendends .
* @ par multiDriverMode Whether the Mixer scan should try more all backendends .
* ' true ' means to scan all backends . ' false ' means : After scanning the
* ' 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 .
* 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 ;
TQPtrList < Mixer > newMixers ;
// Scan for new mixers
// Scan for new mixers
initMixer ( newMixers , multiDriverMode , ref_hwInfoString ) ;
initMixer ( newMixers , multiDriverMode , ref_hwInfoString ) ;
tqWarning ( " MIKE <updateMixer> OLD mixer=%d NEW=%d " , mixers . count ( ) , newMixers . count ( ) ) ;
// Remove no longer existing mixers
// Remove no longer existing mixers
TQPtrList < Mixer > mixersToDeinit ;
TQPtrList < Mixer > mixersToDeinit ;
Mixer * searchMixer = NULL ;
Mixer * searchMixer = NULL ;
@ -314,13 +312,16 @@ void MixerToolBox::updateMixer(TQPtrList<Mixer> &mixers, bool multiDriverMode, T
}
}
if ( ! searchMixer )
if ( ! searchMixer )
{
{
changesDetected = true ;
mixers . take ( ) ;
mixers . take ( ) ;
mixersToDeinit . append ( currMixer ) ;
mixersToDeinit . append ( currMixer ) ;
tqWarning ( " MIKE <updateMixer> remove mixer=( " + currMixer - > id ( ) + " )= " + currMixer - > mixerName ( ) ) ;
}
}
currMixer = mixers . next ( ) ;
currMixer = mixers . next ( ) ;
}
}
deinitMixer ( mixersToDeinit ) ;
deinitMixer ( mixersToDeinit ) ;
// Add newly found mixers
// Add newly found mixers
int insertLocation = 0 ;
searchMixer = newMixers . first ( ) ;
searchMixer = newMixers . first ( ) ;
while ( searchMixer )
while ( searchMixer )
{
{
@ -336,11 +337,16 @@ void MixerToolBox::updateMixer(TQPtrList<Mixer> &mixers, bool multiDriverMode, T
if ( ! currMixer )
if ( ! currMixer )
{
{
// New mixer, append to existing list
// New mixer, append to existing list
changesDetected = true ;
newMixers . take ( ) ;
newMixers . take ( ) ;
mixers . append ( searchMixer ) ;
mixers . insert ( insertLocation , searchMixer ) ;
tqWarning ( " MIKE <updateMixer> add new mixer=( " + searchMixer - > id ( ) + " )= " + searchMixer - > mixerName ( ) ) ;
}
}
searchMixer = newMixers . next ( ) ;
searchMixer = newMixers . next ( ) ;
+ + insertLocation ;
}
}
// Deallocate duplicated mixers
// Deallocate duplicated mixers
deinitMixer ( newMixers ) ;
deinitMixer ( newMixers ) ;
return changesDetected ;
}
}