/[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 961 - (hide annotations) (download) (as text)
Sun Dec 3 18:26:13 2006 UTC (17 years, 4 months ago) by capela
File MIME type: text/x-c++hdr
File size: 18769 byte(s)
- Adding preliminary MIDI instrument mapping support; now
  with an instrument list widget and editing capabilities.

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

  ViewVC Help
Powered by ViewVC