diff options
-rw-r--r-- | src/3rdparty/phonon/mmf/abstractaudioeffect.cpp | 12 | ||||
-rw-r--r-- | src/3rdparty/phonon/mmf/abstractaudioeffect.h | 2 | ||||
-rw-r--r-- | src/3rdparty/phonon/mmf/bassboost.cpp | 29 | ||||
-rw-r--r-- | src/3rdparty/phonon/mmf/bassboost.h | 5 | ||||
-rw-r--r-- | src/3rdparty/phonon/mmf/effectfactory.cpp | 5 |
5 files changed, 42 insertions, 11 deletions
diff --git a/src/3rdparty/phonon/mmf/abstractaudioeffect.cpp b/src/3rdparty/phonon/mmf/abstractaudioeffect.cpp index 3bce86b..593e00f 100644 --- a/src/3rdparty/phonon/mmf/abstractaudioeffect.cpp +++ b/src/3rdparty/phonon/mmf/abstractaudioeffect.cpp @@ -114,6 +114,16 @@ void AbstractAudioEffect::disconnectMediaObject(MediaObject *mediaObject) abstractPlayerChanged(0); } +void AbstractAudioEffect::setEnabled(bool enabled) +{ + if (enabled) + // TODO: handle audio effect errors + TRAP_IGNORE(m_effect->EnableL()) + else + // TODO: handle audio effect errors + TRAP_IGNORE(m_effect->DisableL()) +} + void AbstractAudioEffect::createEffect() { Q_ASSERT_X(m_player, Q_FUNC_INFO, "Invalid media player pointer"); @@ -131,6 +141,8 @@ void AbstractAudioEffect::createEffect() // TODO: handle audio effect errors TRAP_IGNORE(m_effect->EnableL()); + + setEnabled(true); } } diff --git a/src/3rdparty/phonon/mmf/abstractaudioeffect.h b/src/3rdparty/phonon/mmf/abstractaudioeffect.h index 9b9c47d..57427e7 100644 --- a/src/3rdparty/phonon/mmf/abstractaudioeffect.h +++ b/src/3rdparty/phonon/mmf/abstractaudioeffect.h @@ -82,6 +82,8 @@ protected: void connectMediaObject(MediaObject *mediaObject); void disconnectMediaObject(MediaObject *mediaObject); + void setEnabled(bool enabled); + virtual void createEffect(AudioPlayer::NativePlayer *player) = 0; virtual void parameterChanged(const EffectParameter ¶m, diff --git a/src/3rdparty/phonon/mmf/bassboost.cpp b/src/3rdparty/phonon/mmf/bassboost.cpp index 997bae4..a8631e0 100644 --- a/src/3rdparty/phonon/mmf/bassboost.cpp +++ b/src/3rdparty/phonon/mmf/bassboost.cpp @@ -37,10 +37,11 @@ BassBoost::BassBoost(QObject *parent, const QList<EffectParameter> ¶meters) } -void BassBoost::parameterChanged(const EffectParameter &, - const QVariant &) +void BassBoost::parameterChanged(const EffectParameter ¶m, + const QVariant &value) { - Q_ASSERT_X(false, Q_FUNC_INFO, "BassBoost has no parameters"); + Q_ASSERT_X(param.id() == 0, Q_FUNC_INFO, "Invalid parameter ID"); + setEnabled(value.toBool()); } //----------------------------------------------------------------------------- @@ -52,9 +53,27 @@ const char* BassBoost::description() return "Bass boost"; } -bool BassBoost::getParameters(CMdaAudioOutputStream *, QList<EffectParameter>&) +bool BassBoost::getParameters(CMdaAudioOutputStream *stream, + QList<EffectParameter> ¶meters) { - return true; + bool supported = false; + + QScopedPointer<CBassBoost> effect; + TRAPD(err, effect.reset(CBassBoost::NewL(*stream))); + + if(KErrNone == err) { + supported = true; + + EffectParameter param( + /* parameterId */ 0, + /* name */ tr("Enabled"), + /* hints */ EffectParameter::ToggledHint, + /* defaultValue */ QVariant(bool(true))); + + parameters.append(param); + } + + return supported; } QT_END_NAMESPACE diff --git a/src/3rdparty/phonon/mmf/bassboost.h b/src/3rdparty/phonon/mmf/bassboost.h index b2bc854..82a3bab 100644 --- a/src/3rdparty/phonon/mmf/bassboost.h +++ b/src/3rdparty/phonon/mmf/bassboost.h @@ -30,10 +30,7 @@ namespace Phonon namespace MMF { /** - * @short An "bass boost" effect. - * - * The documentation does not say what "bass boost" is, neither has it anykind - * of setting. It's an on or off thing. + * @short A "bass boost" effect. */ class BassBoost : public AbstractAudioEffect { diff --git a/src/3rdparty/phonon/mmf/effectfactory.cpp b/src/3rdparty/phonon/mmf/effectfactory.cpp index 19c6d90..c6593bb 100644 --- a/src/3rdparty/phonon/mmf/effectfactory.cpp +++ b/src/3rdparty/phonon/mmf/effectfactory.cpp @@ -68,15 +68,16 @@ AbstractAudioEffect *EffectFactory::createAudioEffect(Type type, { case TypeBassBoost: effect = new BassBoost(parent, parameters); + break; case TypeAudioEqualizer: effect = new AudioEqualizer(parent, parameters); + break; case TypeDistanceAttenuation: case TypeEnvironmentalReverb: case TypeListenerOrientation: case TypeLoudness: case TypeSourceOrientation: case TypeStereoWidening: - break; default: Q_ASSERT_X(false, Q_FUNC_INFO, "Unknown effect"); } @@ -124,7 +125,7 @@ void EffectFactory::initialize() Q_ASSERT_X(!m_initialized, Q_FUNC_INFO, "Already initialized"); INITIALIZE_EFFECT(AudioEqualizer) - //INITIALIZE_EFFECT(BassBoost) + INITIALIZE_EFFECT(BassBoost) m_initialized = true; } |