ZynAddSubFX: save which controllers were modified and restore them
[lmms.git] / plugins / zynaddsubfx / ZynAddSubFx.h
blobf37ba857b4000b7036ce7b4202e4931fd709d52b
1 /*
2 * ZynAddSubFx.h - ZynAddSubFX-embedding plugin
4 * Copyright (c) 2008-2010 Tobias Doerffel <tobydox/at/users.sourceforge.net>
5 *
6 * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public
10 * License as published by the Free Software Foundation; either
11 * version 2 of the License, or (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * General Public License for more details.
18 * You should have received a copy of the GNU General Public
19 * License along with this program (see COPYING); if not, write to the
20 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
21 * Boston, MA 02110-1301 USA.
25 #ifndef _ZYNADDSUBFX_H
26 #define _ZYNADDSUBFX_H
28 #include <QtCore/QMap>
29 #include <QtCore/QMutex>
31 #include "AutomatableModel.h"
32 #include "Instrument.h"
33 #include "InstrumentView.h"
34 #include "RemotePlugin.h"
35 #include "src/globals.h"
38 class QPushButton;
40 class LocalZynAddSubFx;
41 class ZynAddSubFxView;
42 class notePlayHandle;
43 class knob;
44 class ledCheckBox;
47 class ZynAddSubFxRemotePlugin : public QObject, public RemotePlugin
49 Q_OBJECT
50 public:
51 ZynAddSubFxRemotePlugin();
52 virtual ~ZynAddSubFxRemotePlugin();
54 virtual bool processMessage( const message & _m );
57 signals:
58 void clickedCloseButton();
60 } ;
64 class ZynAddSubFxInstrument : public Instrument
66 Q_OBJECT
67 public:
68 ZynAddSubFxInstrument( InstrumentTrack * _instrument_track );
69 virtual ~ZynAddSubFxInstrument();
71 virtual void play( sampleFrame * _working_buffer );
73 virtual bool handleMidiEvent( const midiEvent & _me,
74 const midiTime & _time );
76 virtual void saveSettings( QDomDocument & _doc, QDomElement & _parent );
77 virtual void loadSettings( const QDomElement & _this );
79 virtual void loadFile( const QString & _file );
82 virtual QString nodeName() const;
84 virtual bool isMidiBased() const
86 return true;
89 virtual PluginView * instantiateView( QWidget * _parent );
92 private slots:
93 void reloadPlugin();
95 void updatePortamento();
96 void updateFilterFreq();
97 void updateFilterQ();
98 void updateBandwidth();
99 void updateFmGain();
100 void updateResCenterFreq();
101 void updateResBandwidth();
104 private:
105 void initPlugin();
106 void sendControlChange( MidiControllers midiCtl, float value );
108 bool m_hasGUI;
109 QMutex m_pluginMutex;
110 LocalZynAddSubFx * m_plugin;
111 ZynAddSubFxRemotePlugin * m_remotePlugin;
113 FloatModel m_portamentoModel;
114 FloatModel m_filterFreqModel;
115 FloatModel m_filterQModel;
116 FloatModel m_bandwidthModel;
117 FloatModel m_fmGainModel;
118 FloatModel m_resCenterFreqModel;
119 FloatModel m_resBandwidthModel;
120 BoolModel m_forwardMidiCcModel;
122 QMap<int, bool> m_modifiedControllers;
124 friend class ZynAddSubFxView;
127 signals:
128 void settingsChanged();
134 class ZynAddSubFxView : public InstrumentView
136 Q_OBJECT
137 public:
138 ZynAddSubFxView( Instrument * _instrument, QWidget * _parent );
139 virtual ~ZynAddSubFxView();
142 protected:
143 virtual void dragEnterEvent( QDragEnterEvent * _dee );
144 virtual void dropEvent( QDropEvent * _de );
147 private:
148 void modelChanged();
150 QPushButton * m_toggleUIButton;
151 knob * m_portamento;
152 knob * m_filterFreq;
153 knob * m_filterQ;
154 knob * m_bandwidth;
155 knob * m_fmGain;
156 knob * m_resCenterFreq;
157 knob * m_resBandwidth;
158 ledCheckBox * m_forwardMidiCC;
161 private slots:
162 void toggleUI();
167 #endif