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

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

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 490 by capela, Fri Apr 1 00:34:58 2005 UTC revision 961 by capela, Sun Dec 3 18:26:13 2006 UTC
# Line 2  Line 2 
2  //  //
3  // ui.h extension file, included from the uic-generated form implementation.  // ui.h extension file, included from the uic-generated form implementation.
4  /****************************************************************************  /****************************************************************************
5     Copyright (C) 2004-2005, rncbc aka Rui Nuno Capela. All rights reserved.     Copyright (C) 2004-2006, rncbc aka Rui Nuno Capela. All rights reserved.
6    
7     This program is free software; you can redistribute it and/or     This program is free software; you can redistribute it and/or
8     modify it under the terms of the GNU General Public License     modify it under the terms of the GNU General Public License
# Line 14  Line 14 
14     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15     GNU General Public License for more details.     GNU General Public License for more details.
16    
17     You should have received a copy of the GNU General Public License     You should have received a copy of the GNU General Public License along
18     along with this program; if not, write to the Free Software     with this program; if not, write to the Free Software Foundation, Inc.,
19     Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.     51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20    
21  *****************************************************************************/  *****************************************************************************/
22    
23    #include "qsamplerAbout.h"
24    #include "qsamplerDeviceForm.h"
25    
26    #include "qsamplerMainForm.h"
27    
28  #include <qvalidator.h>  #include <qvalidator.h>
29  #include <qmessagebox.h>  #include <qmessagebox.h>
30  #include <qfiledialog.h>  #include <qfiledialog.h>
31  #include <qfileinfo.h>  #include <qfileinfo.h>
32  #include <qlistbox.h>  #include <qlistbox.h>
33    
 #include "qsamplerDeviceForm.h"  
   
 #include "config.h"  
   
34    
35  // Kind of constructor.  // Kind of constructor.
36  void qsamplerChannelForm::init (void)  void qsamplerChannelForm::init (void)
# Line 72  void qsamplerChannelForm::setup ( qsampl Line 73  void qsamplerChannelForm::setup ( qsampl
73    
74          // It can be a brand new channel, remember?          // It can be a brand new channel, remember?
75          bool bNew = (m_pChannel->channelID() < 0);          bool bNew = (m_pChannel->channelID() < 0);
76          setCaption(m_pChannel->channelName());          setCaption(QSAMPLER_TITLE ": " + m_pChannel->channelName());
77    
78          // Check if we're up and connected.          // Check if we're up and connected.
79          if (m_pChannel->client() == NULL)          qsamplerMainForm *pMainForm = qsamplerMainForm::getInstance();
80            if (pMainForm == NULL)
81                    return;
82            if (pMainForm->client() == NULL)
83                  return;                  return;
84    
85          qsamplerOptions *pOptions = m_pChannel->options();          qsamplerOptions *pOptions = pMainForm->options();
86          if (pOptions == NULL)          if (pOptions == NULL)
87                  return;                  return;
88    
# Line 88  void qsamplerChannelForm::setup ( qsampl Line 92  void qsamplerChannelForm::setup ( qsampl
92          // Load combo box history...          // Load combo box history...
93          pOptions->loadComboBoxHistory(InstrumentFileComboBox);          pOptions->loadComboBoxHistory(InstrumentFileComboBox);
94    
95            // 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          // Populate Engines list.          // Populate Engines list.
100          const char **ppszEngines = ::lscp_get_available_engines(m_pChannel->client());          const char **ppszEngines = ::lscp_list_available_engines(pMainForm->client());
101          if (ppszEngines) {          if (ppszEngines) {
102                  EngineNameComboBox->clear();                  EngineNameComboBox->clear();
103                  for (int iEngine = 0; ppszEngines[iEngine]; iEngine++)                  for (int iEngine = 0; ppszEngines[iEngine]; iEngine++)
104                          EngineNameComboBox->insertItem(ppszEngines[iEngine]);                          EngineNameComboBox->insertItem(ppszEngines[iEngine]);
105          }          }
106          else m_pChannel->appendMessagesClient("lscp_get_available_engines");          else m_pChannel->appendMessagesClient("lscp_list_available_engines");
107    
108          // Populate Audio output type list.          // Populate Audio output type list.
109          AudioDriverComboBox->clear();          AudioDriverComboBox->clear();
110          AudioDriverComboBox->insertStringList(          AudioDriverComboBox->insertStringList(
111                  qsamplerDevice::getDrivers(m_pChannel->client(), qsamplerDevice::Audio));                  qsamplerDevice::getDrivers(pMainForm->client(), qsamplerDevice::Audio));
112    
113          // Populate MIDI input type list.          // Populate MIDI input type list.
114          MidiDriverComboBox->clear();          MidiDriverComboBox->clear();
115          MidiDriverComboBox->insertStringList(          MidiDriverComboBox->insertStringList(
116                  qsamplerDevice::getDrivers(m_pChannel->client(), qsamplerDevice::Midi));                  qsamplerDevice::getDrivers(pMainForm->client(), qsamplerDevice::Midi));
117    
118          // Read proper channel information,          // Read proper channel information,
119          // and populate the channel form fields.          // and populate the channel form fields.
# Line 133  void qsamplerChannelForm::setup ( qsampl Line 141  void qsamplerChannelForm::setup ( qsampl
141          InstrumentNrComboBox->setCurrentItem(pChannel->instrumentNr());          InstrumentNrComboBox->setCurrentItem(pChannel->instrumentNr());
142    
143          // MIDI input device...          // MIDI input device...
144          qsamplerDevice midiDevice(m_pChannel->mainForm(),          qsamplerDevice midiDevice(qsamplerDevice::Midi, m_pChannel->midiDevice());
                 qsamplerDevice::Midi, m_pChannel->midiDevice());  
