1 |
// qsamplerChannel.h |
// qsamplerChannel.h |
2 |
// |
// |
3 |
/**************************************************************************** |
/**************************************************************************** |
4 |
Copyright (C) 2003-2005, rncbc aka Rui Nuno Capela. All rights reserved. |
Copyright (C) 2004-2007, 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 qsamplerMainForm; |
class qsamplerDevice; |
33 |
|
|
34 |
|
|
35 |
|
// Typedef'd QMap. |
36 |
|
typedef QMap<int, int> qsamplerChannelRoutingMap; |
37 |
|
|
38 |
|
|
39 |
//------------------------------------------------------------------------- |
//------------------------------------------------------------------------- |
45 |
public: |
public: |
46 |
|
|
47 |
// Constructor. |
// Constructor. |
48 |
qsamplerChannel(qsamplerMainForm *pMainForm, int iChannelID = -1); |
qsamplerChannel(int iChannelID = -1); |
49 |
// Default destructor. |
// Default destructor. |
50 |
~qsamplerChannel(); |
~qsamplerChannel(); |
51 |
|
|
|
// Main application form accessor. |
|
|
qsamplerMainForm *mainForm() const; |
|
|
|
|
|
// Main application options accessor. |
|
|
qsamplerOptions *options() const; |
|
|
|
|
|
// LSCP client descriptor accessor. |
|
|
lscp_client_t * client() const; |
|
|
|
|
52 |
// Add/remove sampler channel methods. |
// Add/remove sampler channel methods. |
53 |
bool addChannel(); |
bool addChannel(); |
54 |
bool removeChannel(); |
bool removeChannel(); |
69 |
int instrumentNr() const; |
int instrumentNr() const; |
70 |
const QString& instrumentName() const; |
const QString& instrumentName() const; |
71 |
int instrumentStatus() const; |
int instrumentStatus() const; |
72 |
|
|
73 |
// Instrument file loader. |
// Instrument file loader. |
74 |
bool loadInstrument(const QString& sInstrumentFile, int iInstrumentNr); |
bool loadInstrument(const QString& sInstrumentFile, int iInstrumentNr); |
75 |
// Special instrument file/name/number settler. |
// Special instrument file/name/number settler. |
91 |
int midiChannel() const; |
int midiChannel() const; |
92 |
bool setMidiChannel(int iMidiChannel); |
bool setMidiChannel(int iMidiChannel); |
93 |
|
|
94 |
|
// MIDI instrument map. |
95 |
|
int midiMap() const; |
96 |
|
bool setMidiMap(int iMidiMap); |
97 |
|
|
98 |
// Audio output driver (DEPRECATED). |
// Audio output driver (DEPRECATED). |
99 |
const QString& audioDriver() const; |
const QString& audioDriver() const; |
100 |
bool setAudioDriver(const QString& sAudioDriver); |
bool setAudioDriver(const QString& sAudioDriver); |
107 |
float volume() const; |
float volume() const; |
108 |
bool setVolume(float fVolume); |
bool setVolume(float fVolume); |
109 |
|
|
110 |
|
// Sampler channel mute state. |
111 |
|
bool channelMute() const; |
112 |
|
bool setChannelMute(bool bMute); |
113 |
|
|
114 |
|
// Sampler channel solo state. |
115 |
|
bool channelSolo() const; |
116 |
|
bool setChannelSolo(bool bSolo); |
117 |
|
|
118 |
|
// Audio routing accessors. |
119 |
|
int audioChannel(int iAudioOut) const; |
120 |
|
bool setAudioChannel(int iAudioOut, int iAudioIn); |
121 |
|
// The audio routing map itself. |
122 |
|
const qsamplerChannelRoutingMap& audioRouting() const; |
123 |
|
|
124 |
// Istrument name remapper. |
// Istrument name remapper. |
125 |
void updateInstrumentName(); |
void updateInstrumentName(); |
126 |
|
|
133 |
// Reset channel method. |
// Reset channel method. |
134 |
bool channelReset(); |
bool channelReset(); |
135 |
|
|
136 |
|
// Spawn instrument editor method. |
137 |
|
bool editChannel(); |
138 |
|
|
139 |
// Message logging methods (brainlessly mapped to main form's). |
// Message logging methods (brainlessly mapped to main form's). |
140 |
void appendMessages (const QString & s) const; |
void appendMessages (const QString & s) const; |
141 |
void appendMessagesColor (const QString & s, const QString & c) const; |
void appendMessagesColor (const QString & s, const QString & c) const; |
149 |
// Common (invalid) name-helpers. |
// Common (invalid) name-helpers. |
150 |
static QString noEngineName(); |
static QString noEngineName(); |
151 |
static QString noInstrumentName(); |
static QString noInstrumentName(); |
152 |
|
static QString loadingInstrument(); |
153 |
|
|
154 |
// Check whether a given file is an instrument file. |
// Check whether a given file is an instrument file. |
155 |
static bool isInstrumentFile (const QString& sInstrumentFile); |
static bool isInstrumentFile (const QString& sInstrumentFile); |
162 |
|
|
163 |
private: |
private: |
164 |
|
|
|
// Main application form reference. |
|
|
qsamplerMainForm *m_pMainForm; |
|
|
|
|
165 |
// Unique channel identifier. |
// Unique channel identifier. |
166 |
int m_iChannelID; |
int m_iChannelID; |
167 |
|
|
171 |
QString m_sInstrumentFile; |
QString m_sInstrumentFile; |
172 |
int m_iInstrumentNr; |
int m_iInstrumentNr; |
173 |
int m_iInstrumentStatus; |
int m_iInstrumentStatus; |
174 |
QString m_sMidiDriver; // DEPRECATED. |
QString m_sMidiDriver; |
175 |
int m_iMidiDevice; |
int m_iMidiDevice; |
176 |
int m_iMidiPort; |
int m_iMidiPort; |
177 |
int m_iMidiChannel; |
int m_iMidiChannel; |
178 |
QString m_sAudioDriver; // DEPRECATED. |
int m_iMidiMap; |
179 |
|
QString m_sAudioDriver; |
180 |
int m_iAudioDevice; |
int m_iAudioDevice; |
181 |
float m_fVolume; |
float m_fVolume; |
182 |
|
bool m_bMute; |
183 |
|
bool m_bSolo; |
184 |
|
|
185 |
|
// The audio routing mapping. |
186 |
|
qsamplerChannelRoutingMap m_audioRouting; |
187 |
}; |
}; |
188 |
|
|
189 |
|
|
190 |
|
//------------------------------------------------------------------------- |
191 |
|
// qsamplerChannelRoutingTable - Channel routing table widget. |
192 |
|
// |
193 |
|
|
194 |
|
class qsamplerChannelRoutingTable : public QTable |
195 |
|
{ |
196 |
|
Q_OBJECT |
197 |
|
|
198 |
|
public: |
199 |
|
|
200 |
|
// Constructor. |
201 |
|
qsamplerChannelRoutingTable(QWidget *pParent = 0, const char *pszName = 0); |
202 |
|
// Default destructor. |
203 |
|
~qsamplerChannelRoutingTable(); |
204 |
|
|
205 |
|
// Common parameter table renderer. |
206 |
|
void refresh(qsamplerDevice *pDevice, |
207 |
|
const qsamplerChannelRoutingMap& routing); |
208 |
|
|
209 |
|
// Commit any pending editing. |
210 |
|
void flush(); |
211 |
|
}; |
212 |
|
|
213 |
|
|
214 |
|
//------------------------------------------------------------------------- |
215 |
|
// qsamplerChannelRoutingComboBox - Custom combo box for routing table. |
216 |
|
// |
217 |
|
|
218 |
|
class qsamplerChannelRoutingComboBox : public QTableItem |
219 |
|
{ |
220 |
|
public: |
221 |
|
|
222 |
|
// Constructor. |
223 |
|
qsamplerChannelRoutingComboBox(QTable *pTable, |
224 |
|
const QStringList& list, const QPixmap& pixmap); |
225 |
|
|
226 |
|
// Public accessors. |
227 |
|
void setCurrentItem(int iCurrentItem); |
228 |
|
int currentItem() const; |
229 |
|
|
230 |
|
protected: |
231 |
|
|
232 |
|
// Virtual implemetations. |
233 |
|
QWidget *createEditor() const; |
234 |
|
void setContentFromEditor(QWidget *pWidget); |
235 |
|
|
236 |
|
private: |
237 |
|
|
238 |
|
// Initial value holders |
239 |
|
QStringList m_list; |
240 |
|
int m_iCurrentItem; |
241 |
|
}; |
242 |
|
|
243 |
|
|
244 |
#endif // __qsamplerChannel_h |
#endif // __qsamplerChannel_h |
245 |
|
|
246 |
|
|