1 /*
2  * EffectChain.h - class for processing and effects chain
3  *
4  * Copyright (c) 2006-2008 Danny McRae <khjklujn/at/users.sourceforge.net>
5  * Copyright (c) 2008-2014 Tobias Doerffel <tobydox/at/users.sourceforge.net>
6  *
7  * This file is part of LMMS - https://lmms.io
8  *
9  * This program is free software; you can redistribute it and/or
10  * modify it under the terms of the GNU General Public
11  * License as published by the Free Software Foundation; either
12  * version 2 of the License, or (at your option) any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
17  * General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public
20  * License along with this program (see COPYING); if not, write to the
21  * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
22  * Boston, MA 02110-1301 USA.
23  *
24  */
25 
26 #ifndef EFFECT_CHAIN_H
27 #define EFFECT_CHAIN_H
28 
29 #include "Model.h"
30 #include "SerializingObject.h"
31 #include "AutomatableModel.h"
32 
33 class Effect;
34 
35 
36 class EXPORT EffectChain : public Model, public SerializingObject
37 {
38 	Q_OBJECT
39 public:
40 	EffectChain( Model * _parent );
41 	virtual ~EffectChain();
42 
43 	virtual void saveSettings( QDomDocument & _doc, QDomElement & _parent );
44 	virtual void loadSettings( const QDomElement & _this );
45 
nodeName()46 	inline virtual QString nodeName() const
47 	{
48 		return "fxchain";
49 	}
50 
51 	void appendEffect( Effect * _effect );
52 	void removeEffect( Effect * _effect );
53 	void moveDown( Effect * _effect );
54 	void moveUp( Effect * _effect );
55 	bool processAudioBuffer( sampleFrame * _buf, const fpp_t _frames, bool hasInputNoise );
56 	void startRunning();
57 
58 	void clear();
59 
setEnabled(bool _on)60 	void setEnabled( bool _on )
61 	{
62 		m_enabledModel.setValue( _on );
63 	}
64 
65 
66 private:
67 	typedef QVector<Effect *> EffectList;
68 	EffectList m_effects;
69 
70 	BoolModel m_enabledModel;
71 
72 
73 	friend class EffectRackView;
74 
75 
76 signals:
77 	void aboutToClear();
78 
79 } ;
80 
81 #endif
82 
83