/[svn]/qsampler/trunk/src/qsamplerChannelForm.ui.h
ViewVC logotype

Contents of /qsampler/trunk/src/qsamplerChannelForm.ui.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1016 - (show annotations) (download) (as text)
Mon Jan 8 22:04:33 2007 UTC (17 years, 3 months ago) by capela
File MIME type: text/x-c++hdr
File size: 19736 byte(s)
* MIDI instrument item editing has been fixed (hopefully).

* Sampler channel setup dialog does not mandate for valid nor
  existing instrument file name; dropped MIDI port from sampler
  channel strip display, only MIDI channel is now displayed.

1 // qsamplerChannelForm.ui.h
2 //
3 // ui.h extension file, included from the uic-generated form implementation.
4 /****************************************************************************
5 Copyright (C) 2004-2007, 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 along
18 with this program; if not, write to the Free Software Foundation, Inc.,
19 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20
21 *****************************************************************************/
22
23 #include "qsamplerAbout.h"
24 #include "qsamplerDeviceForm.h"
25
26 #include "qsamplerMainForm.h"
27 #include "qsamplerInstrument.h"
28
29
30 #include <qvalidator.h>
31 #include <qmessagebox.h>
32 #include <qfiledialog.h>
33 #include <qfileinfo.h>
34 #include <qlistbox.h>
35
36
37 // Kind of constructor.
38 void qsamplerChannelForm::init (void)
39 {
40 // Initialize locals.
41 m_pChannel = NULL;
42
43 m_iDirtySetup = 0;
44 m_iDirtyCount = 0;
45
46 m_midiDevices.setAutoDelete(true);
47 m_audioDevices.setAutoDelete(true);
48
49 m_pDeviceForm = NULL;
50
51 // Try to restore normal window positioning.
52 adjustSize();
53 }
54
55
56 // Kind of destructor.
57 void qsamplerChannelForm::destroy (void)
58 {
59 if (m_pDeviceForm)
60 delete m_pDeviceForm;
61 m_pDeviceForm = NULL;
62 }
63
64
65 // Channel dialog setup formal initializer.
66 void qsamplerChannelForm::setup ( qsamplerChannel *pChannel )
67 {
68 m_pChannel = pChannel;
69
70 m_iDirtySetup = 0;
71 m_iDirtyCount = 0;
72
73 if (m_pChannel == NULL)
74 return;
75
76 // It can be a brand new channel, remember?
77 bool bNew = (m_pChannel->channelID() < 0);
78 setCaption(QSAMPLER_TITLE ": " + m_pChannel->channelName());
79
80 // Check if we're up and connected.
81 qsamplerMainForm *pMainForm = qsamplerMainForm::getInstance();
82 if (pMainForm == NULL)
83 return;
84 if (pMainForm->client() == NULL)
85 return;
86
87 qsamplerOptions *pOptions = pMainForm->options();
88 if (pOptions == NULL)
89 return;
90
91 // Avoid nested changes.
92 m_iDirtySetup++;
93
94 // Load combo box history...
95 pOptions->loadComboBoxHistory(InstrumentFileComboBox);
96
97 // Notify.that we've just changed one audio route.
98 QObject::connect(AudioRoutingTable, SIGNAL(valueChanged(int,int)),
99 this, SLOT(changeAudioRouting(int,int)));
100
101 // Populate Engines list.
102 const char **ppszEngines = ::lscp_list_available_engines(pMainForm->client());
103 if (ppszEngines) {
104 EngineNameComboBox->clear();
105 for (int iEngine = 0; ppszEngines[iEngine]; iEngine++)
106 EngineNameComboBox->insertItem(ppszEngines[iEngine]);
107 }
108 else m_pChannel->appendMessagesClient("lscp_list_available_engines");
109
110 // Populate Audio output type list.
111 AudioDriverComboBox->clear();
112 AudioDriverComboBox->insertStringList(
113 qsamplerDevice::getDrivers(pMainForm->client(), qsamplerDevice::Audio));
114
115 // Populate MIDI input type list.
116 MidiDriverComboBox->clear();
117 MidiDriverComboBox->insertStringList(
118 qsamplerDevice::getDrivers(pMainForm->client(), qsamplerDevice::Midi));
119
120 // Populate Maps list.
121 MidiMapComboBox->clear();
122 MidiMapComboBox->insertStringList(qsamplerInstrument::getMapNames());
123
124 // Read proper channel information,
125 // and populate the channel form fields.
126
127 // Engine name...
128 QString sEngineName = pChannel->engineName();
129 if (sEngineName.isEmpty() || bNew)
130 sEngineName = pOptions->sEngineName;
131 if (sEngineName.isEmpty())
132 sEngineName = qsamplerChannel::noEngineName();
133 if (EngineNameComboBox->listBox()->findItem(sEngineName,
134 Qt::ExactMatch | Qt::CaseSensitive) == NULL) {
135 EngineNameComboBox->insertItem(sEngineName);
136 }
137 EngineNameComboBox->setCurrentText(sEngineName);
138 // Instrument filename and index...
139 QString sInstrumentFile = pChannel->instrumentFile();
140 if (sInstrumentFile.isEmpty())
141 sInstrumentFile = qsamplerChannel::noInstrumentName();
142 InstrumentFileComboBox->setCurrentText(sInstrumentFile);
143 InstrumentNrComboBox->clear();
144 InstrumentNrComboBox->insertStringList(
145 qsamplerChannel::getInstrumentList(sInstrumentFile,
146 pOptions->bInstrumentNames));
147 InstrumentNrComboBox->setCurrentItem(pChannel->instrumentNr());
148
149 // MIDI input device...
150 qsamplerDevice midiDevice(qsamplerDevice::Midi, m_pChannel->midiDevice());
151 // MIDI input driver...
152 QString sMidiDriver = midiDevice.driverName();
153 if (sMidiDriver.isEmpty() || bNew)
154 sMidiDriver = pOptions->sMidiDriver.upper();
155 if (!sMidiDriver.isEmpty()) {
156 if (MidiDriverComboBox->listBox()->findItem(sMidiDriver,
157 Qt::ExactMatch | Qt::CaseSensitive) == NULL) {
158 MidiDriverComboBox->insertItem(sMidiDriver);
159 }
160 MidiDriverComboBox->setCurrentText(sMidiDriver);
161 }
162 selectMidiDriverItem(sMidiDriver);
163 if (!bNew)
164 MidiDeviceComboBox->setCurrentText(midiDevice.deviceName());
165 selectMidiDeviceItem(MidiDeviceComboBox->currentItem());
166 // MIDI input port...
167 MidiPortSpinBox->setValue(pChannel->midiPort());
168 // MIDI input channel...
169 int iMidiChannel = pChannel->midiChannel();
170 // When new, try to suggest a sensible MIDI channel...
171 if (iMidiChannel < 0)
172 iMidiChannel = (::lscp_get_channels(pMainForm->client()) % 16);
173 MidiChannelComboBox->setCurrentItem(iMidiChannel);
174 // MIDI instrument map...
175 int iMidiMap = (bNew ? pOptions->iMidiMap : pChannel->midiMap());
176 // When new, try to suggest a sensible MIDI map...
177 if (iMidiMap < 0)
178 iMidiMap = 0;
179 const QString& sMapName = qsamplerInstrument::getMapName(iMidiMap);
180 if (!sMapName.isEmpty())
181 MidiMapComboBox->setCurrentText(sMapName);
182 // It might be no maps around...
183 bool bMidiMapEnabled = (MidiMapComboBox->count() > 0);
184 MidiMapTextLabel->setEnabled(bMidiMapEnabled);
185 MidiMapComboBox->setEnabled(bMidiMapEnabled);
186
187 // Audio output device...
188 qsamplerDevice audioDevice(qsamplerDevice::Audio, m_pChannel->audioDevice());
189 // Audio output driver...
190 QString sAudioDriver = audioDevice.driverName();
191 if (sAudioDriver.isEmpty() || bNew)
192 sAudioDriver = pOptions->sAudioDriver.upper();
193 if (!sAudioDriver.isEmpty()) {
194 if (AudioDriverComboBox->listBox()->findItem(sAudioDriver,
195 Qt::ExactMatch | Qt::CaseSensitive) == NULL) {
196 AudioDriverComboBox->insertItem(sAudioDriver);
197 }
198 AudioDriverComboBox->setCurrentText(sAudioDriver);
199 }
200 selectAudioDriverItem(sAudioDriver);
201 if (!bNew)
202 AudioDeviceComboBox->setCurrentText(audioDevice.deviceName());
203 selectAudioDeviceItem(AudioDeviceComboBox->currentItem());
204
205 // As convenient, make it ready on stabilizeForm() for
206 // prompt acceptance, if we got the minimum required...
207 /* if (sEngineName != qsamplerChannel::noEngineName() &&
208 sInstrumentFile != qsamplerChannel::noInstrumentName())
209 m_iDirtyCount++; */
210 // Done.
211 m_iDirtySetup--;
212 stabilizeForm();
213 }
214
215
216 // Accept settings (OK button slot).
217 void qsamplerChannelForm::accept (void)
218 {
219 if (m_pChannel == NULL)
220 return;
221
222 qsamplerMainForm *pMainForm = qsamplerMainForm::getInstance();
223 if (pMainForm == NULL)
224 return;
225 if (pMainForm->client() == NULL)
226 return;
227
228 qsamplerOptions *pOptions = pMainForm->options();
229 if (pOptions == NULL)
230 return;
231
232 // Flush any pending editing...
233 AudioRoutingTable->flush();
234
235 // We'll go for it!
236 if (m_iDirtyCount > 0) {
237 int iErrors = 0;
238 // Are we a new channel?
239 if (!m_pChannel->addChannel())
240 iErrors++;
241 // Accept Audio driver or device selection...
242 if (m_audioDevices.isEmpty()) {
243 if (!m_pChannel->setAudioDriver(AudioDriverComboBox->currentText()))
244 iErrors++;
245 } else {
246 qsamplerDevice *pDevice = m_audioDevices.at(AudioDeviceComboBox->currentItem());
247 if (pDevice == NULL)
248 iErrors++;
249 else if (!m_pChannel->setAudioDevice(pDevice->deviceID()))
250 iErrors++;
251 else if (!m_audioRouting.isEmpty()) {
252 // Set the audio route changes...
253 qsamplerChannelRoutingMap::ConstIterator iter;
254 for (iter = m_audioRouting.begin();
255 iter != m_audioRouting.end(); ++iter) {
256 if (!m_pChannel->setAudioChannel(iter.key(), iter.data()))
257 iErrors++;
258 }
259 }
260 }
261 // Accept MIDI driver or device selection...
262 if (m_midiDevices.isEmpty()) {
263 if (!m_pChannel->setMidiDriver(MidiDriverComboBox->currentText()))
264 iErrors++;
265 } else {
266 qsamplerDevice *pDevice = m_midiDevices.at(MidiDeviceComboBox->currentItem());
267 if (pDevice == NULL)
268 iErrors++;
269 else if (!m_pChannel->setMidiDevice(pDevice->deviceID()))
270 iErrors++;
271 }
272 // MIDI input port number...
273 if (!m_pChannel->setMidiPort(MidiPortSpinBox->value()))
274 iErrors++;
275 // MIDI input channel...
276 if (!m_pChannel->setMidiChannel(MidiChannelComboBox->currentItem()))
277 iErrors++;
278 // Engine name...
279 if (!m_pChannel->loadEngine(EngineNameComboBox->currentText()))
280 iErrors++;
281 // Instrument file and index...
282 const QString& sPath = InstrumentFileComboBox->currentText();
283 if (!sPath.isEmpty() && QFileInfo(sPath).exists()) {
284 if (!m_pChannel->loadInstrument(sPath, InstrumentNrComboBox->currentItem()))
285 iErrors++;
286 }
287 // MIDI intrument map...
288 if (!m_pChannel->setMidiMap(MidiMapComboBox->currentItem()))
289 iErrors++;
290 // Show error messages?
291 if (iErrors > 0)
292 m_pChannel->appendMessagesError(tr("Some channel settings could not be set.\n\nSorry."));
293 }
294
295 // Save default engine name, instrument directory and history...
296 pOptions->sInstrumentDir = QFileInfo(InstrumentFileComboBox->currentText()).dirPath(true);
297 pOptions->sEngineName = EngineNameComboBox->currentText();
298 pOptions->sAudioDriver = AudioDriverComboBox->currentText();
299 pOptions->sMidiDriver = MidiDriverComboBox->currentText();
300 pOptions->iMidiMap = MidiMapComboBox->currentItem();
301 pOptions->saveComboBoxHistory(InstrumentFileComboBox);
302
303 // Just go with dialog acceptance.
304 QDialog::accept();
305 }
306
307
308 // Reject settings (Cancel button slot).
309 void qsamplerChannelForm::reject (void)
310 {
311 bool bReject = true;
312
313 // Check if there's any pending changes...
314 if (m_iDirtyCount > 0 && OkPushButton->isEnabled()) {
315 switch (QMessageBox::warning(this,
316 QSAMPLER_TITLE ": " + tr("Warning"),
317 tr("Some channel settings have been changed.\n\n"
318 "Do you want to apply the changes?"),
319 tr("Apply"), tr("Discard"), tr("Cancel"))) {
320 case 0: // Apply...
321 accept();
322 return;
323 case 1: // Discard
324 break;
325 default: // Cancel.
326 bReject = false;
327 break;
328 }
329 }
330
331 if (bReject)
332 QDialog::reject();
333 }
334
335
336 // Browse and open an instrument file.
337 void qsamplerChannelForm::openInstrumentFile (void)
338 {
339 qsamplerMainForm *pMainForm = qsamplerMainForm::getInstance();
340 if (pMainForm == NULL)
341 return;
342 if (pMainForm->client() == NULL)
343 return;
344
345 qsamplerOptions *pOptions = pMainForm->options();
346 if (pOptions == NULL)
347 return;
348
349 // FIXME: the instrument file filters should be restricted,
350 // depending on the current engine.
351 QString sInstrumentFile = QFileDialog::getOpenFileName(
352 pOptions->sInstrumentDir, // Start here.
353 tr("Instrument files") + " (*.gig *.dls)", // Filter (GIG and DLS files)
354 this, 0, // Parent and name (none)
355 QSAMPLER_TITLE ": " + tr("Instrument files") // Caption.
356 );
357
358 if (sInstrumentFile.isEmpty())
359 return;
360
361 InstrumentFileComboBox->setCurrentText(sInstrumentFile);
362 updateInstrumentName();
363 }
364
365
366 // Refresh the actual instrument name.
367 void qsamplerChannelForm::updateInstrumentName (void)
368 {
369 qsamplerMainForm *pMainForm = qsamplerMainForm::getInstance();
370 if (pMainForm == NULL)
371 return;
372 if (pMainForm->client() == NULL)
373 return;
374
375 qsamplerOptions *pOptions = pMainForm->options();
376 if (pOptions == NULL)
377 return;
378
379 // Finally this better idea would be to use libgig
380 // to retrieve the REAL instrument names.
381 InstrumentNrComboBox->clear();
382 InstrumentNrComboBox->insertStringList(
383 qsamplerChannel::getInstrumentList(
384 InstrumentFileComboBox->currentText(),
385 pOptions->bInstrumentNames)
386 );
387
388 optionsChanged();
389 }
390
391
392 // Show device options dialog.
393 void qsamplerChannelForm::setupDevice ( qsamplerDevice *pDevice,
394 qsamplerDevice::qsamplerDeviceType deviceTypeMode,
395 const QString& sDriverName )
396 {
397 qsamplerMainForm *pMainForm = qsamplerMainForm::getInstance();
398 if (pMainForm == NULL)
399 return;
400 if (pMainForm->client() == NULL)
401 return;
402
403 // Create the device form if not already...
404 if (m_pDeviceForm == NULL) {
405 m_pDeviceForm = new qsamplerDeviceForm(this, 0,
406 WType_Dialog | WShowModal);
407 QObject::connect(m_pDeviceForm, SIGNAL(devicesChanged()),
408 this, SLOT(updateDevices()));
409 }
410
411 // Refresh the device form with selected data.
412 if (m_pDeviceForm) {
413 m_pDeviceForm->setDeviceTypeMode(deviceTypeMode);
414 m_pDeviceForm->refreshDevices();
415 m_pDeviceForm->setDevice(pDevice);
416 m_pDeviceForm->setDriverName(sDriverName);
417 m_pDeviceForm->show();
418 }
419 }
420
421
422 // Refresh MIDI driver item devices.
423 void qsamplerChannelForm::selectMidiDriverItem ( const QString& sMidiDriver )
424 {
425 qsamplerMainForm *pMainForm = qsamplerMainForm::getInstance();
426 if (pMainForm == NULL)
427 return;
428 if (pMainForm->client() == NULL)
429 return;
430
431 const QString sDriverName = sMidiDriver.upper();
432
433 // Save current device id.
434 int iDeviceID = 0;
435 qsamplerDevice *pDevice = m_midiDevices.at(MidiDeviceComboBox->currentItem());
436 if (pDevice)
437 iDeviceID = pDevice->deviceID();
438
439 // Clean maplist.
440 MidiDeviceComboBox->clear();
441 m_midiDevices.clear();
442
443 // Populate with the current ones...
444 const QPixmap& midiPixmap = QPixmap::fromMimeSource("midi2.png");
445 int *piDeviceIDs = qsamplerDevice::getDevices(pMainForm->client(),
446 qsamplerDevice::Midi);
447 for (int i = 0; piDeviceIDs && piDeviceIDs[i] >= 0; i++) {
448 pDevice = new qsamplerDevice(qsamplerDevice::Midi, piDeviceIDs[i]);
449 if (pDevice->driverName().upper() == sDriverName) {
450 MidiDeviceComboBox->insertItem(midiPixmap, pDevice->deviceName());
451 m_midiDevices.append(pDevice);
452 } else {
453 delete pDevice;
454 }
455 }
456
457 // Do proper enabling...
458 bool bEnabled = !m_midiDevices.isEmpty();
459 if (bEnabled) {
460 // Select the previous current device...
461 int iMidiItem = 0;
462 for (pDevice = m_midiDevices.first();
463 pDevice;
464 pDevice = m_midiDevices.next()) {
465 if (pDevice->deviceID() == iDeviceID) {
466 MidiDeviceComboBox->setCurrentItem(iMidiItem);
467 selectMidiDeviceItem(iMidiItem);
468 break;
469 }
470 iMidiItem++;
471 }
472 } else {
473 MidiDeviceComboBox->insertItem(
474 tr("(New MIDI %1 device)").arg(sMidiDriver));
475 }
476 MidiDeviceTextLabel->setEnabled(bEnabled);
477 MidiDeviceComboBox->setEnabled(bEnabled);
478 }
479
480
481 // Refresh MIDI device options slot.
482 void qsamplerChannelForm::selectMidiDriver ( const QString& sMidiDriver )
483 {
484 if (m_iDirtySetup > 0)
485 return;
486
487 selectMidiDriverItem(sMidiDriver);
488 optionsChanged();
489 }
490
491
492 // Select MIDI device item.
493 void qsamplerChannelForm::selectMidiDeviceItem ( int iMidiItem )
494 {
495 qsamplerDevice *pDevice = m_midiDevices.at(iMidiItem);
496 if (pDevice) {
497 const qsamplerDeviceParamMap& params = pDevice->params();
498 int iPorts = params["PORTS"].value.toInt();
499 MidiPortTextLabel->setEnabled(iPorts > 0);
500 MidiPortSpinBox->setEnabled(iPorts > 0);
501 if (iPorts > 0)
502 MidiPortSpinBox->setMaxValue(iPorts - 1);
503 }
504 }
505
506
507 // Select MIDI device options slot.
508 void qsamplerChannelForm::selectMidiDevice ( int iMidiItem )
509 {
510 if (m_iDirtySetup > 0)
511 return;
512
513 selectMidiDeviceItem(iMidiItem);
514 optionsChanged();
515 }
516
517
518 // MIDI device options.
519 void qsamplerChannelForm::setupMidiDevice (void)
520 {
521 setupDevice(m_midiDevices.at(MidiDeviceComboBox->currentItem()),
522 qsamplerDevice::Midi, MidiDriverComboBox->currentText());
523 }
524
525
526 // Refresh Audio driver item devices.
527 void qsamplerChannelForm::selectAudioDriverItem ( const QString& sAudioDriver )
528 {
529 qsamplerMainForm *pMainForm = qsamplerMainForm::getInstance();
530 if (pMainForm == NULL)
531 return;
532 if (pMainForm->client() == NULL)
533 return;
534
535 const QString sDriverName = sAudioDriver.upper();
536
537 // Save current device id.
538 int iDeviceID = 0;
539 qsamplerDevice *pDevice = m_audioDevices.at(AudioDeviceComboBox->currentItem());
540 if (pDevice)
541 iDeviceID = pDevice->deviceID();
542
543 // Clean maplist.
544 AudioDeviceComboBox->clear();
545 m_audioDevices.clear();
546
547 // Populate with the current ones...
548 const QPixmap& audioPixmap = QPixmap::fromMimeSource("audio2.png");
549 int *piDeviceIDs = qsamplerDevice::getDevices(pMainForm->client(),
550 qsamplerDevice::Audio);
551 for (int i = 0; piDeviceIDs && piDeviceIDs[i] >= 0; i++) {
552 pDevice = new qsamplerDevice(qsamplerDevice::Audio, piDeviceIDs[i]);
553 if (pDevice->driverName().upper() == sDriverName) {
554 AudioDeviceComboBox->insertItem(audioPixmap, pDevice->deviceName());
555 m_audioDevices.append(pDevice);
556 } else {
557 delete pDevice;
558 }
559 }
560
561 // Do proper enabling...
562 bool bEnabled = !m_audioDevices.isEmpty();
563 if (bEnabled) {
564 // Select the previous current device...
565 int iAudioItem = 0;
566 for (pDevice = m_audioDevices.first();
567 pDevice;
568 pDevice = m_audioDevices.next()) {
569 if (pDevice->deviceID() == iDeviceID) {
570 AudioDeviceComboBox->setCurrentItem(iAudioItem);
571 selectAudioDeviceItem(iAudioItem);
572 break;
573 }
574 iAudioItem++;
575 }
576 } else {
577 AudioDeviceComboBox->insertItem(
578 tr("(New Audio %1 device)").arg(sAudioDriver));
579 AudioRoutingTable->setNumRows(0);
580 }
581 AudioDeviceTextLabel->setEnabled(bEnabled);
582 AudioDeviceComboBox->setEnabled(bEnabled);
583 AudioRoutingTable->setEnabled(bEnabled);
584 }
585
586
587 // Refresh Audio device options slot.
588 void qsamplerChannelForm::selectAudioDriver ( const QString& sAudioDriver )
589 {
590 if (m_iDirtySetup > 0)
591 return;
592
593 selectAudioDriverItem(sAudioDriver);
594 optionsChanged();
595 }
596
597
598 // Select Audio device item.
599 void qsamplerChannelForm::selectAudioDeviceItem ( int iAudioItem )
600 {
601 qsamplerDevice *pDevice = m_audioDevices.at(iAudioItem);
602 if (pDevice) {
603 // Refresh the audio routing table.
604 AudioRoutingTable->refresh(pDevice, m_pChannel->audioRouting());
605 // Reset routing change map.
606 m_audioRouting.clear();
607 }
608 }
609
610
611 // Select Audio device options slot.
612 void qsamplerChannelForm::selectAudioDevice ( int iAudioItem )
613 {
614 if (m_iDirtySetup > 0)
615 return;
616
617 selectAudioDeviceItem(iAudioItem);
618 optionsChanged();
619 }
620
621
622 // Audio device options.
623 void qsamplerChannelForm::setupAudioDevice (void)
624 {
625 setupDevice(m_audioDevices.at(AudioDeviceComboBox->currentItem()),
626 qsamplerDevice::Audio, AudioDriverComboBox->currentText());
627 }
628
629
630 // Audio routing change slot.
631 void qsamplerChannelForm::changeAudioRouting ( int iRow, int iCol )
632 {
633 if (m_iDirtySetup > 0)
634 return;
635 if (iRow < 0 || iCol < 0)
636 return;
637
638 // Verify that this is a QComboTableItem (magic rtti == 1)
639 QTableItem *pItem = AudioRoutingTable->item(iRow, iCol);
640 if (pItem == NULL)
641 return;
642 qsamplerChannelRoutingComboBox *pComboItem =
643 static_cast<qsamplerChannelRoutingComboBox*> (pItem);
644 // FIXME: Its not garanteed that we must have
645 // iAudioOut == iRow on all times forth!
646 m_audioRouting[iRow] = pComboItem->currentItem();
647
648 // And let's get dirty...
649 optionsChanged();
650 }
651
652
653 // UPdate all device lists slot.
654 void qsamplerChannelForm::updateDevices (void)
655 {
656 if (m_iDirtySetup > 0)
657 return;
658
659 selectMidiDriverItem(MidiDriverComboBox->currentText());
660 selectAudioDriverItem(AudioDriverComboBox->currentText());
661 optionsChanged();
662 }
663
664
665 // Dirty up settings.
666 void qsamplerChannelForm::optionsChanged (void)
667 {
668 if (m_iDirtySetup > 0)
669 return;
670
671 m_iDirtyCount++;
672 stabilizeForm();
673 }
674
675
676 // Stabilize current form state.
677 void qsamplerChannelForm::stabilizeForm (void)
678 {
679 bool bValid = true;
680 #if 0
681 const QString& sPath = InstrumentFileComboBox->currentText();
682 bValid = bValid && !sPath.isEmpty() && QFileInfo(sPath).exists();
683 #endif
684 OkPushButton->setEnabled(m_iDirtyCount > 0 && bValid);
685 }
686
687
688 // end of qsamplerChannelForm.ui.h

  ViewVC Help
Powered by ViewVC