1 |
// qsamplerChannel.h |
// qsamplerChannel.h |
2 |
// |
// |
3 |
/**************************************************************************** |
/**************************************************************************** |
4 |
Copyright (C) 2003-2005, rncbc aka Rui Nuno Capela. All rights reserved. |
Copyright (C) 2004-2006, rncbc aka Rui Nuno Capela. All rights reserved. |
5 |
|
|
6 |
This program is free software; you can redistribute it and/or |
This program is free software; you can redistribute it and/or |
7 |
modify it under the terms of the GNU General Public License |
modify it under the terms of the GNU General Public License |
13 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
14 |
GNU General Public License for more details. |
GNU General Public License for more details. |
15 |
|
|
16 |
You should have received a copy of the GNU General Public License |
You should have received a copy of the GNU General Public License along |
17 |
along with this program; if not, write to the Free Software |
with this program; if not, write to the Free Software Foundation, Inc., |
18 |
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
19 |
|
|
20 |
*****************************************************************************/ |
*****************************************************************************/ |
21 |
|
|
22 |
#ifndef __qsamplerChannel_h |
#ifndef __qsamplerChannel_h |
23 |
#define __qsamplerChannel_h |
#define __qsamplerChannel_h |
24 |
|
|
25 |
#include <qobject.h> |
#include <qtable.h> |
26 |
|
|
27 |
#include <lscp/client.h> |
#include <lscp/client.h> |
28 |
#include <lscp/device.h> |
#include <lscp/device.h> |
29 |
|
|
30 |
#include "qsamplerOptions.h" |
#include "qsamplerOptions.h" |
31 |
|
|
32 |
|
class qsamplerDevice; |
33 |
class qsamplerMainForm; |
class qsamplerMainForm; |
34 |
|
|
35 |
|
|
36 |
|
// Typedef'd QMap. |
37 |
|
typedef QMap<int, int> qsamplerChannelRoutingMap; |
38 |
|
|
39 |
|
|
40 |
//------------------------------------------------------------------------- |
//------------------------------------------------------------------------- |
41 |
// qsamplerChannel - Sampler channel structure. |
// qsamplerChannel - Sampler channel structure. |
42 |
// |
// |
45 |
{ |
{ |
46 |
public: |
public: |
47 |
|
|
48 |
// Constructor. |
// Constructor. |
49 |
qsamplerChannel(qsamplerMainForm *pMainForm, int iChannelID = -1); |
qsamplerChannel(qsamplerMainForm *pMainForm, int iChannelID = -1); |
50 |
// Default destructor. |
// Default destructor. |
51 |
~qsamplerChannel(); |
~qsamplerChannel(); |
52 |
|
|
53 |
// Main application options accessor. |
// Main application form accessor. |
54 |
qsamplerOptions *options(); |
qsamplerMainForm *mainForm() const; |
55 |
|
|
56 |
// LSCP client descriptor accessor. |
// Main application options accessor. |
57 |
lscp_client_t * client(); |
qsamplerOptions *options() const; |
58 |
|
|
59 |
// Add/remove sampler channel methods. |
// LSCP client descriptor accessor. |
60 |
bool addChannel(); |
lscp_client_t * client() const; |
61 |
bool removeChannel(); |
|
62 |
|
// Add/remove sampler channel methods. |
63 |
// Sampler channel ID accessors. |
bool addChannel(); |
64 |
int channelID(); |
bool removeChannel(); |
65 |
void setChannelID(int iChannelID); |
|
66 |
|
// Sampler channel ID accessors. |
67 |
// Readable channel name. |
int channelID() const; |
68 |
QString channelName(); |
void setChannelID(int iChannelID); |
69 |
|
|
70 |
// Engine name property. |
// Readable channel name. |
71 |
QString& engineName(); |
QString channelName() const; |
72 |
bool loadEngine(const QString& sEngineName); |
|
73 |
|
// Engine name property. |
74 |
// Instrument file and index. |
const QString& engineName() const; |
75 |
QString& instrumentFile(); |
bool loadEngine(const QString& sEngineName); |
76 |
int instrumentNr(); |
|
77 |
QString& instrumentName(); |
// Instrument file and index. |
78 |
int instrumentStatus(); |
const QString& instrumentFile() const; |
79 |
bool loadInstrument(const QString& sInstrumentFile, int iInstrumentNr); |
int instrumentNr() const; |
80 |
|
const QString& instrumentName() const; |
81 |
|
int instrumentStatus() const; |
82 |
|
|
83 |
|
// Instrument file loader. |
84 |
|
bool loadInstrument(const QString& sInstrumentFile, int iInstrumentNr); |
85 |
// Special instrument file/name/number settler. |
// Special instrument file/name/number settler. |
86 |
bool setInstrument(const QString& sInstrumentFile, int iInstrumentNr); |
bool setInstrument(const QString& sInstrumentFile, int iInstrumentNr); |
87 |
|
|
88 |
// MIDI input driver (DEPRECATED). |
// MIDI input driver (DEPRECATED). |
89 |
QString& midiDriver(); |
const QString& midiDriver() const; |
90 |
bool setMidiDriver(const QString& sMidiDriver); |
bool setMidiDriver(const QString& sMidiDriver); |
91 |
|
|
92 |
// MIDI input device. |
// MIDI input device. |
93 |
int midiDevice(); |
int midiDevice() const; |
94 |
bool setMidiDevice(int iMidiDevice); |
bool setMidiDevice(int iMidiDevice); |
95 |
|
|
96 |
// MIDI input port. |
// MIDI input port. |
97 |
int midiPort(); |
int midiPort() const; |
98 |
bool setMidiPort(int iMidiPort); |
bool setMidiPort(int iMidiPort); |
99 |
|
|
100 |
// MIDI input channel. |
// MIDI input channel. |
101 |
int midiChannel(); |
int midiChannel() const; |
102 |
bool setMidiChannel(int iMidiChannel); |
bool setMidiChannel(int iMidiChannel); |
103 |
|
|
104 |
// Audio output driver (DEPRECATED). |
// Audio output driver (DEPRECATED). |
105 |
QString& audioDriver(); |
const QString& audioDriver() const; |
106 |
bool setAudioDriver(const QString& sAudioDriver); |
bool setAudioDriver(const QString& sAudioDriver); |
107 |
|
|
108 |
// Audio output device. |
// Audio output device. |
109 |
int audioDevice(); |
int audioDevice() const; |
110 |
bool setAudioDevice(int iAudioDevice); |
bool setAudioDevice(int iAudioDevice); |
111 |
|
|
112 |
// Sampler channel volume. |
// Sampler channel volume. |
113 |
float volume(); |
float volume() const; |
114 |
bool setVolume(float fVolume); |
bool setVolume(float fVolume); |
115 |
|
|
116 |
// Istrument name remapper. |
// Sampler channel mute state. |
117 |
void updateInstrumentName(); |
bool channelMute() const; |
118 |
|
bool setChannelMute(bool bMute); |
119 |
// Channel info structure map executive. |
|
120 |
bool updateChannelInfo(); |
// Sampler channel solo state. |
121 |
|
bool channelSolo() const; |
122 |
// Channel setup dialog form. |
bool setChannelSolo(bool bSolo); |
123 |
bool channelSetup(QWidget *pParent); |
|
124 |
|
// Audio routing accessors. |
125 |
// Reset channel method. |
int audioChannel(int iAudioOut) const; |
126 |
bool channelReset(); |
bool setAudioChannel(int iAudioOut, int iAudioIn); |
127 |
|
// The audio routing map itself. |
128 |
// Message logging methods (brainlessly mapped to main form's). |
const qsamplerChannelRoutingMap& audioRouting() const; |
129 |
void appendMessages (const QString & s); |
|
130 |
void appendMessagesColor (const QString & s, const QString & c); |
// Istrument name remapper. |
131 |
void appendMessagesText (const QString & s); |
void updateInstrumentName(); |
132 |
void appendMessagesError (const QString & s); |
|
133 |
void appendMessagesClient (const QString & s); |
// Channel info structure map executive. |
134 |
|
bool updateChannelInfo(); |
135 |
|
|
136 |
|
// Channel setup dialog form. |
137 |
|
bool channelSetup(QWidget *pParent); |
138 |
|
|
139 |
|
// Reset channel method. |
140 |
|
bool channelReset(); |
141 |
|
|
142 |
|
// Message logging methods (brainlessly mapped to main form's). |
143 |
|
void appendMessages (const QString & s) const; |
144 |
|
void appendMessagesColor (const QString & s, const QString & c) const; |
145 |
|
void appendMessagesText (const QString & s) const; |
146 |
|
void appendMessagesError (const QString & s) const; |
147 |
|
void appendMessagesClient (const QString & s) const; |
148 |
|
|
149 |
// Context menu event handler. |
// Context menu event handler. |
150 |
void contextMenuEvent(QContextMenuEvent *pEvent); |
void contextMenuEvent(QContextMenuEvent *pEvent); |
151 |
|
|
152 |
// Common (invalid) name-helpers. |
// Common (invalid) name-helpers. |
153 |
static QString noEngineName(); |
static QString noEngineName(); |
154 |
static QString noInstrumentName(); |
static QString noInstrumentName(); |
155 |
|
static QString loadingInstrument(); |
156 |
|
|
157 |
// Check whether a given file is an instrument file. |
// Check whether a given file is an instrument file. |
158 |
static bool isInstrumentFile (const QString& sInstrumentFile); |
static bool isInstrumentFile (const QString& sInstrumentFile); |
159 |
|
|
160 |
// Retrieve the available instrument name(s) of an instrument file (.gig). |
// Retrieve the available instrument name(s) of an instrument file (.gig). |
161 |
static QString getInstrumentName (const QString& sInstrumentFile, |
static QString getInstrumentName (const QString& sInstrumentFile, |
162 |
int iInstrumentNr, bool bInstrumentNames); |
int iInstrumentNr, bool bInstrumentNames); |
163 |
static QStringList getInstrumentList (const QString& sInstrumentFile, |
static QStringList getInstrumentList (const QString& sInstrumentFile, |
164 |
bool bInstrumentNames); |
bool bInstrumentNames); |
165 |
|
|
166 |
private: |
private: |
167 |
|
|
168 |
// Main application form reference. |
// Main application form reference. |
169 |
qsamplerMainForm *m_pMainForm; |
qsamplerMainForm *m_pMainForm; |
170 |
|
|
171 |
|
// Unique channel identifier. |
172 |
|
int m_iChannelID; |
173 |
|
|
174 |
|
// Sampler channel info map. |
175 |
|
QString m_sEngineName; |
176 |
|
QString m_sInstrumentName; |
177 |
|
QString m_sInstrumentFile; |
178 |
|
int m_iInstrumentNr; |
179 |
|
int m_iInstrumentStatus; |
180 |
|
QString m_sMidiDriver; |
181 |
|
int m_iMidiDevice; |
182 |
|
int m_iMidiPort; |
183 |
|
int m_iMidiChannel; |
184 |
|
QString m_sAudioDriver; |
185 |
|
int m_iAudioDevice; |
186 |
|
float m_fVolume; |
187 |
|
bool m_bMute; |
188 |
|
bool m_bSolo; |
189 |
|
|
190 |
|
// The audio routing mapping. |
191 |
|
qsamplerChannelRoutingMap m_audioRouting; |
192 |
|
}; |
193 |
|
|
194 |
|
|
195 |
|
//------------------------------------------------------------------------- |
196 |
|
// qsamplerChannelRoutingTable - Channel routing table widget. |
197 |
|
// |
198 |
|
|
199 |
|
class qsamplerChannelRoutingTable : public QTable |
200 |
|
{ |
201 |
|
Q_OBJECT |
202 |
|
|
203 |
|
public: |
204 |
|
|
205 |
|
// Constructor. |
206 |
|
qsamplerChannelRoutingTable(QWidget *pParent = 0, const char *pszName = 0); |
207 |
|
// Default destructor. |
208 |
|
~qsamplerChannelRoutingTable(); |
209 |
|
|
210 |
|
// Common parameter table renderer. |
211 |
|
void refresh(qsamplerDevice *pDevice, |
212 |
|
const qsamplerChannelRoutingMap& routing); |
213 |
|
|
214 |
|
// Commit any pending editing. |
215 |
|
void flush(); |
216 |
|
}; |
217 |
|
|
218 |
|
|
219 |
|
//------------------------------------------------------------------------- |
220 |
|
// qsamplerChannelRoutingComboBox - Custom combo box for routing table. |
221 |
|
// |
222 |
|
|
223 |
|
class qsamplerChannelRoutingComboBox : public QTableItem |
224 |
|
{ |
225 |
|
public: |
226 |
|
|
227 |
// Unique channel identifier. |
// Constructor. |
228 |
int m_iChannelID; |
qsamplerChannelRoutingComboBox(QTable *pTable, |
229 |
|
const QStringList& list, const QPixmap& pixmap); |
230 |
|
|
231 |
|
// Public accessors. |
232 |
|
void setCurrentItem(int iCurrentItem); |
233 |
|
int currentItem() const; |
234 |
|
|
235 |
|
protected: |
236 |
|
|
237 |
|
// Virtual implemetations. |
238 |
|
QWidget *createEditor() const; |
239 |
|
void setContentFromEditor(QWidget *pWidget); |
240 |
|
|
241 |
// Sampler channel info map. |
private: |
242 |
QString m_sEngineName; |
|
243 |
QString m_sInstrumentName; |
// Initial value holders |
244 |
QString m_sInstrumentFile; |
QStringList m_list; |
245 |
int m_iInstrumentNr; |
int m_iCurrentItem; |
|
int m_iInstrumentStatus; |
|
|
QString m_sMidiDriver; // DEPRECATED. |
|
|
int m_iMidiDevice; |
|
|
int m_iMidiPort; |
|
|
int m_iMidiChannel; |
|
|
QString m_sAudioDriver; // DEPRECATED. |
|
|
int m_iAudioDevice; |
|
|
float m_fVolume; |
|
246 |
}; |
}; |
247 |
|
|
248 |
|
|
249 |
#endif // __qsamplerChannel_h |
#endif // __qsamplerChannel_h |
250 |
|
|
251 |
|
|