34 |
// Special QListViewItem::rtti() unique return value. |
// Special QListViewItem::rtti() unique return value. |
35 |
#define QSAMPLER_DEVICE_ITEM 1001 |
#define QSAMPLER_DEVICE_ITEM 1001 |
36 |
|
|
37 |
// Early forward declaration. |
// Early forward declarations. |
38 |
|
class qsamplerMainForm; |
39 |
class qsamplerDevicePort; |
class qsamplerDevicePort; |
40 |
|
|
41 |
|
|
90 |
enum qsamplerDeviceType { None, Midi, Audio }; |
enum qsamplerDeviceType { None, Midi, Audio }; |
91 |
|
|
92 |
// Constructor. |
// Constructor. |
93 |
qsamplerDevice(lscp_client_t *pClient, |
qsamplerDevice(qsamplerMainForm *pMainForm, |
94 |
qsamplerDeviceType deviceType, int iDeviceID = -1); |
qsamplerDeviceType deviceType, int iDeviceID = -1); |
95 |
|
// Copy constructor. |
96 |
|
qsamplerDevice(const qsamplerDevice& device); |
97 |
// Default destructor. |
// Default destructor. |
98 |
~qsamplerDevice(); |
~qsamplerDevice(); |
99 |
|
|
100 |
// Initializer. |
// Initializer. |
101 |
void setDevice(lscp_client_t *pClient, |
void setDevice(qsamplerDeviceType deviceType, int iDeviceID = -1); |
|
qsamplerDeviceType deviceType, int iDeviceID = -1); |
|
102 |
|
|
103 |
// Driver name initializer. |
// Driver name initializer. |
104 |
void setDriver(lscp_client_t *pClient, |
void setDriver(const QString& sDriverName); |
105 |
const QString& sDriverName); |
|
106 |
|
// LSCP client descriptor accessor. |
107 |
|
lscp_client_t *client() const; |
108 |
|
|
109 |
// Device property accessors. |
// Device property accessors. |
110 |
int deviceID() const; |
int deviceID() const; |
111 |
qsamplerDeviceType deviceType() const; |
qsamplerDeviceType deviceType() const; |
112 |
const QString& deviceTypeName() const; |
const QString& deviceTypeName() const; |
113 |
const QString& driverName() const; |
const QString& driverName() const; |
114 |
const QString& deviceName() const; |
// Special device name formatter. |
115 |
|
QString deviceName() const; |
116 |
|
|
117 |
// Set the proper device parameter value. |
// Set the proper device parameter value. |
118 |
void setParam (const QString& sParam, const QString& sValue); |
bool setParam (const QString& sParam, const QString& sValue); |
119 |
|
|
120 |
// Device parameters accessor. |
// Device parameters accessor. |
121 |
const qsamplerDeviceParamMap& params() const; |
const qsamplerDeviceParamMap& params() const; |
124 |
qsamplerDevicePortList& ports(); |
qsamplerDevicePortList& ports(); |
125 |
|
|
126 |
// Device parameter dependency list refreshner. |
// Device parameter dependency list refreshner. |
127 |
int refreshParams(lscp_client_t *pClient); |
int refreshParams(); |
128 |
// Device port/channel list refreshner. |
// Device port/channel list refreshner. |
129 |
int refreshPorts(lscp_client_t *pClient); |
int refreshPorts(); |
130 |
// Refresh/set dependencies given that some parameter has changed. |
// Refresh/set dependencies given that some parameter has changed. |
131 |
int refreshDepends(lscp_client_t *pClient, const QString& sParam); |
int refreshDepends(const QString& sParam); |
132 |
|
|
133 |
|
// Create/destroy device methods. |
134 |
|
bool createDevice(); |
135 |
|
bool deleteDevice(); |
136 |
|
|
137 |
|
// Message logging methods (brainlessly mapped to main form's). |
138 |
|
void appendMessages (const QString& s) const; |
139 |
|
void appendMessagesColor (const QString& s, const QString & c) const; |
140 |
|
void appendMessagesText (const QString& s) const; |
141 |
|
void appendMessagesError (const QString& s) const; |
142 |
|
void appendMessagesClient (const QString& s) const; |
143 |
|
|
144 |
// Device ids enumerator. |
// Device ids enumerator. |
145 |
static int *getDevices(lscp_client_t *pClient, |
static int *getDevices(lscp_client_t *pClient, |
152 |
private: |
private: |
153 |
|
|
154 |
// Refresh/set given parameter based on driver supplied dependencies. |
// Refresh/set given parameter based on driver supplied dependencies. |
155 |
int refreshParam(lscp_client_t *pClient, const QString& sParam); |
int refreshParam(const QString& sParam); |
156 |
|
|
157 |
|
// Main application form reference. |
158 |
|
qsamplerMainForm *m_pMainForm; |
159 |
|
|
160 |
// Instance variables. |
// Instance variables. |
161 |
int m_iDeviceID; |
int m_iDeviceID; |
181 |
public: |
public: |
182 |
|
|
183 |
// Constructor. |
// Constructor. |
184 |
qsamplerDevicePort(lscp_client_t *pClient, |
qsamplerDevicePort(qsamplerDevice& device, int iPortID); |
|
const qsamplerDevice& device, int iPortID); |
|
185 |
// Default destructor. |
// Default destructor. |
186 |
~qsamplerDevicePort(); |
~qsamplerDevicePort(); |
187 |
|
|
188 |
// Initializer. |
// Initializer. |
189 |
void setDevicePort(lscp_client_t *pClient, |
void setDevicePort(int iPortID); |
|
const qsamplerDevice& device, int iPortID); |
|
190 |
|
|
191 |
// Device port property accessors. |
// Device port property accessors. |
192 |
int portID() const; |
int portID() const; |
196 |
const qsamplerDeviceParamMap& params() const; |
const qsamplerDeviceParamMap& params() const; |
197 |
|
|
198 |
// Set the proper device port/channel parameter value. |
// Set the proper device port/channel parameter value. |
199 |
void setParam (const QString& sParam, const QString& sValue); |
bool setParam (const QString& sParam, const QString& sValue); |
200 |
|
|
201 |
private: |
private: |
202 |
|
|
203 |
|
// Device reference. |
204 |
|
qsamplerDevice& m_device; |
205 |
|
|
206 |
// Instance variables. |
// Instance variables. |
207 |
int m_iPortID; |
int m_iPortID; |
208 |
QString m_sPortName; |
QString m_sPortName; |
221 |
public: |
public: |
222 |
|
|
223 |
// Constructors. |
// Constructors. |
224 |
qsamplerDeviceItem(QListView *pListView, lscp_client_t *pClient, |
qsamplerDeviceItem(QListView *pListView, qsamplerMainForm *pMainForm, |
225 |
qsamplerDevice::qsamplerDeviceType deviceType); |
qsamplerDevice::qsamplerDeviceType deviceType); |
226 |
qsamplerDeviceItem(QListViewItem *pItem, lscp_client_t *pClient, |
qsamplerDeviceItem(QListViewItem *pItem, qsamplerMainForm *pMainForm, |
227 |
qsamplerDevice::qsamplerDeviceType deviceType, int iDeviceID); |
qsamplerDevice::qsamplerDeviceType deviceType, int iDeviceID); |
228 |
// Default destructor. |
// Default destructor. |
229 |
~qsamplerDeviceItem(); |
~qsamplerDeviceItem(); |