1 |
capela |
109 |
// qsamplerChannelStrip.ui.h |
2 |
|
|
// |
3 |
|
|
// ui.h extension file, included from the uic-generated form implementation. |
4 |
|
|
/**************************************************************************** |
5 |
|
|
Copyright (C) 2004, rncbc aka Rui Nuno Capela. All rights reserved. |
6 |
|
|
|
7 |
|
|
This program is free software; you can redistribute it and/or |
8 |
|
|
modify it under the terms of the GNU General Public License |
9 |
|
|
as published by the Free Software Foundation; either version 2 |
10 |
|
|
of the License, or (at your option) any later version. |
11 |
|
|
|
12 |
|
|
This program is distributed in the hope that it will be useful, |
13 |
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of |
14 |
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
15 |
|
|
GNU General Public License for more details. |
16 |
|
|
|
17 |
|
|
You should have received a copy of the GNU General Public License |
18 |
|
|
along with this program; if not, write to the Free Software |
19 |
|
|
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
20 |
|
|
|
21 |
|
|
*****************************************************************************/ |
22 |
|
|
|
23 |
|
|
#include <qvalidator.h> |
24 |
|
|
#include <qmessagebox.h> |
25 |
|
|
#include <qfileinfo.h> |
26 |
|
|
#include <qtooltip.h> |
27 |
capela |
118 |
#include <qpopupmenu.h> |
28 |
capela |
109 |
|
29 |
|
|
#include <math.h> |
30 |
|
|
|
31 |
|
|
#include "qsamplerMainForm.h" |
32 |
|
|
#include "qsamplerChannelForm.h" |
33 |
|
|
|
34 |
|
|
#include "config.h" |
35 |
|
|
|
36 |
|
|
|
37 |
|
|
// Kind of constructor. |
38 |
|
|
void qsamplerChannelStrip::init (void) |
39 |
|
|
{ |
40 |
|
|
// Initialize locals. |
41 |
|
|
m_pMainForm = NULL; |
42 |
|
|
m_iChannelID = 0; |
43 |
|
|
|
44 |
capela |
145 |
// m_sEngineName = tr("(No engine)"); |
45 |
|
|
// m_sInstrumentFile = tr("(No instrument)"); |
46 |
|
|
m_iInstrumentNr = -1; |
47 |
|
|
m_iInstrumentStatus = -1; |
48 |
|
|
m_sMidiDriver = "Alsa"; // DEPRECATED. |
49 |
|
|
m_iMidiDevice = -1; |
50 |
|
|
m_iMidiPort = -1; |
51 |
|
|
m_iMidiChannel = -1; |
52 |
|
|
m_sAudioDriver = "Alsa"; // DEPRECATED. |
53 |
|
|
m_iAudioDevice = -1; |
54 |
|
|
m_fVolume = 0.0; |
55 |
capela |
109 |
|
56 |
|
|
m_iDirtyChange = 0; |
57 |
|
|
|
58 |
|
|
// Try to restore normal window positioning. |
59 |
|
|
adjustSize(); |
60 |
|
|
} |
61 |
|
|
|
62 |
|
|
|
63 |
|
|
// Kind of destructor. |
64 |
|
|
void qsamplerChannelStrip::destroy (void) |
65 |
|
|
{ |
66 |
|
|
} |
67 |
|
|
|
68 |
|
|
|
69 |
|
|
// Channel strip setup formal initializer. |
70 |
|
|
void qsamplerChannelStrip::setup ( qsamplerMainForm *pMainForm, int iChannelID ) |
71 |
|
|
{ |
72 |
|
|
m_iDirtyChange = 0; |
73 |
|
|
m_pMainForm = pMainForm; |
74 |
|
|
|
75 |
|
|
setChannelID(iChannelID); |
76 |
|
|
} |
77 |
|
|
|
78 |
|
|
|
79 |
|
|
// The global options settings delegated property. |
80 |
|
|
qsamplerOptions *qsamplerChannelStrip::options (void) |
81 |
|
|
{ |
82 |
|
|
if (m_pMainForm == NULL) |
83 |
|
|
return NULL; |
84 |
|
|
|
85 |
|
|
return m_pMainForm->options(); |
86 |
|
|
} |
87 |
|
|
|
88 |
|
|
|
89 |
|
|
// The client descriptor delegated property. |
90 |
|
|
lscp_client_t *qsamplerChannelStrip::client (void) |
91 |
|
|
{ |
92 |
|
|
if (m_pMainForm == NULL) |
93 |
|
|
return NULL; |
94 |
|
|
|
95 |
|
|
return m_pMainForm->client(); |
96 |
|
|
} |
97 |
|
|
|
98 |
|
|
|
99 |
|
|
// Channel-ID (aka Sammpler-Channel) accessors. |
100 |
|
|
int qsamplerChannelStrip::channelID (void) |
101 |
|
|
{ |
102 |
|
|
return m_iChannelID; |
103 |
|
|
} |
104 |
|
|
|
105 |
|
|
void qsamplerChannelStrip::setChannelID ( int iChannelID ) |
106 |
|
|
{ |
107 |
|
|
m_iChannelID = iChannelID; |
108 |
|
|
|
109 |
|
|
updateChannelInfo(); |
110 |
|
|
} |
111 |
|
|
|
112 |
|
|
|
113 |
|
|
// Engine name accessors. |
114 |
|
|
QString& qsamplerChannelStrip::engineName (void) |
115 |
|
|
{ |
116 |
|
|
return m_sEngineName; |
117 |
|
|
} |
118 |
|
|
|
119 |
|
|
bool qsamplerChannelStrip::loadEngine ( const QString& sEngineName ) |
120 |
|
|
{ |
121 |
|
|
if (client() == NULL) |
122 |
|
|
return false; |
123 |
|
|
|
124 |
|
|
if (::lscp_load_engine(client(), sEngineName.latin1(), m_iChannelID) != LSCP_OK) { |
125 |
|
|
appendMessagesClient("lscp_load_engine"); |
126 |
|
|
return false; |
127 |
|
|
} |
128 |
|
|
|
129 |
|
|
m_sEngineName = sEngineName; |
130 |
|
|
return true; |
131 |
|
|
} |
132 |
|
|
|
133 |
|
|
|
134 |
capela |
145 |
// Instrument filename accessor. |
135 |
capela |
109 |
QString& qsamplerChannelStrip::instrumentFile (void) |
136 |
|
|
{ |
137 |
|
|
return m_sInstrumentFile; |
138 |
|
|
} |
139 |
|
|
|
140 |
capela |
145 |
// Instrument index accessor. |
141 |
capela |
109 |
int qsamplerChannelStrip::instrumentNr (void) |
142 |
|
|
{ |
143 |
|
|
return m_iInstrumentNr; |
144 |
|
|
} |
145 |
|
|
|
146 |
capela |
145 |
// Instrument status accessor. |
147 |
|
|
int qsamplerChannelStrip::instrumentStatus (void) |
148 |
|
|
{ |
149 |
|
|
return m_iInstrumentStatus; |
150 |
|
|
} |
151 |
|
|
|
152 |
|
|
// Instrument file loader. |
153 |
capela |
109 |
bool qsamplerChannelStrip::loadInstrument ( const QString& sInstrumentFile, int iInstrumentNr ) |
154 |
|
|
{ |
155 |
|
|
if (client() == NULL) |
156 |
|
|
return false; |
157 |
|
|
|
158 |
capela |
145 |
if (::lscp_load_instrument_non_modal(client(), sInstrumentFile.latin1(), iInstrumentNr, m_iChannelID) != LSCP_OK) { |
159 |
capela |
109 |
appendMessagesClient("lscp_load_instrument"); |
160 |
|
|
return false; |
161 |
|
|
} |
162 |
|
|
|
163 |
|
|
m_sInstrumentFile = sInstrumentFile; |
164 |
|
|
m_iInstrumentNr = iInstrumentNr; |
165 |
capela |
145 |
m_iInstrumentStatus = 0; |
166 |
|
|
|
167 |
capela |
109 |
return true; |
168 |
|
|
} |
169 |
|
|
|
170 |
|
|
|
171 |
|
|
// MIDI driver type accessors (DEPRECATED). |
172 |
|
|
QString& qsamplerChannelStrip::midiDriver (void) |
173 |
|
|
{ |
174 |
|
|
return m_sMidiDriver; |
175 |
|
|
} |
176 |
|
|
|
177 |
|
|
bool qsamplerChannelStrip::setMidiDriver ( const QString& sMidiDriver ) |
178 |
|
|
{ |
179 |
|
|
if (client() == NULL) |
180 |
|
|
return false; |
181 |
|
|
|
182 |
|
|
if (::lscp_set_channel_midi_type(client(), m_iChannelID, sMidiDriver.latin1()) != LSCP_OK) { |
183 |
|
|
appendMessagesClient("lscp_set_channel_midi_type"); |
184 |
|
|
return false; |
185 |
|
|
} |
186 |
|
|
|
187 |
|
|
m_sMidiDriver = sMidiDriver; |
188 |
|
|
return true; |
189 |
|
|
} |
190 |
|
|
|
191 |
|
|
|
192 |
|
|
// MIDI device accessors. |
193 |
|
|
int qsamplerChannelStrip::midiDevice (void) |
194 |
|
|
{ |
195 |
|
|
return m_iMidiDevice; |
196 |
|
|
} |
197 |
|
|
|
198 |
|
|
bool qsamplerChannelStrip::setMidiDevice ( int iMidiDevice ) |
199 |
|
|
{ |
200 |
|
|
if (client() == NULL) |
201 |
|
|
return false; |
202 |
|
|
|
203 |
capela |
145 |
if (::lscp_set_channel_midi_device(client(), m_iChannelID, iMidiDevice) != LSCP_OK) { |
204 |
|
|
appendMessagesClient("lscp_set_channel_midi_device"); |
205 |
|
|
return false; |
206 |
|
|
} |
207 |
capela |
109 |
|
208 |
|
|
m_iMidiDevice = iMidiDevice; |
209 |
|
|
return true; |
210 |
|
|
} |
211 |
|
|
|
212 |
|
|
|
213 |
|
|
// MIDI port number accessor. |
214 |
|
|
int qsamplerChannelStrip::midiPort (void) |
215 |
|
|
{ |
216 |
|
|
return m_iMidiPort; |
217 |
|
|
} |
218 |
|
|
|
219 |
|
|
bool qsamplerChannelStrip::setMidiPort ( int iMidiPort ) |
220 |
|
|
{ |
221 |
|
|
if (client() == NULL) |
222 |
|
|
return false; |
223 |
|
|
|
224 |
capela |
145 |
if (::lscp_set_channel_midi_port(client(), m_iChannelID, iMidiPort) != LSCP_OK) { |
225 |
|
|
appendMessagesClient("lscp_set_channel_midi_port"); |
226 |
|
|
return false; |
227 |
|
|
} |
228 |
capela |
109 |
|
229 |
|
|
m_iMidiPort = iMidiPort; |
230 |
|
|
return true; |
231 |
|
|
} |
232 |
|
|
|
233 |
|
|
|
234 |
|
|
// MIDI channel accessor. |
235 |
|
|
int qsamplerChannelStrip::midiChannel (void) |
236 |
|
|
{ |
237 |
|
|
return m_iMidiChannel; |
238 |
|
|
} |
239 |
|
|
|
240 |
|
|
bool qsamplerChannelStrip::setMidiChannel ( int iMidiChannel ) |
241 |
|
|
{ |
242 |
|
|
if (client() == NULL) |
243 |
|
|
return false; |
244 |
|
|
|
245 |
capela |
145 |
if (::lscp_set_channel_midi_channel(client(), m_iChannelID, iMidiChannel) != LSCP_OK) { |
246 |
|
|
appendMessagesClient("lscp_set_channel_midi_channel"); |
247 |
|
|
return false; |
248 |
|
|
} |
249 |
capela |
109 |
|
250 |
|
|
m_iMidiChannel = iMidiChannel; |
251 |
|
|
return true; |
252 |
|
|
} |
253 |
|
|
|
254 |
|
|
|
255 |
|
|
// Audio device accessor. |
256 |
|
|
int qsamplerChannelStrip::audioDevice (void) |
257 |
|
|
{ |
258 |
|
|
return m_iAudioDevice; |
259 |
|
|
} |
260 |
|
|
|
261 |
|
|
bool qsamplerChannelStrip::setAudioDevice ( int iAudioDevice ) |
262 |
|
|
{ |
263 |
|
|
if (client() == NULL) |
264 |
|
|
return false; |
265 |
|
|
|
266 |
capela |
145 |
if (::lscp_set_channel_audio_device(client(), m_iChannelID, iAudioDevice) != LSCP_OK) { |
267 |
|
|
appendMessagesClient("lscp_set_channel_audio_device"); |
268 |
|
|
return false; |
269 |
|
|
} |
270 |
capela |
109 |
|
271 |
|
|
m_iAudioDevice = iAudioDevice; |
272 |
|
|
return true; |
273 |
|
|
} |
274 |
|
|
|
275 |
|
|
|
276 |
|
|
// Audio driver type accessors (DEPRECATED). |
277 |
|
|
QString& qsamplerChannelStrip::audioDriver (void) |
278 |
|
|
{ |
279 |
|
|
return m_sAudioDriver; |
280 |
|
|
} |
281 |
|
|
|
282 |
|
|
bool qsamplerChannelStrip::setAudioDriver ( const QString& sAudioDriver ) |
283 |
|
|
{ |
284 |
|
|
if (client() == NULL) |
285 |
|
|
return false; |
286 |
|
|
|
287 |
|
|
if (::lscp_set_channel_audio_type(client(), m_iChannelID, sAudioDriver.latin1()) != LSCP_OK) { |
288 |
|
|
appendMessagesClient("lscp_set_channel_audio_type"); |
289 |
|
|
return false; |
290 |
|
|
} |
291 |
|
|
|
292 |
|
|
m_sAudioDriver = sAudioDriver; |
293 |
|
|
return true; |
294 |
|
|
} |
295 |
|
|
|
296 |
|
|
|
297 |
|
|
// Channel volume accessors. |
298 |
|
|
float qsamplerChannelStrip::volume (void) |
299 |
|
|
{ |
300 |
|
|
return m_fVolume; |
301 |
|
|
} |
302 |
|
|
|
303 |
|
|
bool qsamplerChannelStrip::setVolume ( float fVolume ) |
304 |
|
|
{ |
305 |
|
|
if (client() == NULL) |
306 |
|
|
return false; |
307 |
|
|
|
308 |
|
|
if (::lscp_set_channel_volume(client(), m_iChannelID, fVolume) != LSCP_OK) { |
309 |
|
|
appendMessagesClient("lscp_set_channel_volume"); |
310 |
|
|
return false; |
311 |
|
|
} |
312 |
|
|
|
313 |
|
|
m_fVolume = fVolume; |
314 |
|
|
return true; |
315 |
|
|
} |
316 |
|
|
|
317 |
|
|
|
318 |
|
|
// Messages view font accessors. |
319 |
|
|
QFont qsamplerChannelStrip::displayFont (void) |
320 |
|
|
{ |
321 |
|
|
return EngineNameTextLabel->font(); |
322 |
|
|
} |
323 |
|
|
|
324 |
|
|
void qsamplerChannelStrip::setDisplayFont ( const QFont & font ) |
325 |
|
|
{ |
326 |
|
|
EngineNameTextLabel->setFont(font); |
327 |
capela |
145 |
MidiPortChannelTextLabel->setFont(font); |
328 |
capela |
109 |
InstrumentNameTextLabel->setFont(font); |
329 |
capela |
145 |
InstrumentStatusTextLabel->setFont(font); |
330 |
capela |
109 |
} |
331 |
|
|
|
332 |
|
|
// Channel setup dialog. |
333 |
capela |
176 |
void qsamplerChannelStrip::channelSetup ( bool bNew ) |
334 |
capela |
109 |
{ |
335 |
|
|
qsamplerChannelForm *pChannelForm = new qsamplerChannelForm(this); |
336 |
|
|
if (pChannelForm) { |
337 |
capela |
176 |
pChannelForm->setup(this, bNew); |
338 |
capela |
109 |
if (pChannelForm->exec()) { |
339 |
|
|
updateChannelInfo(); |
340 |
|
|
emit channelChanged(this); |
341 |
|
|
} |
342 |
|
|
delete pChannelForm; |
343 |
|
|
} |
344 |
|
|
} |
345 |
|
|
|
346 |
|
|
|
347 |
|
|
// Update whole channel info state. |
348 |
|
|
void qsamplerChannelStrip::updateChannelInfo (void) |
349 |
|
|
{ |
350 |
|
|
// Update strip caption. |
351 |
|
|
QString sText = tr("Channel %1").arg(m_iChannelID); |
352 |
|
|
setCaption(sText); |
353 |
|
|
ChannelSetupPushButton->setText(sText); |
354 |
|
|
|
355 |
|
|
// Check if we're up and connected. |
356 |
|
|
if (client() == NULL) |
357 |
|
|
return; |
358 |
|
|
|
359 |
|
|
// Read channel information. |
360 |
|
|
lscp_channel_info_t *pChannelInfo = ::lscp_get_channel_info(client(), m_iChannelID); |
361 |
|
|
if (pChannelInfo == NULL) { |
362 |
|
|
appendMessagesClient("lscp_get_channel_info"); |
363 |
capela |
145 |
appendMessagesError(tr("Could not get channel information.\n\nSorry.")); |
364 |
capela |
109 |
} else { |
365 |
|
|
// Cache in channel information. |
366 |
capela |
145 |
m_sEngineName = pChannelInfo->engine_name; |
367 |
|
|
m_sInstrumentFile = pChannelInfo->instrument_file; |
368 |
|
|
m_iInstrumentNr = pChannelInfo->instrument_nr; |
369 |
|
|
m_iInstrumentStatus = pChannelInfo->instrument_status; |
370 |
|
|
m_iMidiDevice = pChannelInfo->midi_device; |
371 |
|
|
m_iMidiPort = pChannelInfo->midi_port; |
372 |
|
|
m_iMidiChannel = pChannelInfo->midi_channel; |
373 |
|
|
m_iAudioDevice = pChannelInfo->audio_device; |
374 |
|
|
m_fVolume = pChannelInfo->volume; |
375 |
|
|
// Some sanity checks. |
376 |
|
|
if (m_sEngineName == "NONE") |
377 |
|
|
m_sEngineName = QString::null; |
378 |
|
|
if (m_sInstrumentFile == "NONE") |
379 |
|
|
m_sInstrumentFile = QString::null; |
380 |
capela |
109 |
} |
381 |
|
|
|
382 |
|
|
// Set some proper display values. |
383 |
|
|
|
384 |
|
|
// Engine name... |
385 |
|
|
if (m_sEngineName.isEmpty()) |
386 |
|
|
EngineNameTextLabel->setText(tr("(No engine)")); |
387 |
|
|
else |
388 |
|
|
EngineNameTextLabel->setText(m_sEngineName); |
389 |
|
|
|
390 |
|
|
// Instrument name... |
391 |
|
|
if (m_sInstrumentFile.isEmpty()) |
392 |
|
|
InstrumentNameTextLabel->setText(tr("(No instrument)")); |
393 |
|
|
else |
394 |
|
|
InstrumentNameTextLabel->setText(QString("%1 [%2]") |
395 |
|
|
.arg(QFileInfo(m_sInstrumentFile).fileName()).arg(m_iInstrumentNr)); |
396 |
|
|
|
397 |
capela |
145 |
// Instrument status... |
398 |
|
|
if (m_iInstrumentStatus < 0) { |
399 |
|
|
InstrumentStatusTextLabel->setPaletteForegroundColor(Qt::red); |
400 |
|
|
InstrumentStatusTextLabel->setText(tr("ERR%1").arg(m_iInstrumentStatus)); |
401 |
|
|
} else { |
402 |
|
|
InstrumentStatusTextLabel->setPaletteForegroundColor(m_iInstrumentStatus < 100 ? Qt::yellow : Qt::green); |
403 |
|
|
InstrumentStatusTextLabel->setText(QString::number(m_iInstrumentStatus) + "%"); |
404 |
|
|
} |
405 |
|
|
|
406 |
capela |
109 |
// MIDI Port/Channel... |
407 |
|
|
MidiPortChannelTextLabel->setText(QString("%1 / %2") |
408 |
|
|
.arg(m_iMidiPort).arg(m_iMidiChannel)); |
409 |
|
|
|
410 |
|
|
// And update the both GUI volume elements. |
411 |
|
|
updateChannelVolume(); |
412 |
|
|
} |
413 |
|
|
|
414 |
|
|
|
415 |
|
|
// Do the dirty volume change. |
416 |
|
|
void qsamplerChannelStrip::updateChannelVolume (void) |
417 |
|
|
{ |
418 |
|
|
// Convert... |
419 |
|
|
#ifdef CONFIG_ROUND |
420 |
|
|
int iVolume = (int) ::round(100.0 * m_fVolume); |
421 |
|
|
#else |
422 |
|
|
double fIPart = 0.0; |
423 |
|
|
double fFPart = ::modf(100.0 * m_fVolume, &fIPart); |
424 |
|
|
int iVolume = (int) fIPart; |
425 |
|
|
if (fFPart >= +0.5) |
426 |
|
|
iVolume++; |
427 |
|
|
else |
428 |
|
|
if (fFPart <= -0.5) |
429 |
|
|
iVolume--; |
430 |
|
|
#endif |
431 |
|
|
|
432 |
|
|
// And clip... |
433 |
capela |
119 |
if (iVolume < 0) |
434 |
capela |
109 |
iVolume = 0; |
435 |
|
|
|
436 |
|
|
// Flag it here, to avoid infinite recursion. |
437 |
|
|
m_iDirtyChange++; |
438 |
|
|
VolumeSlider->setValue(iVolume); |
439 |
|
|
VolumeSpinBox->setValue(iVolume); |
440 |
|
|
m_iDirtyChange--; |
441 |
|
|
} |
442 |
|
|
|
443 |
|
|
|
444 |
|
|
// Update whole channel usage state. |
445 |
|
|
void qsamplerChannelStrip::updateChannelUsage (void) |
446 |
|
|
{ |
447 |
|
|
if (client() == NULL) |
448 |
|
|
return; |
449 |
|
|
|
450 |
capela |
145 |
// Conditionally update whole channel status info. |
451 |
capela |
176 |
if (m_iInstrumentStatus >= 0 && m_iInstrumentStatus < 100) { |
452 |
capela |
145 |
updateChannelInfo(); |
453 |
capela |
176 |
// Once we get a complete instrument load, try a implied reset channel.... |
454 |
|
|
if (m_iInstrumentStatus == 100) { |
455 |
|
|
if (::lscp_reset_channel(client(), m_iChannelID) != LSCP_OK) |
456 |
|
|
appendMessagesClient("lscp_reset_channel"); |
457 |
capela |
182 |
else |
458 |
|
|
appendMessages(tr("Channel %1 reset.").arg(m_iChannelID)); |
459 |
capela |
176 |
} |
460 |
|
|
} |
461 |
capela |
152 |
// Leave, if we still have an erroneus or incomplete instrument load. |
462 |
|
|
if (m_iInstrumentStatus < 100) |
463 |
|
|
return; |
464 |
capela |
145 |
|
465 |
capela |
109 |
// Get current channel voice count. |
466 |
|
|
int iVoiceCount = ::lscp_get_channel_voice_count(client(), m_iChannelID); |
467 |
|
|
// Get current stream count. |
468 |
|
|
int iStreamCount = ::lscp_get_channel_stream_count(client(), m_iChannelID); |
469 |
|
|
// Get current channel buffer fill usage. |
470 |
|
|
// As benno has suggested this is the percentage usage |
471 |
|
|
// of the least filled buffer stream... |
472 |
capela |
176 |
int iStreamUsage = ::lscp_get_channel_stream_usage(client(), m_iChannelID);; |
473 |
|
|
|
474 |
capela |
109 |
// Update the GUI elements... |
475 |
|
|
StreamUsageProgressBar->setProgress(iStreamUsage); |
476 |
|
|
StreamVoiceCountTextLabel->setText(QString("%1 / %2").arg(iStreamCount).arg(iVoiceCount)); |
477 |
|
|
} |
478 |
|
|
|
479 |
|
|
|
480 |
|
|
// Volume change slot. |
481 |
|
|
void qsamplerChannelStrip::volumeChanged ( int iVolume ) |
482 |
|
|
{ |
483 |
|
|
// Avoid recursion. |
484 |
|
|
if (m_iDirtyChange > 0) |
485 |
|
|
return; |
486 |
|
|
|
487 |
|
|
// Convert and clip. |
488 |
|
|
float fVolume = (float) iVolume / 100.0; |
489 |
capela |
119 |
if (fVolume < 0.001) |
490 |
capela |
109 |
fVolume = 0.0; |
491 |
|
|
|
492 |
|
|
// Update the GUI elements. |
493 |
|
|
if (setVolume(fVolume)) { |
494 |
|
|
updateChannelVolume(); |
495 |
|
|
emit channelChanged(this); |
496 |
|
|
} |
497 |
|
|
} |
498 |
|
|
|
499 |
|
|
|
500 |
|
|
// Redirected messages output methods. |
501 |
|
|
void qsamplerChannelStrip::appendMessages( const QString& s ) |
502 |
|
|
{ |
503 |
|
|
m_pMainForm->appendMessages(s); |
504 |
|
|
} |
505 |
|
|
|
506 |
|
|
void qsamplerChannelStrip::appendMessagesColor( const QString& s, const QString& c ) |
507 |
|
|
{ |
508 |
|
|
m_pMainForm->appendMessagesColor(s, c); |
509 |
|
|
} |
510 |
|
|
|
511 |
|
|
void qsamplerChannelStrip::appendMessagesText( const QString& s ) |
512 |
|
|
{ |
513 |
|
|
m_pMainForm->appendMessagesText(s); |
514 |
|
|
} |
515 |
|
|
|
516 |
|
|
void qsamplerChannelStrip::appendMessagesError( const QString& s ) |
517 |
|
|
{ |
518 |
|
|
m_pMainForm->appendMessagesError(s); |
519 |
|
|
} |
520 |
|
|
|
521 |
|
|
void qsamplerChannelStrip::appendMessagesClient( const QString& s ) |
522 |
|
|
{ |
523 |
|
|
m_pMainForm->appendMessagesClient(s); |
524 |
|
|
} |
525 |
|
|
|
526 |
|
|
|
527 |
capela |
118 |
// Context menu event handler. |
528 |
|
|
void qsamplerChannelStrip::contextMenuEvent( QContextMenuEvent *pEvent ) |
529 |
|
|
{ |
530 |
|
|
// We'll just show up the main form's edit menu. |
531 |
capela |
127 |
m_pMainForm->contextMenuEvent(pEvent); |
532 |
capela |
118 |
} |
533 |
|
|
|
534 |
|
|
|
535 |
capela |
119 |
// Maximum volume slider accessors. |
536 |
|
|
void qsamplerChannelStrip::setMaxVolume ( int iMaxVolume ) |
537 |
|
|
{ |
538 |
|
|
m_iDirtyChange++; |
539 |
|
|
VolumeSlider->setRange(0, iMaxVolume); |
540 |
|
|
VolumeSpinBox->setRange(0, iMaxVolume); |
541 |
|
|
m_iDirtyChange--; |
542 |
|
|
} |
543 |
|
|
|
544 |
|
|
|
545 |
capela |
109 |
// end of qsamplerChannelStrip.ui.h |