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

Legend:
Removed from v.264  
changed lines
  Added in v.767

  ViewVC Help
Powered by ViewVC