1 |
// qsamplerDevice.h |
// qsamplerDevice.h |
2 |
// |
// |
3 |
/**************************************************************************** |
/**************************************************************************** |
4 |
Copyright (C) 2005, rncbc aka Rui Nuno Capela. All rights reserved. |
Copyright (C) 2004-2006, 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 |
|
|
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(qsamplerDeviceType deviceType, int iDeviceID = -1); |
94 |
qsamplerDeviceType deviceType, int iDeviceID = -1); |
// Copy constructor. |
95 |
|
qsamplerDevice(const qsamplerDevice& device); |
96 |
// Default destructor. |
// Default destructor. |
97 |
~qsamplerDevice(); |
~qsamplerDevice(); |
98 |
|
|
99 |
// Initializer. |
// Initializer. |
100 |
void setDevice(lscp_client_t *pClient, |
void setDevice(qsamplerDeviceType deviceType, int iDeviceID = -1); |
|
qsamplerDeviceType deviceType, int iDeviceID = -1); |
|
101 |
|
|
102 |
// Driver name initializer. |
// Driver name initializer. |
103 |
void setDriver(lscp_client_t *pClient, |
void setDriver(const QString& sDriverName); |
|
const QString& sDriverName); |
|
104 |
|
|
105 |
// Device property accessors. |
// Device property accessors. |
106 |
int deviceID() const; |
int deviceID() const; |
107 |
qsamplerDeviceType deviceType() const; |
qsamplerDeviceType deviceType() const; |
108 |
const QString& deviceTypeName() const; |
const QString& deviceTypeName() const; |
109 |
const QString& driverName() const; |
const QString& driverName() const; |
110 |
const QString& deviceName() const; |
// Special device name formatter. |
111 |
|
QString deviceName() const; |
112 |
|
|
113 |
// Set the proper device parameter value. |
// Set the proper device parameter value. |
114 |
void setParam (const QString& sParam, const QString& sValue); |
bool setParam (const QString& sParam, const QString& sValue); |
115 |
|
|
116 |
// Device parameters accessor. |
// Device parameters accessor. |
117 |
const qsamplerDeviceParamMap& params() const; |
const qsamplerDeviceParamMap& params() const; |
120 |
qsamplerDevicePortList& ports(); |
qsamplerDevicePortList& ports(); |
121 |
|
|
122 |
// Device parameter dependency list refreshner. |
// Device parameter dependency list refreshner. |
123 |
int refreshParams(lscp_client_t *pClient); |
int refreshParams(); |
124 |
// Device port/channel list refreshner. |
// Device port/channel list refreshner. |
125 |
int refreshPorts(lscp_client_t *pClient); |
int refreshPorts(); |
126 |
// Refresh/set dependencies given that some parameter has changed. |
// Refresh/set dependencies given that some parameter has changed. |
127 |
int refreshDepends(lscp_client_t *pClient, const QString& sParam); |
int refreshDepends(const QString& sParam); |
128 |
|
|
129 |
|
// Create/destroy device methods. |
130 |
|
bool createDevice(); |
131 |
|
bool deleteDevice(); |
132 |
|
|
133 |
|
// Message logging methods (brainlessly mapped to main form's). |
134 |
|
void appendMessages (const QString& s) const; |
135 |
|
void appendMessagesColor (const QString& s, const QString & c) const; |
136 |
|
void appendMessagesText (const QString& s) const; |
137 |
|
void appendMessagesError (const QString& s) const; |
138 |
|
void appendMessagesClient (const QString& s) const; |
139 |
|
|
140 |
// Device ids enumerator. |
// Device ids enumerator. |
141 |
static int *getDevices(lscp_client_t *pClient, |
static int *getDevices(lscp_client_t *pClient, |
148 |
private: |
private: |
149 |
|
|
150 |
// Refresh/set given parameter based on driver supplied dependencies. |
// Refresh/set given parameter based on driver supplied dependencies. |
151 |
int refreshParam(lscp_client_t *pClient, const QString& sParam); |
int refreshParam(const QString& sParam); |
152 |
|
|
153 |
|
// Main application form reference. |
154 |
|
qsamplerMainForm *m_pMainForm; |
155 |
|
|
156 |
// Instance variables. |
// Instance variables. |
157 |
int m_iDeviceID; |
int m_iDeviceID; |
162 |
|
|
163 |
// Device parameter list. |
// Device parameter list. |
164 |
qsamplerDeviceParamMap m_params; |
qsamplerDeviceParamMap m_params; |
165 |
|
|
166 |
// Device port/channel list. |
// Device port/channel list. |
167 |
qsamplerDevicePortList m_ports; |
qsamplerDevicePortList m_ports; |
168 |
}; |
}; |
177 |
public: |
public: |
178 |
|
|
179 |
// Constructor. |
// Constructor. |
180 |
qsamplerDevicePort(lscp_client_t *pClient, |
qsamplerDevicePort(qsamplerDevice& device, int iPortID); |
|
const qsamplerDevice& device, int iPortID); |
|
181 |
// Default destructor. |
// Default destructor. |
182 |
~qsamplerDevicePort(); |
~qsamplerDevicePort(); |
183 |
|
|
184 |
// Initializer. |
// Initializer. |
185 |
void setDevicePort(lscp_client_t *pClient, |
void setDevicePort(int iPortID); |
|
const qsamplerDevice& device, int iPortID); |
|
186 |
|
|
187 |
// Device port property accessors. |
// Device port property accessors. |
188 |
int portID() const; |
int portID() const; |
192 |
const qsamplerDeviceParamMap& params() const; |
const qsamplerDeviceParamMap& params() const; |
193 |
|
|
194 |
// Set the proper device port/channel parameter value. |
// Set the proper device port/channel parameter value. |
195 |
void setParam (const QString& sParam, const QString& sValue); |
bool setParam (const QString& sParam, const QString& sValue); |
196 |
|
|
197 |
private: |
private: |
198 |
|
|
199 |
|
// Device reference. |
200 |
|
qsamplerDevice& m_device; |
201 |
|
|
202 |
// Instance variables. |
// Instance variables. |
203 |
int m_iPortID; |
int m_iPortID; |
204 |
QString m_sPortName; |
QString m_sPortName; |
217 |
public: |
public: |
218 |
|
|
219 |
// Constructors. |
// Constructors. |
220 |
qsamplerDeviceItem(QListView *pListView, lscp_client_t *pClient, |
qsamplerDeviceItem(QListView *pListView, |
221 |
qsamplerDevice::qsamplerDeviceType deviceType); |
qsamplerDevice::qsamplerDeviceType deviceType); |
222 |
qsamplerDeviceItem(QListViewItem *pItem, lscp_client_t *pClient, |
qsamplerDeviceItem(QListViewItem *pItem, |
223 |
qsamplerDevice::qsamplerDeviceType deviceType, int iDeviceID); |
qsamplerDevice::qsamplerDeviceType deviceType, int iDeviceID); |
224 |
// Default destructor. |
// Default destructor. |
225 |
~qsamplerDeviceItem(); |
~qsamplerDeviceItem(); |