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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 433 - (hide annotations) (download) (as text)
Wed Mar 9 16:44:04 2005 UTC (19 years ago) by capela
File MIME type: text/x-c++hdr
File size: 4773 byte(s)
* Device configuration is now partially functional.

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    
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 431 // Constructor.
46     qsamplerDeviceParam(lscp_param_info_t *pParamInfo = NULL,
47 capela 429 const char *pszValue = NULL);
48 capela 431 // Default destructor.
49     ~qsamplerDeviceParam();
50 capela 429
51     // Initializer.
52     void setParam(lscp_param_info_t *pParamInfo,
53     const char *pszValue = NULL);
54    
55 capela 431 // 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 capela 429 };
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 capela 431 // We use the same class for MIDI and audio device management
83     enum qsamplerDeviceType { Midi, Audio };
84 capela 429
85 capela 431 // Constructor.
86     qsamplerDevice(lscp_client_t *pClient,
87 capela 429 qsamplerDeviceType deviceType, int iDeviceID = -1);
88 capela 431 // Default destructor.
89     ~qsamplerDevice();
90 capela 429
91     // Initializer.
92     void setDevice(lscp_client_t *pClient,
93     qsamplerDeviceType deviceType, int iDeviceID = -1);
94 capela 431
95     // Driver name initializer.
96     void setDriver(lscp_client_t *pClient,
97     const QString& sDriverName);
98    
99 capela 429 // Device property accessors.
100 capela 431 int deviceID() const;
101     qsamplerDeviceType deviceType() const;
102 capela 433 const QString& deviceTypeName() const;
103 capela 431 const QString& driverName() const;
104     const QString& deviceName() const;
105 capela 429
106     // Device parameters accessor.
107     qsamplerDeviceParamMap& params();
108    
109     // Update/refresh device/driver data.
110     void refresh();
111    
112 capela 430 // Device ids enumerator.
113 capela 431 static int *getDevices(lscp_client_t *pClient,
114 capela 429 qsamplerDeviceType deviceType);
115    
116 capela 430 // Driver names enumerator.
117 capela 431 static QStringList getDrivers(lscp_client_t *pClient,
118 capela 430 qsamplerDeviceType deviceType);
119    
120 capela 429 private:
121    
122     // Instance variables.
123 capela 431 int m_iDeviceID;
124     qsamplerDeviceType m_deviceType;
125 capela 433 QString m_sDeviceType;
126 capela 431 QString m_sDriverName;
127     QString m_sDeviceName;
128 capela 429
129     // Device parameter list.
130     qsamplerDeviceParamMap m_params;
131     };
132    
133    
134     //-------------------------------------------------------------------------
135     // qsamplerDeviceItem - QListView device item.
136     //
137    
138     class qsamplerDeviceItem : public QListViewItem
139     {
140     public:
141    
142 capela 431 // Constructors.
143     qsamplerDeviceItem(QListView *pListView, lscp_client_t *pClient,
144 capela 429 qsamplerDevice::qsamplerDeviceType deviceType);
145 capela 431 qsamplerDeviceItem(QListViewItem *pItem, lscp_client_t *pClient,
146 capela 429 qsamplerDevice::qsamplerDeviceType deviceType, int iDeviceID);
147 capela 431 // Default destructor.
148     ~qsamplerDeviceItem();
149 capela 429
150 capela 431 // Instance accessors.
151     qsamplerDevice& device();
152 capela 429
153 capela 431 // To virtually distinguish between list view items.
154     virtual int rtti() const;
155 capela 429
156     private:
157    
158 capela 431 // Instance variables.
159     qsamplerDevice m_device;
160 capela 429 };
161    
162    
163     //-------------------------------------------------------------------------
164     // qsamplerDeviceParamTable - Device parameter view table.
165     //
166    
167     class qsamplerDeviceParamTable : public QTable
168     {
169 capela 431 Q_OBJECT
170 capela 426
171     public:
172    
173 capela 431 // Constructor.
174     qsamplerDeviceParamTable(QWidget *pParent = 0, const char *pszName = 0);
175     // Default destructor.
176     ~qsamplerDeviceParamTable();
177 capela 426
178 capela 431 // Client/device descriptor selector.
179     void refresh(qsamplerDevice& device);
180 capela 426 };
181    
182    
183     #endif // __qsamplerDevice_h
184    
185    
186     // end of qsamplerDevice.h

  ViewVC Help
Powered by ViewVC