145          // MIDI input driver...          // MIDI input driver...
146          QString sMidiDriver = midiDevice.driverName();          QString sMidiDriver = midiDevice.driverName();
147          if (sMidiDriver.isEmpty() || bNew)          if (sMidiDriver.isEmpty() || bNew)
# Line 156  void qsamplerChannelForm::setup ( qsampl Line 163  void qsamplerChannelForm::setup ( qsampl
163          int iMidiChannel = pChannel->midiChannel();          int iMidiChannel = pChannel->midiChannel();
164          // When new, try to suggest a sensible MIDI channel...          // When new, try to suggest a sensible MIDI channel...
165          if (iMidiChannel < 0)          if (iMidiChannel < 0)
166                  iMidiChannel = (::lscp_get_channels(m_pChannel->client()) % 16);                  iMidiChannel = (::lscp_get_channels(pMainForm->client()) % 16);
167          MidiChannelComboBox->setCurrentItem(iMidiChannel);          MidiChannelComboBox->setCurrentItem(iMidiChannel);
168    
169          // Audio output device...          // Audio output device...
170          qsamplerDevice audioDevice(m_pChannel->mainForm(),          qsamplerDevice audioDevice(qsamplerDevice::Audio, m_pChannel->audioDevice());
                 qsamplerDevice::Audio, m_pChannel->audioDevice());  
