/[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 426 by capela, Mon Mar 7 11:09:32 2005 UTC revision 430 by capela, Tue Mar 8 17:23:29 2005 UTC
# Line 1  Line 1 
1  // qsamplerDevice.h  // qsamplerDevice.h
2  //  //
3  /****************************************************************************  /****************************************************************************
4     Copyright (C) 2003-2005, rncbc aka Rui Nuno Capela. All rights reserved.     Copyright (C) 2005, 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
# Line 22  Line 22 
22  #ifndef __qsamplerDevice_h  #ifndef __qsamplerDevice_h
23  #define __qsamplerDevice_h  #define __qsamplerDevice_h
24    
25    #include <qlistview.h>
26  #include <qtable.h>  #include <qtable.h>
27    
28  #include <lscp/client.h>  #include <lscp/client.h>
# Line 30  Line 31 
31  #include "qsamplerOptions.h"  #include "qsamplerOptions.h"
32    
33    
34    // Special QListViewItem::rtti() unique return value.
35    #define QSAMPLER_DEVICE_ITEM    1001
36    
37    
38    //-------------------------------------------------------------------------
39    // qsamplerDeviceParam - MIDI/Audio Device parameter structure.
40    //
41    class qsamplerDeviceParam
42    {
43    public:
44    
45        // 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  // qsamplerDeviceParameterTable - Device parameter view table.  // qsamplerDevice - MIDI/Audio Device structure.
76  //  //
77    
78  class qsamplerDeviceParameterTable : public QTable  class qsamplerDevice
79    {
80    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 ids enumerator.
108        static int *getDevices(lscp_client_t *pClient,
109                    qsamplerDeviceType deviceType);
110    
111            // Driver names enumerator.
112        static QStringList getDrivers(lscp_client_t *pClient,
113                    qsamplerDeviceType deviceType);
114    
115    private:
116    
117            // Instance variables.
118        int                m_iDeviceID;
119        qsamplerDeviceType m_deviceType;
120        QString            m_sDriverName;
121        QString            m_sDeviceName;
122    
123            // Device parameter list.
124            qsamplerDeviceParamMap m_params;
125    };
126    
127    
128    //-------------------------------------------------------------------------
129    // qsamplerDeviceItem - QListView device item.
130    //
131    
132    class qsamplerDeviceItem : public QListViewItem
133    {
134    public:
135    
136        // Constructors.
137        qsamplerDeviceItem(QListView *pListView, lscp_client_t *pClient,
138                    qsamplerDevice::qsamplerDeviceType deviceType);
139        qsamplerDeviceItem(QListViewItem *pItem, lscp_client_t *pClient,
140                    qsamplerDevice::qsamplerDeviceType deviceType, int iDeviceID);
141        // Default destructor.
142        ~qsamplerDeviceItem();
143    
144        // Instance accessors.
145        const qsamplerDevice& device();
146    
147        // To virtually distinguish between list view items.
148        virtual int rtti() const;
149    
150    private:
151    
152        // Instance variables.
153        qsamplerDevice m_device;
154    };
155    
156    
157    //-------------------------------------------------------------------------
158    // qsamplerDeviceParamTable - Device parameter view table.
159    //
160    
161    class qsamplerDeviceParamTable : public QTable
162  {  {
163      Q_OBJECT      Q_OBJECT
164    
165  public:  public:
166    
167      // Constructor.      // Constructor.
168      qsamplerDeviceParameterTable(QWidget *pParent = 0, const char *pszName = 0);      qsamplerDeviceParamTable(QWidget *pParent = 0, const char *pszName = 0);
169      // Default destructor.      // Default destructor.
170      ~qsamplerDeviceParameterTable();      ~qsamplerDeviceParamTable();
   
     // LSCP client descriptor accessor.  
     void setClient(lscp_client_t *pClient);  
     lscp_client_t * client();  
171    
172        // Client/device descriptor selector.
173            void setDevice(lscp_client_t *pClient,
174                    qsamplerDevice::qsamplerDeviceType deviceType, int iDeviceID = -1);
175    
176        // Client/device descriptor accessors.
177            lscp_client_t *client();
178            int deviceID();
179    
180            // The main table refresher.
181            void refresh();
182            
183  private:  private:
184    
185      // LSCP client reference.      // LSCP client/device references.
186      lscp_client_t *m_pClient;      lscp_client_t *m_pClient;
187        qsamplerDevice::qsamplerDeviceType m_deviceType;
188        int m_iDeviceID;
189  };  };
190    
191    

Legend:
Removed from v.426  
changed lines
  Added in v.430

  ViewVC Help
Powered by ViewVC