/[svn]/qsampler/trunk/src/qsamplerDevice.h
ViewVC logotype

Annotation of /qsampler/trunk/src/qsamplerDevice.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 463 - (hide annotations) (download) (as text)
Tue Mar 15 15:32:29 2005 UTC (19 years, 1 month ago) by capela
File MIME type: text/x-c++hdr
File size: 7279 byte(s)
* Device port/channel configuration is now complete (EXPERIMENTAL).

1 capela 426 // qsamplerDevice.h
2     //
3     /****************************************************************************
4 capela 430 Copyright (C) 2005, rncbc aka Rui Nuno Capela. All rights reserved.
5 capela 426
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     You should have received a copy of the GNU General Public License
17     along with this program; if not, write to the Free Software
18     Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19    
20     *****************************************************************************/
21    
22     #ifndef __qsamplerDevice_h
23     #define __qsamplerDevice_h
24    
25 capela 429 #include <qlistview.h>
26 capela 426 #include <qtable.h>
27    
28     #include <lscp/client.h>
29     #include <lscp/device.h>
30    
31     #include "qsamplerOptions.h"
32    
33    
34 capela 430 // Special QListViewItem::rtti() unique return value.
35 capela 429 #define QSAMPLER_DEVICE_ITEM 1001
36    
37 capela 463 // Early forward declaration.
38     class qsamplerDevicePort;
39 capela 429
40 capela 463
41 capela 426 //-------------------------------------------------------------------------
42 capela 429 // qsamplerDeviceParam - MIDI/Audio Device parameter structure.
43 capela 426 //
44 capela 429 class qsamplerDeviceParam
45     {
46     public:
47 capela 426
48 capela 431 // Constructor.
49     qsamplerDeviceParam(lscp_param_info_t *pParamInfo = NULL,
50 capela 429 const char *pszValue = NULL);
51 capela 431 // Default destructor.
52     ~qsamplerDeviceParam();
53 capela 429
54     // Initializer.
55     void setParam(lscp_param_info_t *pParamInfo,
56     const char *pszValue = NULL);
57    
58 capela 431 // Info structure field members.
59     lscp_type_t type;
60     QString description;
61     bool mandatory;
62     bool fix;
63     bool multiplicity;
64     QStringList depends;
65     QString defaultv;
66     QString range_min;
67     QString range_max;
68     QStringList possibilities;
69     // The current parameter value.
70     QString value;
71 capela 429 };
72    
73 capela 463 // Typedef'd parameter QMap.
74 capela 429 typedef QMap<QString, qsamplerDeviceParam> qsamplerDeviceParamMap;
75    
76 capela 463 // Typedef'd device port/channels QptrList.
77     typedef QPtrList<qsamplerDevicePort> qsamplerDevicePortList;
78 capela 429
79 capela 463
80 capela 429 //-------------------------------------------------------------------------
81     // qsamplerDevice - MIDI/Audio Device structure.
82     //
83    
84     class qsamplerDevice
85 capela 426 {
86 capela 429 public:
87    
88 capela 431 // We use the same class for MIDI and audio device management
89 capela 436 enum qsamplerDeviceType { None, Midi, Audio };
90 capela 429
91 capela 431 // Constructor.
92     qsamplerDevice(lscp_client_t *pClient,
93 capela 429 qsamplerDeviceType deviceType, int iDeviceID = -1);
94 capela 431 // Default destructor.
95     ~qsamplerDevice();
96 capela 429
97     // Initializer.
98     void setDevice(lscp_client_t *pClient,
99     qsamplerDeviceType deviceType, int iDeviceID = -1);
100 capela 431
101     // Driver name initializer.
102     void setDriver(lscp_client_t *pClient,
103     const QString& sDriverName);
104    
105 capela 429 // Device property accessors.
106 capela 431 int deviceID() const;
107     qsamplerDeviceType deviceType() const;
108 capela 433 const QString& deviceTypeName() const;
109 capela 431 const QString& driverName() const;
110     const QString& deviceName() const;
111 capela 429
112 capela 463 // Set the proper device parameter value.
113     void setParam (const QString& sParam, const QString& sValue);
114    
115 capela 429 // Device parameters accessor.
116 capela 462 const qsamplerDeviceParamMap& params() const;
117 capela 429
118 capela 463 // Device port/channel list accessor.
119     qsamplerDevicePortList& ports();
120 capela 429
121 capela 463 // Device port/channel list refreshner.
122     void refresh(lscp_client_t *pClient);
123    
124 capela 430 // Device ids enumerator.
125 capela 431 static int *getDevices(lscp_client_t *pClient,
126 capela 429 qsamplerDeviceType deviceType);
127    
128 capela 430 // Driver names enumerator.
129 capela 431 static QStringList getDrivers(lscp_client_t *pClient,
130 capela 430 qsamplerDeviceType deviceType);
131    
132 capela 429 private:
133    
134     // Instance variables.
135 capela 431 int m_iDeviceID;
136     qsamplerDeviceType m_deviceType;
137 capela 433 QString m_sDeviceType;
138 capela 431 QString m_sDriverName;
139     QString m_sDeviceName;
140 capela 429
141     // Device parameter list.
142     qsamplerDeviceParamMap m_params;
143 capela 463
144     // Device port/channel list.
145     qsamplerDevicePortList m_ports;
146 capela 429 };
147    
148    
149     //-------------------------------------------------------------------------
150 capela 462 // qsamplerDevicePort - MIDI/Audio Device port/channel structure.
151     //
152    
153     class qsamplerDevicePort
154     {
155     public:
156    
157     // Constructor.
158     qsamplerDevicePort(lscp_client_t *pClient,
159     const qsamplerDevice& device, int iPortID);
160     // Default destructor.
161     ~qsamplerDevicePort();
162    
163     // Initializer.
164     void setDevicePort(lscp_client_t *pClient,
165     const qsamplerDevice& device, int iPortID);
166    
167     // Device port property accessors.
168     int portID() const;
169     const QString& portName() const;
170    
171     // Device port parameters accessor.
172     const qsamplerDeviceParamMap& params() const;
173    
174     // Set the proper device port/channel parameter value.
175     void setParam (const QString& sParam, const QString& sValue);
176    
177     private:
178    
179     // Instance variables.
180     int m_iPortID;
181     QString m_sPortName;
182    
183     // Device port parameter list.
184     qsamplerDeviceParamMap m_params;
185     };
186    
187    
188     //-------------------------------------------------------------------------
189 capela 429 // qsamplerDeviceItem - QListView device item.
190     //
191    
192     class qsamplerDeviceItem : public QListViewItem
193     {
194     public:
195    
196 capela 431 // Constructors.
197     qsamplerDeviceItem(QListView *pListView, lscp_client_t *pClient,
198 capela 429 qsamplerDevice::qsamplerDeviceType deviceType);
199 capela 431 qsamplerDeviceItem(QListViewItem *pItem, lscp_client_t *pClient,
200 capela 429 qsamplerDevice::qsamplerDeviceType deviceType, int iDeviceID);
201 capela 431 // Default destructor.
202     ~qsamplerDeviceItem();
203 capela 429
204 capela 431 // Instance accessors.
205     qsamplerDevice& device();
206 capela 429
207 capela 431 // To virtually distinguish between list view items.
208     virtual int rtti() const;
209 capela 429
210     private:
211    
212 capela 431 // Instance variables.
213     qsamplerDevice m_device;
214 capela 429 };
215    
216    
217     //-------------------------------------------------------------------------
218     // qsamplerDeviceParamTable - Device parameter view table.
219     //
220    
221     class qsamplerDeviceParamTable : public QTable
222     {
223 capela 431 Q_OBJECT
224 capela 426
225     public:
226    
227 capela 431 // Constructor.
228     qsamplerDeviceParamTable(QWidget *pParent = 0, const char *pszName = 0);
229     // Default destructor.
230     ~qsamplerDeviceParamTable();
231 capela 426
232 capela 462 // Common parameter table renderer.
233     void refresh(const qsamplerDeviceParamMap& params, bool bEditable);
234 capela 426 };
235    
236    
237 capela 442 //-------------------------------------------------------------------------
238     // qsamplerDeviceParamTableSpinBox - Custom spin box for parameter table.
239     //
240    
241     class qsamplerDeviceParamTableSpinBox : public QTableItem
242     {
243     public:
244    
245     // Constructor.
246 capela 447 qsamplerDeviceParamTableSpinBox (QTable *pTable, EditType editType,
247     const QString& sText);
248 capela 442
249     // Public accessors.
250     void setMinValue(int iMinValue);
251     void setMaxValue(int iMaxValue);
252     void setValue(int iValue);
253    
254     protected:
255    
256     // Virtual implemetations.
257     QWidget *createEditor() const;
258     void setContentFromEditor(QWidget *pWidget);
259    
260     private:
261    
262     // Initial value holders.
263 capela 447 int m_iValue;
264 capela 442 int m_iMinValue;
265     int m_iMaxValue;
266     };
267    
268    
269     //-------------------------------------------------------------------------
270     // qsamplerDeviceParamTableEditBox - Custom edit box for parameter table.
271     //
272    
273     class qsamplerDeviceParamTableEditBox : public QTableItem
274     {
275     public:
276    
277     // Constructor.
278     qsamplerDeviceParamTableEditBox (QTable *pTable, EditType editType,
279     const QString& sText);
280    
281     protected:
282    
283     // Virtual implemetations.
284     QWidget *createEditor() const;
285     void setContentFromEditor(QWidget *pWidget);
286     };
287    
288    
289 capela 426 #endif // __qsamplerDevice_h
290    
291    
292     // end of qsamplerDevice.h

  ViewVC Help
Powered by ViewVC