diff options
Diffstat (limited to 'src/3rdparty/phonon/mmf/audioequalizer.cpp')
-rw-r--r-- | src/3rdparty/phonon/mmf/audioequalizer.cpp | 67 |
1 files changed, 38 insertions, 29 deletions
diff --git a/src/3rdparty/phonon/mmf/audioequalizer.cpp b/src/3rdparty/phonon/mmf/audioequalizer.cpp index b41eda4..a4127c4 100644 --- a/src/3rdparty/phonon/mmf/audioequalizer.cpp +++ b/src/3rdparty/phonon/mmf/audioequalizer.cpp @@ -82,37 +82,46 @@ const char* AudioEqualizer::description() return "Audio equalizer"; } -void AudioEqualizer::getParameters(NativeEffect *effect, - QList<EffectParameter> ¶meters) +bool AudioEqualizer::getParameters(CMdaAudioOutputStream *stream, + QList<EffectParameter>& parameters) { - TInt32 dbMin; - TInt32 dbMax; - effect->DbLevelLimits(dbMin, dbMax); - - const int bandCount = effect->NumberOfBands(); - - // For some reason, band IDs are 1-based, as opposed to the - // 0-based indices used in just about other Symbian API...! - for (int i = 1; i <= bandCount; ++i) { - const qint32 hz = effect->CenterFrequency(i); - - // We pass a floating-point parameter range of -1.0 to +1.0 for - // each band in order to work around a limitation in - // Phonon::EffectWidget. See documentation of EffectParameter - // for more details. - EffectParameter param( - /* parameterId */ i, - /* name */ tr("%1 Hz").arg(hz), - /* hints */ EffectParameter::LogarithmicHint, - /* defaultValue */ QVariant(qreal(0.0)), - /* minimumValue */ QVariant(qreal(-1.0)), - /* maximumValue */ QVariant(qreal(+1.0)), - /* values */ QVariantList(), - /* description */ QString()); - - param.setInternalRange(dbMin, dbMax); - parameters.append(param); + bool supported = false; + + QScopedPointer<CAudioEqualizer> effect; + TRAPD(err, effect.reset(CAudioEqualizer::NewL(*stream))); + + if (KErrNone == err) { + supported = true; + + TInt32 dbMin; + TInt32 dbMax; + effect->DbLevelLimits(dbMin, dbMax); + + const int bandCount = effect->NumberOfBands(); + + // For some reason, band IDs are 1-based, as opposed to the + // 0-based indices used in just about other Symbian API...! + for (int i = 1; i <= bandCount; ++i) { + const qint32 hz = effect->CenterFrequency(i); + + // We pass a floating-point parameter range of -1.0 to +1.0 for + // each band in order to work around a limitation in + // Phonon::EffectWidget. See documentation of EffectParameter + // for more details. + EffectParameter param( + /* parameterId */ i, + /* name */ tr("%1 Hz").arg(hz), + /* hints */ EffectParameter::LogarithmicHint, + /* defaultValue */ QVariant(qreal(0.0)), + /* minimumValue */ QVariant(qreal(-1.0)), + /* maximumValue */ QVariant(qreal(+1.0))); + + param.setInternalRange(dbMin, dbMax); + parameters.append(param); + } } + + return supported; } QT_END_NAMESPACE |