/[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 767 - (hide annotations) (download) (as text)
Tue Aug 30 09:52:46 2005 UTC (18 years, 7 months ago) by capela
File MIME type: text/x-c++hdr
File size: 17978 byte(s)
* Sampler channel audio routing changes are now being
  properly flushed upon immediate dialog acceptance,

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 759 /* if (sEngineName != qsamplerChannel::noEngineName() &&
187 capela 395 sInstrumentFile != qsamplerChannel::noInstrumentName())
188 capela 759 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 767 // Flush any pending editing...
206     AudioRoutingTable->flush();
207    
208 capela 490 // We'll go for it!
209     if (m_iDirtyCount > 0) {
210     int iErrors = 0;
211     // Are we a new channel?
212     if (!m_pChannel->addChannel())
213     iErrors++;
214 capela 452 // Accept Audio driver or device selection...
215     if (m_audioDevices.isEmpty()) {
216     if (!m_pChannel->setAudioDriver(AudioDriverComboBox->currentText()))
217     iErrors++;
218     } else {
219     qsamplerDevice *pDevice = m_audioDevices.at(AudioDeviceComboBox->currentItem());
220     if (pDevice == NULL)
221     iErrors++;
222     else if (!m_pChannel->setAudioDevice(pDevice->deviceID()))
223     iErrors++;
224 capela 758 else if (!m_audioRouting.isEmpty()) {
225     // Set the audio route changes...
226     qsamplerChannelRoutingMap::ConstIterator iter;
227     for (iter = m_audioRouting.begin();
228     iter != m_audioRouting.end(); ++iter) {
229     if (!m_pChannel->setAudioChannel(iter.key(), iter.data()))
230     iErrors++;
231     }
232     }
233 capela 452 }
234     // Accept MIDI driver or device selection...
235     if (m_midiDevices.isEmpty()) {
236     if (!m_pChannel->setMidiDriver(MidiDriverComboBox->currentText()))
237     iErrors++;
238     } else {
239     qsamplerDevice *pDevice = m_midiDevices.at(MidiDeviceComboBox->currentItem());
240     if (pDevice == NULL)
241     iErrors++;
242     else if (!m_pChannel->setMidiDevice(pDevice->deviceID()))
243     iErrors++;
244     }
245 capela 490 // MIDI input port number...
246     if (!m_pChannel->setMidiPort(MidiPortSpinBox->value()))
247     iErrors++;
248     // MIDI input channel...
249     if (!m_pChannel->setMidiChannel(MidiChannelComboBox->currentItem()))
250     iErrors++;
251     // Engine name...
252     if (!m_pChannel->loadEngine(EngineNameComboBox->currentText()))
253     iErrors++;
254     // Instrument file and index...
255     if (!m_pChannel->loadInstrument(InstrumentFileComboBox->currentText(), InstrumentNrComboBox->currentItem()))
256     iErrors++;
257     // Show error messages?
258     if (iErrors > 0)
259     m_pChannel->appendMessagesError(tr("Some channel settings could not be set.\n\nSorry."));
260     }
261 capela 104
262 capela 490 // Save default engine name, instrument directory and history...
263     pOptions->sInstrumentDir = QFileInfo(InstrumentFileComboBox->currentText()).dirPath(true);
264     pOptions->sEngineName = EngineNameComboBox->currentText();
265     pOptions->sAudioDriver = AudioDriverComboBox->currentText();
266     pOptions->sMidiDriver = MidiDriverComboBox->currentText();
267     pOptions->saveComboBoxHistory(InstrumentFileComboBox);
268 capela 104
269 capela 490 // Just go with dialog acceptance.
270     QDialog::accept();
271 capela 104 }
272    
273    
274     // Reject settings (Cancel button slot).
275     void qsamplerChannelForm::reject (void)
276     {
277 capela 490 bool bReject = true;
278 capela 104
279 capela 490 // Check if there's any pending changes...
280     if (m_iDirtyCount > 0 && OkPushButton->isEnabled()) {
281 capela 757 switch (QMessageBox::warning(this,
282     QSAMPLER_TITLE ": " + tr("Warning"),
283 capela 490 tr("Some channel settings have been changed.\n\n"
284     "Do you want to apply the changes?"),
285     tr("Apply"), tr("Discard"), tr("Cancel"))) {
286     case 0: // Apply...
287     accept();
288     return;
289     case 1: // Discard
290     break;
291     default: // Cancel.
292     bReject = false;
293     }
294     }
295 capela 104
296 capela 490 if (bReject)
297     QDialog::reject();
298 capela 104 }
299    
300    
301     // Browse and open an instrument file.
302     void qsamplerChannelForm::openInstrumentFile (void)
303     {
304 capela 490 qsamplerOptions *pOptions = m_pChannel->options();
305     if (pOptions == NULL)
306     return;
307 capela 104
308 capela 490 // FIXME: the instrument file filters should be restricted,
309     // depending on the current engine.
310     QString sInstrumentFile = QFileDialog::getOpenFileName(
311 capela 757 pOptions->sInstrumentDir, // Start here.
312     tr("Instrument files") + " (*.gig *.dls)", // Filter (GIG and DLS files)
313     this, 0, // Parent and name (none)
314     QSAMPLER_TITLE ": " + tr("Instrument files") // Caption.
315 capela 490 );
316 capela 104
317 capela 490 if (sInstrumentFile.isEmpty())
318     return;
319 capela 104
320 capela 490 InstrumentFileComboBox->setCurrentText(sInstrumentFile);
321 capela 525 updateInstrumentName();
322 capela 104 }
323    
324    
325     // Refresh the actual instrument name.
326     void qsamplerChannelForm::updateInstrumentName (void)
327     {
328 capela 490 qsamplerOptions *pOptions = m_pChannel->options();
329     if (pOptions == NULL)
330     return;
331 capela 341
332 capela 490 // Finally this better idea would be to use libgig
333     // to retrieve the REAL instrument names.
334     InstrumentNrComboBox->clear();
335     InstrumentNrComboBox->insertStringList(
336     qsamplerChannel::getInstrumentList(
337 capela 344 InstrumentFileComboBox->currentText(),
338     pOptions->bInstrumentNames)
339 capela 490 );
340 capela 104
341 capela 490 optionsChanged();
342 capela 104 }
343    
344 capela 487 // Show device options dialog.
345 capela 490 void qsamplerChannelForm::setupDevice ( qsamplerDevice *pDevice,
346     qsamplerDevice::qsamplerDeviceType deviceTypeMode,
347     const QString& sDriverName )
348 capela 487 {
349     // Create the device form if not already...
350     if (m_pDeviceForm == NULL) {
351     m_pDeviceForm = new qsamplerDeviceForm(this, 0,
352     WType_Dialog | WShowModal);
353     m_pDeviceForm->setMainForm(m_pChannel->mainForm());
354 capela 488 QObject::connect(m_pDeviceForm, SIGNAL(devicesChanged()),
355 capela 490 this, SLOT(updateDevices()));
356 capela 487 }
357    
358     // Refresh the device form with selected data.
359     if (m_pDeviceForm) {
360 capela 490 m_pDeviceForm->setDeviceTypeMode(deviceTypeMode);
361     m_pDeviceForm->setClient(m_pChannel->client()); // -> refreshDevices();
362     m_pDeviceForm->setDevice(pDevice);
363     m_pDeviceForm->setDriverName(sDriverName);
364 capela 487 m_pDeviceForm->show();
365     }
366     }
367    
368    
369 capela 488 // Refresh MIDI driver item devices.
370     void qsamplerChannelForm::selectMidiDriverItem ( const QString& sMidiDriver )
371 capela 452 {
372 capela 454 const QString sDriverName = sMidiDriver.upper();
373 capela 488
374     // Save current device id.
375 capela 759 int iDeviceID = 0;
376 capela 488 qsamplerDevice *pDevice = m_midiDevices.at(MidiDeviceComboBox->currentItem());
377     if (pDevice)
378 capela 490 iDeviceID = pDevice->deviceID();
379 capela 488
380     // Clean maplist.
381 capela 452 MidiDeviceComboBox->clear();
382 capela 488 m_midiDevices.clear();
383 capela 104
384 capela 488 // Populate with the current ones...
385 capela 452 const QPixmap& midiPixmap = QPixmap::fromMimeSource("midi2.png");
386     int *piDeviceIDs = qsamplerDevice::getDevices(m_pChannel->client(),
387     qsamplerDevice::Midi);
388     for (int i = 0; piDeviceIDs && piDeviceIDs[i] >= 0; i++) {
389 capela 488 pDevice = new qsamplerDevice(m_pChannel->mainForm(),
390 capela 452 qsamplerDevice::Midi, piDeviceIDs[i]);
391 capela 454 if (pDevice->driverName().upper() == sDriverName) {
392 capela 452 MidiDeviceComboBox->insertItem(midiPixmap, pDevice->deviceName());
393     m_midiDevices.append(pDevice);
394     } else {
395     delete pDevice;
396     }
397     }
398    
399 capela 488 // Do proper enabling...
400 capela 452 bool bEnabled = !m_midiDevices.isEmpty();
401 capela 759 if (bEnabled) {
402 capela 490 // 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 capela 759 } else {
415     MidiDeviceComboBox->insertItem(
416     tr("(New MIDI %1 device)").arg(sMidiDriver));
417 capela 488 }
418 capela 452 MidiDeviceTextLabel->setEnabled(bEnabled);
419     MidiDeviceComboBox->setEnabled(bEnabled);
420 capela 488 }
421    
422    
423     // Refresh MIDI device options slot.
424     void qsamplerChannelForm::selectMidiDriver ( const QString& sMidiDriver )
425     {
426     if (m_iDirtySetup > 0)
427 capela 490 return;
428 capela 488
429     selectMidiDriverItem(sMidiDriver);
430 capela 452 optionsChanged();
431     }
432    
433    
434 capela 488 // Select MIDI device item.
435     void qsamplerChannelForm::selectMidiDeviceItem ( int iMidiItem )
436 capela 455 {
437     qsamplerDevice *pDevice = m_midiDevices.at(iMidiItem);
438     if (pDevice) {
439 capela 462 const qsamplerDeviceParamMap& params = pDevice->params();
440 capela 455 int iPorts = params["PORTS"].value.toInt();
441     MidiPortTextLabel->setEnabled(iPorts > 0);
442     MidiPortSpinBox->setEnabled(iPorts > 0);
443     if (iPorts > 0)
444     MidiPortSpinBox->setMaxValue(iPorts - 1);
445     }
446 capela 488 }
447    
448    
449     // Select MIDI device options slot.
450     void qsamplerChannelForm::selectMidiDevice ( int iMidiItem )
451     {
452     if (m_iDirtySetup > 0)
453 capela 490 return;
454 capela 488
455     selectMidiDeviceItem(iMidiItem);
456 capela 455 optionsChanged();
457     }
458    
459    
460 capela 487 // MIDI device options.
461     void qsamplerChannelForm::setupMidiDevice (void)
462     {
463 capela 490 setupDevice(m_midiDevices.at(MidiDeviceComboBox->currentItem()),
464     qsamplerDevice::Midi, MidiDriverComboBox->currentText());
465 capela 487 }
466    
467    
468 capela 488 // Refresh Audio driver item devices.
469     void qsamplerChannelForm::selectAudioDriverItem ( const QString& sAudioDriver )
470 capela 452 {
471 capela 454 const QString sDriverName = sAudioDriver.upper();
472    
473 capela 488 // Save current device id.
474 capela 759 int iDeviceID = 0;
475 capela 488 qsamplerDevice *pDevice = m_audioDevices.at(AudioDeviceComboBox->currentItem());
476     if (pDevice)
477 capela 490 iDeviceID = pDevice->deviceID();
478 capela 488
479     // Clean maplist.
480 capela 452 AudioDeviceComboBox->clear();
481     m_audioDevices.clear();
482    
483 capela 488 // Populate with the current ones...
484 capela 452 const QPixmap& audioPixmap = QPixmap::fromMimeSource("audio2.png");
485     int *piDeviceIDs = qsamplerDevice::getDevices(m_pChannel->client(),
486     qsamplerDevice::Audio);
487     for (int i = 0; piDeviceIDs && piDeviceIDs[i] >= 0; i++) {
488 capela 488 pDevice = new qsamplerDevice(m_pChannel->mainForm(),
489 capela 452 qsamplerDevice::Audio, piDeviceIDs[i]);
490 capela 454 if (pDevice->driverName().upper() == sDriverName) {
491 capela 452 AudioDeviceComboBox->insertItem(audioPixmap, pDevice->deviceName());
492     m_audioDevices.append(pDevice);
493     } else {
494     delete pDevice;
495     }
496     }
497    
498 capela 488 // Do proper enabling...
499 capela 452 bool bEnabled = !m_audioDevices.isEmpty();
500 capela 759 if (bEnabled) {
501 capela 490 // 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 capela 759 } else {
514     AudioDeviceComboBox->insertItem(
515     tr("(New Audio %1 device)").arg(sAudioDriver));
516     AudioRoutingTable->setNumRows(0);
517 capela 488 }
518 capela 452 AudioDeviceTextLabel->setEnabled(bEnabled);
519     AudioDeviceComboBox->setEnabled(bEnabled);
520 capela 758 AudioRoutingTable->setEnabled(bEnabled);
521 capela 488 }
522    
523    
524     // Refresh Audio device options slot.
525     void qsamplerChannelForm::selectAudioDriver ( const QString& sAudioDriver )
526     {
527     if (m_iDirtySetup > 0)
528 capela 490 return;
529    
530 capela 488 selectAudioDriverItem(sAudioDriver);
531 capela 452 optionsChanged();
532     }
533    
534    
535 capela 488 // Select Audio device item.
536     void qsamplerChannelForm::selectAudioDeviceItem ( int iAudioItem )
537 capela 455 {
538     qsamplerDevice *pDevice = m_audioDevices.at(iAudioItem);
539     if (pDevice) {
540 capela 758 // Refresh the audio routing table.
541     AudioRoutingTable->refresh(pDevice, m_pChannel->audioRouting());
542     // Reset routing change map.
543     m_audioRouting.clear();
544 capela 455 }
545 capela 488 }
546    
547    
548     // Select Audio device options slot.
549     void qsamplerChannelForm::selectAudioDevice ( int iAudioItem )
550     {
551     if (m_iDirtySetup > 0)
552 capela 490 return;
553 capela 488
554     selectAudioDeviceItem(iAudioItem);
555 capela 455 optionsChanged();
556     }
557    
558    
559 capela 487 // Audio device options.
560     void qsamplerChannelForm::setupAudioDevice (void)
561     {
562 capela 490 setupDevice(m_audioDevices.at(AudioDeviceComboBox->currentItem()),
563     qsamplerDevice::Audio, AudioDriverComboBox->currentText());
564 capela 487 }
565    
566    
567 capela 758 // Audio routing change slot.
568     void qsamplerChannelForm::changeAudioRouting ( int iRow, int iCol )
569     {
570     if (m_iDirtySetup > 0)
571     return;
572     if (iRow < 0 || iCol < 0)
573     return;
574    
575     // Verify that this is a QComboTableItem (magic rtti == 1)
576     QTableItem *pItem = AudioRoutingTable->item(iRow, iCol);
577     if (pItem == NULL)
578     return;
579 capela 759 qsamplerChannelRoutingComboBox *pComboItem =
580     static_cast<qsamplerChannelRoutingComboBox*> (pItem);
581     // FIXME: Its not garanteed that we must have
582     // iAudioOut == iRow on all times forth!
583     m_audioRouting[iRow] = pComboItem->currentItem();
584    
585     // And let's get dirty...
586     optionsChanged();
587 capela 758 }
588    
589    
590 capela 488 // UPdate all device lists slot.
591     void qsamplerChannelForm::updateDevices (void)
592     {
593 capela 490 if (m_iDirtySetup > 0)
594     return;
595 capela 488
596     selectMidiDriverItem(MidiDriverComboBox->currentText());
597     selectAudioDriverItem(AudioDriverComboBox->currentText());
598     optionsChanged();
599     }
600    
601    
602 capela 104 // Dirty up settings.
603     void qsamplerChannelForm::optionsChanged (void)
604     {
605 capela 490 if (m_iDirtySetup > 0)
606     return;
607 capela 104
608 capela 490 m_iDirtyCount++;
609     stabilizeForm();
610 capela 104 }
611    
612    
613     // Stabilize current form state.
614     void qsamplerChannelForm::stabilizeForm (void)
615     {
616 capela 490 const QString& sFilename = InstrumentFileComboBox->currentText();
617     OkPushButton->setEnabled(m_iDirtyCount > 0 && !sFilename.isEmpty() && QFileInfo(sFilename).exists());
618 capela 104 }
619    
620    
621     // end of qsamplerChannelForm.ui.h

  ViewVC Help
Powered by ViewVC