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 |
|
|
#include <qobject.h> |
26 |
|
|
|
27 |
|
|
#include <lscp/client.h> |
28 |
|
|
#include <lscp/device.h> |
29 |
|
|
|
30 |
|
|
#include "qsamplerOptions.h" |
31 |
|
|
|
32 |
|
|
class qsamplerMainForm; |
33 |
|
|
|
34 |
|
|
|
35 |
|
|
//------------------------------------------------------------------------- |
36 |
|
|
// qsamplerChannel - Sampler channel structure. |
37 |
|
|
// |
38 |
|
|
|
39 |
|
|
class qsamplerChannel |
40 |
|
|
{ |
41 |
|
|
public: |
42 |
|
|
|
43 |
capela |
467 |
// Constructor. |
44 |
|
|
qsamplerChannel(qsamplerMainForm *pMainForm, int iChannelID = -1); |
45 |
|
|
// Default destructor. |
46 |
|
|
~qsamplerChannel(); |
47 |
capela |
264 |
|
48 |
capela |
484 |
// Main application form accessor. |
49 |
|
|
qsamplerMainForm *mainForm() const; |
50 |
capela |
490 |
|
51 |
capela |
467 |
// Main application options accessor. |
52 |
capela |
484 |
qsamplerOptions *options() const; |
53 |
capela |
264 |
|
54 |
capela |
467 |
// LSCP client descriptor accessor. |
55 |
capela |
484 |
lscp_client_t * client() const; |
56 |
capela |
295 |
|
57 |
capela |
467 |
// Add/remove sampler channel methods. |
58 |
|
|
bool addChannel(); |
59 |
|
|
bool removeChannel(); |
60 |
capela |
295 |
|
61 |
capela |
467 |
// Sampler channel ID accessors. |
62 |
capela |
484 |
int channelID() const; |
63 |
capela |
467 |
void setChannelID(int iChannelID); |
64 |
capela |
295 |
|
65 |
capela |
467 |
// Readable channel name. |
66 |
capela |
484 |
QString channelName() const; |
67 |
capela |
467 |
|
68 |
|
|
// Engine name property. |
69 |
capela |
484 |
const QString& engineName() const; |
70 |
capela |
467 |
bool loadEngine(const QString& sEngineName); |
71 |
|
|
|
72 |
|
|
// Instrument file and index. |
73 |
capela |
484 |
const QString& instrumentFile() const; |
74 |
|
|
int instrumentNr() const; |
75 |
|
|
const QString& instrumentName() const; |
76 |
|
|
int instrumentStatus() const; |
77 |
capela |
490 |
|
78 |
capela |
484 |
// Instrument file loader. |
79 |
capela |
467 |
bool loadInstrument(const QString& sInstrumentFile, int iInstrumentNr); |
80 |
capela |
388 |
// Special instrument file/name/number settler. |
81 |
capela |
467 |
bool setInstrument(const QString& sInstrumentFile, int iInstrumentNr); |
82 |
capela |
344 |
|
83 |
capela |
467 |
// MIDI input driver (DEPRECATED). |
84 |
capela |
484 |
const QString& midiDriver() const; |
85 |
capela |
467 |
bool setMidiDriver(const QString& sMidiDriver); |
86 |
capela |
264 |
|
87 |
capela |
467 |
// MIDI input device. |
88 |
capela |
484 |
int midiDevice() const; |
89 |
capela |
467 |
bool setMidiDevice(int iMidiDevice); |
90 |
capela |
264 |
|
91 |
capela |
467 |
// MIDI input port. |
92 |
capela |
484 |
int midiPort() const; |
93 |
capela |
467 |
bool setMidiPort(int iMidiPort); |
94 |
capela |
371 |
|
95 |
capela |
467 |
// MIDI input channel. |
96 |
capela |
484 |
int midiChannel() const; |
97 |
capela |
467 |
bool setMidiChannel(int iMidiChannel); |
98 |
capela |
264 |
|
99 |
capela |
467 |
// Audio output driver (DEPRECATED). |
100 |
capela |
484 |
const QString& audioDriver() const; |
101 |
capela |
467 |
bool setAudioDriver(const QString& sAudioDriver); |
102 |
capela |
303 |
|
103 |
capela |
467 |
// Audio output device. |
104 |
capela |
484 |
int audioDevice() const; |
105 |
capela |
467 |
bool setAudioDevice(int iAudioDevice); |
106 |
capela |
400 |
|
107 |
capela |
467 |
// Sampler channel volume. |
108 |
capela |
484 |
float volume() const; |
109 |
capela |
467 |
bool setVolume(float fVolume); |
110 |
capela |
264 |
|
111 |
capela |
467 |
// Istrument name remapper. |
112 |
|
|
void updateInstrumentName(); |
113 |
capela |
303 |
|
114 |
capela |
467 |
// Channel info structure map executive. |
115 |
|
|
bool updateChannelInfo(); |
116 |
|
|
|
117 |
|
|
// Channel setup dialog form. |
118 |
|
|
bool channelSetup(QWidget *pParent); |
119 |
|
|
|
120 |
|
|
// Reset channel method. |
121 |
|
|
bool channelReset(); |
122 |
|
|
|
123 |
|
|
// Message logging methods (brainlessly mapped to main form's). |
124 |
capela |
484 |
void appendMessages (const QString & s) const; |
125 |
|
|
void appendMessagesColor (const QString & s, const QString & c) const; |
126 |
|
|
void appendMessagesText (const QString & s) const; |
127 |
|
|
void appendMessagesError (const QString & s) const; |
128 |
|
|
void appendMessagesClient (const QString & s) const; |
129 |
capela |
467 |
|
130 |
|
|
// Context menu event handler. |
131 |
|
|
void contextMenuEvent(QContextMenuEvent *pEvent); |
132 |
|
|
|
133 |
capela |
388 |
// Common (invalid) name-helpers. |
134 |
capela |
467 |
static QString noEngineName(); |
135 |
|
|
static QString noInstrumentName(); |
136 |
schoenebeck |
519 |
static QString loadingInstrument(); |
137 |
capela |
388 |
|
138 |
|
|
// Check whether a given file is an instrument file. |
139 |
|
|
static bool isInstrumentFile (const QString& sInstrumentFile); |
140 |
|
|
|
141 |
capela |
467 |
// Retrieve the available instrument name(s) of an instrument file (.gig). |
142 |
|
|
static QString getInstrumentName (const QString& sInstrumentFile, |
143 |
capela |
344 |
int iInstrumentNr, bool bInstrumentNames); |
144 |
capela |
467 |
static QStringList getInstrumentList (const QString& sInstrumentFile, |
145 |
capela |
344 |
bool bInstrumentNames); |
146 |
capela |
299 |
|
147 |
capela |
264 |
private: |
148 |
|
|
|
149 |
capela |
467 |
// Main application form reference. |
150 |
|
|
qsamplerMainForm *m_pMainForm; |
151 |
capela |
264 |
|
152 |
capela |
467 |
// Unique channel identifier. |
153 |
|
|
int m_iChannelID; |
154 |
capela |
264 |
|
155 |
capela |
467 |
// Sampler channel info map. |
156 |
|
|
QString m_sEngineName; |
157 |
|
|
QString m_sInstrumentName; |
158 |
|
|
QString m_sInstrumentFile; |
159 |
|
|
int m_iInstrumentNr; |
160 |
|
|
int m_iInstrumentStatus; |
161 |
capela |
490 |
QString m_sMidiDriver; |
162 |
capela |
467 |
int m_iMidiDevice; |
163 |
|
|
int m_iMidiPort; |
164 |
|
|
int m_iMidiChannel; |
165 |
capela |
490 |
QString m_sAudioDriver; |
166 |
capela |
467 |
int m_iAudioDevice; |
167 |
|
|
float m_fVolume; |
168 |
capela |
264 |
}; |
169 |
|
|
|
170 |
|
|
#endif // __qsamplerChannel_h |
171 |
|
|
|
172 |
|
|
|
173 |
|
|
// end of qsamplerChannel.h |