diff options
author | Gareth Stockwell <ext-gareth.stockwell@nokia.com> | 2010-01-11 17:41:23 (GMT) |
---|---|---|
committer | Gareth Stockwell <ext-gareth.stockwell@nokia.com> | 2010-01-11 17:59:52 (GMT) |
commit | 5a8c0ded599263446010dfc1729dcab8b2f62f0d (patch) | |
tree | d662bc84c4723fac1aa3fe27fc7321adf25062ff /src/3rdparty | |
parent | f42624c9f88cbbb71d6857566e00348b119d486c (diff) | |
download | Qt-5a8c0ded599263446010dfc1729dcab8b2f62f0d.zip Qt-5a8c0ded599263446010dfc1729dcab8b2f62f0d.tar.gz Qt-5a8c0ded599263446010dfc1729dcab8b2f62f0d.tar.bz2 |
Simplified error handling for audio effects
Task-number: QTBUG-4659
Reviewed-by: Espen Riskedal
Diffstat (limited to 'src/3rdparty')
-rw-r--r-- | src/3rdparty/phonon/mmf/abstractaudioeffect.cpp | 22 | ||||
-rw-r--r-- | src/3rdparty/phonon/mmf/abstractaudioeffect.h | 2 | ||||
-rw-r--r-- | src/3rdparty/phonon/mmf/audioequalizer.cpp | 6 | ||||
-rw-r--r-- | src/3rdparty/phonon/mmf/audioequalizer.h | 2 | ||||
-rw-r--r-- | src/3rdparty/phonon/mmf/bassboost.cpp | 3 | ||||
-rw-r--r-- | src/3rdparty/phonon/mmf/bassboost.h | 4 | ||||
-rw-r--r-- | src/3rdparty/phonon/mmf/environmentalreverb.cpp | 5 | ||||
-rw-r--r-- | src/3rdparty/phonon/mmf/environmentalreverb.h | 4 | ||||
-rw-r--r-- | src/3rdparty/phonon/mmf/loudness.cpp | 3 | ||||
-rw-r--r-- | src/3rdparty/phonon/mmf/loudness.h | 4 | ||||
-rw-r--r-- | src/3rdparty/phonon/mmf/stereowidening.cpp | 5 | ||||
-rw-r--r-- | src/3rdparty/phonon/mmf/stereowidening.h | 4 |
12 files changed, 33 insertions, 31 deletions
diff --git a/src/3rdparty/phonon/mmf/abstractaudioeffect.cpp b/src/3rdparty/phonon/mmf/abstractaudioeffect.cpp index 593e00f..e3672e6 100644 --- a/src/3rdparty/phonon/mmf/abstractaudioeffect.cpp +++ b/src/3rdparty/phonon/mmf/abstractaudioeffect.cpp @@ -71,9 +71,10 @@ void AbstractAudioEffect::setParameterValue(const Phonon::EffectParameter ¶m if (m_effect.data()) { const EffectParameter& internalParam = internalParameter(param.id()); - parameterChanged(internalParam, newValue); + int err = parameterChanged(internalParam, newValue); + TRAP(err, m_effect->ApplyL()); // TODO: handle audio effect errors - TRAP_IGNORE(m_effect->ApplyL()); + Q_UNUSED(err); } } @@ -116,12 +117,16 @@ void AbstractAudioEffect::disconnectMediaObject(MediaObject *mediaObject) void AbstractAudioEffect::setEnabled(bool enabled) { + TInt err = KErrNone; + if (enabled) // TODO: handle audio effect errors - TRAP_IGNORE(m_effect->EnableL()) + TRAP(err, m_effect->EnableL()) else // TODO: handle audio effect errors - TRAP_IGNORE(m_effect->DisableL()) + TRAP(err, m_effect->DisableL()) + + Q_UNUSED(err); } void AbstractAudioEffect::createEffect() @@ -134,15 +139,12 @@ void AbstractAudioEffect::createEffect() if (m_effect.data()) { EffectParameter param; + int err = 0; foreach (param, m_params) { const QVariant value = parameterValue(param); - parameterChanged(param, value); + err = parameterChanged(param, value); } - - // TODO: handle audio effect errors - TRAP_IGNORE(m_effect->EnableL()); - - setEnabled(true); + Q_UNUSED(err) } } diff --git a/src/3rdparty/phonon/mmf/abstractaudioeffect.h b/src/3rdparty/phonon/mmf/abstractaudioeffect.h index 57427e7..a3b35c2 100644 --- a/src/3rdparty/phonon/mmf/abstractaudioeffect.h +++ b/src/3rdparty/phonon/mmf/abstractaudioeffect.h @@ -86,7 +86,7 @@ protected: virtual void createEffect(AudioPlayer::NativePlayer *player) = 0; - virtual void parameterChanged(const EffectParameter ¶m, + virtual int parameterChanged(const EffectParameter ¶m, const QVariant &value) = 0; private: diff --git a/src/3rdparty/phonon/mmf/audioequalizer.cpp b/src/3rdparty/phonon/mmf/audioequalizer.cpp index 1584cf7..201a5fc 100644 --- a/src/3rdparty/phonon/mmf/audioequalizer.cpp +++ b/src/3rdparty/phonon/mmf/audioequalizer.cpp @@ -37,15 +37,15 @@ AudioEqualizer::AudioEqualizer(QObject *parent, const QList<EffectParameter>& pa } -void AudioEqualizer::parameterChanged(const EffectParameter ¶m, +int AudioEqualizer::parameterChanged(const EffectParameter ¶m, const QVariant &value) { 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)); + TRAPD(err, concreteEffect()->SetBandLevelL(band, internalLevel)); + return err; } diff --git a/src/3rdparty/phonon/mmf/audioequalizer.h b/src/3rdparty/phonon/mmf/audioequalizer.h index 3a9a5ca..acfe9b5 100644 --- a/src/3rdparty/phonon/mmf/audioequalizer.h +++ b/src/3rdparty/phonon/mmf/audioequalizer.h @@ -51,7 +51,7 @@ public: protected: // AbstractAudioEffect virtual void createEffect(AudioPlayer::NativePlayer *player); - virtual void parameterChanged(const EffectParameter ¶m, + virtual int parameterChanged(const EffectParameter ¶m, const QVariant &value); private: diff --git a/src/3rdparty/phonon/mmf/bassboost.cpp b/src/3rdparty/phonon/mmf/bassboost.cpp index a8631e0..6996ba9 100644 --- a/src/3rdparty/phonon/mmf/bassboost.cpp +++ b/src/3rdparty/phonon/mmf/bassboost.cpp @@ -37,11 +37,12 @@ BassBoost::BassBoost(QObject *parent, const QList<EffectParameter> ¶meters) } -void BassBoost::parameterChanged(const EffectParameter ¶m, +int BassBoost::parameterChanged(const EffectParameter ¶m, const QVariant &value) { Q_ASSERT_X(param.id() == 0, Q_FUNC_INFO, "Invalid parameter ID"); setEnabled(value.toBool()); + return 0; } //----------------------------------------------------------------------------- diff --git a/src/3rdparty/phonon/mmf/bassboost.h b/src/3rdparty/phonon/mmf/bassboost.h index 82a3bab..e8e8094 100644 --- a/src/3rdparty/phonon/mmf/bassboost.h +++ b/src/3rdparty/phonon/mmf/bassboost.h @@ -46,8 +46,8 @@ public: protected: // AbstractAudioEffect virtual void createEffect(AudioPlayer::NativePlayer *player); - virtual void parameterChanged(const EffectParameter ¶m, - const QVariant &value); + virtual int parameterChanged(const EffectParameter ¶m, + const QVariant &value); private: CBassBoost *concreteEffect(); diff --git a/src/3rdparty/phonon/mmf/environmentalreverb.cpp b/src/3rdparty/phonon/mmf/environmentalreverb.cpp index 2e30ca1..f362afd 100644 --- a/src/3rdparty/phonon/mmf/environmentalreverb.cpp +++ b/src/3rdparty/phonon/mmf/environmentalreverb.cpp @@ -51,7 +51,7 @@ EnvironmentalReverb::EnvironmentalReverb(QObject *parent, const QList<EffectPara } -void EnvironmentalReverb::parameterChanged(const EffectParameter ¶m, +int EnvironmentalReverb::parameterChanged(const EffectParameter ¶m, const QVariant &value) { const qreal externalLevel = value.toReal(); @@ -94,8 +94,7 @@ void EnvironmentalReverb::parameterChanged(const EffectParameter ¶m, Q_ASSERT_X(false, Q_FUNC_INFO, "Unknown parameter"); } - // TODO: handle audio effect errors - Q_UNUSED(err); + return err; } diff --git a/src/3rdparty/phonon/mmf/environmentalreverb.h b/src/3rdparty/phonon/mmf/environmentalreverb.h index 5760c0a..8a91517 100644 --- a/src/3rdparty/phonon/mmf/environmentalreverb.h +++ b/src/3rdparty/phonon/mmf/environmentalreverb.h @@ -46,8 +46,8 @@ public: protected: // AbstractAudioEffect virtual void createEffect(AudioPlayer::NativePlayer *player); - virtual void parameterChanged(const EffectParameter ¶m, - const QVariant &value); + virtual int parameterChanged(const EffectParameter ¶m, + const QVariant &value); private: CEnvironmentalReverb *concreteEffect(); diff --git a/src/3rdparty/phonon/mmf/loudness.cpp b/src/3rdparty/phonon/mmf/loudness.cpp index 7a033fa..2239ac1 100644 --- a/src/3rdparty/phonon/mmf/loudness.cpp +++ b/src/3rdparty/phonon/mmf/loudness.cpp @@ -37,11 +37,12 @@ Loudness::Loudness(QObject *parent, const QList<EffectParameter>& parameters) } -void Loudness::parameterChanged(const EffectParameter ¶m, +int Loudness::parameterChanged(const EffectParameter ¶m, const QVariant &value) { Q_ASSERT_X(param.id() == 0, Q_FUNC_INFO, "Invalid parameter ID"); setEnabled(value.toBool()); + return 0; } //----------------------------------------------------------------------------- diff --git a/src/3rdparty/phonon/mmf/loudness.h b/src/3rdparty/phonon/mmf/loudness.h index f772d7f..bb3380e 100644 --- a/src/3rdparty/phonon/mmf/loudness.h +++ b/src/3rdparty/phonon/mmf/loudness.h @@ -46,8 +46,8 @@ public: protected: // AbstractAudioEffect virtual void createEffect(AudioPlayer::NativePlayer *player); - virtual void parameterChanged(const EffectParameter ¶m, - const QVariant &value); + virtual int parameterChanged(const EffectParameter ¶m, + const QVariant &value); private: CLoudness *concreteEffect(); diff --git a/src/3rdparty/phonon/mmf/stereowidening.cpp b/src/3rdparty/phonon/mmf/stereowidening.cpp index 4fee1aa..d14617d 100644 --- a/src/3rdparty/phonon/mmf/stereowidening.cpp +++ b/src/3rdparty/phonon/mmf/stereowidening.cpp @@ -37,7 +37,7 @@ StereoWidening::StereoWidening(QObject *parent, const QList<EffectParameter>& pa } -void StereoWidening::parameterChanged(const EffectParameter ¶m, +int StereoWidening::parameterChanged(const EffectParameter ¶m, const QVariant &value) { Q_ASSERT_X(param.id() == 0, Q_FUNC_INFO, "Invalid parameter ID"); @@ -47,8 +47,7 @@ void StereoWidening::parameterChanged(const EffectParameter ¶m, TRAPD(err, concreteEffect()->SetStereoWideningLevelL(internalLevel)); - // TODO: handle audio effect errors - Q_UNUSED(err); + return err; } //----------------------------------------------------------------------------- diff --git a/src/3rdparty/phonon/mmf/stereowidening.h b/src/3rdparty/phonon/mmf/stereowidening.h index 249c279..c967e37 100644 --- a/src/3rdparty/phonon/mmf/stereowidening.h +++ b/src/3rdparty/phonon/mmf/stereowidening.h @@ -46,8 +46,8 @@ public: protected: // AbstractAudioEffect virtual void createEffect(AudioPlayer::NativePlayer *player); - virtual void parameterChanged(const EffectParameter ¶m, - const QVariant &value); + virtual int parameterChanged(const EffectParameter ¶m, + const QVariant &value); private: CStereoWidening *concreteEffect(); |