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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 767 - (hide annotations) (download) (as text)
Tue Aug 30 09:52:46 2005 UTC (14 years, 5 months ago) by capela
File MIME type: text/x-c++hdr
File size: 6789 byte(s)
* Sampler channel audio routing changes are now being
  properly flushed upon immediate dialog acceptance,

1 capela 264 // qsamplerChannel.h
2     //
3     /****************************************************************************
4 capela 341 Copyright (C) 2003-2005, rncbc aka Rui Nuno Capela. All rights reserved.
5 capela 264
6     This program is free software; you can redistribute it and/or
7     modify it under the terms of the GNU General Public License
8     as published by the Free Software Foundation; either version 2
9     of the License, or (at your option) any later version.
10    
11     This program is distributed in the hope that it will be useful,
12     but WITHOUT ANY WARRANTY; without even the implied warranty of
13     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14     GNU General Public License for more details.
15    
16     You should have received a copy of the GNU General Public License
17     along with this program; if not, write to the Free Software
18     Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19    
20     *****************************************************************************/
21    
22     #ifndef __qsamplerChannel_h
23     #define __qsamplerChannel_h
24    
25 capela 758 #include <qtable.h>
26 capela 264
27     #include <lscp/client.h>
28     #include <lscp/device.h>
29    
30     #include "qsamplerOptions.h"
31    
32 capela 758 class qsamplerDevice;
33 capela 264 class qsamplerMainForm;
34    
35    
36 capela 758 // Typedef'd QMap.
37     typedef QMap<int, int> qsamplerChannelRoutingMap;
38    
39    
40 capela 264 //-------------------------------------------------------------------------
41     // qsamplerChannel - Sampler channel structure.
42     //
43    
44     class qsamplerChannel
45     {
46     public:
47    
48 capela 467 // Constructor.
49     qsamplerChannel(qsamplerMainForm *pMainForm, int iChannelID = -1);
50     // Default destructor.
51     ~qsamplerChannel();
52 capela 264
53 capela 484 // Main application form accessor.
54     qsamplerMainForm *mainForm() const;
55 capela 490
56 capela 467 // Main application options accessor.
57 capela 484 qsamplerOptions *options() const;
58 capela 264
59 capela 467 // LSCP client descriptor accessor.
60 capela 484 lscp_client_t * client() const;
61 capela 295
62 capela 467 // Add/remove sampler channel methods.
63     bool addChannel();
64     bool removeChannel();
65 capela 295
66 capela 467 // Sampler channel ID accessors.
67 capela 484 int channelID() const;
68 capela 467 void setChannelID(int iChannelID);
69 capela 295
70 capela 467 // Readable channel name.
71 capela 484 QString channelName() const;
72 capela 467
73     // Engine name property.
74 capela 484 const QString& engineName() const;
75 capela 467 bool loadEngine(const QString& sEngineName);
76    
77     // Instrument file and index.
78 capela 484 const QString& instrumentFile() const;
79     int instrumentNr() const;
80     const QString& instrumentName() const;
81     int instrumentStatus() const;
82 capela 490
83 capela 484 // Instrument file loader.
84 capela 467 bool loadInstrument(const QString& sInstrumentFile, int iInstrumentNr);
85 capela 388 // Special instrument file/name/number settler.
86 capela 467 bool setInstrument(const QString& sInstrumentFile, int iInstrumentNr);
87 capela 344
88 capela 467 // MIDI input driver (DEPRECATED).
89 capela 484 const QString& midiDriver() const;
90 capela 467 bool setMidiDriver(const QString& sMidiDriver);
91 capela 264
92 capela 467 // MIDI input device.
93 capela 484 int midiDevice() const;
94 capela 467 bool setMidiDevice(int iMidiDevice);
95 capela 264
96 capela 467 // MIDI input port.
97 capela 484 int midiPort() const;
98 capela 467 bool setMidiPort(int iMidiPort);
99 capela 371
100 capela 467 // MIDI input channel.
101 capela 484 int midiChannel() const;
102 capela 467 bool setMidiChannel(int iMidiChannel);
103 capela 264
104 capela 467 // Audio output driver (DEPRECATED).
105 capela 484 const QString& audioDriver() const;
106 capela 467 bool setAudioDriver(const QString& sAudioDriver);
107 capela 303
108 capela 467 // Audio output device.
109 capela 484 int audioDevice() const;
110 capela 467 bool setAudioDevice(int iAudioDevice);
111 capela 400
112 capela 467 // Sampler channel volume.
113 capela 484 float volume() const;
114 capela 467 bool setVolume(float fVolume);
115 capela 264
116 capela 751 // 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 capela 758 // 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 capela 467 // Istrument name remapper.
131     void updateInstrumentName();
132 capela 303
133 capela 467 // 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 capela 484 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 capela 467
149     // Context menu event handler.
150     void contextMenuEvent(QContextMenuEvent *pEvent);
151    
152 capela 388 // Common (invalid) name-helpers.
153 capela 467 static QString noEngineName();
154     static QString noInstrumentName();
155 schoenebeck 519 static QString loadingInstrument();
156 capela 388
157     // Check whether a given file is an instrument file.
158     static bool isInstrumentFile (const QString& sInstrumentFile);
159    
160 capela 467 // Retrieve the available instrument name(s) of an instrument file (.gig).
161     static QString getInstrumentName (const QString& sInstrumentFile,
162 capela 344 int iInstrumentNr, bool bInstrumentNames);
163 capela 467 static QStringList getInstrumentList (const QString& sInstrumentFile,
164 capela 344 bool bInstrumentNames);
165 capela 299
166 capela 264 private:
167    
168 capela 467 // Main application form reference.
169     qsamplerMainForm *m_pMainForm;
170 capela 264
171 capela 467 // Unique channel identifier.
172     int m_iChannelID;
173 capela 264
174 capela 467 // 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 capela 490 QString m_sMidiDriver;
181 capela 467 int m_iMidiDevice;
182     int m_iMidiPort;
183     int m_iMidiChannel;
184 capela 490 QString m_sAudioDriver;
185 capela 467 int m_iAudioDevice;
186     float m_fVolume;
187 capela 751 bool m_bMute;
188     bool m_bSolo;
189 capela 758
190     // The audio routing mapping.
191     qsamplerChannelRoutingMap m_audioRouting;
192 capela 264 };
193    
194 capela 758
195     //-------------------------------------------------------------------------
196     // qsamplerChannelRoutingTable - Channel routing table widget.
197     //
198    
199     class qsamplerChannelRoutingTable : public QTable
200     {
201     Q_OBJECT
202    
203     public:
204    
205     // Constructor.
206     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 capela 767
214     // Commit any pending editing.
215     void flush();
216 capela 758 };
217    
218    
219 capela 759 //-------------------------------------------------------------------------
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 capela 264 #endif // __qsamplerChannel_h
250    
251    
252     // end of qsamplerChannel.h

  ViewVC Help
Powered by ViewVC