/[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 442 by capela, Thu Mar 10 15:48:38 2005 UTC revision 961 by capela, Sun Dec 3 18:26:13 2006 UTC
# Line 1  Line 1 
1  // qsamplerDevice.h  // qsamplerDevice.h
2  //  //
3  /****************************************************************************  /****************************************************************************
4     Copyright (C) 2005, rncbc aka Rui Nuno Capela. All rights reserved.     Copyright (C) 2004-2006, 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 13  Line 13 
13     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14     GNU General Public License for more details.     GNU General Public License for more details.
15    
16     You should have received a copy of the GNU General Public License     You should have received a copy of the GNU General Public License along
17     along with this program; if not, write to the Free Software     with this program; if not, write to the Free Software Foundation, Inc.,
18     Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.     51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19    
20  *****************************************************************************/  *****************************************************************************/
21    
# 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 declarations.
38    class qsamplerMainForm;
39    class qsamplerDevicePort;
40    
41    
42  //-------------------------------------------------------------------------  //-------------------------------------------------------------------------
43  // qsamplerDeviceParam - MIDI/Audio Device parameter structure.  // qsamplerDeviceParam - MIDI/Audio Device parameter structure.
# Line 67  public: Line 71  public:
71          QString         value;          QString         value;
72  };  };
73    
74  // A typedef'd parameter QMap.  // Typedef'd parameter QMap.
75  typedef QMap<QString, qsamplerDeviceParam> qsamplerDeviceParamMap;  typedef QMap<QString, qsamplerDeviceParam> qsamplerDeviceParamMap;
76    
77    // Typedef'd device port/channels QptrList.
78    typedef QPtrList<qsamplerDevicePort> qsamplerDevicePortList;
79    
80    
81  //-------------------------------------------------------------------------  //-------------------------------------------------------------------------
82  // qsamplerDevice - MIDI/Audio Device structure.  // qsamplerDevice - MIDI/Audio Device structure.
# Line 83  public: Line 90  public:
90          enum qsamplerDeviceType { None, Midi, Audio };          enum qsamplerDeviceType { None, Midi, Audio };
91    
92          // Constructor.          // Constructor.
93          qsamplerDevice(lscp_client_t *pClient,          qsamplerDevice(qsamplerDeviceType deviceType, int iDeviceID = -1);
94                  qsamplerDeviceType deviceType, int iDeviceID = -1);          // Copy constructor.
95        qsamplerDevice(const qsamplerDevice& device);
96          // Default destructor.          // Default destructor.
97          ~qsamplerDevice();          ~qsamplerDevice();
98    
99          // Initializer.          // Initializer.
100          void setDevice(lscp_client_t *pClient,          void setDevice(qsamplerDeviceType deviceType, int iDeviceID = -1);
                 qsamplerDeviceType deviceType, int iDeviceID = -1);  
101    
102          // Driver name initializer.          // Driver name initializer.
103          void setDriver(lscp_client_t *pClient,          void setDriver(const QString& sDriverName);
                 const QString& sDriverName);  
