/[svn]/qsampler/trunk/src/qsamplerChannelForm.cpp
ViewVC logotype

Contents of /qsampler/trunk/src/qsamplerChannelForm.cpp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1464 - (show annotations) (download)
Thu Nov 1 17:14:21 2007 UTC (16 years, 5 months ago) by capela
File size: 19718 byte(s)
- Qt4 migration: missing copyright headers update.

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

  ViewVC Help
Powered by ViewVC