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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 429 - (hide annotations) (download) (as text)
Tue Mar 8 14:56:05 2005 UTC (16 years, 10 months ago) by capela
File MIME type: text/x-c++hdr
File size: 4983 byte(s)
On-going with new device configuration interface.

1 capela 426 // qsamplerDevice.h
2     //
3     /****************************************************************************
4     Copyright (C) 2003-2005, rncbc aka Rui Nuno Capela. All rights reserved.
5    
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 429 // Special QListViewItem::rtti() return values.
35     #define QSAMPLER_DEVICE_ITEM 1001
36    
37    
38 capela 426 //-------------------------------------------------------------------------
39 capela 429 // qsamplerDeviceParam - MIDI/Audio Device parameter structure.
40 capela 426 //
41 capela 429 class qsamplerDeviceParam
42     {
43     public:
44 capela 426
45 capela 429 // Constructor.
46     qsamplerDeviceParam(lscp_param_info_t *pParamInfo = NULL,
47     const char *pszValue = NULL);
48     // Default destructor.
49     ~qsamplerDeviceParam();
50    
51     // Initializer.
52     void setParam(lscp_param_info_t *pParamInfo,
53     const char *pszValue = NULL);
54    
55     // Info structure field members.
56     lscp_type_t type;
57     QString description;
58     bool mandatory;
59     bool fix;
60     bool multiplicity;
61     QStringList depends;
62     QString defaultv;
63     QString range_min;
64     QString range_max;
65     QStringList possibilities;
66     // The current parameter value.
67     QString value;
68     };
69    
70     // A typedef'd parameter QMap.
71     typedef QMap<QString, qsamplerDeviceParam> qsamplerDeviceParamMap;
72    
73    
74     //-------------------------------------------------------------------------
75     // qsamplerDevice - MIDI/Audio Device structure.
76     //
77    
78     class qsamplerDevice
79 capela 426 {
80 capela 429 public:
81    
82     // We use the same class for MIDI and audio device management
83     enum qsamplerDeviceType { Midi, Audio };
84    
85     // Constructor.
86     qsamplerDevice(lscp_client_t *pClient,
87     qsamplerDeviceType deviceType, int iDeviceID = -1);
88     // Default destructor.
89     ~qsamplerDevice();
90    
91     // Initializer.
92     void setDevice(lscp_client_t *pClient,
93     qsamplerDeviceType deviceType, int iDeviceID = -1);
94    
95     // Device property accessors.
96     int deviceID() const;
97     qsamplerDeviceType deviceType() const;
98     const QString& driverName() const;
99     const QString& deviceName() const;
100    
101     // Device parameters accessor.
102     qsamplerDeviceParamMap& params();
103    
104     // Update/refresh device/driver data.
105     void refresh();
106    
107     // Device enumerator.
108     static int *getDevices(lscp_client_t *pClient,
109     qsamplerDeviceType deviceType);
110    
111     private:
112    
113     // Instance variables.
114     int m_iDeviceID;
115     qsamplerDeviceType m_deviceType;
116     QString m_sDriverName;
117     QString m_sDeviceName;
118    
119     // Device parameter list.
120     qsamplerDeviceParamMap m_params;
121     };
122    
123    
124     //-------------------------------------------------------------------------
125     // qsamplerDeviceItem - QListView device item.
126     //
127    
128     class qsamplerDeviceItem : public QListViewItem
129     {
130     public:
131    
132     // Constructors.
133     qsamplerDeviceItem(QListView *pListView, lscp_client_t *pClient,
134     qsamplerDevice::qsamplerDeviceType deviceType);
135     qsamplerDeviceItem(QListViewItem *pItem, lscp_client_t *pClient,
136     qsamplerDevice::qsamplerDeviceType deviceType, int iDeviceID);
137     // Default destructor.
138     ~qsamplerDeviceItem();
139    
140     // Instance accessors.
141     const qsamplerDevice& device();
142    
143     // To virtually distinguish between list view items.
144     virtual int rtti() const;
145    
146     private:
147    
148     // Instance variables.
149     qsamplerDevice m_device;
150     };
151    
152    
153     //-------------------------------------------------------------------------
154     // qsamplerDeviceParamTable - Device parameter view table.
155     //
156    
157     class qsamplerDeviceParamTable : public QTable
158     {
159 capela 426 Q_OBJECT
160    
161     public:
162    
163     // Constructor.
164 capela 429 qsamplerDeviceParamTable(QWidget *pParent = 0, const char *pszName = 0);
165 capela 426 // Default destructor.
166 capela 429 ~qsamplerDeviceParamTable();
167 capela 426
168 capela 429 // Client/device descriptor selector.
169     void setDevice(lscp_client_t *pClient,
170     qsamplerDevice::qsamplerDeviceType deviceType, int iDeviceID = -1);
171 capela 426
172 capela 429 // Client/device descriptor accessors.
173     lscp_client_t *client();
174     int deviceID();
175    
176     // The main table refresher.
177     void refresh();
178    
179 capela 426 private:
180    
181 capela 429 // LSCP client/device references.
182 capela 426 lscp_client_t *m_pClient;
183 capela 429 qsamplerDevice::qsamplerDeviceType m_deviceType;
184     int m_iDeviceID;
185 capela 426 };
186    
187    
188     #endif // __qsamplerDevice_h
189    
190    
191     // end of qsamplerDevice.h

  ViewVC Help
Powered by ViewVC