/[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 303 by capela, Fri Nov 19 10:18:59 2004 UTC revision 961 by capela, Sun Dec 3 18:26:13 2006 UTC
# Line 1  Line 1 
1  // qsamplerChannel.h  // qsamplerChannel.h
2  //  //
3  /****************************************************************************  /****************************************************************************
4     Copyright (C) 2003-2004, 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);
75      int      instrumentNr();          // Special instrument file/name/number settler.
76      int      instrumentStatus();          bool     setInstrument(const QString& sInstrumentFile, int iInstrumentNr);
77      bool     loadInstrument(const QString& sInstrumentFile, int iInstrumentNr);  
78                // MIDI input driver (DEPRECATED).
79      // MIDI input driver (DEPRECATED).          const QString& midiDriver() const;
80      QString& midiDriver();          bool     setMidiDriver(const QString& sMidiDriver);
81      bool     setMidiDriver(const QString& sMidiDriver);  
82                // MIDI input device.
83      // MIDI input device.          int      midiDevice() const;
84      int      midiDevice();          bool     setMidiDevice(int iMidiDevice);
85      bool     setMidiDevice(int iMidiDevice);  
86                // MIDI input port.
87      // MIDI input port.          int      midiPort() const;
88      int      midiPort();          bool     setMidiPort(int iMidiPort);
89      bool     setMidiPort(int iMidiPort);  
90                // MIDI input channel.
91      // MIDI input channel.          int      midiChannel() const;
92      int      midiChannel();          bool     setMidiChannel(int iMidiChannel);
93      bool     setMidiChannel(int iMidiChannel);  
94                // Audio output driver (DEPRECATED).
95      // Audio output driver (DEPRECATED).          const QString& audioDriver() const;
96      QString& audioDriver();          bool     setAudioDriver(const QString& sAudioDriver);
97      bool     setAudioDriver(const QString& sAudioDriver);  
98            // Audio output device.
99      // Audio output device.          int      audioDevice() const;
100      int      audioDevice();          bool     setAudioDevice(int iAudioDevice);
101      bool     setAudioDevice(int iAudioDevice);  
102                // Sampler channel volume.
103      // Sampler channel volume.          float    volume() const;
104      float    volume();          bool     setVolume(float fVolume);
105      bool     setVolume(float fVolume);  
106            // Sampler channel mute state.
107      // Channel info structure map executive.          bool     channelMute() const;
108      bool     updateChannelInfo();          bool     setChannelMute(bool bMute);
109    
110      // Reset channel method.          // Sampler channel solo state.
111      bool     resetChannel();          bool     channelSolo() const;
112            bool     setChannelSolo(bool bSolo);
113      // Channel setup dialog form.  
114      bool     channelSetup(QWidget *pParent);          // Audio routing accessors.
115            int      audioChannel(int iAudioOut) const;
116      // Message logging methods (brainlessly mapped to main form's).          bool     setAudioChannel(int iAudioOut, int iAudioIn);
117      void     appendMessages       (const QString & s);          // The audio routing map itself.
118      void     appendMessagesColor  (const QString & s, const QString & c);          const qsamplerChannelRoutingMap& audioRouting() const;
119      void     appendMessagesText   (const QString & s);  
120      void     appendMessagesError  (const QString & s);          // Istrument name remapper.
121      void     appendMessagesClient (const QString & s);          void     updateInstrumentName();
122    
123      // Context menu event handler.          // Channel info structure map executive.
124      void contextMenuEvent(QContextMenuEvent *pEvent);          bool     updateChannelInfo();
125    
126      // Retrieve the available instrument name(s) of an instrument file (.gig).          // Channel setup dialog form.
127      static QString     getInstrumentName (const QString& sInstrumentFile, int iInstrumentNr);          bool     channelSetup(QWidget *pParent);
128      static QStringList getInstrumentList (const QString& sInstrumentFile);  
129            // Reset channel method.
130            bool     channelReset();
131    
132            // Message logging methods (brainlessly mapped to main form's).
133            void     appendMessages       (const QString & s) const;
134            void     appendMessagesColor  (const QString & s, const QString & c) const;
135            void     appendMessagesText   (const QString & s) const;
136            void     appendMessagesError  (const QString & s) const;
137            void     appendMessagesClient (const QString & s) const;
138    
139            // Context menu event handler.
140            void contextMenuEvent(QContextMenuEvent *pEvent);
141    
142            // Common (invalid) name-helpers.
143            static QString noEngineName();
144            static QString noInstrumentName();
145            static QString loadingInstrument();
146    
147            // Check whether a given file is an instrument file.
148            static bool isInstrumentFile (const QString& sInstrumentFile);
149    
150            // Retrieve the available instrument name(s) of an instrument file (.gig).
151            static QString getInstrumentName (const QString& sInstrumentFile,
152                                                            int iInstrumentNr, bool bInstrumentNames);
153            static QStringList getInstrumentList (const QString& sInstrumentFile,
154                                                            bool bInstrumentNames);
155    
156  private:  private:
157    
158      // Main application form reference.          // Unique channel identifier.
159      qsamplerMainForm *m_pMainForm;          int     m_iChannelID;
160    
161            // Sampler channel info map.
162            QString m_sEngineName;
163            QString m_sInstrumentName;
164            QString m_sInstrumentFile;
165            int     m_iInstrumentNr;
166            int     m_iInstrumentStatus;
167            QString m_sMidiDriver;
168            int     m_iMidiDevice;
169            int     m_iMidiPort;
170            int     m_iMidiChannel;
171            QString m_sAudioDriver;
172            int     m_iAudioDevice;
173            float   m_fVolume;
174            bool    m_bMute;
175            bool    m_bSolo;
176    
177            // The audio routing mapping.
178            qsamplerChannelRoutingMap m_audioRouting;
179    };
180    
181    
182    //-------------------------------------------------------------------------
183    // qsamplerChannelRoutingTable - Channel routing table widget.
184    //
185    
186    class qsamplerChannelRoutingTable : public QTable
187    {
188            Q_OBJECT
189    
190    public:
191    
192            // Constructor.
193            qsamplerChannelRoutingTable(QWidget *pParent = 0, const char *pszName = 0);
194            // Default destructor.
195            ~qsamplerChannelRoutingTable();
196    
197            // Common parameter table renderer.
198            void refresh(qsamplerDevice *pDevice,
199                    const qsamplerChannelRoutingMap& routing);
200    
201            // Commit any pending editing.
202            void flush();
203    };
204    
     // Unique channel identifier.  
     int     m_iChannelID;  
205    
206      // Sampler channel info map.  //-------------------------------------------------------------------------
207      QString m_sEngineName;  // qsamplerChannelRoutingComboBox - Custom combo box for routing table.
208      QString m_sInstrumentFile;  //
209      int     m_iInstrumentNr;  
210      int     m_iInstrumentStatus;  class qsamplerChannelRoutingComboBox : public QTableItem
211      QString m_sMidiDriver;          // DEPRECATED.  {
212      int     m_iMidiDevice;  public:
213      int     m_iMidiPort;  
214      int     m_iMidiChannel;          // Constructor.
215      QString m_sAudioDriver;         // DEPRECATED.          qsamplerChannelRoutingComboBox(QTable *pTable,
216      int     m_iAudioDevice;                  const QStringList& list, const QPixmap& pixmap);
217      float   m_fVolume;  
218            // Public accessors.
219            void setCurrentItem(int iCurrentItem);
220            int currentItem() const;
221    
222    protected:
223    
224            // Virtual implemetations.
225            QWidget *createEditor() const;
226            void setContentFromEditor(QWidget *pWidget);
227    
228    private:
229    
230            // Initial value holders
231            QStringList m_list;
232            int m_iCurrentItem;
233  };  };
234    
235    
236  #endif  // __qsamplerChannel_h  #endif  // __qsamplerChannel_h
237    
238    

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

  ViewVC Help
Powered by ViewVC