author | eckhart.koppen@nokia.com |
Wed, 31 Mar 2010 11:06:36 +0300 | |
changeset 7 | f7bc934e204c |
parent 3 | 41300fa6a67c |
permissions | -rw-r--r-- |
0 | 1 |
/* This file is part of the KDE project. |
2 |
||
3 |
Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
4 |
||
5 |
This library is free software: you can redistribute it and/or modify |
|
6 |
it under the terms of the GNU Lesser General Public License as published by |
|
7 |
the Free Software Foundation, either version 2.1 or 3 of the License. |
|
8 |
||
9 |
This library is distributed in the hope that it will be useful, |
|
10 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
12 |
GNU Lesser General Public License for more details. |
|
13 |
||
14 |
You should have received a copy of the GNU Lesser General Public License |
|
15 |
along with this library. If not, see <http://www.gnu.org/licenses/>. |
|
16 |
||
17 |
*/ |
|
18 |
||
19 |
#include "mediaobject.h" |
|
20 |
||
21 |
#include "abstractaudioeffect.h" |
|
7
f7bc934e204c
5cabc75a39ca2f064f70b40f72ed93c74c4dc19b
eckhart.koppen@nokia.com
parents:
3
diff
changeset
|
22 |
#include "audioplayer.h" |
0 | 23 |
|
24 |
QT_BEGIN_NAMESPACE |
|
25 |
||
26 |
using namespace Phonon; |
|
27 |
using namespace Phonon::MMF; |
|
28 |
||
29 |
/*! \class MMF::AbstractAudioEffect |
|
30 |
\internal |
|
31 |
*/ |
|
32 |
||
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
33 |
/*! \namespace Phonon::MMF |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
34 |
\internal |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
35 |
*/ |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
36 |
|
0 | 37 |
AbstractAudioEffect::AbstractAudioEffect(QObject *parent, |
7
f7bc934e204c
5cabc75a39ca2f064f70b40f72ed93c74c4dc19b
eckhart.koppen@nokia.com
parents:
3
diff
changeset
|
38 |
const QList<EffectParameter> ¶ms) |
f7bc934e204c
5cabc75a39ca2f064f70b40f72ed93c74c4dc19b
eckhart.koppen@nokia.com
parents:
3
diff
changeset
|
39 |
: MediaNode(parent) |
f7bc934e204c
5cabc75a39ca2f064f70b40f72ed93c74c4dc19b
eckhart.koppen@nokia.com
parents:
3
diff
changeset
|
40 |
, m_params(params) |
f7bc934e204c
5cabc75a39ca2f064f70b40f72ed93c74c4dc19b
eckhart.koppen@nokia.com
parents:
3
diff
changeset
|
41 |
, m_player(0) |
0 | 42 |
{ |
7
f7bc934e204c
5cabc75a39ca2f064f70b40f72ed93c74c4dc19b
eckhart.koppen@nokia.com
parents:
3
diff
changeset
|
43 |
|
0 | 44 |
} |
45 |
||
7
f7bc934e204c
5cabc75a39ca2f064f70b40f72ed93c74c4dc19b
eckhart.koppen@nokia.com
parents:
3
diff
changeset
|
46 |
QList<Phonon::EffectParameter> AbstractAudioEffect::parameters() const |
0 | 47 |
{ |
7
f7bc934e204c
5cabc75a39ca2f064f70b40f72ed93c74c4dc19b
eckhart.koppen@nokia.com
parents:
3
diff
changeset
|
48 |
// Convert from QList<MMF::EffectParameter> to QList<Phonon::EffectParameter> |
f7bc934e204c
5cabc75a39ca2f064f70b40f72ed93c74c4dc19b
eckhart.koppen@nokia.com
parents:
3
diff
changeset
|
49 |
QList<Phonon::EffectParameter> result; |
f7bc934e204c
5cabc75a39ca2f064f70b40f72ed93c74c4dc19b
eckhart.koppen@nokia.com
parents:
3
diff
changeset
|
50 |
EffectParameter param; |
f7bc934e204c
5cabc75a39ca2f064f70b40f72ed93c74c4dc19b
eckhart.koppen@nokia.com
parents:
3
diff
changeset
|
51 |
foreach (param, m_params) |
f7bc934e204c
5cabc75a39ca2f064f70b40f72ed93c74c4dc19b
eckhart.koppen@nokia.com
parents:
3
diff
changeset
|
52 |
result += param; |
f7bc934e204c
5cabc75a39ca2f064f70b40f72ed93c74c4dc19b
eckhart.koppen@nokia.com
parents:
3
diff
changeset
|
53 |
return result; |
0 | 54 |
} |
55 |
||
7
f7bc934e204c
5cabc75a39ca2f064f70b40f72ed93c74c4dc19b
eckhart.koppen@nokia.com
parents:
3
diff
changeset
|
56 |
QVariant AbstractAudioEffect::parameterValue(const Phonon::EffectParameter &queriedParam) const |
0 | 57 |
{ |
58 |
const QVariant &val = m_values.value(queriedParam.id()); |
|
59 |
||
60 |
if (val.isNull()) |
|
61 |
return queriedParam.defaultValue(); |
|
62 |
else |
|
63 |
return val; |
|
64 |
} |
|
65 |
||
7
f7bc934e204c
5cabc75a39ca2f064f70b40f72ed93c74c4dc19b
eckhart.koppen@nokia.com
parents:
3
diff
changeset
|
66 |
void AbstractAudioEffect::setParameterValue(const Phonon::EffectParameter ¶m, |
0 | 67 |
const QVariant &newValue) |
68 |
{ |
|
69 |
m_values.insert(param.id(), newValue); |
|
7
f7bc934e204c
5cabc75a39ca2f064f70b40f72ed93c74c4dc19b
eckhart.koppen@nokia.com
parents:
3
diff
changeset
|
70 |
|
f7bc934e204c
5cabc75a39ca2f064f70b40f72ed93c74c4dc19b
eckhart.koppen@nokia.com
parents:
3
diff
changeset
|
71 |
if (m_effect.data()) { |
f7bc934e204c
5cabc75a39ca2f064f70b40f72ed93c74c4dc19b
eckhart.koppen@nokia.com
parents:
3
diff
changeset
|
72 |
const EffectParameter& internalParam = internalParameter(param.id()); |
f7bc934e204c
5cabc75a39ca2f064f70b40f72ed93c74c4dc19b
eckhart.koppen@nokia.com
parents:
3
diff
changeset
|
73 |
int err = parameterChanged(internalParam, newValue); |
f7bc934e204c
5cabc75a39ca2f064f70b40f72ed93c74c4dc19b
eckhart.koppen@nokia.com
parents:
3
diff
changeset
|
74 |
// TODO: handle audio effect errors |
f7bc934e204c
5cabc75a39ca2f064f70b40f72ed93c74c4dc19b
eckhart.koppen@nokia.com
parents:
3
diff
changeset
|
75 |
Q_UNUSED(err); |
f7bc934e204c
5cabc75a39ca2f064f70b40f72ed93c74c4dc19b
eckhart.koppen@nokia.com
parents:
3
diff
changeset
|
76 |
} |
f7bc934e204c
5cabc75a39ca2f064f70b40f72ed93c74c4dc19b
eckhart.koppen@nokia.com
parents:
3
diff
changeset
|
77 |
} |
f7bc934e204c
5cabc75a39ca2f064f70b40f72ed93c74c4dc19b
eckhart.koppen@nokia.com
parents:
3
diff
changeset
|
78 |
|
f7bc934e204c
5cabc75a39ca2f064f70b40f72ed93c74c4dc19b
eckhart.koppen@nokia.com
parents:
3
diff
changeset
|
79 |
void AbstractAudioEffect::abstractPlayerChanged(AbstractPlayer *player) |
f7bc934e204c
5cabc75a39ca2f064f70b40f72ed93c74c4dc19b
eckhart.koppen@nokia.com
parents:
3
diff
changeset
|
80 |
{ |
f7bc934e204c
5cabc75a39ca2f064f70b40f72ed93c74c4dc19b
eckhart.koppen@nokia.com
parents:
3
diff
changeset
|
81 |
m_player = qobject_cast<AbstractMediaPlayer *>(player); |
f7bc934e204c
5cabc75a39ca2f064f70b40f72ed93c74c4dc19b
eckhart.koppen@nokia.com
parents:
3
diff
changeset
|
82 |
m_effect.reset(); |
f7bc934e204c
5cabc75a39ca2f064f70b40f72ed93c74c4dc19b
eckhart.koppen@nokia.com
parents:
3
diff
changeset
|
83 |
} |
f7bc934e204c
5cabc75a39ca2f064f70b40f72ed93c74c4dc19b
eckhart.koppen@nokia.com
parents:
3
diff
changeset
|
84 |
|
f7bc934e204c
5cabc75a39ca2f064f70b40f72ed93c74c4dc19b
eckhart.koppen@nokia.com
parents:
3
diff
changeset
|
85 |
void AbstractAudioEffect::stateChanged(Phonon::State newState, |
f7bc934e204c
5cabc75a39ca2f064f70b40f72ed93c74c4dc19b
eckhart.koppen@nokia.com
parents:
3
diff
changeset
|
86 |
Phonon::State oldState) |
f7bc934e204c
5cabc75a39ca2f064f70b40f72ed93c74c4dc19b
eckhart.koppen@nokia.com
parents:
3
diff
changeset
|
87 |
{ |
f7bc934e204c
5cabc75a39ca2f064f70b40f72ed93c74c4dc19b
eckhart.koppen@nokia.com
parents:
3
diff
changeset
|
88 |
if (Phonon::LoadingState == oldState |
f7bc934e204c
5cabc75a39ca2f064f70b40f72ed93c74c4dc19b
eckhart.koppen@nokia.com
parents:
3
diff
changeset
|
89 |
&& Phonon::LoadingState != newState) |
f7bc934e204c
5cabc75a39ca2f064f70b40f72ed93c74c4dc19b
eckhart.koppen@nokia.com
parents:
3
diff
changeset
|
90 |
createEffect(); |
f7bc934e204c
5cabc75a39ca2f064f70b40f72ed93c74c4dc19b
eckhart.koppen@nokia.com
parents:
3
diff
changeset
|
91 |
} |
f7bc934e204c
5cabc75a39ca2f064f70b40f72ed93c74c4dc19b
eckhart.koppen@nokia.com
parents:
3
diff
changeset
|
92 |
|
f7bc934e204c
5cabc75a39ca2f064f70b40f72ed93c74c4dc19b
eckhart.koppen@nokia.com
parents:
3
diff
changeset
|
93 |
void AbstractAudioEffect::connectMediaObject(MediaObject *mediaObject) |
f7bc934e204c
5cabc75a39ca2f064f70b40f72ed93c74c4dc19b
eckhart.koppen@nokia.com
parents:
3
diff
changeset
|
94 |
{ |
f7bc934e204c
5cabc75a39ca2f064f70b40f72ed93c74c4dc19b
eckhart.koppen@nokia.com
parents:
3
diff
changeset
|
95 |
Q_ASSERT_X(!m_player, Q_FUNC_INFO, "Player already connected"); |
f7bc934e204c
5cabc75a39ca2f064f70b40f72ed93c74c4dc19b
eckhart.koppen@nokia.com
parents:
3
diff
changeset
|
96 |
Q_ASSERT_X(!m_effect.data(), Q_FUNC_INFO, "Effect already created"); |
f7bc934e204c
5cabc75a39ca2f064f70b40f72ed93c74c4dc19b
eckhart.koppen@nokia.com
parents:
3
diff
changeset
|
97 |
|
f7bc934e204c
5cabc75a39ca2f064f70b40f72ed93c74c4dc19b
eckhart.koppen@nokia.com
parents:
3
diff
changeset
|
98 |
abstractPlayerChanged(mediaObject->abstractPlayer()); |
f7bc934e204c
5cabc75a39ca2f064f70b40f72ed93c74c4dc19b
eckhart.koppen@nokia.com
parents:
3
diff
changeset
|
99 |
|
f7bc934e204c
5cabc75a39ca2f064f70b40f72ed93c74c4dc19b
eckhart.koppen@nokia.com
parents:
3
diff
changeset
|
100 |
connect(mediaObject, SIGNAL(stateChanged(Phonon::State, Phonon::State)), |
f7bc934e204c
5cabc75a39ca2f064f70b40f72ed93c74c4dc19b
eckhart.koppen@nokia.com
parents:
3
diff
changeset
|
101 |
SLOT(stateChanged(Phonon::State, Phonon::State))); |
f7bc934e204c
5cabc75a39ca2f064f70b40f72ed93c74c4dc19b
eckhart.koppen@nokia.com
parents:
3
diff
changeset
|
102 |
|
f7bc934e204c
5cabc75a39ca2f064f70b40f72ed93c74c4dc19b
eckhart.koppen@nokia.com
parents:
3
diff
changeset
|
103 |
connect(mediaObject, SIGNAL(abstractPlayerChanged(AbstractPlayer *)), |
f7bc934e204c
5cabc75a39ca2f064f70b40f72ed93c74c4dc19b
eckhart.koppen@nokia.com
parents:
3
diff
changeset
|
104 |
SLOT(abstractPlayerChanged(AbstractPlayer *))); |
f7bc934e204c
5cabc75a39ca2f064f70b40f72ed93c74c4dc19b
eckhart.koppen@nokia.com
parents:
3
diff
changeset
|
105 |
|
f7bc934e204c
5cabc75a39ca2f064f70b40f72ed93c74c4dc19b
eckhart.koppen@nokia.com
parents:
3
diff
changeset
|
106 |
if (mediaObject->state() != Phonon::LoadingState) |
f7bc934e204c
5cabc75a39ca2f064f70b40f72ed93c74c4dc19b
eckhart.koppen@nokia.com
parents:
3
diff
changeset
|
107 |
createEffect(); |
f7bc934e204c
5cabc75a39ca2f064f70b40f72ed93c74c4dc19b
eckhart.koppen@nokia.com
parents:
3
diff
changeset
|
108 |
} |
f7bc934e204c
5cabc75a39ca2f064f70b40f72ed93c74c4dc19b
eckhart.koppen@nokia.com
parents:
3
diff
changeset
|
109 |
|
f7bc934e204c
5cabc75a39ca2f064f70b40f72ed93c74c4dc19b
eckhart.koppen@nokia.com
parents:
3
diff
changeset
|
110 |
void AbstractAudioEffect::disconnectMediaObject(MediaObject *mediaObject) |
f7bc934e204c
5cabc75a39ca2f064f70b40f72ed93c74c4dc19b
eckhart.koppen@nokia.com
parents:
3
diff
changeset
|
111 |
{ |
f7bc934e204c
5cabc75a39ca2f064f70b40f72ed93c74c4dc19b
eckhart.koppen@nokia.com
parents:
3
diff
changeset
|
112 |
mediaObject->disconnect(this); |
f7bc934e204c
5cabc75a39ca2f064f70b40f72ed93c74c4dc19b
eckhart.koppen@nokia.com
parents:
3
diff
changeset
|
113 |
abstractPlayerChanged(0); |
f7bc934e204c
5cabc75a39ca2f064f70b40f72ed93c74c4dc19b
eckhart.koppen@nokia.com
parents:
3
diff
changeset
|
114 |
} |
f7bc934e204c
5cabc75a39ca2f064f70b40f72ed93c74c4dc19b
eckhart.koppen@nokia.com
parents:
3
diff
changeset
|
115 |
|
f7bc934e204c
5cabc75a39ca2f064f70b40f72ed93c74c4dc19b
eckhart.koppen@nokia.com
parents:
3
diff
changeset
|
116 |
void AbstractAudioEffect::setEnabled(bool enabled) |
f7bc934e204c
5cabc75a39ca2f064f70b40f72ed93c74c4dc19b
eckhart.koppen@nokia.com
parents:
3
diff
changeset
|
117 |
{ |
f7bc934e204c
5cabc75a39ca2f064f70b40f72ed93c74c4dc19b
eckhart.koppen@nokia.com
parents:
3
diff
changeset
|
118 |
TInt err = KErrNone; |
f7bc934e204c
5cabc75a39ca2f064f70b40f72ed93c74c4dc19b
eckhart.koppen@nokia.com
parents:
3
diff
changeset
|
119 |
|
f7bc934e204c
5cabc75a39ca2f064f70b40f72ed93c74c4dc19b
eckhart.koppen@nokia.com
parents:
3
diff
changeset
|
120 |
if (enabled) |
f7bc934e204c
5cabc75a39ca2f064f70b40f72ed93c74c4dc19b
eckhart.koppen@nokia.com
parents:
3
diff
changeset
|
121 |
// TODO: handle audio effect errors |
f7bc934e204c
5cabc75a39ca2f064f70b40f72ed93c74c4dc19b
eckhart.koppen@nokia.com
parents:
3
diff
changeset
|
122 |
TRAP(err, m_effect->EnableL()) |
f7bc934e204c
5cabc75a39ca2f064f70b40f72ed93c74c4dc19b
eckhart.koppen@nokia.com
parents:
3
diff
changeset
|
123 |
else |
f7bc934e204c
5cabc75a39ca2f064f70b40f72ed93c74c4dc19b
eckhart.koppen@nokia.com
parents:
3
diff
changeset
|
124 |
// TODO: handle audio effect errors |
f7bc934e204c
5cabc75a39ca2f064f70b40f72ed93c74c4dc19b
eckhart.koppen@nokia.com
parents:
3
diff
changeset
|
125 |
TRAP(err, m_effect->DisableL()) |
f7bc934e204c
5cabc75a39ca2f064f70b40f72ed93c74c4dc19b
eckhart.koppen@nokia.com
parents:
3
diff
changeset
|
126 |
|
f7bc934e204c
5cabc75a39ca2f064f70b40f72ed93c74c4dc19b
eckhart.koppen@nokia.com
parents:
3
diff
changeset
|
127 |
Q_UNUSED(err); |
0 | 128 |
} |
129 |
||
7
f7bc934e204c
5cabc75a39ca2f064f70b40f72ed93c74c4dc19b
eckhart.koppen@nokia.com
parents:
3
diff
changeset
|
130 |
void AbstractAudioEffect::createEffect() |
f7bc934e204c
5cabc75a39ca2f064f70b40f72ed93c74c4dc19b
eckhart.koppen@nokia.com
parents:
3
diff
changeset
|
131 |
{ |
f7bc934e204c
5cabc75a39ca2f064f70b40f72ed93c74c4dc19b
eckhart.koppen@nokia.com
parents:
3
diff
changeset
|
132 |
Q_ASSERT_X(m_player, Q_FUNC_INFO, "Invalid media player pointer"); |
f7bc934e204c
5cabc75a39ca2f064f70b40f72ed93c74c4dc19b
eckhart.koppen@nokia.com
parents:
3
diff
changeset
|
133 |
|
f7bc934e204c
5cabc75a39ca2f064f70b40f72ed93c74c4dc19b
eckhart.koppen@nokia.com
parents:
3
diff
changeset
|
134 |
if (AudioPlayer *audioPlayer = qobject_cast<AudioPlayer *>(m_player)) { |
f7bc934e204c
5cabc75a39ca2f064f70b40f72ed93c74c4dc19b
eckhart.koppen@nokia.com
parents:
3
diff
changeset
|
135 |
createEffect(audioPlayer->nativePlayer()); |
f7bc934e204c
5cabc75a39ca2f064f70b40f72ed93c74c4dc19b
eckhart.koppen@nokia.com
parents:
3
diff
changeset
|
136 |
} |
f7bc934e204c
5cabc75a39ca2f064f70b40f72ed93c74c4dc19b
eckhart.koppen@nokia.com
parents:
3
diff
changeset
|
137 |
|
f7bc934e204c
5cabc75a39ca2f064f70b40f72ed93c74c4dc19b
eckhart.koppen@nokia.com
parents:
3
diff
changeset
|
138 |
if (m_effect.data()) { |
f7bc934e204c
5cabc75a39ca2f064f70b40f72ed93c74c4dc19b
eckhart.koppen@nokia.com
parents:
3
diff
changeset
|
139 |
EffectParameter param; |
f7bc934e204c
5cabc75a39ca2f064f70b40f72ed93c74c4dc19b
eckhart.koppen@nokia.com
parents:
3
diff
changeset
|
140 |
int err = 0; |
f7bc934e204c
5cabc75a39ca2f064f70b40f72ed93c74c4dc19b
eckhart.koppen@nokia.com
parents:
3
diff
changeset
|
141 |
foreach (param, m_params) { |
f7bc934e204c
5cabc75a39ca2f064f70b40f72ed93c74c4dc19b
eckhart.koppen@nokia.com
parents:
3
diff
changeset
|
142 |
const QVariant value = parameterValue(param); |
f7bc934e204c
5cabc75a39ca2f064f70b40f72ed93c74c4dc19b
eckhart.koppen@nokia.com
parents:
3
diff
changeset
|
143 |
err = parameterChanged(param, value); |
f7bc934e204c
5cabc75a39ca2f064f70b40f72ed93c74c4dc19b
eckhart.koppen@nokia.com
parents:
3
diff
changeset
|
144 |
} |
f7bc934e204c
5cabc75a39ca2f064f70b40f72ed93c74c4dc19b
eckhart.koppen@nokia.com
parents:
3
diff
changeset
|
145 |
Q_UNUSED(err) |
f7bc934e204c
5cabc75a39ca2f064f70b40f72ed93c74c4dc19b
eckhart.koppen@nokia.com
parents:
3
diff
changeset
|
146 |
} |
f7bc934e204c
5cabc75a39ca2f064f70b40f72ed93c74c4dc19b
eckhart.koppen@nokia.com
parents:
3
diff
changeset
|
147 |
} |
f7bc934e204c
5cabc75a39ca2f064f70b40f72ed93c74c4dc19b
eckhart.koppen@nokia.com
parents:
3
diff
changeset
|
148 |
|
f7bc934e204c
5cabc75a39ca2f064f70b40f72ed93c74c4dc19b
eckhart.koppen@nokia.com
parents:
3
diff
changeset
|
149 |
const MMF::EffectParameter& AbstractAudioEffect::internalParameter(int id) const |
f7bc934e204c
5cabc75a39ca2f064f70b40f72ed93c74c4dc19b
eckhart.koppen@nokia.com
parents:
3
diff
changeset
|
150 |
{ |
f7bc934e204c
5cabc75a39ca2f064f70b40f72ed93c74c4dc19b
eckhart.koppen@nokia.com
parents:
3
diff
changeset
|
151 |
const EffectParameter *result = 0; |
f7bc934e204c
5cabc75a39ca2f064f70b40f72ed93c74c4dc19b
eckhart.koppen@nokia.com
parents:
3
diff
changeset
|
152 |
for (int i=0; i<m_params.count() && !result; ++i) { |
f7bc934e204c
5cabc75a39ca2f064f70b40f72ed93c74c4dc19b
eckhart.koppen@nokia.com
parents:
3
diff
changeset
|
153 |
if (m_params[i].id() == id) |
f7bc934e204c
5cabc75a39ca2f064f70b40f72ed93c74c4dc19b
eckhart.koppen@nokia.com
parents:
3
diff
changeset
|
154 |
result = &m_params[i]; |
f7bc934e204c
5cabc75a39ca2f064f70b40f72ed93c74c4dc19b
eckhart.koppen@nokia.com
parents:
3
diff
changeset
|
155 |
} |
f7bc934e204c
5cabc75a39ca2f064f70b40f72ed93c74c4dc19b
eckhart.koppen@nokia.com
parents:
3
diff
changeset
|
156 |
Q_ASSERT_X(result, Q_FUNC_INFO, "Parameter not found"); |
f7bc934e204c
5cabc75a39ca2f064f70b40f72ed93c74c4dc19b
eckhart.koppen@nokia.com
parents:
3
diff
changeset
|
157 |
return *result; |
f7bc934e204c
5cabc75a39ca2f064f70b40f72ed93c74c4dc19b
eckhart.koppen@nokia.com
parents:
3
diff
changeset
|
158 |
} |
f7bc934e204c
5cabc75a39ca2f064f70b40f72ed93c74c4dc19b
eckhart.koppen@nokia.com
parents:
3
diff
changeset
|
159 |
|
f7bc934e204c
5cabc75a39ca2f064f70b40f72ed93c74c4dc19b
eckhart.koppen@nokia.com
parents:
3
diff
changeset
|
160 |
int AbstractAudioEffect::parameterChanged(const EffectParameter ¶m, |
f7bc934e204c
5cabc75a39ca2f064f70b40f72ed93c74c4dc19b
eckhart.koppen@nokia.com
parents:
3
diff
changeset
|
161 |
const QVariant &value) |
f7bc934e204c
5cabc75a39ca2f064f70b40f72ed93c74c4dc19b
eckhart.koppen@nokia.com
parents:
3
diff
changeset
|
162 |
{ |
f7bc934e204c
5cabc75a39ca2f064f70b40f72ed93c74c4dc19b
eckhart.koppen@nokia.com
parents:
3
diff
changeset
|
163 |
int err = 0; |
f7bc934e204c
5cabc75a39ca2f064f70b40f72ed93c74c4dc19b
eckhart.koppen@nokia.com
parents:
3
diff
changeset
|
164 |
|
f7bc934e204c
5cabc75a39ca2f064f70b40f72ed93c74c4dc19b
eckhart.koppen@nokia.com
parents:
3
diff
changeset
|
165 |
switch (param.id()) { |
f7bc934e204c
5cabc75a39ca2f064f70b40f72ed93c74c4dc19b
eckhart.koppen@nokia.com
parents:
3
diff
changeset
|
166 |
case ParameterEnable: |
f7bc934e204c
5cabc75a39ca2f064f70b40f72ed93c74c4dc19b
eckhart.koppen@nokia.com
parents:
3
diff
changeset
|
167 |
setEnabled(value.toBool()); |
f7bc934e204c
5cabc75a39ca2f064f70b40f72ed93c74c4dc19b
eckhart.koppen@nokia.com
parents:
3
diff
changeset
|
168 |
break; |
f7bc934e204c
5cabc75a39ca2f064f70b40f72ed93c74c4dc19b
eckhart.koppen@nokia.com
parents:
3
diff
changeset
|
169 |
default: |
f7bc934e204c
5cabc75a39ca2f064f70b40f72ed93c74c4dc19b
eckhart.koppen@nokia.com
parents:
3
diff
changeset
|
170 |
{ |
f7bc934e204c
5cabc75a39ca2f064f70b40f72ed93c74c4dc19b
eckhart.koppen@nokia.com
parents:
3
diff
changeset
|
171 |
const EffectParameter& internalParam = internalParameter(param.id()); |
f7bc934e204c
5cabc75a39ca2f064f70b40f72ed93c74c4dc19b
eckhart.koppen@nokia.com
parents:
3
diff
changeset
|
172 |
err = effectParameterChanged(internalParam, value); |
f7bc934e204c
5cabc75a39ca2f064f70b40f72ed93c74c4dc19b
eckhart.koppen@nokia.com
parents:
3
diff
changeset
|
173 |
} |
f7bc934e204c
5cabc75a39ca2f064f70b40f72ed93c74c4dc19b
eckhart.koppen@nokia.com
parents:
3
diff
changeset
|
174 |
break; |
f7bc934e204c
5cabc75a39ca2f064f70b40f72ed93c74c4dc19b
eckhart.koppen@nokia.com
parents:
3
diff
changeset
|
175 |
} |
f7bc934e204c
5cabc75a39ca2f064f70b40f72ed93c74c4dc19b
eckhart.koppen@nokia.com
parents:
3
diff
changeset
|
176 |
|
f7bc934e204c
5cabc75a39ca2f064f70b40f72ed93c74c4dc19b
eckhart.koppen@nokia.com
parents:
3
diff
changeset
|
177 |
if (!err) |
f7bc934e204c
5cabc75a39ca2f064f70b40f72ed93c74c4dc19b
eckhart.koppen@nokia.com
parents:
3
diff
changeset
|
178 |
TRAP(err, m_effect->ApplyL()); |
f7bc934e204c
5cabc75a39ca2f064f70b40f72ed93c74c4dc19b
eckhart.koppen@nokia.com
parents:
3
diff
changeset
|
179 |
|
f7bc934e204c
5cabc75a39ca2f064f70b40f72ed93c74c4dc19b
eckhart.koppen@nokia.com
parents:
3
diff
changeset
|
180 |
return err; |
f7bc934e204c
5cabc75a39ca2f064f70b40f72ed93c74c4dc19b
eckhart.koppen@nokia.com
parents:
3
diff
changeset
|
181 |
} |
f7bc934e204c
5cabc75a39ca2f064f70b40f72ed93c74c4dc19b
eckhart.koppen@nokia.com
parents:
3
diff
changeset
|
182 |
|
f7bc934e204c
5cabc75a39ca2f064f70b40f72ed93c74c4dc19b
eckhart.koppen@nokia.com
parents:
3
diff
changeset
|
183 |
int AbstractAudioEffect::effectParameterChanged( |
f7bc934e204c
5cabc75a39ca2f064f70b40f72ed93c74c4dc19b
eckhart.koppen@nokia.com
parents:
3
diff
changeset
|
184 |
const EffectParameter ¶m, const QVariant &value) |
f7bc934e204c
5cabc75a39ca2f064f70b40f72ed93c74c4dc19b
eckhart.koppen@nokia.com
parents:
3
diff
changeset
|
185 |
{ |
f7bc934e204c
5cabc75a39ca2f064f70b40f72ed93c74c4dc19b
eckhart.koppen@nokia.com
parents:
3
diff
changeset
|
186 |
// Default implementation |
f7bc934e204c
5cabc75a39ca2f064f70b40f72ed93c74c4dc19b
eckhart.koppen@nokia.com
parents:
3
diff
changeset
|
187 |
Q_ASSERT_X(false, Q_FUNC_INFO, "Effect has no parameters"); |
f7bc934e204c
5cabc75a39ca2f064f70b40f72ed93c74c4dc19b
eckhart.koppen@nokia.com
parents:
3
diff
changeset
|
188 |
return 0; |
f7bc934e204c
5cabc75a39ca2f064f70b40f72ed93c74c4dc19b
eckhart.koppen@nokia.com
parents:
3
diff
changeset
|
189 |
} |
f7bc934e204c
5cabc75a39ca2f064f70b40f72ed93c74c4dc19b
eckhart.koppen@nokia.com
parents:
3
diff
changeset
|
190 |
|
f7bc934e204c
5cabc75a39ca2f064f70b40f72ed93c74c4dc19b
eckhart.koppen@nokia.com
parents:
3
diff
changeset
|
191 |
|
0 | 192 |
QT_END_NAMESPACE |
193 |