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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 759 - (show annotations) (download) (as text)
Sun Aug 28 11:44:10 2005 UTC (14 years, 5 months ago) by capela
File MIME type: text/x-c++hdr
File size: 6741 byte(s)
Usability changes on the new sampler channel audio routing functionality.

1 // qsamplerChannel.h
2 //
3 /****************************************************************************
4 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
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 #include <qtable.h>
26
27 #include <lscp/client.h>
28 #include <lscp/device.h>
29
30 #include "qsamplerOptions.h"
31
32 class qsamplerDevice;
33 class qsamplerMainForm;
34
35
36 // Typedef'd QMap.
37 typedef QMap<int, int> qsamplerChannelRoutingMap;
38
39
40 //-------------------------------------------------------------------------
41 // qsamplerChannel - Sampler channel structure.
42 //
43
44 class qsamplerChannel
45 {
46 public:
47
48 // Constructor.
49 qsamplerChannel(qsamplerMainForm *pMainForm, int iChannelID = -1);
50 // Default destructor.
51 ~qsamplerChannel();
52
53 // Main application form accessor.
54 qsamplerMainForm *mainForm() const;
55
56 // Main application options accessor.
57 qsamplerOptions *options() const;
58
59 // LSCP client descriptor accessor.
60 lscp_client_t * client() const;
61
62 // Add/remove sampler channel methods.
63 bool addChannel();
64 bool removeChannel();
65
66 // Sampler channel ID accessors.
67 int channelID() const;
68 void setChannelID(int iChannelID);
69
70 // Readable channel name.
71 QString channelName() const;
72
73 // Engine name property.
74 const QString& engineName() const;
75 bool loadEngine(const QString& sEngineName);
76
77 // Instrument file and index.
78 const QString& instrumentFile() const;
79 int instrumentNr() const;
80 const QString& instrumentName() const;
81 int instrumentStatus() const;
82
83 // Instrument file loader.
84 bool loadInstrument(const QString& sInstrumentFile, int iInstrumentNr);
85 // Special instrument file/name/number settler.
86 bool setInstrument(const QString& sInstrumentFile, int iInstrumentNr);
87
88 // MIDI input driver (DEPRECATED).
89 const QString& midiDriver() const;
90 bool setMidiDriver(const QString& sMidiDriver);
91
92 // MIDI input device.
93 int midiDevice() const;
94 bool setMidiDevice(int iMidiDevice);
95
96 // MIDI input port.
97 int midiPort() const;
98 bool setMidiPort(int iMidiPort);
99
100 // MIDI input channel.
101 int midiChannel() const;
102 bool setMidiChannel(int iMidiChannel);
103
104 // Audio output driver (DEPRECATED).
105 const QString& audioDriver() const;
106 bool setAudioDriver(const QString& sAudioDriver);
107
108 // Audio output device.
109 int audioDevice() const;
110 bool setAudioDevice(int iAudioDevice);
111
112 // 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:
167
168 // Main application form reference.
169 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 // 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 };
214
215
216 //-------------------------------------------------------------------------
217 // qsamplerChannelRoutingComboBox - Custom combo box for routing table.
218 //
219
220 class qsamplerChannelRoutingComboBox : public QTableItem
221 {
222 public:
223
224 // Constructor.
225 qsamplerChannelRoutingComboBox(QTable *pTable,
226 const QStringList& list, const QPixmap& pixmap);
227
228 // Public accessors.
229 void setCurrentItem(int iCurrentItem);
230 int currentItem() const;
231
232 protected:
233
234 // Virtual implemetations.
235 QWidget *createEditor() const;
236 void setContentFromEditor(QWidget *pWidget);
237
238 private:
239
240 // Initial value holders
241 QStringList m_list;
242 int m_iCurrentItem;
243 };
244
245
246 #endif // __qsamplerChannel_h
247
248
249 // end of qsamplerChannel.h

  ViewVC Help
Powered by ViewVC