aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/qmmp/effect.cpp8
-rw-r--r--src/qmmp/qmmpaudioengine.cpp13
2 files changed, 11 insertions, 10 deletions
diff --git a/src/qmmp/effect.cpp b/src/qmmp/effect.cpp
index 0b8b622ab..51490f098 100644
--- a/src/qmmp/effect.cpp
+++ b/src/qmmp/effect.cpp
@@ -121,12 +121,8 @@ void Effect::checkFactories()
Effect* Effect::create(EffectFactory *factory)
{
checkFactories();
- Effect *effect = 0;
- if(isEnabled(factory))
- {
- effect = factory->create();
- effect->m_factory = factory;
- }
+ Effect *effect = factory->create();
+ effect->m_factory = factory;
return effect;
}
diff --git a/src/qmmp/qmmpaudioengine.cpp b/src/qmmp/qmmpaudioengine.cpp
index 30a109689..b26971bd3 100644
--- a/src/qmmp/qmmpaudioengine.cpp
+++ b/src/qmmp/qmmpaudioengine.cpp
@@ -157,7 +157,9 @@ void QmmpAudioEngine::addEffect(EffectFactory *factory)
}
if(m_output && m_output->isRunning())
{
- Effect *effect = factory->create();
+ Effect *effect = Effect::create(factory);
+ if(!effect)
+ return;
effect->configure(m_ap.sampleRate(), m_ap.channels(), m_ap.format());
if(effect->audioParameters() == m_ap)
{
@@ -176,10 +178,13 @@ void QmmpAudioEngine::addEffect(EffectFactory *factory)
void QmmpAudioEngine::removeEffect(EffectFactory *factory)
{
Effect *effect = 0;
- foreach(effect, m_effects)
+ foreach(Effect *e, m_effects)
{
- if(effect->factory() == factory)
+ if(e->factory() == factory)
+ {
+ effect = e;
break;
+ }
}
if(!effect)
return;
@@ -415,7 +420,7 @@ void QmmpAudioEngine::run()
delete m_output;
m_output = createOutput();
if(m_output)
- {
+ {
m_output->start();
sendMetaData();
addOffset(); //offset