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

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

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 431 by capela, Tue Mar 8 20:12:08 2005 UTC revision 467 by capela, Tue Mar 15 23:54:14 2005 UTC
# Line 34  Line 34 
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.
38    class qsamplerDevicePort;
39    
40    
41  //-------------------------------------------------------------------------  //-------------------------------------------------------------------------
42  // qsamplerDeviceParam - MIDI/Audio Device parameter structure.  // qsamplerDeviceParam - MIDI/Audio Device parameter structure.
# Line 67  public: Line 70  public:
70          QString         value;          QString         value;
71  };  };
72    
73  // A typedef'd parameter QMap.  // Typedef'd parameter QMap.
74  typedef QMap<QString, qsamplerDeviceParam> qsamplerDeviceParamMap;  typedef QMap<QString, qsamplerDeviceParam> qsamplerDeviceParamMap;
75    
76    // Typedef'd device port/channels QptrList.
77    typedef QPtrList<qsamplerDevicePort> qsamplerDevicePortList;
78    
79    
80  //-------------------------------------------------------------------------  //-------------------------------------------------------------------------
81  // qsamplerDevice - MIDI/Audio Device structure.  // qsamplerDevice - MIDI/Audio Device structure.
# Line 80  class qsamplerDevice Line 86  class qsamplerDevice
86  public:  public:
87    
88          // We use the same class for MIDI and audio device management          // We use the same class for MIDI and audio device management
89          enum qsamplerDeviceType { Midi, Audio };          enum qsamplerDeviceType { None, Midi, Audio };
90    
91          // Constructor.          // Constructor.
92          qsamplerDevice(lscp_client_t *pClient,          qsamplerDevice(lscp_client_t *pClient,
# Line 99  public: Line 105  public:
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;
109          const QString&      driverName() const;          const QString&      driverName() const;
110          const QString&      deviceName() const;          const QString&      deviceName() const;
111    
112            // Set the proper device parameter value.
113            void setParam (const QString& sParam, const QString& sValue);
114    
115          // Device parameters accessor.          // Device parameters accessor.
116          qsamplerDeviceParamMap& params();          const qsamplerDeviceParamMap& params() const;
117    
118            // Device port/channel list accessor.
119            qsamplerDevicePortList& ports();
120    
121          // Update/refresh device/driver data.          // Device parameter dependency list refreshner.
122          void refresh();          int refreshParams(lscp_client_t *pClient);
123            // Device port/channel list refreshner.
124            int refreshPorts(lscp_client_t *pClient);
125            // Refresh/set dependencies given that some parameter has changed.
126            int refreshDepends(lscp_client_t *pClient, const QString& sParam);
127    
128          // Device ids enumerator.          // Device ids enumerator.
129          static int *getDevices(lscp_client_t *pClient,          static int *getDevices(lscp_client_t *pClient,
# Line 118  public: Line 135  public:
135    
136  private:  private:
137    
138            // Refresh/set given parameter based on driver supplied dependencies.
139            int refreshParam(lscp_client_t *pClient, const QString& sParam);
140    
141          // Instance variables.          // Instance variables.
142          int                m_iDeviceID;          int                m_iDeviceID;
143          qsamplerDeviceType m_deviceType;          qsamplerDeviceType m_deviceType;
144            QString            m_sDeviceType;
145          QString            m_sDriverName;          QString            m_sDriverName;
146          QString            m_sDeviceName;          QString            m_sDeviceName;
147    
148          // Device parameter list.          // Device parameter list.
149          qsamplerDeviceParamMap m_params;          qsamplerDeviceParamMap m_params;
150            
151            // Device port/channel list.
152            qsamplerDevicePortList m_ports;
153    };
154    
155    
156    //-------------------------------------------------------------------------
157    // qsamplerDevicePort - MIDI/Audio Device port/channel structure.
158    //
159    
160    class qsamplerDevicePort
161    {
162    public:
163    
164            // Constructor.
165            qsamplerDevicePort(lscp_client_t *pClient,
166                    const qsamplerDevice& device, int iPortID);
167            // Default destructor.
168            ~qsamplerDevicePort();
169    
170            // Initializer.
171            void setDevicePort(lscp_client_t *pClient,
172                    const qsamplerDevice& device, int iPortID);
173    
174            // Device port property accessors.
175            int            portID()   const;
176            const QString& portName() const;
177    
178            // Device port parameters accessor.
179            const qsamplerDeviceParamMap& params() const;
180    
181            // Set the proper device port/channel parameter value.
182            void setParam (const QString& sParam, const QString& sValue);
183    
184    private:
185    
186            // Instance variables.
187            int     m_iPortID;
188            QString m_sPortName;
189    
190            // Device port parameter list.
191            qsamplerDeviceParamMap m_params;
192  };  };
193    
194    
# Line 173  public: Line 236  public:
236          // Default destructor.          // Default destructor.
237          ~qsamplerDeviceParamTable();          ~qsamplerDeviceParamTable();
238    
239          // Client/device descriptor selector.          // Common parameter table renderer.
240          void refresh(qsamplerDevice& device);          void refresh(const qsamplerDeviceParamMap& params, bool bEditable);
241    };
242    
243    
244    //-------------------------------------------------------------------------
245    // qsamplerDeviceParamTableSpinBox - Custom spin box for parameter table.
246    //
247    
248    class qsamplerDeviceParamTableSpinBox : public QTableItem
249    {
250    public:
251    
252            // Constructor.
253            qsamplerDeviceParamTableSpinBox (QTable *pTable, EditType editType,
254                    const QString& sText);
255    
256            // Public accessors.
257            void setMinValue(int iMinValue);
258            void setMaxValue(int iMaxValue);
259            void setValue(int iValue);
260    
261    protected:
262    
263            // Virtual implemetations.
264            QWidget *createEditor() const;
265            void setContentFromEditor(QWidget *pWidget);
266    
267    private:
268    
269            // Initial value holders.
270            int m_iValue;
271            int m_iMinValue;
272            int m_iMaxValue;
273    };
274    
275    
276    //-------------------------------------------------------------------------
277    // qsamplerDeviceParamTableEditBox - Custom edit box for parameter table.
278    //
279    
280    class qsamplerDeviceParamTableEditBox : public QTableItem
281    {
282    public:
283    
284            // Constructor.
285            qsamplerDeviceParamTableEditBox (QTable *pTable, EditType editType,
286                    const QString& sText);
287    
288    protected:
289    
290            // Virtual implemetations.
291            QWidget *createEditor() const;
292            void setContentFromEditor(QWidget *pWidget);
293  };  };
294    
295    

Legend:
Removed from v.431  
changed lines
  Added in v.467

  ViewVC Help
Powered by ViewVC