summaryrefslogtreecommitdiff
path: root/src/3rdparty
diff options
context:
space:
mode:
authorGareth Stockwell <ext-gareth.stockwell@nokia.com>2010-01-11 15:38:07 +0000
committerGareth Stockwell <ext-gareth.stockwell@nokia.com>2010-01-11 15:38:07 +0000
commit894bb6e1742b75312feb7a18d043a67a3dba4cb9 (patch)
tree84ed946121bbae72b0933b8f5bc785a6b34aec18 /src/3rdparty
parente53306725e52407146304df9d8d3a65920fc3e8d (diff)
downloadqt4-tools-894bb6e1742b75312feb7a18d043a67a3dba4cb9.tar.gz
Removed dependency of EffectFactory on native effect headers
By refactoring the static capabilities / parameters interface exposed by AbstractAudioEffect-derived classes to the EffectFactory, the latter's implementation no longer needs access to the headers for native effect classes. Previously, during the initialization phase, the EffectFactory tried to create an instance of each native effect class, in order to determine whether that effect is supported. This is now done inside the backend class for each effect, thereby improving encapsulation. Task-number: QTBUG-4659 Reviewed-by: Espen Riskedal
Diffstat (limited to 'src/3rdparty')
-rw-r--r--src/3rdparty/phonon/mmf/abstractaudioeffect.h2
-rw-r--r--src/3rdparty/phonon/mmf/audioequalizer.cpp67
-rw-r--r--src/3rdparty/phonon/mmf/audioequalizer.h7
-rw-r--r--src/3rdparty/phonon/mmf/bassboost.cpp4
-rw-r--r--src/3rdparty/phonon/mmf/bassboost.h7
-rw-r--r--src/3rdparty/phonon/mmf/effectfactory.cpp21
6 files changed, 48 insertions, 60 deletions
diff --git a/src/3rdparty/phonon/mmf/abstractaudioeffect.h b/src/3rdparty/phonon/mmf/abstractaudioeffect.h
index 7d44bf0116..9e5a6eb20a 100644
--- a/src/3rdparty/phonon/mmf/abstractaudioeffect.h
+++ b/src/3rdparty/phonon/mmf/abstractaudioeffect.h
@@ -30,6 +30,8 @@ along with this library. If not, see <http://www.gnu.org/licenses/>.
#include "mmf_medianode.h"
#include "mmf_videoplayer.h"
+class CMdaAudioOutputStream;
+
QT_BEGIN_NAMESPACE
namespace Phonon
diff --git a/src/3rdparty/phonon/mmf/audioequalizer.cpp b/src/3rdparty/phonon/mmf/audioequalizer.cpp
index b41eda4cb7..a4127c4d32 100644
--- a/src/3rdparty/phonon/mmf/audioequalizer.cpp
+++ b/src/3rdparty/phonon/mmf/audioequalizer.cpp
@@ -82,37 +82,46 @@ const char* AudioEqualizer::description()
return "Audio equalizer";
}
-void AudioEqualizer::getParameters(NativeEffect *effect,
- QList<EffectParameter> &parameters)
+bool AudioEqualizer::getParameters(CMdaAudioOutputStream *stream,
+ QList<EffectParameter>& parameters)
{
- TInt32 dbMin;
- TInt32 dbMax;
- effect->DbLevelLimits(dbMin, dbMax);
-
- 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);
-
- // We pass a floating-point parameter range of -1.0 to +1.0 for
- // each band in order to work around a limitation in
- // Phonon::EffectWidget. See documentation of EffectParameter
- // for more details.
- EffectParameter param(
- /* parameterId */ i,
- /* name */ tr("%1 Hz").arg(hz),
- /* hints */ EffectParameter::LogarithmicHint,
- /* defaultValue */ QVariant(qreal(0.0)),
- /* minimumValue */ QVariant(qreal(-1.0)),
- /* maximumValue */ QVariant(qreal(+1.0)),
- /* values */ QVariantList(),
- /* description */ QString());
-
- param.setInternalRange(dbMin, dbMax);
- parameters.append(param);
+ bool supported = false;
+
+ QScopedPointer<CAudioEqualizer> effect;
+ TRAPD(err, effect.reset(CAudioEqualizer::NewL(*stream)));
+
+ if (KErrNone == err) {
+ supported = true;
+
+ TInt32 dbMin;
+ TInt32 dbMax;
+ effect->DbLevelLimits(dbMin, dbMax);
+
+ 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);
+
+ // We pass a floating-point parameter range of -1.0 to +1.0 for
+ // each band in order to work around a limitation in
+ // Phonon::EffectWidget. See documentation of EffectParameter
+ // for more details.
+ EffectParameter param(
+ /* parameterId */ i,
+ /* name */ tr("%1 Hz").arg(hz),
+ /* hints */ EffectParameter::LogarithmicHint,
+ /* defaultValue */ QVariant(qreal(0.0)),
+ /* minimumValue */ QVariant(qreal(-1.0)),
+ /* maximumValue */ QVariant(qreal(+1.0)));
+
+ param.setInternalRange(dbMin, dbMax);
+ parameters.append(param);
+ }
}
+
+ return supported;
}
QT_END_NAMESPACE
diff --git a/src/3rdparty/phonon/mmf/audioequalizer.h b/src/3rdparty/phonon/mmf/audioequalizer.h
index 22fa1e8b41..35592f4522 100644
--- a/src/3rdparty/phonon/mmf/audioequalizer.h
+++ b/src/3rdparty/phonon/mmf/audioequalizer.h
@@ -21,8 +21,6 @@ along with this library. If not, see <http://www.gnu.org/licenses/>.
#include "abstractaudioeffect.h"
-class CAudioEqualizer;
-
QT_BEGIN_NAMESPACE
namespace Phonon
@@ -45,9 +43,8 @@ public:
// Static interface required by EffectFactory
static const char* description();
- typedef CAudioEqualizer NativeEffect;
- static void getParameters(NativeEffect *effect,
- QList<EffectParameter> &parameters);
+ static bool getParameters(CMdaAudioOutputStream *stream,
+ QList<EffectParameter>& parameters);
protected:
// AbstractAudioEffect
diff --git a/src/3rdparty/phonon/mmf/bassboost.cpp b/src/3rdparty/phonon/mmf/bassboost.cpp
index 9f62ecc84f..642d782a7b 100644
--- a/src/3rdparty/phonon/mmf/bassboost.cpp
+++ b/src/3rdparty/phonon/mmf/bassboost.cpp
@@ -61,9 +61,9 @@ const char* BassBoost::description()
return "Bass boost";
}
-void BassBoost::getParameters(NativeEffect*, QList<EffectParameter>&)
+bool BassBoost::getParameters(CMdaAudioOutputStream *, QList<EffectParameter>&)
{
-
+ return true;
}
QT_END_NAMESPACE
diff --git a/src/3rdparty/phonon/mmf/bassboost.h b/src/3rdparty/phonon/mmf/bassboost.h
index 9f3d764ed5..241cda9461 100644
--- a/src/3rdparty/phonon/mmf/bassboost.h
+++ b/src/3rdparty/phonon/mmf/bassboost.h
@@ -21,8 +21,6 @@ along with this library. If not, see <http://www.gnu.org/licenses/>.
#include "abstractaudioeffect.h"
-class CBassBoost;
-
QT_BEGIN_NAMESPACE
namespace Phonon
@@ -43,9 +41,8 @@ public:
// Static interface required by EffectFactory
static const char* description();
- typedef CBassBoost NativeEffect;
- static void getParameters(NativeEffect *effect,
- QList<EffectParameter> &parameters);
+ static bool getParameters(CMdaAudioOutputStream *stream,
+ QList<EffectParameter>& parameters);
protected:
// AbstractAudioEffect
diff --git a/src/3rdparty/phonon/mmf/effectfactory.cpp b/src/3rdparty/phonon/mmf/effectfactory.cpp
index a8cbf247b5..19c6d90391 100644
--- a/src/3rdparty/phonon/mmf/effectfactory.cpp
+++ b/src/3rdparty/phonon/mmf/effectfactory.cpp
@@ -19,17 +19,6 @@ along with this library. If not, see <http://www.gnu.org/licenses/>.
#include <QObject>
#include <QCoreApplication>
-#include <AudioEqualizerBase.h>
-#include <BassBoostBase.h>
-#include <DistanceAttenuationBase.h>
-#include <DopplerBase.h>
-#include <EnvironmentalReverbBase.h>
-#include <ListenerOrientationBase.h>
-#include <LocationBase.h>
-#include <LoudnessBase.h>
-#include <SourceOrientationBase.h>
-#include <StereoWideningBase.h>
-
#include <mdaaudiooutputstream.h>
#include "audioequalizer.h"
@@ -171,19 +160,13 @@ EffectFactory::EffectData EffectFactory::getData()
OutputStreamFactory streamFactory;
QScopedPointer<CMdaAudioOutputStream> stream(streamFactory.create());
- typedef typename BackendNode::NativeEffect NativeEffect;
- QScopedPointer<NativeEffect> effect;
- TRAPD(err, effect.reset(NativeEffect::NewL(*stream)));
- data.m_supported = (KErrNone == err);
-
- if (KErrNone == err) {
+ if (data.m_supported = BackendNode::getParameters
+ (stream.data(), data.m_parameters)) {
const QString description = QCoreApplication::translate
("Phonon::MMF::EffectFactory", BackendNode::description());
data.m_descriptions.insert("name", description);
data.m_descriptions.insert("description", description);
data.m_descriptions.insert("available", true);
-
- BackendNode::getParameters(effect.data(), data.m_parameters);
}
return data;