/[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 1505 by capela, Wed Nov 21 18:37: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())
208                  sInstrumentFile = qsamplerChannel::noInstrumentName();                  sInstrumentFile = qsamplerChannel::noInstrumentName();
209          ui.InstrumentFileComboBox->setItemText(          ui.InstrumentFileComboBox->setEditText(sInstrumentFile);
                 ui.InstrumentFileComboBox->currentIndex(),  
                 sInstrumentFile);  
210          ui.InstrumentNrComboBox->clear();          ui.InstrumentNrComboBox->clear();
211          ui.InstrumentNrComboBox->insertItems(0,          ui.InstrumentNrComboBox->insertItems(0,
212                  qsamplerChannel::getInstrumentList(sInstrumentFile,                  qsamplerChannel::getInstrumentList(sInstrumentFile,
# Line 324  void ChannelForm::accept (void) Line 323  void ChannelForm::accept (void)
323                          if (!m_pChannel->setAudioDriver(ui.AudioDriverComboBox->currentText()))                          if (!m_pChannel->setAudioDriver(ui.AudioDriverComboBox->currentText()))
324                                  iErrors++;                                  iErrors++;
325                  } else {                  } else {
326                          qsamplerDevice *pDevice = m_audioDevices.at(ui.AudioDeviceComboBox->currentIndex());                          qsamplerDevice *pDevice = NULL;
327                            int iAudioItem = ui.AudioDeviceComboBox->currentIndex();
328                            if (iAudioItem >= 0 && iAudioItem < m_audioDevices.count())
329                                    pDevice = m_audioDevices.at(iAudioItem);
330                          qsamplerChannelRoutingMap routingMap = routingModel.routingMap();                          qsamplerChannelRoutingMap routingMap = routingModel.routingMap();
331                          if (pDevice == NULL)                          if (pDevice == NULL)
332                                  iErrors++;                                  iErrors++;
# Line 345  void ChannelForm::accept (void) Line 347  void ChannelForm::accept (void)
347                          if (!m_pChannel->setMidiDriver(ui.MidiDriverComboBox->currentText()))                          if (!m_pChannel->setMidiDriver(ui.MidiDriverComboBox->currentText()))
348                                  iErrors++;                                  iErrors++;
349                  } else {                  } else {
350                          qsamplerDevice *pDevice = m_midiDevices.at(ui.MidiDeviceComboBox->currentIndex());                          qsamplerDevice *pDevice = NULL;
351                            int iMidiItem = ui.MidiDeviceComboBox->currentIndex();
352                            if (iMidiItem >= 0 && iMidiItem < m_midiDevices.count())
353                                    pDevice = m_midiDevices.at(iMidiItem);
354                          if (pDevice == NULL)                          if (pDevice == NULL)
355                                  iErrors++;                                  iErrors++;
356                          else if (!m_pChannel->setMidiDevice(pDevice->deviceID()))                          else if (!m_pChannel->setMidiDevice(pDevice->deviceID()))
# Line 440  void ChannelForm::openInstrumentFile (vo Line 445  void ChannelForm::openInstrumentFile (vo
445          if (sInstrumentFile.isEmpty())          if (sInstrumentFile.isEmpty())
446                  return;                  return;
447    
448          ui.InstrumentFileComboBox->setItemText(          ui.InstrumentFileComboBox->setEditText(sInstrumentFile);
                 ui.InstrumentFileComboBox->currentIndex(),  
                 sInstrumentFile);  
   
449          updateInstrumentName();          updateInstrumentName();
450  }  }
451    
# Line 479  void ChannelForm::setupDevice ( qsampler Line 481  void ChannelForm::setupDevice ( qsampler
481          qsamplerDevice::qsamplerDeviceType deviceTypeMode,          qsamplerDevice::qsamplerDeviceType deviceTypeMode,
482          const QString& sDriverName )          const QString& sDriverName )
483  {  {
484            if (pDevice == NULL)
485                    return;
486    
487          MainForm *pMainForm = MainForm::getInstance();          MainForm *pMainForm = MainForm::getInstance();
488          if (pMainForm == NULL)          if (pMainForm == NULL)
489                  return;                  return;
# Line 516  void ChannelForm::selectMidiDriverItem ( Line 521  void ChannelForm::selectMidiDriverItem (
521          const QString sDriverName = sMidiDriver.toUpper();          const QString sDriverName = sMidiDriver.toUpper();
522    
523          // Save current device id.          // Save current device id.
524            // Save current device id.
525          int iDeviceID = 0;          int iDeviceID = 0;
526          qsamplerDevice *pDevice = m_midiDevices.at(ui.MidiDeviceComboBox->currentIndex());          qsamplerDevice *pDevice = NULL;
527            int iMidiItem = ui.MidiDeviceComboBox->currentIndex();
528            if (iMidiItem >= 0 && iMidiItem < m_midiDevices.count())
529                    pDevice = m_midiDevices.at(iMidiItem);
530          if (pDevice)          if (pDevice)
531                  iDeviceID = pDevice->deviceID();                  iDeviceID = pDevice->deviceID();
532    
# Line 544  void ChannelForm::selectMidiDriverItem ( Line 553  void ChannelForm::selectMidiDriverItem (
553          bool bEnabled = !m_midiDevices.isEmpty();          bool bEnabled = !m_midiDevices.isEmpty();
554          if (bEnabled) {          if (bEnabled) {
555                  // Select the previous current device...                  // Select the previous current device...
556                  int iMidiItem = 0;                  iMidiItem = 0;
557                  QListIterator<qsamplerDevice *> iter(m_midiDevices);                  QListIterator<qsamplerDevice *> iter(m_midiDevices);
558                  while (iter.hasNext()) {                  while (iter.hasNext()) {
559                          pDevice = iter.next();                          pDevice = iter.next();
# Line 578  void ChannelForm::selectMidiDriver ( con Line 587  void ChannelForm::selectMidiDriver ( con
587  // Select MIDI device item.  // Select MIDI device item.
588  void ChannelForm::selectMidiDeviceItem ( int iMidiItem )  void ChannelForm::selectMidiDeviceItem ( int iMidiItem )
589  {  {
590          qsamplerDevice *pDevice = m_midiDevices.at(iMidiItem);          qsamplerDevice *pDevice = NULL;
591            if (iMidiItem >= 0 && iMidiItem < m_midiDevices.count())
592                    pDevice = m_midiDevices.at(iMidiItem);
593          if (pDevice) {          if (pDevice) {
594                  const qsamplerDeviceParamMap& params = pDevice->params();                  const qsamplerDeviceParamMap& params = pDevice->params();
595                  int iPorts = params["PORTS"].value.toInt();                  int iPorts = params["PORTS"].value.toInt();
# Line 604  void ChannelForm::selectMidiDevice ( int Line 615  void ChannelForm::selectMidiDevice ( int
615  // MIDI device options.  // MIDI device options.
616  void ChannelForm::setupMidiDevice (void)  void ChannelForm::setupMidiDevice (void)
617  {  {
618          setupDevice(m_midiDevices.at(ui.MidiDeviceComboBox->currentIndex()),          qsamplerDevice *pDevice = NULL;
619            int iMidiItem = ui.MidiDeviceComboBox->currentIndex();
620            if (iMidiItem >= 0 && iMidiItem < m_midiDevices.count())
621                    pDevice = m_midiDevices.at(iMidiItem);
622            setupDevice(pDevice,
623                  qsamplerDevice::Midi, ui.MidiDriverComboBox->currentText());                  qsamplerDevice::Midi, ui.MidiDriverComboBox->currentText());
624  }  }
625    
# Line 622  void ChannelForm::selectAudioDriverItem Line 637  void ChannelForm::selectAudioDriverItem
637    
638          // Save current device id.          // Save current device id.
639          int iDeviceID = 0;          int iDeviceID = 0;
640          qsamplerDevice *pDevice = m_audioDevices.at(ui.AudioDeviceComboBox->currentIndex());          qsamplerDevice *pDevice = NULL;
641            int iAudioItem = ui.AudioDeviceComboBox->currentIndex();
642            if (iAudioItem >= 0 && iAudioItem < m_audioDevices.count())
643                    pDevice = m_audioDevices.at(iAudioItem);
644          if (pDevice)          if (pDevice)
645                  iDeviceID = pDevice->deviceID();                  iDeviceID = pDevice->deviceID();
646    
# Line 649  void ChannelForm::selectAudioDriverItem Line 667  void ChannelForm::selectAudioDriverItem
667          bool bEnabled = !m_audioDevices.isEmpty();          bool bEnabled = !m_audioDevices.isEmpty();
668          if (bEnabled) {          if (bEnabled) {
669                  // Select the previous current device...                  // Select the previous current device...
670                  int iAudioItem = 0;                  iAudioItem = 0;
671                  QListIterator<qsamplerDevice *> iter(m_audioDevices);                  QListIterator<qsamplerDevice *> iter(m_audioDevices);
672                  while (iter.hasNext()) {                  while (iter.hasNext()) {
673                          pDevice = iter.next();                          pDevice = iter.next();
# Line 685  void ChannelForm::selectAudioDriver ( co Line 703  void ChannelForm::selectAudioDriver ( co
703  // Select Audio device item.  // Select Audio device item.
704  void ChannelForm::selectAudioDeviceItem ( int iAudioItem )  void ChannelForm::selectAudioDeviceItem ( int iAudioItem )
705  {  {
706          qsamplerDevice *pDevice = m_audioDevices.at(iAudioItem);          qsamplerDevice *pDevice = NULL;
707            if (iAudioItem >= 0 && iAudioItem < m_audioDevices.count())
708                    pDevice = m_audioDevices.at(iAudioItem);
709          if (pDevice) {          if (pDevice) {
710                  // Refresh the audio routing table.                  // Refresh the audio routing table.
711                  routingModel.refresh(pDevice, m_pChannel->audioRouting());                  routingModel.refresh(pDevice, m_pChannel->audioRouting());
# Line 709  void ChannelForm::selectAudioDevice ( in Line 729  void ChannelForm::selectAudioDevice ( in
729  // Audio device options.  // Audio device options.
730  void ChannelForm::setupAudioDevice (void)  void ChannelForm::setupAudioDevice (void)
731  {  {
732          setupDevice(m_audioDevices.at(ui.AudioDeviceComboBox->currentIndex()),          qsamplerDevice *pDevice = NULL;
733            int iAudioItem = ui.AudioDeviceComboBox->currentIndex();
734            if (iAudioItem >= 0 && iAudioItem < m_audioDevices.count())
735                    pDevice = m_audioDevices.at(iAudioItem);
736            setupDevice(pDevice,
737                  qsamplerDevice::Audio, ui.AudioDriverComboBox->currentText());                  qsamplerDevice::Audio, ui.AudioDriverComboBox->currentText());
738  }  }
739    

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

  ViewVC Help
Powered by ViewVC