1 |
// qsamplerDevice.h |
// qsamplerDevice.h |
2 |
// |
// |
3 |
/**************************************************************************** |
/**************************************************************************** |
4 |
Copyright (C) 2003-2005, rncbc aka Rui Nuno Capela. All rights reserved. |
Copyright (C) 2005, 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 |
31 |
#include "qsamplerOptions.h" |
#include "qsamplerOptions.h" |
32 |
|
|
33 |
|
|
34 |
// Special QListViewItem::rtti() return values. |
// Special QListViewItem::rtti() unique return value. |
35 |
#define QSAMPLER_DEVICE_ITEM 1001 |
#define QSAMPLER_DEVICE_ITEM 1001 |
36 |
|
|
37 |
|
|
42 |
{ |
{ |
43 |
public: |
public: |
44 |
|
|
45 |
// Constructor. |
// Constructor. |
46 |
qsamplerDeviceParam(lscp_param_info_t *pParamInfo = NULL, |
qsamplerDeviceParam(lscp_param_info_t *pParamInfo = NULL, |
47 |
const char *pszValue = NULL); |
const char *pszValue = NULL); |
48 |
// Default destructor. |
// Default destructor. |
49 |
~qsamplerDeviceParam(); |
~qsamplerDeviceParam(); |
50 |
|
|
51 |
// Initializer. |
// Initializer. |
52 |
void setParam(lscp_param_info_t *pParamInfo, |
void setParam(lscp_param_info_t *pParamInfo, |
53 |
const char *pszValue = NULL); |
const char *pszValue = NULL); |
54 |
|
|
55 |
// Info structure field members. |
// Info structure field members. |
56 |
lscp_type_t type; |
lscp_type_t type; |
57 |
QString description; |
QString description; |
58 |
bool mandatory; |
bool mandatory; |
59 |
bool fix; |
bool fix; |
60 |
bool multiplicity; |
bool multiplicity; |
61 |
QStringList depends; |
QStringList depends; |
62 |
QString defaultv; |
QString defaultv; |
63 |
QString range_min; |
QString range_min; |
64 |
QString range_max; |
QString range_max; |
65 |
QStringList possibilities; |
QStringList possibilities; |
66 |
// The current parameter value. |
// The current parameter value. |
67 |
QString value; |
QString value; |
68 |
}; |
}; |
69 |
|
|
70 |
// A typedef'd parameter QMap. |
// A typedef'd parameter QMap. |
79 |
{ |
{ |
80 |
public: |
public: |
81 |
|
|
82 |
// We use the same class for MIDI and audio device management |
// We use the same class for MIDI and audio device management |
83 |
enum qsamplerDeviceType { Midi, Audio }; |
enum qsamplerDeviceType { None, Midi, Audio }; |
84 |
|
|
85 |
// Constructor. |
// Constructor. |
86 |
qsamplerDevice(lscp_client_t *pClient, |
qsamplerDevice(lscp_client_t *pClient, |
87 |
qsamplerDeviceType deviceType, int iDeviceID = -1); |
qsamplerDeviceType deviceType, int iDeviceID = -1); |
88 |
// Default destructor. |
// Default destructor. |
89 |
~qsamplerDevice(); |
~qsamplerDevice(); |
90 |
|
|
91 |
// Initializer. |
// Initializer. |
92 |
void setDevice(lscp_client_t *pClient, |
void setDevice(lscp_client_t *pClient, |
93 |
qsamplerDeviceType deviceType, int iDeviceID = -1); |
qsamplerDeviceType deviceType, int iDeviceID = -1); |
94 |
|
|
95 |
|
// Driver name initializer. |
96 |
|
void setDriver(lscp_client_t *pClient, |
97 |
|
const QString& sDriverName); |
98 |
|
|
99 |
// Device property accessors. |
// Device property accessors. |
100 |
int deviceID() const; |
int deviceID() const; |
101 |
qsamplerDeviceType deviceType() const; |
qsamplerDeviceType deviceType() const; |
102 |
const QString& driverName() const; |
const QString& deviceTypeName() const; |
103 |
const QString& deviceName() const; |
const QString& driverName() const; |
104 |
|
const QString& deviceName() const; |
105 |
|
|
106 |
// Device parameters accessor. |
// Device parameters accessor. |
107 |
qsamplerDeviceParamMap& params(); |
qsamplerDeviceParamMap& params(); |
109 |
// Update/refresh device/driver data. |
// Update/refresh device/driver data. |
110 |
void refresh(); |
void refresh(); |
111 |
|
|
112 |
// Device enumerator. |
// Device ids enumerator. |
113 |
static int *getDevices(lscp_client_t *pClient, |
static int *getDevices(lscp_client_t *pClient, |
114 |
|
qsamplerDeviceType deviceType); |
115 |
|
|
116 |
|
// Driver names enumerator. |
117 |
|
static QStringList getDrivers(lscp_client_t *pClient, |
118 |
qsamplerDeviceType deviceType); |
qsamplerDeviceType deviceType); |
119 |
|
|
120 |
private: |
private: |
121 |
|
|
122 |
// Instance variables. |
// Instance variables. |
123 |
int m_iDeviceID; |
int m_iDeviceID; |
124 |
qsamplerDeviceType m_deviceType; |
qsamplerDeviceType m_deviceType; |
125 |
QString m_sDriverName; |
QString m_sDeviceType; |
126 |
QString m_sDeviceName; |
QString m_sDriverName; |
127 |
|
QString m_sDeviceName; |
128 |
|
|
129 |
// Device parameter list. |
// Device parameter list. |
130 |
qsamplerDeviceParamMap m_params; |
qsamplerDeviceParamMap m_params; |
139 |
{ |
{ |
140 |
public: |
public: |
141 |
|
|
142 |
// Constructors. |
// Constructors. |
143 |
qsamplerDeviceItem(QListView *pListView, lscp_client_t *pClient, |
qsamplerDeviceItem(QListView *pListView, lscp_client_t *pClient, |
144 |
qsamplerDevice::qsamplerDeviceType deviceType); |
qsamplerDevice::qsamplerDeviceType deviceType); |
145 |
qsamplerDeviceItem(QListViewItem *pItem, lscp_client_t *pClient, |
qsamplerDeviceItem(QListViewItem *pItem, lscp_client_t *pClient, |
146 |
qsamplerDevice::qsamplerDeviceType deviceType, int iDeviceID); |
qsamplerDevice::qsamplerDeviceType deviceType, int iDeviceID); |
147 |
// Default destructor. |
// Default destructor. |
148 |
~qsamplerDeviceItem(); |
~qsamplerDeviceItem(); |
149 |
|
|
150 |
// Instance accessors. |
// Instance accessors. |
151 |
const qsamplerDevice& device(); |
qsamplerDevice& device(); |
152 |
|
|
153 |
// To virtually distinguish between list view items. |
// To virtually distinguish between list view items. |
154 |
virtual int rtti() const; |
virtual int rtti() const; |
155 |
|
|
156 |
private: |
private: |
157 |
|
|
158 |
// Instance variables. |
// Instance variables. |
159 |
qsamplerDevice m_device; |
qsamplerDevice m_device; |
160 |
}; |
}; |
161 |
|
|
162 |
|
|
166 |
|
|
167 |
class qsamplerDeviceParamTable : public QTable |
class qsamplerDeviceParamTable : public QTable |
168 |
{ |
{ |
169 |
Q_OBJECT |
Q_OBJECT |
170 |
|
|
171 |
public: |
public: |
172 |
|
|
173 |
// Constructor. |
// Constructor. |
174 |
qsamplerDeviceParamTable(QWidget *pParent = 0, const char *pszName = 0); |
qsamplerDeviceParamTable(QWidget *pParent = 0, const char *pszName = 0); |
175 |
// Default destructor. |
// Default destructor. |
176 |
~qsamplerDeviceParamTable(); |
~qsamplerDeviceParamTable(); |
177 |
|
|
178 |
// Client/device descriptor selector. |
// Client/device descriptor selector. |
179 |
void setDevice(lscp_client_t *pClient, |
void refresh(qsamplerDevice& device); |
180 |
qsamplerDevice::qsamplerDeviceType deviceType, int iDeviceID = -1); |
}; |
181 |
|
|
|
// Client/device descriptor accessors. |
|
|
lscp_client_t *client(); |
|
|
int deviceID(); |
|
182 |
|
|
183 |
// The main table refresher. |
//------------------------------------------------------------------------- |
184 |
void refresh(); |
// qsamplerDeviceParamTableSpinBox - Custom spin box for parameter table. |
185 |
|
// |
186 |
|
|
187 |
|
class qsamplerDeviceParamTableSpinBox : public QTableItem |
188 |
|
{ |
189 |
|
public: |
190 |
|
|
191 |
|
// Constructor. |
192 |
|
qsamplerDeviceParamTableSpinBox (QTable *pTable, EditType editType); |
193 |
|
|
194 |
|
// Public accessors. |
195 |
|
void setMinValue(int iMinValue); |
196 |
|
void setMaxValue(int iMaxValue); |
197 |
|
void setValue(int iValue); |
198 |
|
|
199 |
|
protected: |
200 |
|
|
201 |
|
// Virtual implemetations. |
202 |
|
QWidget *createEditor() const; |
203 |
|
void setContentFromEditor(QWidget *pWidget); |
204 |
|
|
205 |
private: |
private: |
206 |
|
|
207 |
// LSCP client/device references. |
// Initial value holders. |
208 |
lscp_client_t *m_pClient; |
int m_iMinValue; |
209 |
qsamplerDevice::qsamplerDeviceType m_deviceType; |
int m_iMaxValue; |
210 |
int m_iDeviceID; |
int m_iValue; |
211 |
|
}; |
212 |
|
|
213 |
|
|
214 |
|
//------------------------------------------------------------------------- |
215 |
|
// qsamplerDeviceParamTableEditBox - Custom edit box for parameter table. |
216 |
|
// |
217 |
|
|
218 |
|
class qsamplerDeviceParamTableEditBox : public QTableItem |
219 |
|
{ |
220 |
|
public: |
221 |
|
|
222 |
|
// Constructor. |
223 |
|
qsamplerDeviceParamTableEditBox (QTable *pTable, EditType editType, |
224 |
|
const QString& sText); |
225 |
|
|
226 |
|
protected: |
227 |
|
|
228 |
|
// Virtual implemetations. |
229 |
|
QWidget *createEditor() const; |
230 |
|
void setContentFromEditor(QWidget *pWidget); |
231 |
}; |
}; |
232 |
|
|
233 |
|
|