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