/[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 1519 by capela, Sat Nov 24 13:06:19 2007 UTC revision 1840 by capela, Thu Feb 19 11:44:57 2009 UTC
# Line 1  Line 1 
1  // qsamplerChannelForm.cpp  // qsamplerChannelForm.cpp
2  //  //
3  /****************************************************************************  /****************************************************************************
4     Copyright (C) 2004-2007, rncbc aka Rui Nuno Capela. All rights reserved.     Copyright (C) 2004-2009, rncbc aka Rui Nuno Capela. All rights reserved.
5     Copyright (C) 2007, Christian Schoenebeck     Copyright (C) 2007, 2008 Christian Schoenebeck
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 38  Line 38 
38    
39  namespace QSampler {  namespace QSampler {
40    
41    //-------------------------------------------------------------------------
42    // QSampler::Channelform -- Channel form implementation.
43    //
44    
45  ChannelForm::ChannelForm ( QWidget* pParent )  ChannelForm::ChannelForm ( QWidget* pParent )
46          : QDialog(pParent)          : QDialog(pParent)
47  {  {
# Line 141  ChannelForm::~ChannelForm() Line 145  ChannelForm::~ChannelForm()
145    
146    
147  // Channel dialog setup formal initializer.  // Channel dialog setup formal initializer.
148  void ChannelForm::setup ( qsamplerChannel *pChannel )  void ChannelForm::setup ( Channel *pChannel )
149  {  {
150          m_pChannel = pChannel;          m_pChannel = pChannel;
151    
# Line 152  void ChannelForm::setup ( qsamplerChanne Line 156  void ChannelForm::setup ( qsamplerChanne
156                  return;                  return;
157    
158          // It can be a brand new channel, remember?          // It can be a brand new channel, remember?
159          bool bNew = (m_pChannel->channelID() < 0);          const bool bNew = (m_pChannel->channelID() < 0);
160          setWindowTitle(QSAMPLER_TITLE ": " + m_pChannel->channelName());          setWindowTitle(QSAMPLER_TITLE ": " + m_pChannel->channelName());
161    
162          // Check if we're up and connected.          // Check if we're up and connected.
# Line 162  void ChannelForm::setup ( qsamplerChanne Line 166  void ChannelForm::setup ( qsamplerChanne
166          if (pMainForm->client() == NULL)          if (pMainForm->client() == NULL)
167                  return;                  return;
168    
169          qsamplerOptions *pOptions = pMainForm->options();          Options *pOptions = pMainForm->options();
170          if (pOptions == NULL)          if (pOptions == NULL)
171                  return;                  return;
172    
# Line 184  void ChannelForm::setup ( qsamplerChanne Line 188  void ChannelForm::setup ( qsamplerChanne
188          // Populate Audio output type list.          // Populate Audio output type list.
189          m_ui.AudioDriverComboBox->clear();          m_ui.AudioDriverComboBox->clear();
190          m_ui.AudioDriverComboBox->insertItems(0,          m_ui.AudioDriverComboBox->insertItems(0,
191                  qsamplerDevice::getDrivers(pMainForm->client(), qsamplerDevice::Audio));                  Device::getDrivers(pMainForm->client(), Device::Audio));
192    
193          // Populate MIDI input type list.          // Populate MIDI input type list.
194          m_ui.MidiDriverComboBox->clear();          m_ui.MidiDriverComboBox->clear();
195          m_ui.MidiDriverComboBox->insertItems(0,          m_ui.MidiDriverComboBox->insertItems(0,
196                  qsamplerDevice::getDrivers(pMainForm->client(), qsamplerDevice::Midi));                  Device::getDrivers(pMainForm->client(), Device::Midi));
197    
198          // Populate Maps list.          // Populate Maps list.
199          m_ui.MidiMapComboBox->clear();          m_ui.MidiMapComboBox->clear();
200          m_ui.MidiMapComboBox->insertItems(0,          m_ui.MidiMapComboBox->insertItems(0,
201                  qsamplerInstrument::getMapNames());                  Instrument::getMapNames());
202    
203          // Read proper channel information,          // Read proper channel information,
204          // and populate the channel form fields.          // and populate the channel form fields.
# Line 204  void ChannelForm::setup ( qsamplerChanne Line 208  void ChannelForm::setup ( qsamplerChanne
208          if (sEngineName.isEmpty() || bNew)          if (sEngineName.isEmpty() || bNew)
209                  sEngineName = pOptions->sEngineName;                  sEngineName = pOptions->sEngineName;
210          if (sEngineName.isEmpty())          if (sEngineName.isEmpty())
211                  sEngineName = qsamplerChannel::noEngineName();                  sEngineName = Channel::noEngineName();
212          if (m_ui.EngineNameComboBox->findText(sEngineName,          if (m_ui.EngineNameComboBox->findText(sEngineName,
213                          Qt::MatchExactly | Qt::MatchCaseSensitive) < 0) {                          Qt::MatchExactly | Qt::MatchCaseSensitive) < 0) {
214                  m_ui.EngineNameComboBox->addItem(sEngineName);                  m_ui.EngineNameComboBox->addItem(sEngineName);
# Line 216  void ChannelForm::setup ( qsamplerChanne Line 220  void ChannelForm::setup ( qsamplerChanne
220          // Instrument filename and index...          // Instrument filename and index...
221          QString sInstrumentFile = pChannel->instrumentFile();          QString sInstrumentFile = pChannel->instrumentFile();
222          if (sInstrumentFile.isEmpty())          if (sInstrumentFile.isEmpty())
223                  sInstrumentFile = qsamplerChannel::noInstrumentName();                  sInstrumentFile = Channel::noInstrumentName();
224          m_ui.InstrumentFileComboBox->setEditText(sInstrumentFile);          m_ui.InstrumentFileComboBox->setEditText(sInstrumentFile);
225          m_ui.InstrumentNrComboBox->clear();          m_ui.InstrumentNrComboBox->clear();
226          m_ui.InstrumentNrComboBox->insertItems(0,          m_ui.InstrumentNrComboBox->insertItems(0,
227                  qsamplerChannel::getInstrumentList(sInstrumentFile,                  Channel::getInstrumentList(sInstrumentFile,
228                  pOptions->bInstrumentNames));                  pOptions->bInstrumentNames));
229          int iInstrumentNr = pChannel->instrumentNr();          int iInstrumentNr = pChannel->instrumentNr();
230          if (iInstrumentNr < 0)          if (iInstrumentNr < 0)
# Line 228  void ChannelForm::setup ( qsamplerChanne Line 232  void ChannelForm::setup ( qsamplerChanne
232          m_ui.InstrumentNrComboBox->setCurrentIndex(iInstrumentNr);          m_ui.InstrumentNrComboBox->setCurrentIndex(iInstrumentNr);
233    
234          // MIDI input device...          // MIDI input device...
235          qsamplerDevice midiDevice(qsamplerDevice::Midi, m_pChannel->midiDevice());          Device midiDevice(Device::Midi, m_pChannel->midiDevice());
236          // MIDI input driver...          // MIDI input driver...
237          QString sMidiDriver = midiDevice.driverName();          QString sMidiDriver = midiDevice.driverName();
238          if (sMidiDriver.isEmpty() || bNew)          if (sMidiDriver.isEmpty() || bNew)
# Line 238  void ChannelForm::setup ( qsamplerChanne Line 242  void ChannelForm::setup ( qsamplerChanne
242                                  Qt::MatchExactly | Qt::MatchCaseSensitive) < 0) {                                  Qt::MatchExactly | Qt::MatchCaseSensitive) < 0) {
243                          m_ui.MidiDriverComboBox->insertItem(0, sMidiDriver);                          m_ui.MidiDriverComboBox->insertItem(0, sMidiDriver);
244                  }                  }
245                  m_ui.MidiDriverComboBox->setItemText(                  m_ui.MidiDriverComboBox->setCurrentIndex(
246                          m_ui.MidiDriverComboBox->currentIndex(),                          m_ui.MidiDriverComboBox->findText(sMidiDriver,
247                          sMidiDriver);                                  Qt::MatchExactly | Qt::MatchCaseSensitive)
248                    );
249          }          }
250          selectMidiDriverItem(sMidiDriver);          selectMidiDriverItem(sMidiDriver);
251          if (!bNew) {          if (!bNew) {
# Line 262  void ChannelForm::setup ( qsamplerChanne Line 267  void ChannelForm::setup ( qsamplerChanne
267          // When new, try to suggest a sensible MIDI map...          // When new, try to suggest a sensible MIDI map...
268          if (iMidiMap < 0)          if (iMidiMap < 0)
269                  iMidiMap = 0;                  iMidiMap = 0;
270          const QString& sMapName = qsamplerInstrument::getMapName(iMidiMap);          const QString& sMapName = Instrument::getMapName(iMidiMap);
271          if (!sMapName.isEmpty()) {          if (!sMapName.isEmpty()) {
272                  m_ui.MidiMapComboBox->setItemText(                  m_ui.MidiMapComboBox->setItemText(
273                          m_ui.MidiMapComboBox->currentIndex(),                          m_ui.MidiMapComboBox->currentIndex(),
# Line 274  void ChannelForm::setup ( qsamplerChanne Line 279  void ChannelForm::setup ( qsamplerChanne
279          m_ui.MidiMapComboBox->setEnabled(bMidiMapEnabled);          m_ui.MidiMapComboBox->setEnabled(bMidiMapEnabled);
280    
281          // Audio output device...          // Audio output device...
282          qsamplerDevice audioDevice(qsamplerDevice::Audio, m_pChannel->audioDevice());          Device audioDevice(Device::Audio, m_pChannel->audioDevice());
283          // Audio output driver...          // Audio output driver...
284          QString sAudioDriver = audioDevice.driverName();          QString sAudioDriver = audioDevice.driverName();
285          if (sAudioDriver.isEmpty() || bNew)          if (sAudioDriver.isEmpty() || bNew)
# Line 284  void ChannelForm::setup ( qsamplerChanne Line 289  void ChannelForm::setup ( qsamplerChanne
289                                  Qt::MatchExactly | Qt::MatchCaseSensitive) < 0) {                                  Qt::MatchExactly | Qt::MatchCaseSensitive) < 0) {
290                          m_ui.AudioDriverComboBox->insertItem(0, sAudioDriver);                          m_ui.AudioDriverComboBox->insertItem(0, sAudioDriver);
291                  }                  }
292                  m_ui.AudioDriverComboBox->setItemText(                  m_ui.AudioDriverComboBox->setCurrentIndex(
293                          m_ui.AudioDriverComboBox->currentIndex(),                          m_ui.AudioDriverComboBox->findText(sAudioDriver,
294                          sAudioDriver);                                  Qt::MatchExactly | Qt::MatchCaseSensitive)
295                    );
296          }          }
297          selectAudioDriverItem(sAudioDriver);          selectAudioDriverItem(sAudioDriver);
298          if (!bNew) {          if (!bNew) {
# Line 300  void ChannelForm::setup ( qsamplerChanne Line 306  void ChannelForm::setup ( qsamplerChanne
306          // if we're editing an existing sampler channel...          // if we're editing an existing sampler channel...
307          m_ui.AudioRoutingTable->setVisible(!bNew);          m_ui.AudioRoutingTable->setVisible(!bNew);
308    
309            const QString sInstrumentNrToolTip =
310                    (pOptions->bInstrumentNames) ?
311                            "Select an instrument of the file" :
312                            "You might want to enable instrument name retrieval in the "
313                            "settings dialog";
314            m_ui.InstrumentNrComboBox->setToolTip(
315                    QObject::tr(sInstrumentNrToolTip.toUtf8().data())
316            );
317    
318          // As convenient, make it ready on stabilizeForm() for          // As convenient, make it ready on stabilizeForm() for
319          // prompt acceptance, if we got the minimum required...          // prompt acceptance, if we got the minimum required...
320  /*      if (sEngineName != qsamplerChannel::noEngineName() &&  /*      if (sEngineName != Channel::noEngineName() &&
321                  sInstrumentFile != qsamplerChannel::noInstrumentName())                  sInstrumentFile != Channel::noInstrumentName())
322                  m_iDirtyCount++; */                  m_iDirtyCount++; */
323          // Done.          // Done.
324          m_iDirtySetup--;          m_iDirtySetup--;
# Line 323  void ChannelForm::accept (void) Line 338  void ChannelForm::accept (void)
338          if (pMainForm->client() == NULL)          if (pMainForm->client() == NULL)
339                  return;                  return;
340    
341          qsamplerOptions *pOptions = pMainForm->options();          Options *pOptions = pMainForm->options();
342          if (pOptions == NULL)          if (pOptions == NULL)
343                  return;                  return;
344    
# Line 341  void ChannelForm::accept (void) Line 356  void ChannelForm::accept (void)
356                          if (!m_pChannel->setAudioDriver(m_ui.AudioDriverComboBox->currentText()))                          if (!m_pChannel->setAudioDriver(m_ui.AudioDriverComboBox->currentText()))
357                                  iErrors++;                                  iErrors++;
358                  } else {                  } else {
359                          qsamplerDevice *pDevice = NULL;                          Device *pDevice = NULL;
360                          int iAudioItem = m_ui.AudioDeviceComboBox->currentIndex();                          int iAudioItem = m_ui.AudioDeviceComboBox->currentIndex();
361                          if (iAudioItem >= 0 && iAudioItem < m_audioDevices.count())                          if (iAudioItem >= 0 && iAudioItem < m_audioDevices.count())
362                                  pDevice = m_audioDevices.at(iAudioItem);                                  pDevice = m_audioDevices.at(iAudioItem);
363                          qsamplerChannelRoutingMap routingMap = m_routingModel.routingMap();                          ChannelRoutingMap routingMap = m_routingModel.routingMap();
364                          if (pDevice == NULL)                          if (pDevice == NULL)
365                                  iErrors++;                                  iErrors++;
366                          else if (!m_pChannel->setAudioDevice(pDevice->deviceID()))                          else if (!m_pChannel->setAudioDevice(pDevice->deviceID()))
367                                  iErrors++;                                  iErrors++;
368                          else if (!routingMap.isEmpty()) {                          else if (!routingMap.isEmpty()) {
369                                  // Set the audio route changes...                                  // Set the audio route changes...
370                                  qsamplerChannelRoutingMap::ConstIterator iter;                                  ChannelRoutingMap::ConstIterator iter;
371                                  for (iter = routingMap.begin();                                  for (iter = routingMap.begin();
372                                                  iter != routingMap.end(); ++iter) {                                                  iter != routingMap.end(); ++iter) {
373                                          if (!m_pChannel->setAudioChannel(iter.key(), iter.value()))                                          if (!m_pChannel->setAudioChannel(iter.key(), iter.value()))
# Line 365  void ChannelForm::accept (void) Line 380  void ChannelForm::accept (void)
380                          if (!m_pChannel->setMidiDriver(m_ui.MidiDriverComboBox->currentText()))                          if (!m_pChannel->setMidiDriver(m_ui.MidiDriverComboBox->currentText()))
381                                  iErrors++;                                  iErrors++;
382                  } else {                  } else {
383                          qsamplerDevice *pDevice = NULL;                          Device *pDevice = NULL;
384                          int iMidiItem = m_ui.MidiDeviceComboBox->currentIndex();                          int iMidiItem = m_ui.MidiDeviceComboBox->currentIndex();
385                          if (iMidiItem >= 0 && iMidiItem < m_midiDevices.count())                          if (iMidiItem >= 0 && iMidiItem < m_midiDevices.count())
386                                  pDevice = m_midiDevices.at(iMidiItem);                                  pDevice = m_midiDevices.at(iMidiItem);
# Line 424  void ChannelForm::reject (void) Line 439  void ChannelForm::reject (void)
439                          QSAMPLER_TITLE ": " + tr("Warning"),                          QSAMPLER_TITLE ": " + tr("Warning"),
440                          tr("Some channel settings have been changed.\n\n"                          tr("Some channel settings have been changed.\n\n"
441                          "Do you want to apply the changes?"),                          "Do you want to apply the changes?"),
442                          tr("Apply"), tr("Discard"), tr("Cancel"))) {                          QMessageBox::Apply |
443                  case 0:     // Apply...                          QMessageBox::Discard |
444                            QMessageBox::Cancel)) {
445                    case QMessageBox::Apply:
446                          accept();                          accept();
447                          return;                          return;
448                  case 1:     // Discard                  case QMessageBox::Discard:
449                          break;                          break;
450                  default:    // Cancel.                  default:    // Cancel.
451                          bReject = false;                          bReject = false;
# Line 450  void ChannelForm::openInstrumentFile (vo Line 467  void ChannelForm::openInstrumentFile (vo
467          if (pMainForm->client() == NULL)          if (pMainForm->client() == NULL)
468                  return;                  return;
469    
470          qsamplerOptions *pOptions = pMainForm->options();          Options *pOptions = pMainForm->options();
471          if (pOptions == NULL)          if (pOptions == NULL)
472                  return;                  return;
473    
# Line 479  void ChannelForm::updateInstrumentName ( Line 496  void ChannelForm::updateInstrumentName (
496          if (pMainForm->client() == NULL)          if (pMainForm->client() == NULL)
497                  return;                  return;
498    
499          qsamplerOptions *pOptions = pMainForm->options();          Options *pOptions = pMainForm->options();
500          if (pOptions == NULL)          if (pOptions == NULL)
501                  return;                  return;
502    
# Line 487  void ChannelForm::updateInstrumentName ( Line 504  void ChannelForm::updateInstrumentName (
504          // to retrieve the REAL instrument names.          // to retrieve the REAL instrument names.
505          m_ui.InstrumentNrComboBox->clear();          m_ui.InstrumentNrComboBox->clear();
506          m_ui.InstrumentNrComboBox->insertItems(0,          m_ui.InstrumentNrComboBox->insertItems(0,
507                  qsamplerChannel::getInstrumentList(                  Channel::getInstrumentList(
508                          m_ui.InstrumentFileComboBox->currentText(),                          m_ui.InstrumentFileComboBox->currentText(),
509                          pOptions->bInstrumentNames)                          pOptions->bInstrumentNames)
510          );          );
# Line 497  void ChannelForm::updateInstrumentName ( Line 514  void ChannelForm::updateInstrumentName (
514    
515    
516  // Show device options dialog.  // Show device options dialog.
517  void ChannelForm::setupDevice ( qsamplerDevice *pDevice,  void ChannelForm::setupDevice ( Device *pDevice,
518          qsamplerDevice::DeviceType deviceTypeMode,          Device::DeviceType deviceTypeMode,
519          const QString& sDriverName )          const QString& sDriverName )
520  {  {
         if (pDevice == NULL)  
                 return;  
   
521          MainForm *pMainForm = MainForm::getInstance();          MainForm *pMainForm = MainForm::getInstance();
522          if (pMainForm == NULL)          if (pMainForm == NULL)
523                  return;                  return;
# Line 543  void ChannelForm::selectMidiDriverItem ( Line 557  void ChannelForm::selectMidiDriverItem (
557          // Save current device id.          // Save current device id.
558          // Save current device id.          // Save current device id.
559          int iDeviceID = 0;          int iDeviceID = 0;
560          qsamplerDevice *pDevice = NULL;          Device *pDevice = NULL;
561          int iMidiItem = m_ui.MidiDeviceComboBox->currentIndex();          int iMidiItem = m_ui.MidiDeviceComboBox->currentIndex();
562          if (iMidiItem >= 0 && iMidiItem < m_midiDevices.count())          if (iMidiItem >= 0 && iMidiItem < m_midiDevices.count())
563                  pDevice = m_midiDevices.at(iMidiItem);                  pDevice = m_midiDevices.at(iMidiItem);
# Line 557  void ChannelForm::selectMidiDriverItem ( Line 571  void ChannelForm::selectMidiDriverItem (
571    
572          // Populate with the current ones...          // Populate with the current ones...
573          const QPixmap midiPixmap(":/icons/midi2.png");          const QPixmap midiPixmap(":/icons/midi2.png");
574          int *piDeviceIDs = qsamplerDevice::getDevices(pMainForm->client(),          int *piDeviceIDs = Device::getDevices(pMainForm->client(),
575                  qsamplerDevice::Midi);                  Device::Midi);
576          for (int i = 0; piDeviceIDs && piDeviceIDs[i] >= 0; i++) {          for (int i = 0; piDeviceIDs && piDeviceIDs[i] >= 0; i++) {
577                  pDevice = new qsamplerDevice(qsamplerDevice::Midi, piDeviceIDs[i]);                  pDevice = new Device(Device::Midi, piDeviceIDs[i]);
578                  if (pDevice->driverName().toUpper() == sDriverName) {                  if (pDevice->driverName().toUpper() == sDriverName) {
579                          m_ui.MidiDeviceComboBox->insertItem(0,                          m_ui.MidiDeviceComboBox->insertItem(0,
580                                  midiPixmap, pDevice->deviceName());                                  midiPixmap, pDevice->deviceName());
# Line 575  void ChannelForm::selectMidiDriverItem ( Line 589  void ChannelForm::selectMidiDriverItem (
589          if (bEnabled) {          if (bEnabled) {
590                  // Select the previous current device...                  // Select the previous current device...
591                  iMidiItem = 0;                  iMidiItem = 0;
592                  QListIterator<qsamplerDevice *> iter(m_midiDevices);                  QListIterator<Device *> iter(m_midiDevices);
593                  while (iter.hasNext()) {                  while (iter.hasNext()) {
594                          pDevice = iter.next();                          pDevice = iter.next();
595                          if (pDevice->deviceID() == iDeviceID) {                          if (pDevice->deviceID() == iDeviceID) {
# Line 608  void ChannelForm::selectMidiDriver ( con Line 622  void ChannelForm::selectMidiDriver ( con
622  // Select MIDI device item.  // Select MIDI device item.
623  void ChannelForm::selectMidiDeviceItem ( int iMidiItem )  void ChannelForm::selectMidiDeviceItem ( int iMidiItem )
624  {  {
625          qsamplerDevice *pDevice = NULL;          Device *pDevice = NULL;
626          if (iMidiItem >= 0 && iMidiItem < m_midiDevices.count())          if (iMidiItem >= 0 && iMidiItem < m_midiDevices.count())
627                  pDevice = m_midiDevices.at(iMidiItem);                  pDevice = m_midiDevices.at(iMidiItem);
628          if (pDevice) {          if (pDevice) {
629                  const qsamplerDeviceParamMap& params = pDevice->params();                  const DeviceParamMap& params = pDevice->params();
630                  int iPorts = params["PORTS"].value.toInt();                  int iPorts = params["PORTS"].value.toInt();
631                  m_ui.MidiPortTextLabel->setEnabled(iPorts > 0);                  m_ui.MidiPortTextLabel->setEnabled(iPorts > 0);
632                  m_ui.MidiPortSpinBox->setEnabled(iPorts > 0);                  m_ui.MidiPortSpinBox->setEnabled(iPorts > 0);
# Line 636  void ChannelForm::selectMidiDevice ( int Line 650  void ChannelForm::selectMidiDevice ( int
650  // MIDI device options.  // MIDI device options.
651  void ChannelForm::setupMidiDevice (void)  void ChannelForm::setupMidiDevice (void)
652  {  {
653          qsamplerDevice *pDevice = NULL;          Device *pDevice = NULL;
654          int iMidiItem = m_ui.MidiDeviceComboBox->currentIndex();          int iMidiItem = m_ui.MidiDeviceComboBox->currentIndex();
655          if (iMidiItem >= 0 && iMidiItem < m_midiDevices.count())          if (iMidiItem >= 0 && iMidiItem < m_midiDevices.count())
656                  pDevice = m_midiDevices.at(iMidiItem);                  pDevice = m_midiDevices.at(iMidiItem);
657          setupDevice(pDevice,          setupDevice(pDevice,
658                  qsamplerDevice::Midi, m_ui.MidiDriverComboBox->currentText());                  Device::Midi, m_ui.MidiDriverComboBox->currentText());
659  }  }
660    
661    
# Line 658  void ChannelForm::selectAudioDriverItem Line 672  void ChannelForm::selectAudioDriverItem
672    
673          // Save current device id.          // Save current device id.
674          int iDeviceID = 0;          int iDeviceID = 0;
675          qsamplerDevice *pDevice = NULL;          Device *pDevice = NULL;
676          int iAudioItem = m_ui.AudioDeviceComboBox->currentIndex();          int iAudioItem = m_ui.AudioDeviceComboBox->currentIndex();
677          if (iAudioItem >= 0 && iAudioItem < m_audioDevices.count())          if (iAudioItem >= 0 && iAudioItem < m_audioDevices.count())
678                  pDevice = m_audioDevices.at(iAudioItem);                  pDevice = m_audioDevices.at(iAudioItem);
# Line 672  void ChannelForm::selectAudioDriverItem Line 686  void ChannelForm::selectAudioDriverItem
686    
687          // Populate with the current ones...          // Populate with the current ones...
688          const QPixmap audioPixmap(":/icons/audio2.png");          const QPixmap audioPixmap(":/icons/audio2.png");
689          int *piDeviceIDs = qsamplerDevice::getDevices(pMainForm->client(),          int *piDeviceIDs = Device::getDevices(pMainForm->client(),
690                  qsamplerDevice::Audio);                  Device::Audio);
691          for (int i = 0; piDeviceIDs && piDeviceIDs[i] >= 0; i++) {          for (int i = 0; piDeviceIDs && piDeviceIDs[i] >= 0; i++) {
692                  pDevice = new qsamplerDevice(qsamplerDevice::Audio, piDeviceIDs[i]);                  pDevice = new Device(Device::Audio, piDeviceIDs[i]);
693                  if (pDevice->driverName().toUpper() == sDriverName) {                  if (pDevice->driverName().toUpper() == sDriverName) {
694                          m_ui.AudioDeviceComboBox->insertItem(0,                          m_ui.AudioDeviceComboBox->insertItem(0,
695                                  audioPixmap, pDevice->deviceName());                                  audioPixmap, pDevice->deviceName());
# Line 690  void ChannelForm::selectAudioDriverItem Line 704  void ChannelForm::selectAudioDriverItem
704          if (bEnabled) {          if (bEnabled) {
705                  // Select the previous current device...                  // Select the previous current device...
706                  iAudioItem = 0;                  iAudioItem = 0;
707                  QListIterator<qsamplerDevice *> iter(m_audioDevices);                  QListIterator<Device *> iter(m_audioDevices);
708                  while (iter.hasNext()) {                  while (iter.hasNext()) {
709                          pDevice = iter.next();                          pDevice = iter.next();
710                          if (pDevice->deviceID() == iDeviceID) {                          if (pDevice->deviceID() == iDeviceID) {
# Line 725  void ChannelForm::selectAudioDriver ( co Line 739  void ChannelForm::selectAudioDriver ( co
739  // Select Audio device item.  // Select Audio device item.
740  void ChannelForm::selectAudioDeviceItem ( int iAudioItem )  void ChannelForm::selectAudioDeviceItem ( int iAudioItem )
741  {  {
742          qsamplerDevice *pDevice = NULL;          Device *pDevice = NULL;
743          if (iAudioItem >= 0 && iAudioItem < m_audioDevices.count())          if (iAudioItem >= 0 && iAudioItem < m_audioDevices.count())
744                  pDevice = m_audioDevices.at(iAudioItem);                  pDevice = m_audioDevices.at(iAudioItem);
745          if (pDevice) {          if (pDevice) {
# Line 751  void ChannelForm::selectAudioDevice ( in Line 765  void ChannelForm::selectAudioDevice ( in
765  // Audio device options.  // Audio device options.
766  void ChannelForm::setupAudioDevice (void)  void ChannelForm::setupAudioDevice (void)
767  {  {
768          qsamplerDevice *pDevice = NULL;          Device *pDevice = NULL;
769          int iAudioItem = m_ui.AudioDeviceComboBox->currentIndex();          int iAudioItem = m_ui.AudioDeviceComboBox->currentIndex();
770          if (iAudioItem >= 0 && iAudioItem < m_audioDevices.count())          if (iAudioItem >= 0 && iAudioItem < m_audioDevices.count())
771                  pDevice = m_audioDevices.at(iAudioItem);                  pDevice = m_audioDevices.at(iAudioItem);
772          setupDevice(pDevice,          setupDevice(pDevice,
773                  qsamplerDevice::Audio, m_ui.AudioDriverComboBox->currentText());                  Device::Audio, m_ui.AudioDriverComboBox->currentText());
774  }  }
775    
776  // UPdate all device lists slot.  // UPdate all device lists slot.
# Line 788  void ChannelForm::stabilizeForm (void) Line 802  void ChannelForm::stabilizeForm (void)
802          const bool bValid =          const bool bValid =
803                  m_ui.EngineNameComboBox->currentIndex() >= 0 &&                  m_ui.EngineNameComboBox->currentIndex() >= 0 &&
804                  m_ui.EngineNameComboBox->currentText()                  m_ui.EngineNameComboBox->currentText()
805                          != qsamplerChannel::noEngineName();                          != Channel::noEngineName();
806  #if 0  #if 0
807          const QString& sPath = InstrumentFileComboBox->currentText();          const QString& sPath = InstrumentFileComboBox->currentText();
808          bValid = bValid && !sPath.isEmpty() && QFileInfo(sPath).exists();          bValid = bValid && !sPath.isEmpty() && QFileInfo(sPath).exists();

Legend:
Removed from v.1519  
changed lines
  Added in v.1840

  ViewVC Help
Powered by ViewVC