summaryrefslogtreecommitdiffstats
path: root/src/3rdparty/phonon/mmf/audioequalizer.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/3rdparty/phonon/mmf/audioequalizer.cpp')
-rw-r--r--src/3rdparty/phonon/mmf/audioequalizer.cpp32
1 files changed, 26 insertions, 6 deletions
diff --git a/src/3rdparty/phonon/mmf/audioequalizer.cpp b/src/3rdparty/phonon/mmf/audioequalizer.cpp
index 7cc9bc7..c2936c5 100644
--- a/src/3rdparty/phonon/mmf/audioequalizer.cpp
+++ b/src/3rdparty/phonon/mmf/audioequalizer.cpp
@@ -16,6 +16,7 @@ along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
+#include <AudioEqualizerBase.h>
#include "audioequalizer.h"
QT_BEGIN_NAMESPACE
@@ -34,18 +35,37 @@ AudioEqualizer::AudioEqualizer(QObject *parent) : AbstractAudioEffect::AbstractA
void AudioEqualizer::parameterChanged(const int pid,
const QVariant &value)
{
- // There is no way to return an error from this function, so we just
- // have to trap and ignore exceptions.
- TRAP_IGNORE(static_cast<CAudioEqualizer *>(m_effect.data())->SetBandLevelL(pid, value.toInt()));
+ if (m_effect.data()) {
+ const int band = pid;
+ const int level = value.toInt();
+ setBandLevel(band, level);
+ }
}
-bool AudioEqualizer::activateOn(CPlayerType *player)
+void AudioEqualizer::connectAudioPlayer(AudioPlayer::NativePlayer *player)
{
CAudioEqualizer *ptr = 0;
QT_TRAP_THROWING(ptr = CAudioEqualizer::NewL(*player));
m_effect.reset(ptr);
+}
- return true;
+void AudioEqualizer::applyParameters()
+{
+ if (m_effect.data()) {
+ EffectParameter param;
+ foreach (param, parameters()) {
+ const int band = param.id();
+ const int level = parameterValue(param).toInt();
+ setBandLevel(band, level);
+ }
+ }
+}
+
+void AudioEqualizer::setBandLevel(int band, int level)
+{
+ CAudioEqualizer *const effect = static_cast<CAudioEqualizer *>(m_effect.data());
+ // TODO: handle audio effect errors
+ TRAP_IGNORE(effect->SetBandLevelL(band, level));
}
QList<EffectParameter> AudioEqualizer::createParams()
@@ -57,7 +77,7 @@ QList<EffectParameter> AudioEqualizer::createParams()
AudioPlayer dummyPlayer;
CAudioEqualizer *eqPtr = 0;
- QT_TRAP_THROWING(eqPtr = CAudioEqualizer::NewL(*dummyPlayer.player());)
+ QT_TRAP_THROWING(eqPtr = CAudioEqualizer::NewL(*dummyPlayer.nativePlayer()));
QScopedPointer<CAudioEqualizer> e(eqPtr);
TInt32 dbMin;