/[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 488 by capela, Thu Mar 31 16:26:40 2005 UTC revision 525 by capela, Mon May 9 10:21:41 2005 UTC
# Line 34  Line 34 
34  // Kind of constructor.  // Kind of constructor.
35  void qsamplerChannelForm::init (void)  void qsamplerChannelForm::init (void)
36  {  {
37      // Initialize locals.          // Initialize locals.
38      m_pChannel = NULL;          m_pChannel = NULL;
39    
40      m_iDirtySetup = 0;          m_iDirtySetup = 0;
41      m_iDirtyCount = 0;          m_iDirtyCount = 0;
42    
43          m_midiDevices.setAutoDelete(true);          m_midiDevices.setAutoDelete(true);
44          m_audioDevices.setAutoDelete(true);          m_audioDevices.setAutoDelete(true);
45    
46          m_pDeviceForm = NULL;          m_pDeviceForm = NULL;
47            
48      // Try to restore normal window positioning.          // Try to restore normal window positioning.
49      adjustSize();          adjustSize();
50  }  }
51    
52    
# Line 54  void qsamplerChannelForm::init (void) Line 54  void qsamplerChannelForm::init (void)
54  void qsamplerChannelForm::destroy (void)  void qsamplerChannelForm::destroy (void)
55  {  {
56          if (m_pDeviceForm)          if (m_pDeviceForm)
57              delete m_pDeviceForm;                  delete m_pDeviceForm;
58          m_pDeviceForm = NULL;          m_pDeviceForm = NULL;
59  }  }
60    
# Line 62  void qsamplerChannelForm::destroy (void) Line 62  void qsamplerChannelForm::destroy (void)
62  // Channel dialog setup formal initializer.  // Channel dialog setup formal initializer.
63  void qsamplerChannelForm::setup ( qsamplerChannel *pChannel )  void qsamplerChannelForm::setup ( qsamplerChannel *pChannel )
64  {  {
65      m_pChannel = pChannel;          m_pChannel = pChannel;
66    
67            m_iDirtySetup = 0;
68            m_iDirtyCount = 0;
69    
70      m_iDirtySetup = 0;          if (m_pChannel == NULL)
71      m_iDirtyCount = 0;                  return;
72    
73      if (m_pChannel == NULL)          // It can be a brand new channel, remember?
74          return;          bool bNew = (m_pChannel->channelID() < 0);
75            setCaption(m_pChannel->channelName());
76    
77            // Check if we're up and connected.
78            if (m_pChannel->client() == NULL)
79                    return;
80    
81            qsamplerOptions *pOptions = m_pChannel->options();
82            if (pOptions == NULL)
83                    return;
84    
85            // Avoid nested changes.
86            m_iDirtySetup++;
87    
88            // Load combo box history...
89            pOptions->loadComboBoxHistory(InstrumentFileComboBox);
90    
91            // Populate Engines list.
92            const char **ppszEngines = ::lscp_list_available_engines(m_pChannel->client());
93            if (ppszEngines) {
94                    EngineNameComboBox->clear();
95                    for (int iEngine = 0; ppszEngines[iEngine]; iEngine++)
96                            EngineNameComboBox->insertItem(ppszEngines[iEngine]);
97            }
98            else m_pChannel->appendMessagesClient("lscp_list_available_engines");
99    
100      // It can be a brand new channel, remember?          // Populate Audio output type list.
101      bool bNew = (m_pChannel->channelID() < 0);          AudioDriverComboBox->clear();
102      setCaption(m_pChannel->channelName());          AudioDriverComboBox->insertStringList(
   
     // Check if we're up and connected.  
     if (m_pChannel->client() == NULL)  
         return;  
   
     qsamplerOptions *pOptions = m_pChannel->options();  
     if (pOptions == NULL)  
         return;  
   
     // Avoid nested changes.  
     m_iDirtySetup++;  
   
     // Load combo box history...  
     pOptions->loadComboBoxHistory(InstrumentFileComboBox);  
   
     // Populate Engines list.  
     const char **ppszEngines = ::lscp_get_available_engines(m_pChannel->client());  
     if (ppszEngines) {  
         EngineNameComboBox->clear();  
         for (int iEngine = 0; ppszEngines[iEngine]; iEngine++)  
             EngineNameComboBox->insertItem(ppszEngines[iEngine]);  
     }  
     else m_pChannel->appendMessagesClient("lscp_get_available_engines");  
   
     // Populate Audio output type list.  
     AudioDriverComboBox->clear();  
     AudioDriverComboBox->insertStringList(  
103                  qsamplerDevice::getDrivers(m_pChannel->client(), qsamplerDevice::Audio));                  qsamplerDevice::getDrivers(m_pChannel->client(), qsamplerDevice::Audio));
104    
105      // Populate MIDI input type list.          // Populate MIDI input type list.
106      MidiDriverComboBox->clear();          MidiDriverComboBox->clear();
107      MidiDriverComboBox->insertStringList(          MidiDriverComboBox->insertStringList(
108                  qsamplerDevice::getDrivers(m_pChannel->client(), qsamplerDevice::Midi));                  qsamplerDevice::getDrivers(m_pChannel->client(), qsamplerDevice::Midi));
109    
110      // Read proper channel information,          // Read proper channel information,
111      // and populate the channel form fields.          // and populate the channel form fields.
112    
113      // Engine name...          // Engine name...
114      QString sEngineName = pChannel->engineName();          QString sEngineName = pChannel->engineName();
115      if (sEngineName.isEmpty() || bNew)          if (sEngineName.isEmpty() || bNew)
116          sEngineName = pOptions->sEngineName;                  sEngineName = pOptions->sEngineName;
117      if (sEngineName.isEmpty())          if (sEngineName.isEmpty())
118          sEngineName = qsamplerChannel::noEngineName();                  sEngineName = qsamplerChannel::noEngineName();
119      if (EngineNameComboBox->listBox()->findItem(sEngineName, Qt::ExactMatch) == NULL)          if (EngineNameComboBox->listBox()->findItem(sEngineName,
120          EngineNameComboBox->insertItem(sEngineName);                          Qt::ExactMatch | Qt::CaseSensitive) == NULL) {
121      EngineNameComboBox->setCurrentText(sEngineName);                  EngineNameComboBox->insertItem(sEngineName);
122      // Instrument filename and index...          }
123      QString sInstrumentFile = pChannel->instrumentFile();          EngineNameComboBox->setCurrentText(sEngineName);
124      if (sInstrumentFile.isEmpty())          // Instrument filename and index...
125          sInstrumentFile = qsamplerChannel::noInstrumentName();          QString sInstrumentFile = pChannel->instrumentFile();
126      InstrumentFileComboBox->setCurrentText(sInstrumentFile);          if (sInstrumentFile.isEmpty())
127      InstrumentNrComboBox->clear();                  sInstrumentFile = qsamplerChannel::noInstrumentName();
128      InstrumentNrComboBox->insertStringList(          InstrumentFileComboBox->setCurrentText(sInstrumentFile);
129            InstrumentNrComboBox->clear();
130            InstrumentNrComboBox->insertStringList(
131                  qsamplerChannel::getInstrumentList(sInstrumentFile,                  qsamplerChannel::getInstrumentList(sInstrumentFile,
132                  pOptions->bInstrumentNames));                  pOptions->bInstrumentNames));
133      InstrumentNrComboBox->setCurrentItem(pChannel->instrumentNr());          InstrumentNrComboBox->setCurrentItem(pChannel->instrumentNr());
134        
135          // MIDI input device...          // MIDI input device...
136          qsamplerDevice midiDevice(m_pChannel->mainForm(),          qsamplerDevice midiDevice(m_pChannel->mainForm(),
137                  qsamplerDevice::Midi, m_pChannel->midiDevice());                  qsamplerDevice::Midi, m_pChannel->midiDevice());
138      // MIDI input driver...          // MIDI input driver...
139          QString sMidiDriver = midiDevice.driverName();          QString sMidiDriver = midiDevice.driverName();
140          if (sMidiDriver.isEmpty() || bNew)          if (sMidiDriver.isEmpty() || bNew)
141                  sMidiDriver = pOptions->sMidiDriver;                  sMidiDriver = pOptions->sMidiDriver.upper();
142          if (!sMidiDriver.isEmpty()) {          if (!sMidiDriver.isEmpty()) {
143                  if (MidiDriverComboBox->listBox()->findItem(sMidiDriver, Qt::ExactMatch) == NULL)                  if (MidiDriverComboBox->listBox()->findItem(sMidiDriver,
144                                    Qt::ExactMatch | Qt::CaseSensitive) == NULL) {
145                          MidiDriverComboBox->insertItem(sMidiDriver);                          MidiDriverComboBox->insertItem(sMidiDriver);
146                    }
147                  MidiDriverComboBox->setCurrentText(sMidiDriver);                  MidiDriverComboBox->setCurrentText(sMidiDriver);
148          }          }
149          selectMidiDriverItem(sMidiDriver);          selectMidiDriverItem(sMidiDriver);
150          if (!bNew)          if (!bNew)
151                  MidiDeviceComboBox->setCurrentText(midiDevice.deviceName());                  MidiDeviceComboBox->setCurrentText(midiDevice.deviceName());
152          selectMidiDeviceItem(MidiDeviceComboBox->currentItem());          selectMidiDeviceItem(MidiDeviceComboBox->currentItem());
153      // MIDI input port...          // MIDI input port...
154      MidiPortSpinBox->setValue(pChannel->midiPort());          MidiPortSpinBox->setValue(pChannel->midiPort());
155      // MIDI input channel...          // MIDI input channel...
156      int iMidiChannel = pChannel->midiChannel();          int iMidiChannel = pChannel->midiChannel();
157      // When new, try to suggest a sensible MIDI channel...          // When new, try to suggest a sensible MIDI channel...
158      if (iMidiChannel < 0)          if (iMidiChannel < 0)
159          iMidiChannel = (::lscp_get_channels(m_pChannel->client()) % 16);                  iMidiChannel = (::lscp_get_channels(m_pChannel->client()) % 16);
160      MidiChannelComboBox->setCurrentItem(iMidiChannel);          MidiChannelComboBox->setCurrentItem(iMidiChannel);
161    
162          // Audio output device...          // Audio output device...
163          qsamplerDevice audioDevice(m_pChannel->mainForm(),          qsamplerDevice audioDevice(m_pChannel->mainForm(),
# Line 161  void qsamplerChannelForm::setup ( qsampl Line 165  void qsamplerChannelForm::setup ( qsampl
165          // Audio output driver...          // Audio output driver...
166          QString sAudioDriver = audioDevice.driverName();          QString sAudioDriver = audioDevice.driverName();
167          if (sAudioDriver.isEmpty() || bNew)          if (sAudioDriver.isEmpty() || bNew)
168                  sAudioDriver = pOptions->sAudioDriver;                  sAudioDriver = pOptions->sAudioDriver.upper();
169          if (!sAudioDriver.isEmpty()) {          if (!sAudioDriver.isEmpty()) {
170                  if (AudioDriverComboBox->listBox()->findItem(sAudioDriver, Qt::ExactMatch) == NULL)                  if (AudioDriverComboBox->listBox()->findItem(sAudioDriver,
171                                    Qt::ExactMatch | Qt::CaseSensitive) == NULL) {
172                          AudioDriverComboBox->insertItem(sAudioDriver);                          AudioDriverComboBox->insertItem(sAudioDriver);
173                    }
174                  AudioDriverComboBox->setCurrentText(sAudioDriver);                  AudioDriverComboBox->setCurrentText(sAudioDriver);
175          }          }
176          selectAudioDriverItem(sAudioDriver);          selectAudioDriverItem(sAudioDriver);
# Line 177  void qsamplerChannelForm::setup ( qsampl Line 183  void qsamplerChannelForm::setup ( qsampl
183          if (sEngineName != qsamplerChannel::noEngineName() &&          if (sEngineName != qsamplerChannel::noEngineName() &&
184                  sInstrumentFile != qsamplerChannel::noInstrumentName())                  sInstrumentFile != qsamplerChannel::noInstrumentName())
185                  m_iDirtyCount++;                  m_iDirtyCount++;
186      // Done.          // Done.
187      m_iDirtySetup--;          m_iDirtySetup--;
188      stabilizeForm();          stabilizeForm();
189  }  }
190    
191    
192  // Accept settings (OK button slot).  // Accept settings (OK button slot).
193  void qsamplerChannelForm::accept (void)  void qsamplerChannelForm::accept (void)
194  {  {
195      if (m_pChannel == NULL)          if (m_pChannel == NULL)
196          return;                  return;
197    
198      qsamplerOptions *pOptions = m_pChannel->options();          qsamplerOptions *pOptions = m_pChannel->options();
199      if (pOptions == NULL)          if (pOptions == NULL)
200          return;                  return;
201    
202      // We'll go for it!          // We'll go for it!
203      if (m_iDirtyCount > 0) {          if (m_iDirtyCount > 0) {
204          int iErrors = 0;                  int iErrors = 0;
205          // Are we a new channel?                  // Are we a new channel?
206          if (!m_pChannel->addChannel())                  if (!m_pChannel->addChannel())
207              iErrors++;                          iErrors++;
208                  // Accept Audio driver or device selection...                  // Accept Audio driver or device selection...
209                  if (m_audioDevices.isEmpty()) {                  if (m_audioDevices.isEmpty()) {
210                          if (!m_pChannel->setAudioDriver(AudioDriverComboBox->currentText()))                          if (!m_pChannel->setAudioDriver(AudioDriverComboBox->currentText()))
# Line 221  void qsamplerChannelForm::accept (void) Line 227  void qsamplerChannelForm::accept (void)
227                          else if (!m_pChannel->setMidiDevice(pDevice->deviceID()))                          else if (!m_pChannel->setMidiDevice(pDevice->deviceID()))
228                                  iErrors++;                                  iErrors++;
229                  }                  }
230          // MIDI input port number...                  // MIDI input port number...
231          if (!m_pChannel->setMidiPort(MidiPortSpinBox->value()))                  if (!m_pChannel->setMidiPort(MidiPortSpinBox->value()))
232              iErrors++;                          iErrors++;
233          // MIDI input channel...                  // MIDI input channel...
234          if (!m_pChannel->setMidiChannel(MidiChannelComboBox->currentItem()))                  if (!m_pChannel->setMidiChannel(MidiChannelComboBox->currentItem()))
235              iErrors++;                          iErrors++;
236          // Engine name...                  // Engine name...
237          if (!m_pChannel->loadEngine(EngineNameComboBox->currentText()))                  if (!m_pChannel->loadEngine(EngineNameComboBox->currentText()))
238              iErrors++;                          iErrors++;
239          // Instrument file and index...                  // Instrument file and index...
240          if (!m_pChannel->loadInstrument(InstrumentFileComboBox->currentText(), InstrumentNrComboBox->currentItem()))                  if (!m_pChannel->loadInstrument(InstrumentFileComboBox->currentText(), InstrumentNrComboBox->currentItem()))
241              iErrors++;                          iErrors++;
242          // Show error messages?                  // Show error messages?
243          if (iErrors > 0)                  if (iErrors > 0)
244              m_pChannel->appendMessagesError(tr("Some channel settings could not be set.\n\nSorry."));                          m_pChannel->appendMessagesError(tr("Some channel settings could not be set.\n\nSorry."));
245      }          }
246    
247      // Save default engine name, instrument directory and history...          // Save default engine name, instrument directory and history...
248      pOptions->sInstrumentDir = QFileInfo(InstrumentFileComboBox->currentText()).dirPath(true);          pOptions->sInstrumentDir = QFileInfo(InstrumentFileComboBox->currentText()).dirPath(true);
249      pOptions->sEngineName  = EngineNameComboBox->currentText();          pOptions->sEngineName  = EngineNameComboBox->currentText();
250      pOptions->sAudioDriver = AudioDriverComboBox->currentText();          pOptions->sAudioDriver = AudioDriverComboBox->currentText();
251      pOptions->sMidiDriver  = MidiDriverComboBox->currentText();          pOptions->sMidiDriver  = MidiDriverComboBox->currentText();
252      pOptions->saveComboBoxHistory(InstrumentFileComboBox);          pOptions->saveComboBoxHistory(InstrumentFileComboBox);
253    
254      // Just go with dialog acceptance.          // Just go with dialog acceptance.
255      QDialog::accept();          QDialog::accept();
256  }  }
257    
258    
259  // Reject settings (Cancel button slot).  // Reject settings (Cancel button slot).
260  void qsamplerChannelForm::reject (void)  void qsamplerChannelForm::reject (void)
261  {  {
262      bool bReject = true;          bool bReject = true;
263    
264      // Check if there's any pending changes...          // Check if there's any pending changes...
265      if (m_iDirtyCount > 0 && OkPushButton->isEnabled()) {          if (m_iDirtyCount > 0 && OkPushButton->isEnabled()) {
266          switch (QMessageBox::warning(this, tr("Warning"),                  switch (QMessageBox::warning(this, tr("Warning"),
267              tr("Some channel settings have been changed.\n\n"                          tr("Some channel settings have been changed.\n\n"
268                 "Do you want to apply the changes?"),                          "Do you want to apply the changes?"),
269              tr("Apply"), tr("Discard"), tr("Cancel"))) {                          tr("Apply"), tr("Discard"), tr("Cancel"))) {
270          case 0:     // Apply...                  case 0:     // Apply...
271              accept();                          accept();
272              return;                          return;
273          case 1:     // Discard                  case 1:     // Discard
274              break;                          break;
275          default:    // Cancel.                  default:    // Cancel.
276              bReject = false;                          bReject = false;
277          }                  }
278      }          }
279    
280      if (bReject)          if (bReject)
281          QDialog::reject();                  QDialog::reject();
282  }  }
283    
284    
285  // Browse and open an instrument file.  // Browse and open an instrument file.
286  void qsamplerChannelForm::openInstrumentFile (void)  void qsamplerChannelForm::openInstrumentFile (void)
287  {  {
288      qsamplerOptions *pOptions = m_pChannel->options();          qsamplerOptions *pOptions = m_pChannel->options();
289      if (pOptions == NULL)          if (pOptions == NULL)
290          return;                  return;
291    
292      // FIXME: the instrument file filters should be restricted,          // FIXME: the instrument file filters should be restricted,
293      // depending on the current engine.          // depending on the current engine.
294      QString sInstrumentFile = QFileDialog::getOpenFileName(          QString sInstrumentFile = QFileDialog::getOpenFileName(
295              pOptions->sInstrumentDir,                   // Start here.                          pOptions->sInstrumentDir,                   // Start here.
296              tr("Instrument files") + " (*.gig *.dls)",  // Filter (GIG and DLS files)                          tr("Instrument files") + " (*.gig *.dls)",  // Filter (GIG and DLS files)
297              this, 0,                                    // Parent and name (none)                          this, 0,                                    // Parent and name (none)
298              tr("Instrument files")                      // Caption.                          tr("Instrument files")                      // Caption.
299      );          );
300    
301      if (sInstrumentFile.isEmpty())          if (sInstrumentFile.isEmpty())
302          return;                  return;
303    
304      InstrumentFileComboBox->setCurrentText(sInstrumentFile);          InstrumentFileComboBox->setCurrentText(sInstrumentFile);
305            updateInstrumentName();
306  }  }
307    
308    
309  // Refresh the actual instrument name.  // Refresh the actual instrument name.
310  void qsamplerChannelForm::updateInstrumentName (void)  void qsamplerChannelForm::updateInstrumentName (void)
311  {  {
312      qsamplerOptions *pOptions = m_pChannel->options();          qsamplerOptions *pOptions = m_pChannel->options();
313      if (pOptions == NULL)          if (pOptions == NULL)
314          return;                  return;
315    
316      // Finally this better idea would be to use libgig          // Finally this better idea would be to use libgig
317      // to retrieve the REAL instrument names.          // to retrieve the REAL instrument names.
318      InstrumentNrComboBox->clear();          InstrumentNrComboBox->clear();
319      InstrumentNrComboBox->insertStringList(          InstrumentNrComboBox->insertStringList(
320          qsamplerChannel::getInstrumentList(                  qsamplerChannel::getInstrumentList(
321                          InstrumentFileComboBox->currentText(),                          InstrumentFileComboBox->currentText(),
322                          pOptions->bInstrumentNames)                          pOptions->bInstrumentNames)
323      );          );
324    
325      optionsChanged();          optionsChanged();
326  }  }
327    
328  // Show device options dialog.  // Show device options dialog.
329  void qsamplerChannelForm::setupDevice ( qsamplerDevice *pDevice )  void qsamplerChannelForm::setupDevice ( qsamplerDevice *pDevice,
330            qsamplerDevice::qsamplerDeviceType deviceTypeMode,
331            const QString& sDriverName )
332  {  {
         if (pDevice == NULL)  
             return;  
   
333          // Create the device form if not already...          // Create the device form if not already...
334          if (m_pDeviceForm == NULL) {          if (m_pDeviceForm == NULL) {
335                  m_pDeviceForm = new qsamplerDeviceForm(this, 0,                  m_pDeviceForm = new qsamplerDeviceForm(this, 0,
336                          WType_Dialog | WShowModal);                          WType_Dialog | WShowModal);
337                  m_pDeviceForm->setMainForm(m_pChannel->mainForm());                  m_pDeviceForm->setMainForm(m_pChannel->mainForm());
338                  QObject::connect(m_pDeviceForm, SIGNAL(devicesChanged()),                  QObject::connect(m_pDeviceForm, SIGNAL(devicesChanged()),
339                      this, SLOT(updateDevices()));                          this, SLOT(updateDevices()));
340          }          }
341    
342          // Refresh the device form with selected data.          // Refresh the device form with selected data.
343          if (m_pDeviceForm) {          if (m_pDeviceForm) {
344                  m_pDeviceForm->setClient(m_pChannel->client()); // <-- refreshDevices().                  m_pDeviceForm->setDeviceTypeMode(deviceTypeMode);
345                  m_pDeviceForm->setDevice(pDevice->deviceType(),                  m_pDeviceForm->setClient(m_pChannel->client()); // -> refreshDevices();
346                          pDevice->deviceID());                  m_pDeviceForm->setDevice(pDevice);
347                    m_pDeviceForm->setDriverName(sDriverName);
348                  m_pDeviceForm->show();                  m_pDeviceForm->show();
349          }          }
350  }  }
# Line 352  void qsamplerChannelForm::selectMidiDriv Line 359  void qsamplerChannelForm::selectMidiDriv
359          int iDeviceID = -1;          int iDeviceID = -1;
360          qsamplerDevice *pDevice = m_midiDevices.at(MidiDeviceComboBox->currentItem());          qsamplerDevice *pDevice = m_midiDevices.at(MidiDeviceComboBox->currentItem());
361          if (pDevice)          if (pDevice)
362              iDeviceID = pDevice->deviceID();                  iDeviceID = pDevice->deviceID();
363    
364          // Clean maplist.          // Clean maplist.
365          MidiDeviceComboBox->clear();          MidiDeviceComboBox->clear();
# Line 375  void qsamplerChannelForm::selectMidiDriv Line 382  void qsamplerChannelForm::selectMidiDriv
382    
383          // Do proper enabling...          // Do proper enabling...
384          bool bEnabled = !m_midiDevices.isEmpty();          bool bEnabled = !m_midiDevices.isEmpty();
385          if (!bEnabled)          if (!bEnabled) {
386                  MidiDeviceComboBox->insertItem(tr("(New MIDI device)"));                  MidiDeviceComboBox->insertItem(
387          else if (iDeviceID >= 0) {                          tr("(New MIDI %1 device)").arg(sMidiDriver));
388              // Select the previous current device...          } else if (iDeviceID >= 0) {
389              int iMidiItem = 0;                  // Select the previous current device...
390              for (pDevice = m_midiDevices.first();                  int iMidiItem = 0;
391                      pDevice;                  for (pDevice = m_midiDevices.first();
392                          pDevice = m_midiDevices.next()) {                                  pDevice;
393                      if (pDevice->deviceID() == iDeviceID) {                                          pDevice = m_midiDevices.next()) {
394                            if (pDevice->deviceID() == iDeviceID) {
395                                  MidiDeviceComboBox->setCurrentItem(iMidiItem);                                  MidiDeviceComboBox->setCurrentItem(iMidiItem);
396                  //      selectMidiDeviceItem(iMidiItem);                          //      selectMidiDeviceItem(iMidiItem);
397                          break;                                  break;
398                      }                          }
399                          iMidiItem++;                          iMidiItem++;
400                  }                  }
401          }          }
# Line 400  void qsamplerChannelForm::selectMidiDriv Line 408  void qsamplerChannelForm::selectMidiDriv
408  void qsamplerChannelForm::selectMidiDriver ( const QString& sMidiDriver )  void qsamplerChannelForm::selectMidiDriver ( const QString& sMidiDriver )
409  {  {
410          if (m_iDirtySetup > 0)          if (m_iDirtySetup > 0)
411              return;                  return;
412    
413          selectMidiDriverItem(sMidiDriver);          selectMidiDriverItem(sMidiDriver);
414          optionsChanged();          optionsChanged();
# Line 426  void qsamplerChannelForm::selectMidiDevi Line 434  void qsamplerChannelForm::selectMidiDevi
434  void qsamplerChannelForm::selectMidiDevice ( int iMidiItem )  void qsamplerChannelForm::selectMidiDevice ( int iMidiItem )
435  {  {
436          if (m_iDirtySetup > 0)          if (m_iDirtySetup > 0)
437              return;                  return;
438    
439          selectMidiDeviceItem(iMidiItem);          selectMidiDeviceItem(iMidiItem);
440          optionsChanged();          optionsChanged();
# Line 436  void qsamplerChannelForm::selectMidiDevi Line 444  void qsamplerChannelForm::selectMidiDevi
444  // MIDI device options.  // MIDI device options.
445  void qsamplerChannelForm::setupMidiDevice (void)  void qsamplerChannelForm::setupMidiDevice (void)
446  {  {
447          setupDevice(m_midiDevices.at(MidiDeviceComboBox->currentItem()));          setupDevice(m_midiDevices.at(MidiDeviceComboBox->currentItem()),
448                    qsamplerDevice::Midi, MidiDriverComboBox->currentText());
449  }  }
450    
451    
# Line 449  void qsamplerChannelForm::selectAudioDri Line 458  void qsamplerChannelForm::selectAudioDri
458          int iDeviceID = -1;          int iDeviceID = -1;
459          qsamplerDevice *pDevice = m_audioDevices.at(AudioDeviceComboBox->currentItem());          qsamplerDevice *pDevice = m_audioDevices.at(AudioDeviceComboBox->currentItem());
460          if (pDevice)          if (pDevice)
461              iDeviceID = pDevice->deviceID();                  iDeviceID = pDevice->deviceID();
462    
463          // Clean maplist.          // Clean maplist.
464          AudioDeviceComboBox->clear();          AudioDeviceComboBox->clear();
# Line 472  void qsamplerChannelForm::selectAudioDri Line 481  void qsamplerChannelForm::selectAudioDri
481    
482          // Do proper enabling...          // Do proper enabling...
483          bool bEnabled = !m_audioDevices.isEmpty();          bool bEnabled = !m_audioDevices.isEmpty();
484          if (!bEnabled)          if (!bEnabled) {
485                  AudioDeviceComboBox->insertItem(tr("(New Audio device)"));                  AudioDeviceComboBox->insertItem(
486          else if (iDeviceID >= 0) {                          tr("(New Audio %1 device)").arg(sAudioDriver));
487              // Select the previous current device...          } else if (iDeviceID >= 0) {
488              int iAudioItem = 0;                  // Select the previous current device...
489              for (pDevice = m_audioDevices.first();                  int iAudioItem = 0;
490                      pDevice;                  for (pDevice = m_audioDevices.first();
491                          pDevice = m_audioDevices.next()) {                                  pDevice;
492                      if (pDevice->deviceID() == iDeviceID) {                                          pDevice = m_audioDevices.next()) {
493                            if (pDevice->deviceID() == iDeviceID) {
494                                  AudioDeviceComboBox->setCurrentItem(iAudioItem);                                  AudioDeviceComboBox->setCurrentItem(iAudioItem);
495                  //      selectAudioDeviceItem(iAudioItem);                          //      selectAudioDeviceItem(iAudioItem);
496                          break;                                  break;
497                      }                          }
498                          iAudioItem++;                          iAudioItem++;
499                  }                  }
500          }          }
# Line 497  void qsamplerChannelForm::selectAudioDri Line 507  void qsamplerChannelForm::selectAudioDri
507  void qsamplerChannelForm::selectAudioDriver ( const QString& sAudioDriver )  void qsamplerChannelForm::selectAudioDriver ( const QString& sAudioDriver )
508  {  {
509          if (m_iDirtySetup > 0)          if (m_iDirtySetup > 0)
510              return;                  return;
511                
512          selectAudioDriverItem(sAudioDriver);          selectAudioDriverItem(sAudioDriver);
513          optionsChanged();          optionsChanged();
514  }  }
# Line 518  void qsamplerChannelForm::selectAudioDev Line 528  void qsamplerChannelForm::selectAudioDev
528  void qsamplerChannelForm::selectAudioDevice ( int iAudioItem )  void qsamplerChannelForm::selectAudioDevice ( int iAudioItem )
529  {  {
530          if (m_iDirtySetup > 0)          if (m_iDirtySetup > 0)
531              return;                  return;
532    
533          selectAudioDeviceItem(iAudioItem);          selectAudioDeviceItem(iAudioItem);
534          optionsChanged();          optionsChanged();
# Line 528  void qsamplerChannelForm::selectAudioDev Line 538  void qsamplerChannelForm::selectAudioDev
538  // Audio device options.  // Audio device options.
539  void qsamplerChannelForm::setupAudioDevice (void)  void qsamplerChannelForm::setupAudioDevice (void)
540  {  {
541          setupDevice(m_audioDevices.at(AudioDeviceComboBox->currentItem()));          setupDevice(m_audioDevices.at(AudioDeviceComboBox->currentItem()),
542                    qsamplerDevice::Audio, AudioDriverComboBox->currentText());
543  }  }
544    
545    
546  // UPdate all device lists slot.  // UPdate all device lists slot.
547  void qsamplerChannelForm::updateDevices (void)  void qsamplerChannelForm::updateDevices (void)
548  {  {
549      if (m_iDirtySetup > 0)          if (m_iDirtySetup > 0)
550          return;                  return;
551    
552          selectMidiDriverItem(MidiDriverComboBox->currentText());          selectMidiDriverItem(MidiDriverComboBox->currentText());
553          selectAudioDriverItem(AudioDriverComboBox->currentText());          selectAudioDriverItem(AudioDriverComboBox->currentText());
# Line 547  void qsamplerChannelForm::updateDevices Line 558  void qsamplerChannelForm::updateDevices
558  // Dirty up settings.  // Dirty up settings.
559  void qsamplerChannelForm::optionsChanged (void)  void qsamplerChannelForm::optionsChanged (void)
560  {  {
561      if (m_iDirtySetup > 0)          if (m_iDirtySetup > 0)
562          return;                  return;
563    
564      m_iDirtyCount++;          m_iDirtyCount++;
565      stabilizeForm();          stabilizeForm();
566  }  }
567    
568    
569  // Stabilize current form state.  // Stabilize current form state.
570  void qsamplerChannelForm::stabilizeForm (void)  void qsamplerChannelForm::stabilizeForm (void)
571  {  {
572      const QString& sFilename = InstrumentFileComboBox->currentText();          const QString& sFilename = InstrumentFileComboBox->currentText();
573      OkPushButton->setEnabled(m_iDirtyCount > 0 && !sFilename.isEmpty() && QFileInfo(sFilename).exists());          OkPushButton->setEnabled(m_iDirtyCount > 0 && !sFilename.isEmpty() && QFileInfo(sFilename).exists());
574  }  }
575    
576    
577  // end of qsamplerChannelForm.ui.h  // end of qsamplerChannelForm.ui.h
   

Legend:
Removed from v.488  
changed lines
  Added in v.525

  ViewVC Help
Powered by ViewVC