104    
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;          const QString&      deviceTypeName() const;
109          const QString&      driverName() const;          const QString&      driverName() const;
110          const QString&      deviceName() const;          // Special device name formatter.
111            QString deviceName() const;
112    
113            // Set the proper device parameter value.
114            bool setParam (const QString& sParam, const QString& sValue);
115    
116          // Device parameters accessor.          // Device parameters accessor.
117          qsamplerDeviceParamMap& params();          const qsamplerDeviceParamMap& params() const;
118    
119            // Device port/channel list accessor.
120            qsamplerDevicePortList& ports();
121    
122          // Update/refresh device/driver data.          // Device parameter dependency list refreshner.
123          void refresh();          int refreshParams();
124            // Device port/channel list refreshner.
125            int refreshPorts();
126            // Refresh/set dependencies given that some parameter has changed.
127            int refreshDepends(const QString& sParam);
128    
129            // Create/destroy device methods.
130            bool createDevice();
131            bool deleteDevice();
132    
133            // Message logging methods (brainlessly mapped to main form's).
134            void appendMessages       (const QString& s) const;
135            void appendMessagesColor  (const QString& s, const QString & c) const;
136            void appendMessagesText   (const QString& s) const;
137            void appendMessagesError  (const QString& s) const;
138            void appendMessagesClient (const QString& s) const;
139    
140          // Device ids enumerator.          // Device ids enumerator.
141          static int *getDevices(lscp_client_t *pClient,          static int *getDevices(lscp_client_t *pClient,
# Line 119  public: Line 147  public:
147    
148  private:  private:
149    
150            // Refresh/set given parameter based on driver supplied dependencies.
151            int refreshParam(const QString& sParam);
152    
153            // Main application form reference.
154            qsamplerMainForm  *m_pMainForm;
155    
156          // Instance variables.          // Instance variables.
157          int                m_iDeviceID;          int                m_iDeviceID;
158          qsamplerDeviceType m_deviceType;          qsamplerDeviceType m_deviceType;
# Line 128  private: Line 162  private:
162    
163          // Device parameter list.          // Device parameter list.
164          qsamplerDeviceParamMap m_params;          qsamplerDeviceParamMap m_params;
165    
166            // Device port/channel list.
167            qsamplerDevicePortList m_ports;
168    };
169    
170    
171    //-------------------------------------------------------------------------
172    // qsamplerDevicePort - MIDI/Audio Device port/channel structure.
173    //
174    
175    class qsamplerDevicePort
176    {
177    public:
178    
179            // Constructor.
180            qsamplerDevicePort(qsamplerDevice& device, int iPortID);
181            // Default destructor.
182            ~qsamplerDevicePort();
183    
184            // Initializer.
185            void setDevicePort(int iPortID);
186    
187            // Device port property accessors.
188            int            portID()   const;
189            const QString& portName() const;
190    
191            // Device port parameters accessor.
192            const qsamplerDeviceParamMap& params() const;
193    
194            // Set the proper device port/channel parameter value.
195            bool setParam (const QString& sParam, const QString& sValue);
196    
197    private:
198    
199            // Device reference.
200            qsamplerDevice& m_device;
201    
202            // Instance variables.
203            int     m_iPortID;
204            QString m_sPortName;
205    
206            // Device port parameter list.
207            qsamplerDeviceParamMap m_params;
208  };  };
209    
210    
# Line 140  class qsamplerDeviceItem : public QListV Line 217  class qsamplerDeviceItem : public QListV
217  public:  public:
218    
219          // Constructors.          // Constructors.
220          qsamplerDeviceItem(QListView *pListView, lscp_client_t *pClient,          qsamplerDeviceItem(QListView *pListView,
221                  qsamplerDevice::qsamplerDeviceType deviceType);                  qsamplerDevice::qsamplerDeviceType deviceType);
222          qsamplerDeviceItem(QListViewItem *pItem, lscp_client_t *pClient,          qsamplerDeviceItem(QListViewItem *pItem,
223                  qsamplerDevice::qsamplerDeviceType deviceType, int iDeviceID);                  qsamplerDevice::qsamplerDeviceType deviceType, int iDeviceID);
224          // Default destructor.          // Default destructor.
225          ~qsamplerDeviceItem();          ~qsamplerDeviceItem();
# Line 175  public: Line 252  public:
252          // Default destructor.          // Default destructor.
253          ~qsamplerDeviceParamTable();          ~qsamplerDeviceParamTable();
254    
255          // Client/device descriptor selector.          // Common parameter table renderer.
256          void refresh(qsamplerDevice& device);          void refresh(const qsamplerDeviceParamMap& params, bool bEditable);
257  };  };
258    
259    
# Line 189  class qsamplerDeviceParamTableSpinBox : Line 266  class qsamplerDeviceParamTableSpinBox :
266  public:  public:
267    
268          // Constructor.          // Constructor.
269          qsamplerDeviceParamTableSpinBox (QTable *pTable, EditType editType);          qsamplerDeviceParamTableSpinBox (QTable *pTable, EditType editType,
270                    const QString& sText);
271    
272          // Public accessors.          // Public accessors.
273          void setMinValue(int iMinValue);          void setMinValue(int iMinValue);
# Line 205  protected: Line 283  protected:
283  private:  private:
284    
285          // Initial value holders.          // Initial value holders.
286            int m_iValue;
287          int m_iMinValue;          int m_iMinValue;
288          int m_iMaxValue;          int m_iMaxValue;
         int m_iValue;  
289  };  };
290    
291    

Legend:
Removed from v.442  
changed lines
  Added in v.961

  ViewVC Help
Powered by ViewVC