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 <qtable.h> |
#include <QTableWidgetItem> |
26 |
|
#include <QAbstractTableModel> |
27 |
|
#include <QMetaType> |
28 |
|
#include <QItemDelegate> |
29 |
|
#include <QFontMetrics> |
30 |
|
#include <QModelIndex> |
31 |
|
#include <QSize> |
32 |
|
|
33 |
#include <lscp/client.h> |
#include <lscp/client.h> |
34 |
#include <lscp/device.h> |
#include <lscp/device.h> |
36 |
#include "qsamplerOptions.h" |
#include "qsamplerOptions.h" |
37 |
|
|
38 |
class qsamplerDevice; |
class qsamplerDevice; |
|
class qsamplerMainForm; |
|
39 |
|
|
40 |
|
|
41 |
// Typedef'd QMap. |
// Typedef'd QMap. |
51 |
public: |
public: |
52 |
|
|
53 |
// Constructor. |
// Constructor. |
54 |
qsamplerChannel(qsamplerMainForm *pMainForm, int iChannelID = -1); |
qsamplerChannel(int iChannelID = -1); |
55 |
// Default destructor. |
// Default destructor. |
56 |
~qsamplerChannel(); |
~qsamplerChannel(); |
57 |
|
|
|
// Main application form accessor. |
|
|
qsamplerMainForm *mainForm() const; |
|
|
|
|
|
// Main application options accessor. |
|
|
qsamplerOptions *options() const; |
|
|
|
|
|
// LSCP client descriptor accessor. |
|
|
lscp_client_t * client() const; |
|
|
|
|
58 |
// Add/remove sampler channel methods. |
// Add/remove sampler channel methods. |
59 |
bool addChannel(); |
bool addChannel(); |
60 |
bool removeChannel(); |
bool removeChannel(); |
97 |
int midiChannel() const; |
int midiChannel() const; |
98 |
bool setMidiChannel(int iMidiChannel); |
bool setMidiChannel(int iMidiChannel); |
99 |
|
|
100 |
|
// MIDI instrument map. |
101 |
|
int midiMap() const; |
102 |
|
bool setMidiMap(int iMidiMap); |
103 |
|
|
104 |
// Audio output driver (DEPRECATED). |
// Audio output driver (DEPRECATED). |
105 |
const QString& audioDriver() const; |
const QString& audioDriver() const; |
106 |
bool setAudioDriver(const QString& sAudioDriver); |
bool setAudioDriver(const QString& sAudioDriver); |
139 |
// Reset channel method. |
// Reset channel method. |
140 |
bool channelReset(); |
bool channelReset(); |
141 |
|
|
142 |
|
// Spawn instrument editor method. |
143 |
|
bool editChannel(); |
144 |
|
|
145 |
// Message logging methods (brainlessly mapped to main form's). |
// Message logging methods (brainlessly mapped to main form's). |
146 |
void appendMessages (const QString & s) const; |
void appendMessages (const QString & s) const; |
147 |
void appendMessagesColor (const QString & s, const QString & c) const; |
void appendMessagesColor (const QString & s, const QString & c) const; |
168 |
|
|
169 |
private: |
private: |
170 |
|
|
|
// Main application form reference. |
|
|
qsamplerMainForm *m_pMainForm; |
|
|
|
|
171 |
// Unique channel identifier. |
// Unique channel identifier. |
172 |
int m_iChannelID; |
int m_iChannelID; |
173 |
|
|
181 |
int m_iMidiDevice; |
int m_iMidiDevice; |
182 |
int m_iMidiPort; |
int m_iMidiPort; |
183 |
int m_iMidiChannel; |
int m_iMidiChannel; |
184 |
|
int m_iMidiMap; |
185 |
QString m_sAudioDriver; |
QString m_sAudioDriver; |
186 |
int m_iAudioDevice; |
int m_iAudioDevice; |
187 |
float m_fVolume; |
float m_fVolume; |
197 |
// qsamplerChannelRoutingTable - Channel routing table widget. |
// qsamplerChannelRoutingTable - Channel routing table widget. |
198 |
// |
// |
199 |
|
|
200 |
|
#if 0 |
201 |
class qsamplerChannelRoutingTable : public QTable |
class qsamplerChannelRoutingTable : public QTable |
202 |
{ |
{ |
203 |
Q_OBJECT |
Q_OBJECT |
212 |
// Common parameter table renderer. |
// Common parameter table renderer. |
213 |
void refresh(qsamplerDevice *pDevice, |
void refresh(qsamplerDevice *pDevice, |
214 |
const qsamplerChannelRoutingMap& routing); |
const qsamplerChannelRoutingMap& routing); |
215 |
|
|
216 |
|
// Commit any pending editing. |
217 |
|
void flush(); |
218 |
|
}; |
219 |
|
#endif |
220 |
|
|
221 |
|
struct ChannelRoutingItem { |
222 |
|
QStringList options; |
223 |
|
int selection; |
224 |
|
}; |
225 |
|
|
226 |
|
// so we can use it i.e. through QVariant |
227 |
|
Q_DECLARE_METATYPE(ChannelRoutingItem) |
228 |
|
|
229 |
|
class ChannelRoutingModel : public QAbstractTableModel { |
230 |
|
Q_OBJECT |
231 |
|
public: |
232 |
|
ChannelRoutingModel(QObject* parent = 0); |
233 |
|
|
234 |
|
// overridden methods from subclass(es) |
235 |
|
int rowCount(const QModelIndex &parent) const; |
236 |
|
int columnCount(const QModelIndex &parent) const; |
237 |
|
QVariant data(const QModelIndex &index, int role) const; |
238 |
|
QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const; |
239 |
|
|
240 |
|
public slots: |
241 |
|
void refresh(qsamplerDevice *pDevice, const qsamplerChannelRoutingMap& routing); |
242 |
|
|
243 |
|
private: |
244 |
|
qsamplerDevice* pDevice; |
245 |
|
qsamplerChannelRoutingMap routing; |
246 |
|
}; |
247 |
|
|
248 |
|
class ChannelRoutingDelegate : public QItemDelegate { |
249 |
|
Q_OBJECT |
250 |
|
public: |
251 |
|
ChannelRoutingDelegate(QObject* parent = 0); |
252 |
|
|
253 |
|
QWidget* createEditor(QWidget* parent, const QStyleOptionViewItem& option, |
254 |
|
const QModelIndex& index) const; |
255 |
|
|
256 |
|
void setEditorData(QWidget* editor, const QModelIndex& index) const; |
257 |
|
void setModelData(QWidget* editor, QAbstractItemModel* model, |
258 |
|
const QModelIndex& index) const; |
259 |
|
|
260 |
|
void updateEditorGeometry(QWidget* editor, |
261 |
|
const QStyleOptionViewItem& option, const QModelIndex& index) const; |
262 |
}; |
}; |
263 |
|
|
264 |
|
|
266 |
// qsamplerChannelRoutingComboBox - Custom combo box for routing table. |
// qsamplerChannelRoutingComboBox - Custom combo box for routing table. |
267 |
// |
// |
268 |
|
|
269 |
class qsamplerChannelRoutingComboBox : public QTableItem |
/* |
270 |
|
class qsamplerChannelRoutingComboBox : public QTableWidgetItem |
271 |
{ |
{ |
272 |
public: |
public: |
273 |
|
|
274 |
// Constructor. |
// Constructor. |
275 |
qsamplerChannelRoutingComboBox(QTable *pTable, |
qsamplerChannelRoutingComboBox(QTableWidget *pTable, |
276 |
const QStringList& list, const QPixmap& pixmap); |
const QStringList& list, const QPixmap& pixmap); |
277 |
|
|
278 |
// Public accessors. |
// Public accessors. |
291 |
QStringList m_list; |
QStringList m_list; |
292 |
int m_iCurrentItem; |
int m_iCurrentItem; |
293 |
}; |
}; |
294 |
|
*/ |
295 |
|
|
296 |
#endif // __qsamplerChannel_h |
#endif // __qsamplerChannel_h |
297 |
|
|