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

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

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

revision 1499 by capela, Tue Nov 20 16:48:04 2007 UTC revision 1504 by capela, Wed Nov 21 11:46:40 2007 UTC
# Line 201  void ChannelForm::setup ( qsamplerChanne Line 201  void ChannelForm::setup ( qsamplerChanne
201          ui.EngineNameComboBox->setCurrentIndex(          ui.EngineNameComboBox->setCurrentIndex(
202                  ui.EngineNameComboBox->findText(sEngineName,                  ui.EngineNameComboBox->findText(sEngineName,
203                          Qt::MatchExactly | Qt::MatchCaseSensitive));                          Qt::MatchExactly | Qt::MatchCaseSensitive));
204    
205          // Instrument filename and index...          // Instrument filename and index...
206          QString sInstrumentFile = pChannel->instrumentFile();          QString sInstrumentFile = pChannel->instrumentFile();
207          if (sInstrumentFile.isEmpty())          if (sInstrumentFile.isEmpty())
# Line 324  void ChannelForm::accept (void) Line 325  void ChannelForm::accept (void)
325                          if (!m_pChannel->setAudioDriver(ui.AudioDriverComboBox->currentText()))                          if (!m_pChannel->setAudioDriver(ui.AudioDriverComboBox->currentText()))
326                                  iErrors++;                                  iErrors++;
327                  } else {                  } else {
328                          qsamplerDevice *pDevice = m_audioDevices.at(ui.AudioDeviceComboBox->currentIndex());                          qsamplerDevice *pDevice = NULL;
329                            int iAudioItem = ui.AudioDeviceComboBox->currentIndex();
330                            if (iAudioItem >= 0 && iAudioItem < m_audioDevices.count())
331                                    pDevice = m_audioDevices.at(iAudioItem);
332                          qsamplerChannelRoutingMap routingMap = routingModel.routingMap();                          qsamplerChannelRoutingMap routingMap = routingModel.routingMap();
333                          if (pDevice == NULL)                          if (pDevice == NULL)
334                                  iErrors++;                                  iErrors++;
# Line 345  void ChannelForm::accept (void) Line 349  void ChannelForm::accept (void)
349                          if (!m_pChannel->setMidiDriver(ui.MidiDriverComboBox->currentText()))                          if (!m_pChannel->setMidiDriver(ui.MidiDriverComboBox->currentText()))
350                                  iErrors++;                                  iErrors++;
351                  } else {                  } else {
352                          qsamplerDevice *pDevice = m_midiDevices.at(ui.MidiDeviceComboBox->currentIndex());                          qsamplerDevice *pDevice = NULL;
353                            int iMidiItem = ui.MidiDeviceComboBox->currentIndex();
354                            if (iMidiItem >= 0 && iMidiItem < m_midiDevices.count())
355                                    pDevice = m_midiDevices.at(iMidiItem);
356                          if (pDevice == NULL)                          if (pDevice == NULL)
357                                  iErrors++;                                  iErrors++;
358                          else if (!m_pChannel->setMidiDevice(pDevice->deviceID()))                          else if (!m_pChannel->setMidiDevice(pDevice->deviceID()))
# Line 479  void ChannelForm::setupDevice ( qsampler Line 486  void ChannelForm::setupDevice ( qsampler
486          qsamplerDevice::qsamplerDeviceType deviceTypeMode,          qsamplerDevice::qsamplerDeviceType deviceTypeMode,
487          const QString& sDriverName )          const QString& sDriverName )
488  {  {
489            if (pDevice == NULL)
490                    return;
491    
492          MainForm *pMainForm = MainForm::getInstance();          MainForm *pMainForm = MainForm::getInstance();
493          if (pMainForm == NULL)          if (pMainForm == NULL)
494                  return;                  return;
# Line 516  void ChannelForm::selectMidiDriverItem ( Line 526  void ChannelForm::selectMidiDriverItem (
526          const QString sDriverName = sMidiDriver.toUpper();          const QString sDriverName = sMidiDriver.toUpper();
527    
528          // Save current device id.          // Save current device id.
529            // Save current device id.
530          int iDeviceID = 0;          int iDeviceID = 0;
531          qsamplerDevice *pDevice = m_midiDevices.at(ui.MidiDeviceComboBox->currentIndex());          qsamplerDevice *pDevice = NULL;
532            int iMidiItem = ui.MidiDeviceComboBox->currentIndex();
533            if (iMidiItem >= 0 && iMidiItem < m_midiDevices.count())
534                    pDevice = m_midiDevices.at(iMidiItem);
535          if (pDevice)          if (pDevice)
536                  iDeviceID = pDevice->deviceID();                  iDeviceID = pDevice->deviceID();
537    
# Line 544  void ChannelForm::selectMidiDriverItem ( Line 558  void ChannelForm::selectMidiDriverItem (
558          bool bEnabled = !m_midiDevices.isEmpty();          bool bEnabled = !m_midiDevices.isEmpty();
559          if (bEnabled) {          if (bEnabled) {
560                  // Select the previous current device...                  // Select the previous current device...
561                  int iMidiItem = 0;                  iMidiItem = 0;
562                  QListIterator<qsamplerDevice *> iter(m_midiDevices);                  QListIterator<qsamplerDevice *> iter(m_midiDevices);
563                  while (iter.hasNext()) {                  while (iter.hasNext()) {
564                          pDevice = iter.next();                          pDevice = iter.next();
# Line 578  void ChannelForm::selectMidiDriver ( con Line 592  void ChannelForm::selectMidiDriver ( con
592  // Select MIDI device item.  // Select MIDI device item.
593  void ChannelForm::selectMidiDeviceItem ( int iMidiItem )  void ChannelForm::selectMidiDeviceItem ( int iMidiItem )
594  {  {
595          qsamplerDevice *pDevice = m_midiDevices.at(iMidiItem);          qsamplerDevice *pDevice = NULL;
596            if (iMidiItem >= 0 && iMidiItem < m_midiDevices.count())
597                    pDevice = m_midiDevices.at(iMidiItem);
598          if (pDevice) {          if (pDevice) {
599                  const qsamplerDeviceParamMap& params = pDevice->params();                  const qsamplerDeviceParamMap& params = pDevice->params();
600                  int iPorts = params["PORTS"].value.toInt();                  int iPorts = params["PORTS"].value.toInt();
# Line 604  void ChannelForm::selectMidiDevice ( int Line 620  void ChannelForm::selectMidiDevice ( int
620  // MIDI device options.  // MIDI device options.
621  void ChannelForm::setupMidiDevice (void)  void ChannelForm::setupMidiDevice (void)
622  {  {
623          setupDevice(m_midiDevices.at(ui.MidiDeviceComboBox->currentIndex()),          qsamplerDevice *pDevice = NULL;
624            int iMidiItem = ui.MidiDeviceComboBox->currentIndex();
625            if (iMidiItem >= 0 && iMidiItem < m_midiDevices.count())
626                    pDevice = m_midiDevices.at(iMidiItem);
627            setupDevice(pDevice,
628                  qsamplerDevice::Midi, ui.MidiDriverComboBox->currentText());                  qsamplerDevice::Midi, ui.MidiDriverComboBox->currentText());
629  }  }
630    
# Line 622  void ChannelForm::selectAudioDriverItem Line 642  void ChannelForm::selectAudioDriverItem
642    
643          // Save current device id.          // Save current device id.
644          int iDeviceID = 0;          int iDeviceID = 0;
645          qsamplerDevice *pDevice = m_audioDevices.at(ui.AudioDeviceComboBox->currentIndex());          qsamplerDevice *pDevice = NULL;
646            int iAudioItem = ui.AudioDeviceComboBox->currentIndex();
647            if (iAudioItem >= 0 && iAudioItem < m_audioDevices.count())
648                    pDevice = m_audioDevices.at(iAudioItem);
649          if (pDevice)          if (pDevice)
650                  iDeviceID = pDevice->deviceID();                  iDeviceID = pDevice->deviceID();
651    
# Line 649  void ChannelForm::selectAudioDriverItem Line 672  void ChannelForm::selectAudioDriverItem
672          bool bEnabled = !m_audioDevices.isEmpty();          bool bEnabled = !m_audioDevices.isEmpty();
673          if (bEnabled) {          if (bEnabled) {
674                  // Select the previous current device...                  // Select the previous current device...
675                  int iAudioItem = 0;                  iAudioItem = 0;
676                  QListIterator<qsamplerDevice *> iter(m_audioDevices);                  QListIterator<qsamplerDevice *> iter(m_audioDevices);
677                  while (iter.hasNext()) {                  while (iter.hasNext()) {
678                          pDevice = iter.next();                          pDevice = iter.next();
# Line 685  void ChannelForm::selectAudioDriver ( co Line 708  void ChannelForm::selectAudioDriver ( co
708  // Select Audio device item.  // Select Audio device item.
709  void ChannelForm::selectAudioDeviceItem ( int iAudioItem )  void ChannelForm::selectAudioDeviceItem ( int iAudioItem )
710  {  {
711          qsamplerDevice *pDevice = m_audioDevices.at(iAudioItem);          qsamplerDevice *pDevice = NULL;
712            if (iAudioItem >= 0 && iAudioItem < m_audioDevices.count())
713                    pDevice = m_audioDevices.at(iAudioItem);
714          if (pDevice) {          if (pDevice) {
715                  // Refresh the audio routing table.                  // Refresh the audio routing table.
716                  routingModel.refresh(pDevice, m_pChannel->audioRouting());                  routingModel.refresh(pDevice, m_pChannel->audioRouting());
# Line 709  void ChannelForm::selectAudioDevice ( in Line 734  void ChannelForm::selectAudioDevice ( in
734  // Audio device options.  // Audio device options.
735  void ChannelForm::setupAudioDevice (void)  void ChannelForm::setupAudioDevice (void)
736  {  {
737          setupDevice(m_audioDevices.at(ui.AudioDeviceComboBox->currentIndex()),          qsamplerDevice *pDevice = NULL;
738            int iAudioItem = ui.AudioDeviceComboBox->currentIndex();
739            if (iAudioItem >= 0 && iAudioItem < m_audioDevices.count())
740                    pDevice = m_audioDevices.at(iAudioItem);
741            setupDevice(pDevice,
742                  qsamplerDevice::Audio, ui.AudioDriverComboBox->currentText());                  qsamplerDevice::Audio, ui.AudioDriverComboBox->currentText());
743  }  }
744    

Legend:
Removed from v.1499  
changed lines
  Added in v.1504

  ViewVC Help
Powered by ViewVC