aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authortrialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38>2010-01-16 18:04:32 +0000
committertrialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38>2010-01-16 18:04:32 +0000
commit9289605dbae4ec73ef37213626bb2252abeefaf1 (patch)
treec13b889c43917a051e7d47dcd14699fc1d639e40 /src
parent435f1da1de18bafe57e43e47fd8a6fc69fd8bab7 (diff)
downloadqmmp-9289605dbae4ec73ef37213626bb2252abeefaf1.tar.gz
qmmp-9289605dbae4ec73ef37213626bb2252abeefaf1.tar.bz2
qmmp-9289605dbae4ec73ef37213626bb2252abeefaf1.zip
fixed add/remove effect problem
git-svn-id: http://svn.code.sf.net/p/qmmp-dev/code/trunk/qmmp@1504 90c681e8-e032-0410-971d-27865f9a5e38
Diffstat (limited to 'src')
-rw-r--r--src/qmmp/qmmpaudioengine.cpp26
-rw-r--r--src/qmmp/qmmpaudioengine.h3
2 files changed, 17 insertions, 12 deletions
diff --git a/src/qmmp/qmmpaudioengine.cpp b/src/qmmp/qmmpaudioengine.cpp
index 7f385897b..75cc1ca83 100644
--- a/src/qmmp/qmmpaudioengine.cpp
+++ b/src/qmmp/qmmpaudioengine.cpp
@@ -1,5 +1,5 @@
/***************************************************************************
- * Copyright (C) 2009 by Ilya Kotov *
+ * Copyright (C) 2009-2010 by Ilya Kotov *
* forkotov02@hotmail.ru *
* *
* This program is free software; you can redistribute it and/or modify *
@@ -201,7 +201,10 @@ void QmmpAudioEngine::removeEffect(EffectFactory *factory)
if(m_output && m_output->isRunning())
{
mutex()->lock();
- m_effects.removeAll(effect);
+ if(m_blockedEffects.contains(effect))
+ qDebug("QmmpAudioEngine: restart required");
+ else
+ m_effects.removeAll(effect);
mutex()->unlock();
}
}
@@ -531,6 +534,7 @@ void QmmpAudioEngine::sendMetaData()
Output *QmmpAudioEngine::createOutput(Decoder *d)
{
+ m_blockedEffects.clear();
while(!m_effects.isEmpty()) //delete effects
delete m_effects.takeFirst();
@@ -551,20 +555,20 @@ Output *QmmpAudioEngine::createOutput(Decoder *d)
return FALSE;
}
m_effects = Effect::create();
- quint32 srate = m_ap.sampleRate();
- int chan = m_ap.channels();
- Qmmp::AudioFormat format = m_ap.format();
+ AudioParameters ap = m_ap;
m_replayGain->setSampleSize(m_ap.sampleSize());
foreach(Effect *effect, m_effects)
{
- effect->configure(srate, chan, format);
- srate = effect->sampleRate();
- chan = effect->channels();
- format = effect->format();
+ effect->configure(ap.sampleRate(), ap.channels(), ap.format());
+ if (ap != effect->audioParameters())
+ {
+ m_blockedEffects << effect; //list of effects which require restart
+ ap = effect->audioParameters();
+ }
}
- m_chan = chan;
- output->configure(srate, chan, format);
+ m_chan = ap.channels();
+ output->configure(ap.sampleRate(), ap.channels(), ap.format());
return output;
}
diff --git a/src/qmmp/qmmpaudioengine.h b/src/qmmp/qmmpaudioengine.h
index 7d19e2917..b785e9d48 100644
--- a/src/qmmp/qmmpaudioengine.h
+++ b/src/qmmp/qmmpaudioengine.h
@@ -1,5 +1,5 @@
/***************************************************************************
- * Copyright (C) 2009 by Ilya Kotov *
+ * Copyright (C) 2009-2010 by Ilya Kotov *
* forkotov02@hotmail.ru *
* *
* This program is free software; you can redistribute it and/or modify *
@@ -71,6 +71,7 @@ private:
DecoderFactory *m_factory;
QList <Effect*> m_effects;
+ QList <Effect*> m_blockedEffects;
Output *m_output;
bool m_eqInited;