summaryrefslogtreecommitdiffstats
path: root/src/effects/effectchain.h
diff options
context:
space:
mode:
authorRJ Ryan <rryan@mixxx.org>2013-06-19 01:12:50 -0400
committerRJ Ryan <rryan@mixxx.org>2013-06-19 01:12:50 -0400
commit52d6c28ded7b3d7e9ae3874fc893c6b306147931 (patch)
treea2729bd5686b5c13684510d0196862a76c8aedab /src/effects/effectchain.h
parentf62fd9ee125cbd22be97ce5f837f30b8ef443842 (diff)
parent25d57b59dff3947212909634864dd82365c9606b (diff)
Merge branch 'master' into features_effects
Conflicts: res/skins/Outline1024x600-Netbook/keylock-off-Ch1.png res/skins/Outline1024x600-Netbook/keylock-off-Ch2.png res/skins/Outline1024x600-Netbook/keylock-on-Ch1.png res/skins/Outline1024x600-Netbook/keylock-on-Ch2.png
Diffstat (limited to 'src/effects/effectchain.h')
-rw-r--r--src/effects/effectchain.h75
1 files changed, 75 insertions, 0 deletions
diff --git a/src/effects/effectchain.h b/src/effects/effectchain.h
new file mode 100644
index 0000000000..5310691c56
--- /dev/null
+++ b/src/effects/effectchain.h
@@ -0,0 +1,75 @@
+#ifndef EFFECTCHAIN_H
+#define EFFECTCHAIN_H
+
+#include <QObject>
+#include <QMap>
+#include <QMutex>
+#include <QList>
+
+#include "util.h"
+#include "effects/effect.h"
+#include "effects/effectslot.h"
+
+class EffectChain;
+typedef QSharedPointer<EffectChain> EffectChainPointer;
+
+class EffectChain : public QObject {
+ Q_OBJECT
+ public:
+ EffectChain(QObject* pParent=NULL);
+ virtual ~EffectChain();
+
+ // The ID of an EffectChain is a unique ID given to it to help associate it
+ // with the preset from which it was loaded.
+ QString id() const;
+ void setId(const QString& id);
+
+ // Get the human-readable name of the EffectChain
+ QString name() const;
+ void setName(const QString& name);
+
+ double parameter() const;
+ void setParameter(const double& dParameter);
+
+ void addEffect(EffectPointer pEffect);
+ EffectPointer getEffect(unsigned int i) const;
+ QList<EffectPointer> getEffects() const;
+ unsigned int numEffects() const;
+
+ // Take a buffer of numSamples samples of audio from channel channelId,
+ // provided as pInput, and apply each Effect in this EffectChain to it,
+ // putting the resulting output in pOutput. If pInput is equal to pOutput,
+ // then the operation must occur in-place. Both pInput and pOutput are
+ // represented as stereo interleaved samples. There are numSamples total
+ // samples, so numSamples/2 left channel samples and numSamples/2 right
+ // channel samples. The channelId provided allows the effects to maintain
+ // state on a per-channel basis. This is important because one Effect
+ // instance may be used to process the audio of multiple channels.
+ virtual void process(const QString& channelId,
+ const CSAMPLE* pInput, CSAMPLE* pOutput,
+ const unsigned int numSamples);
+
+ signals:
+ // Signal that indicates that the EffectChain has changed (i.e. an Effect
+ // has been added or removed).
+ void updated();
+ private:
+ QString debugString() const {
+ return QString("EffectChain(%1)").arg(m_id);
+ }
+
+ mutable QMutex m_mutex;
+
+ bool m_bEnabled;
+ QString m_id;
+ QString m_name;
+ double m_dMix;
+ double m_dParameter;
+
+ QList<EffectPointer> m_effects;
+
+ DISALLOW_COPY_AND_ASSIGN(EffectChain);
+};
+
+
+#endif /* EFFECTCHAIN_H */