diff options
Diffstat (limited to 'src/3rdparty/phonon/mmf/audioequalizer.cpp')
-rw-r--r-- | src/3rdparty/phonon/mmf/audioequalizer.cpp | 35 |
1 files changed, 10 insertions, 25 deletions
diff --git a/src/3rdparty/phonon/mmf/audioequalizer.cpp b/src/3rdparty/phonon/mmf/audioequalizer.cpp index e3b1ab3..1584cf7 100644 --- a/src/3rdparty/phonon/mmf/audioequalizer.cpp +++ b/src/3rdparty/phonon/mmf/audioequalizer.cpp @@ -37,35 +37,18 @@ AudioEqualizer::AudioEqualizer(QObject *parent, const QList<EffectParameter>& pa } -void AudioEqualizer::parameterChanged(const int pid, +void AudioEqualizer::parameterChanged(const EffectParameter ¶m, const QVariant &value) { - const int band = pid; - const qreal level = value.toReal(); - setBandLevel(band, level); -} - -void AudioEqualizer::applyParameters() -{ - if (m_effect.data()) { - Phonon::EffectParameter param; - foreach (param, parameters()) { - const int band = param.id(); - const qreal level = parameterValue(param).toReal(); - setBandLevel(band, level); - } - } -} - -void AudioEqualizer::setBandLevel(int band, qreal externalLevel) -{ - const EffectParameter ¶m = m_params[band-1]; // Band IDs are 1-based + const int band = param.id() + 1; + const qreal externalLevel = value.toReal(); const int internalLevel = param.toInternalValue(externalLevel); // TODO: handle audio effect errors TRAP_IGNORE(concreteEffect()->SetBandLevelL(band, internalLevel)); } + //----------------------------------------------------------------------------- // Static functions //----------------------------------------------------------------------------- @@ -92,10 +75,12 @@ bool AudioEqualizer::getParameters(CMdaAudioOutputStream *stream, 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); + for (int i = 0; i < bandCount; ++i) { + // For some reason, band IDs are 1-based, as opposed to the + // 0-based indices used in just about other Symbian API...! + const int band = i + 1; + + const qint32 hz = effect->CenterFrequency(band); // We pass a floating-point parameter range of -1.0 to +1.0 for // each band in order to work around a limitation in |