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

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

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

revision 388 by capela, Thu Feb 17 17:27:59 2005 UTC revision 980 by capela, Sun Dec 17 22:29:29 2006 UTC
# Line 1  Line 1 
1  // qsamplerChannel.h  // qsamplerChannel.h
2  //  //
3  /****************************************************************************  /****************************************************************************
4     Copyright (C) 2003-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    
22  #ifndef __qsamplerChannel_h  #ifndef __qsamplerChannel_h
23  #define __qsamplerChannel_h  #define __qsamplerChannel_h
24    
25  #include <qobject.h>  #include <qtable.h>
26    
27  #include <lscp/client.h>  #include <lscp/client.h>
28  #include <lscp/device.h>  #include <lscp/device.h>
29    
30  #include "qsamplerOptions.h"  #include "qsamplerOptions.h"
31    
32  class qsamplerMainForm;  class qsamplerDevice;
33    
34    
35    // Typedef'd QMap.
36    typedef QMap<int, int> qsamplerChannelRoutingMap;
37    
38    
39  //-------------------------------------------------------------------------  //-------------------------------------------------------------------------
# Line 40  class qsamplerChannel Line 44  class qsamplerChannel
44  {  {
45  public:  public:
46    
47      // Constructor.          // Constructor.
48      qsamplerChannel(qsamplerMainForm *pMainForm, int iChannelID = -1);          qsamplerChannel(int iChannelID = -1);
49      // Default destructor.          // Default destructor.
50      ~qsamplerChannel();          ~qsamplerChannel();
51    
52      // Main application options accessor.          // Add/remove sampler channel methods.
53      qsamplerOptions *options();          bool     addChannel();
54            bool     removeChannel();
55      // LSCP client descriptor accessor.  
56      lscp_client_t * client();          // Sampler channel ID accessors.
57            int      channelID() const;
58      // Add/remove sampler channel methods.          void     setChannelID(int iChannelID);
59      bool     addChannel();  
60      bool     removeChannel();          // Readable channel name.
61            QString  channelName() const;
62      // Sampler channel ID accessors.  
63      int      channelID();          // Engine name property.
64      void     setChannelID(int iChannelID);          const QString& engineName() const;
65                bool     loadEngine(const QString& sEngineName);
66      // Readable channel name.  
67      QString  channelName();          // Instrument file and index.
68            const QString& instrumentFile() const;
69      // Engine name property.          int      instrumentNr() const;
70      QString& engineName();          const QString& instrumentName() const;
71      bool     loadEngine(const QString& sEngineName);          int      instrumentStatus() const;
72        
73      // Instrument file and index.          // Instrument file loader.
74      QString& instrumentFile();          bool     loadInstrument(const QString& sInstrumentFile, int iInstrumentNr);
     int      instrumentNr();  
     QString& instrumentName();  
     int      instrumentStatus();  
     bool     loadInstrument(const QString& sInstrumentFile, int iInstrumentNr);  
75          // Special instrument file/name/number settler.          // Special instrument file/name/number settler.
76      bool     setInstrument(const QString& sInstrumentFile, int iInstrumentNr);          bool     setInstrument(const QString& sInstrumentFile, int iInstrumentNr);
77    
78      // MIDI input driver (DEPRECATED).          // MIDI input driver (DEPRECATED).
79      QString& midiDriver();          const QString& midiDriver() const;
80      bool     setMidiDriver(const QString& sMidiDriver);          bool     setMidiDriver(const QString& sMidiDriver);
81        
82      // MIDI input device.          // MIDI input device.
83      int      midiDevice();          int      midiDevice() const;
84      bool     setMidiDevice(int iMidiDevice);          bool     setMidiDevice(int iMidiDevice);
85        
86      // MIDI input port.          // MIDI input port.
87      int      midiPort();          int      midiPort() const;
88      bool     setMidiPort(int iMidiPort);          bool     setMidiPort(int iMidiPort);
89        
90      // MIDI input channel.          // MIDI input channel.
91      int      midiChannel();          int      midiChannel() const;
92      bool     setMidiChannel(int iMidiChannel);          bool     setMidiChannel(int iMidiChannel);
93        
94      // Audio output driver (DEPRECATED).          // MIDI instrument map.
95      QString& audioDriver();          int      midiMap() const;
96      bool     setAudioDriver(const QString& sAudioDriver);          bool     setMidiMap(int iMidiMap);
97    
98      // Audio output device.          // Audio output driver (DEPRECATED).
99      int      audioDevice();          const QString& audioDriver() const;
100      bool     setAudioDevice(int iAudioDevice);          bool     setAudioDriver(const QString& sAudioDriver);
101        
102      // Sampler channel volume.          // Audio output device.
103      float    volume();          int      audioDevice() const;
104      bool     setVolume(float fVolume);          bool     setAudioDevice(int iAudioDevice);
105    
106      // Istrument name remapper.          // Sampler channel volume.
107      void     updateInstrumentName();          float    volume() const;
108            bool     setVolume(float fVolume);
109      // Channel info structure map executive.  
110      bool     updateChannelInfo();          // Sampler channel mute state.
111            bool     channelMute() const;
112      // Reset channel method.          bool     setChannelMute(bool bMute);
113      bool     resetChannel();  
114            // Sampler channel solo state.
115      // Channel setup dialog form.          bool     channelSolo() const;
116      bool     channelSetup(QWidget *pParent);          bool     setChannelSolo(bool bSolo);
117    
118      // Message logging methods (brainlessly mapped to main form's).          // Audio routing accessors.
119      void     appendMessages       (const QString & s);          int      audioChannel(int iAudioOut) const;
120      void     appendMessagesColor  (const QString & s, const QString & c);          bool     setAudioChannel(int iAudioOut, int iAudioIn);
121      void     appendMessagesText   (const QString & s);          // The audio routing map itself.
122      void     appendMessagesError  (const QString & s);          const qsamplerChannelRoutingMap& audioRouting() const;
123      void     appendMessagesClient (const QString & s);  
124            // Istrument name remapper.
125            void     updateInstrumentName();
126    
127            // Channel info structure map executive.
128            bool     updateChannelInfo();
129    
130            // Channel setup dialog form.
131            bool     channelSetup(QWidget *pParent);
132    
133            // Reset channel method.
134            bool     channelReset();
135    
136            // Message logging methods (brainlessly mapped to main form's).
137            void     appendMessages       (const QString & s) const;
138            void     appendMessagesColor  (const QString & s, const QString & c) const;
139            void     appendMessagesText   (const QString & s) const;
140            void     appendMessagesError  (const QString & s) const;
141            void     appendMessagesClient (const QString & s) const;
142    
143      // Context menu event handler.          // Context menu event handler.
144      void contextMenuEvent(QContextMenuEvent *pEvent);          void contextMenuEvent(QContextMenuEvent *pEvent);
145    
146          // Common (invalid) name-helpers.          // Common (invalid) name-helpers.
147      static QString noEngineName();          static QString noEngineName();
148      static QString noInstrumentName();          static QString noInstrumentName();
149            static QString loadingInstrument();
150    
151          // Check whether a given file is an instrument file.          // Check whether a given file is an instrument file.
152          static bool isInstrumentFile (const QString& sInstrumentFile);          static bool isInstrumentFile (const QString& sInstrumentFile);
153    
154      // Retrieve the available instrument name(s) of an instrument file (.gig).          // Retrieve the available instrument name(s) of an instrument file (.gig).
155      static QString getInstrumentName (const QString& sInstrumentFile,          static QString getInstrumentName (const QString& sInstrumentFile,
156                                                          int iInstrumentNr, bool bInstrumentNames);                                                          int iInstrumentNr, bool bInstrumentNames);
157      static QStringList getInstrumentList (const QString& sInstrumentFile,          static QStringList getInstrumentList (const QString& sInstrumentFile,
158                                                          bool bInstrumentNames);                                                          bool bInstrumentNames);
159    
160  private:  private:
161    
162      // Main application form reference.          // Unique channel identifier.
163      qsamplerMainForm *m_pMainForm;          int     m_iChannelID;
164    
165            // Sampler channel info map.
166            QString m_sEngineName;
167            QString m_sInstrumentName;
168            QString m_sInstrumentFile;
169            int     m_iInstrumentNr;
170            int     m_iInstrumentStatus;
171            QString m_sMidiDriver;
172            int     m_iMidiDevice;
173            int     m_iMidiPort;
174            int     m_iMidiChannel;
175            int     m_iMidiMap;
176            QString m_sAudioDriver;
177            int     m_iAudioDevice;
178            float   m_fVolume;
179            bool    m_bMute;
180            bool    m_bSolo;
181    
182            // The audio routing mapping.
183            qsamplerChannelRoutingMap m_audioRouting;
184    };
185    
186    
187    //-------------------------------------------------------------------------
188    // qsamplerChannelRoutingTable - Channel routing table widget.
189    //
190    
191    class qsamplerChannelRoutingTable : public QTable
192    {
193            Q_OBJECT
194    
195    public:
196    
197      // Unique channel identifier.          // Constructor.
198      int     m_iChannelID;          qsamplerChannelRoutingTable(QWidget *pParent = 0, const char *pszName = 0);
199            // Default destructor.
200            ~qsamplerChannelRoutingTable();
201    
202            // Common parameter table renderer.
203            void refresh(qsamplerDevice *pDevice,
204                    const qsamplerChannelRoutingMap& routing);
205    
206      // Sampler channel info map.          // Commit any pending editing.
207      QString m_sEngineName;          void flush();
     QString m_sInstrumentName;  
     QString m_sInstrumentFile;  
     int     m_iInstrumentNr;  
     int     m_iInstrumentStatus;  
     QString m_sMidiDriver;          // DEPRECATED.  
     int     m_iMidiDevice;  
     int     m_iMidiPort;  
     int     m_iMidiChannel;  
     QString m_sAudioDriver;         // DEPRECATED.  
     int     m_iAudioDevice;  
     float   m_fVolume;  
208  };  };
209    
210    
211    //-------------------------------------------------------------------------
212    // qsamplerChannelRoutingComboBox - Custom combo box for routing table.
213    //
214    
215    class qsamplerChannelRoutingComboBox : public QTableItem
216    {
217    public:
218    
219            // Constructor.
220            qsamplerChannelRoutingComboBox(QTable *pTable,
221                    const QStringList& list, const QPixmap& pixmap);
222    
223            // Public accessors.
224            void setCurrentItem(int iCurrentItem);
225            int currentItem() const;
226    
227    protected:
228    
229            // Virtual implemetations.
230            QWidget *createEditor() const;
231            void setContentFromEditor(QWidget *pWidget);
232    
233    private:
234    
235            // Initial value holders
236            QStringList m_list;
237            int m_iCurrentItem;
238    };
239    
240    
241  #endif  // __qsamplerChannel_h  #endif  // __qsamplerChannel_h
242    
243    

Legend:
Removed from v.388  
changed lines
  Added in v.980

  ViewVC Help
Powered by ViewVC