171          // Audio output driver...          // Audio output driver...
172          QString sAudioDriver = audioDevice.driverName();          QString sAudioDriver = audioDevice.driverName();
173          if (sAudioDriver.isEmpty() || bNew)          if (sAudioDriver.isEmpty() || bNew)
# Line 180  void qsamplerChannelForm::setup ( qsampl Line 186  void qsamplerChannelForm::setup ( qsampl
186    
187          // As convenient, make it ready on stabilizeForm() for          // As convenient, make it ready on stabilizeForm() for
188          // prompt acceptance, if we got the minimum required...          // prompt acceptance, if we got the minimum required...
189          if (sEngineName != qsamplerChannel::noEngineName() &&  /*      if (sEngineName != qsamplerChannel::noEngineName() &&
190                  sInstrumentFile != qsamplerChannel::noInstrumentName())                  sInstrumentFile != qsamplerChannel::noInstrumentName())
191                  m_iDirtyCount++;                  m_iDirtyCount++; */
192          // Done.          // Done.
193          m_iDirtySetup--;          m_iDirtySetup--;
194          stabilizeForm();          stabilizeForm();
# Line 195  void qsamplerChannelForm::accept (void) Line 201  void qsamplerChannelForm::accept (void)
201          if (m_pChannel == NULL)          if (m_pChannel == NULL)
202                  return;                  return;
203    
204          qsamplerOptions *pOptions = m_pChannel->options();          qsamplerMainForm *pMainForm = qsamplerMainForm::getInstance();
205            if (pMainForm == NULL)
206                    return;
207            if (pMainForm->client() == NULL)
208                    return;
209    
210            qsamplerOptions *pOptions = pMainForm->options();
211          if (pOptions == NULL)          if (pOptions == NULL)
212                  return;                  return;
213    
214            // Flush any pending editing...
215            AudioRoutingTable->flush();
216    
217          // We'll go for it!          // We'll go for it!
218          if (m_iDirtyCount > 0) {          if (m_iDirtyCount > 0) {
219                  int iErrors = 0;                  int iErrors = 0;
# Line 215  void qsamplerChannelForm::accept (void) Line 230  void qsamplerChannelForm::accept (void)
230                                  iErrors++;                                  iErrors++;
231                          else if (!m_pChannel->setAudioDevice(pDevice->deviceID()))                          else if (!m_pChannel->setAudioDevice(pDevice->deviceID()))
232                                  iErrors++;                                  iErrors++;
233                            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                  }                  }
243                  // Accept MIDI driver or device selection...                  // Accept MIDI driver or device selection...
244                  if (m_midiDevices.isEmpty()) {                  if (m_midiDevices.isEmpty()) {
# Line 263  void qsamplerChannelForm::reject (void) Line 287  void qsamplerChannelForm::reject (void)
287    
288          // Check if there's any pending changes...          // Check if there's any pending changes...
289          if (m_iDirtyCount > 0 && OkPushButton->isEnabled()) {          if (m_iDirtyCount > 0 && OkPushButton->isEnabled()) {
290                  switch (QMessageBox::warning(this, tr("Warning"),                  switch (QMessageBox::warning(this,
291                            QSAMPLER_TITLE ": " + tr("Warning"),
292                          tr("Some channel settings have been changed.\n\n"                          tr("Some channel settings have been changed.\n\n"
293                          "Do you want to apply the changes?"),                          "Do you want to apply the changes?"),
294                          tr("Apply"), tr("Discard"), tr("Cancel"))) {                          tr("Apply"), tr("Discard"), tr("Cancel"))) {
# Line 274  void qsamplerChannelForm::reject (void) Line 299  void qsamplerChannelForm::reject (void)
299                          break;                          break;
300                  default:    // Cancel.                  default:    // Cancel.
301                          bReject = false;                          bReject = false;
302                            break;
303                  }                  }
304          }          }
305    
# Line 285  void qsamplerChannelForm::reject (void) Line 311  void qsamplerChannelForm::reject (void)
311  // Browse and open an instrument file.  // Browse and open an instrument file.
312  void qsamplerChannelForm::openInstrumentFile (void)  void qsamplerChannelForm::openInstrumentFile (void)
313  {  {
314          qsamplerOptions *pOptions = m_pChannel->options();          qsamplerMainForm *pMainForm = qsamplerMainForm::getInstance();
315            if (pMainForm == NULL)
316                    return;
317            if (pMainForm->client() == NULL)
318                    return;
319    
320            qsamplerOptions *pOptions = pMainForm->options();
321          if (pOptions == NULL)          if (pOptions == NULL)
322                  return;                  return;
323    
324          // FIXME: the instrument file filters should be restricted,          // FIXME: the instrument file filters should be restricted,
325          // depending on the current engine.          // depending on the current engine.
326          QString sInstrumentFile = QFileDialog::getOpenFileName(          QString sInstrumentFile = QFileDialog::getOpenFileName(
327                          pOptions->sInstrumentDir,                   // Start here.                  pOptions->sInstrumentDir,                   // Start here.
328                          tr("Instrument files") + " (*.gig *.dls)",  // Filter (GIG and DLS files)                  tr("Instrument files") + " (*.gig *.dls)",  // Filter (GIG and DLS files)
329                          this, 0,                                    // Parent and name (none)                  this, 0,                                    // Parent and name (none)
330                          tr("Instrument files")                      // Caption.                  QSAMPLER_TITLE ": " + tr("Instrument files")    // Caption.
331          );          );
332    
333          if (sInstrumentFile.isEmpty())          if (sInstrumentFile.isEmpty())
334                  return;                  return;
335    
336          InstrumentFileComboBox->setCurrentText(sInstrumentFile);          InstrumentFileComboBox->setCurrentText(sInstrumentFile);
337            updateInstrumentName();
338  }  }
339    
340    
341  // Refresh the actual instrument name.  // Refresh the actual instrument name.
342  void qsamplerChannelForm::updateInstrumentName (void)  void qsamplerChannelForm::updateInstrumentName (void)
343  {  {
344          qsamplerOptions *pOptions = m_pChannel->options();          qsamplerMainForm *pMainForm = qsamplerMainForm::getInstance();
345            if (pMainForm == NULL)
346                    return;
347            if (pMainForm->client() == NULL)
348                    return;
349    
350            qsamplerOptions *pOptions = pMainForm->options();
351          if (pOptions == NULL)          if (pOptions == NULL)
352                  return;                  return;
353    
# Line 324  void qsamplerChannelForm::updateInstrume Line 363  void qsamplerChannelForm::updateInstrume
363          optionsChanged();          optionsChanged();
364  }  }
365    
366    
367  // Show device options dialog.  // Show device options dialog.
368  void qsamplerChannelForm::setupDevice ( qsamplerDevice *pDevice,  void qsamplerChannelForm::setupDevice ( qsamplerDevice *pDevice,
369          qsamplerDevice::qsamplerDeviceType deviceTypeMode,          qsamplerDevice::qsamplerDeviceType deviceTypeMode,
370          const QString& sDriverName )          const QString& sDriverName )
371  {  {
372            qsamplerMainForm *pMainForm = qsamplerMainForm::getInstance();
373            if (pMainForm == NULL)
374                    return;
375            if (pMainForm->client() == NULL)
376                    return;
377    
378          // Create the device form if not already...          // Create the device form if not already...
379          if (m_pDeviceForm == NULL) {          if (m_pDeviceForm == NULL) {
380                  m_pDeviceForm = new qsamplerDeviceForm(this, 0,                  m_pDeviceForm = new qsamplerDeviceForm(this, 0,
381                          WType_Dialog | WShowModal);                          WType_Dialog | WShowModal);
                 m_pDeviceForm->setMainForm(m_pChannel->mainForm());  
382                  QObject::connect(m_pDeviceForm, SIGNAL(devicesChanged()),                  QObject::connect(m_pDeviceForm, SIGNAL(devicesChanged()),
383                          this, SLOT(updateDevices()));                          this, SLOT(updateDevices()));
384          }          }
# Line 341  void qsamplerChannelForm::setupDevice ( Line 386  void qsamplerChannelForm::setupDevice (
386          // Refresh the device form with selected data.          // Refresh the device form with selected data.
387          if (m_pDeviceForm) {          if (m_pDeviceForm) {
388                  m_pDeviceForm->setDeviceTypeMode(deviceTypeMode);                  m_pDeviceForm->setDeviceTypeMode(deviceTypeMode);
389                  m_pDeviceForm->setClient(m_pChannel->client()); // -> refreshDevices();                  m_pDeviceForm->refreshDevices();
390                  m_pDeviceForm->setDevice(pDevice);                  m_pDeviceForm->setDevice(pDevice);
391                  m_pDeviceForm->setDriverName(sDriverName);                  m_pDeviceForm->setDriverName(sDriverName);
392                  m_pDeviceForm->show();                  m_pDeviceForm->show();
# Line 352  void qsamplerChannelForm::setupDevice ( Line 397  void qsamplerChannelForm::setupDevice (
397  // Refresh MIDI driver item devices.  // Refresh MIDI driver item devices.
398  void qsamplerChannelForm::selectMidiDriverItem ( const QString& sMidiDriver )  void qsamplerChannelForm::selectMidiDriverItem ( const QString& sMidiDriver )
399  {  {
400            qsamplerMainForm *pMainForm = qsamplerMainForm::getInstance();
401            if (pMainForm == NULL)
402                    return;
403            if (pMainForm->client() == NULL)
404                    return;
405    
406          const QString sDriverName = sMidiDriver.upper();          const QString sDriverName = sMidiDriver.upper();
407    
408          // Save current device id.          // Save current device id.
409          int iDeviceID = -1;          int iDeviceID = 0;
410          qsamplerDevice *pDevice = m_midiDevices.at(MidiDeviceComboBox->currentItem());          qsamplerDevice *pDevice = m_midiDevices.at(MidiDeviceComboBox->currentItem());
411          if (pDevice)          if (pDevice)
412                  iDeviceID = pDevice->deviceID();                  iDeviceID = pDevice->deviceID();
# Line 366  void qsamplerChannelForm::selectMidiDriv Line 417  void qsamplerChannelForm::selectMidiDriv
417    
418          // Populate with the current ones...          // Populate with the current ones...
419          const QPixmap& midiPixmap = QPixmap::fromMimeSource("midi2.png");          const QPixmap& midiPixmap = QPixmap::fromMimeSource("midi2.png");
420          int *piDeviceIDs = qsamplerDevice::getDevices(m_pChannel->client(),          int *piDeviceIDs = qsamplerDevice::getDevices(pMainForm->client(),
421                  qsamplerDevice::Midi);                  qsamplerDevice::Midi);
422          for (int i = 0; piDeviceIDs && piDeviceIDs[i] >= 0; i++) {          for (int i = 0; piDeviceIDs && piDeviceIDs[i] >= 0; i++) {
423                  pDevice = new qsamplerDevice(m_pChannel->mainForm(),                  pDevice = new qsamplerDevice(qsamplerDevice::Midi, piDeviceIDs[i]);
                         qsamplerDevice::Midi, piDeviceIDs[i]);  
424                  if (pDevice->driverName().upper() == sDriverName) {                  if (pDevice->driverName().upper() == sDriverName) {
425                          MidiDeviceComboBox->insertItem(midiPixmap, pDevice->deviceName());                          MidiDeviceComboBox->insertItem(midiPixmap, pDevice->deviceName());
426                          m_midiDevices.append(pDevice);                          m_midiDevices.append(pDevice);
# Line 381  void qsamplerChannelForm::selectMidiDriv Line 431  void qsamplerChannelForm::selectMidiDriv
431    
432          // Do proper enabling...          // Do proper enabling...
433          bool bEnabled = !m_midiDevices.isEmpty();          bool bEnabled = !m_midiDevices.isEmpty();
434          if (!bEnabled) {          if (bEnabled) {
                 MidiDeviceComboBox->insertItem(  
                         tr("(New MIDI %1 device)").arg(sMidiDriver));  
         } else if (iDeviceID >= 0) {  
435                  // Select the previous current device...                  // Select the previous current device...
436                  int iMidiItem = 0;                  int iMidiItem = 0;
437                  for (pDevice = m_midiDevices.first();                  for (pDevice = m_midiDevices.first();
# Line 392  void qsamplerChannelForm::selectMidiDriv Line 439  void qsamplerChannelForm::selectMidiDriv
439                                          pDevice = m_midiDevices.next()) {                                          pDevice = m_midiDevices.next()) {
440                          if (pDevice->deviceID() == iDeviceID) {                          if (pDevice->deviceID() == iDeviceID) {
441                                  MidiDeviceComboBox->setCurrentItem(iMidiItem);                                  MidiDeviceComboBox->setCurrentItem(iMidiItem);
442                          //      selectMidiDeviceItem(iMidiItem);                                  selectMidiDeviceItem(iMidiItem);
443                                  break;                                  break;
444                          }                          }
445                          iMidiItem++;                          iMidiItem++;
446                  }                  }
447            } else {
448                    MidiDeviceComboBox->insertItem(
449                            tr("(New MIDI %1 device)").arg(sMidiDriver));
450          }          }
451          MidiDeviceTextLabel->setEnabled(bEnabled);          MidiDeviceTextLabel->setEnabled(bEnabled);
452          MidiDeviceComboBox->setEnabled(bEnabled);          MidiDeviceComboBox->setEnabled(bEnabled);
# Line 451  void qsamplerChannelForm::setupMidiDevic Line 501  void qsamplerChannelForm::setupMidiDevic
501  // Refresh Audio driver item devices.  // Refresh Audio driver item devices.
502  void qsamplerChannelForm::selectAudioDriverItem ( const QString& sAudioDriver )  void qsamplerChannelForm::selectAudioDriverItem ( const QString& sAudioDriver )
503  {  {
504            qsamplerMainForm *pMainForm = qsamplerMainForm::getInstance();
505            if (pMainForm == NULL)
506                    return;
507            if (pMainForm->client() == NULL)
508                    return;
509    
510          const QString sDriverName = sAudioDriver.upper();          const QString sDriverName = sAudioDriver.upper();
511    
512          // Save current device id.          // Save current device id.
513          int iDeviceID = -1;          int iDeviceID = 0;
514          qsamplerDevice *pDevice = m_audioDevices.at(AudioDeviceComboBox->currentItem());          qsamplerDevice *pDevice = m_audioDevices.at(AudioDeviceComboBox->currentItem());
515          if (pDevice)          if (pDevice)
516                  iDeviceID = pDevice->deviceID();                  iDeviceID = pDevice->deviceID();
# Line 465  void qsamplerChannelForm::selectAudioDri Line 521  void qsamplerChannelForm::selectAudioDri
521    
522          // Populate with the current ones...          // Populate with the current ones...
523          const QPixmap& audioPixmap = QPixmap::fromMimeSource("audio2.png");          const QPixmap& audioPixmap = QPixmap::fromMimeSource("audio2.png");
524          int *piDeviceIDs = qsamplerDevice::getDevices(m_pChannel->client(),          int *piDeviceIDs = qsamplerDevice::getDevices(pMainForm->client(),
525                  qsamplerDevice::Audio);                  qsamplerDevice::Audio);
526          for (int i = 0; piDeviceIDs && piDeviceIDs[i] >= 0; i++) {          for (int i = 0; piDeviceIDs && piDeviceIDs[i] >= 0; i++) {
527                  pDevice = new qsamplerDevice(m_pChannel->mainForm(),                  pDevice = new qsamplerDevice(qsamplerDevice::Audio, piDeviceIDs[i]);
                         qsamplerDevice::Audio, piDeviceIDs[i]);  
528                  if (pDevice->driverName().upper() == sDriverName) {                  if (pDevice->driverName().upper() == sDriverName) {
529                          AudioDeviceComboBox->insertItem(audioPixmap, pDevice->deviceName());                          AudioDeviceComboBox->insertItem(audioPixmap, pDevice->deviceName());
530                          m_audioDevices.append(pDevice);                          m_audioDevices.append(pDevice);
# Line 480  void qsamplerChannelForm::selectAudioDri Line 535  void qsamplerChannelForm::selectAudioDri
535    
536          // Do proper enabling...          // Do proper enabling...
537          bool bEnabled = !m_audioDevices.isEmpty();          bool bEnabled = !m_audioDevices.isEmpty();
538          if (!bEnabled) {          if (bEnabled) {
                 AudioDeviceComboBox->insertItem(  
                         tr("(New Audio %1 device)").arg(sAudioDriver));  
         } else if (iDeviceID >= 0) {  
539                  // Select the previous current device...                  // Select the previous current device...
540                  int iAudioItem = 0;                  int iAudioItem = 0;
541                  for (pDevice = m_audioDevices.first();                  for (pDevice = m_audioDevices.first();
# Line 491  void qsamplerChannelForm::selectAudioDri Line 543  void qsamplerChannelForm::selectAudioDri
543                                          pDevice = m_audioDevices.next()) {                                          pDevice = m_audioDevices.next()) {
544                          if (pDevice->deviceID() == iDeviceID) {                          if (pDevice->deviceID() == iDeviceID) {
545                                  AudioDeviceComboBox->setCurrentItem(iAudioItem);                                  AudioDeviceComboBox->setCurrentItem(iAudioItem);
546                          //      selectAudioDeviceItem(iAudioItem);                                  selectAudioDeviceItem(iAudioItem);
547                                  break;                                  break;
548                          }                          }
549                          iAudioItem++;                          iAudioItem++;
550                  }                  }
551            } else {
552                    AudioDeviceComboBox->insertItem(
553                            tr("(New Audio %1 device)").arg(sAudioDriver));
554                    AudioRoutingTable->setNumRows(0);
555          }          }
556          AudioDeviceTextLabel->setEnabled(bEnabled);          AudioDeviceTextLabel->setEnabled(bEnabled);
557          AudioDeviceComboBox->setEnabled(bEnabled);          AudioDeviceComboBox->setEnabled(bEnabled);
558            AudioRoutingTable->setEnabled(bEnabled);
559  }  }
560    
561    
# Line 518  void qsamplerChannelForm::selectAudioDev Line 575  void qsamplerChannelForm::selectAudioDev
575  {  {
576          qsamplerDevice *pDevice = m_audioDevices.at(iAudioItem);          qsamplerDevice *pDevice = m_audioDevices.at(iAudioItem);
577          if (pDevice) {          if (pDevice) {
578                  // Is there anything to do here?                  // Refresh the audio routing table.
579                    AudioRoutingTable->refresh(pDevice, m_pChannel->audioRouting());
580                    // Reset routing change map.
581                    m_audioRouting.clear();
582          }          }
583  }  }
584    
# Line 542  void qsamplerChannelForm::setupAudioDevi Line 602  void qsamplerChannelForm::setupAudioDevi
602  }  }
603    
604    
605    // 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            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    }
626    
627    
628  // UPdate all device lists slot.  // UPdate all device lists slot.
629  void qsamplerChannelForm::updateDevices (void)  void qsamplerChannelForm::updateDevices (void)
630  {  {

Legend:
Removed from v.490  
changed lines
  Added in v.961

  ViewVC Help
Powered by ViewVC