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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 758 - (hide annotations) (download) (as text)
Sun Aug 28 00:31:34 2005 UTC (18 years, 7 months ago) by capela
File MIME type: text/x-c++hdr
File size: 17984 byte(s)
* Audio output channel routing configuration finally hits
  the sampler channel dialog, at last! (EXPERIMENTAL).

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

  ViewVC Help
Powered by ViewVC