/[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 454 by capela, Mon Mar 14 10:59:57 2005 UTC revision 487 by capela, Thu Mar 31 14:17:19 2005 UTC
# Line 26  Line 26 
26  #include <qfileinfo.h>  #include <qfileinfo.h>
27  #include <qlistbox.h>  #include <qlistbox.h>
28    
29    #include "qsamplerDeviceForm.h"
30    
31  #include "config.h"  #include "config.h"
32    
33    
# Line 41  void qsamplerChannelForm::init (void) Line 43  void qsamplerChannelForm::init (void)
43          m_midiDevices.setAutoDelete(true);          m_midiDevices.setAutoDelete(true);
44          m_audioDevices.setAutoDelete(true);          m_audioDevices.setAutoDelete(true);
45    
46            m_pDeviceForm = NULL;
47            
48      // Try to restore normal window positioning.      // Try to restore normal window positioning.
49      adjustSize();      adjustSize();
50  }  }
# Line 49  void qsamplerChannelForm::init (void) Line 53  void qsamplerChannelForm::init (void)
53  // Kind of destructor.  // Kind of destructor.
54  void qsamplerChannelForm::destroy (void)  void qsamplerChannelForm::destroy (void)
55  {  {
56            if (m_pDeviceForm)
57                delete m_pDeviceForm;
58            m_pDeviceForm = NULL;
59  }  }
60    
61    
# Line 124  void qsamplerChannelForm::setup ( qsampl Line 131  void qsamplerChannelForm::setup ( qsampl
131      InstrumentNrComboBox->setCurrentItem(pChannel->instrumentNr());      InstrumentNrComboBox->setCurrentItem(pChannel->instrumentNr());
132            
133          // MIDI input device...          // MIDI input device...
134          qsamplerDevice midiDevice(m_pChannel->client(),          qsamplerDevice midiDevice(m_pChannel->mainForm(),
135                  qsamplerDevice::Midi, m_pChannel->midiDevice());                  qsamplerDevice::Midi, m_pChannel->midiDevice());
136      // MIDI input driver...      // MIDI input driver...
137          QString sMidiDriver = midiDevice.driverName();          QString sMidiDriver = midiDevice.driverName();
# Line 138  void qsamplerChannelForm::setup ( qsampl Line 145  void qsamplerChannelForm::setup ( qsampl
145          selectMidiDriver(sMidiDriver);          selectMidiDriver(sMidiDriver);
146          if (!bNew)          if (!bNew)
147                  MidiDeviceComboBox->setCurrentText(midiDevice.deviceName());                  MidiDeviceComboBox->setCurrentText(midiDevice.deviceName());
148            selectMidiDevice(MidiDeviceComboBox->currentItem());
149      // MIDI input port...      // MIDI input port...
150      MidiPortSpinBox->setValue(pChannel->midiPort());      MidiPortSpinBox->setValue(pChannel->midiPort());
151      // MIDI input channel...      // MIDI input channel...
# Line 146  void qsamplerChannelForm::setup ( qsampl Line 154  void qsamplerChannelForm::setup ( qsampl
154      if (iMidiChannel < 0)      if (iMidiChannel < 0)
155          iMidiChannel = (::lscp_get_channels(m_pChannel->client()) % 16);          iMidiChannel = (::lscp_get_channels(m_pChannel->client()) % 16);
156      MidiChannelComboBox->setCurrentItem(iMidiChannel);      MidiChannelComboBox->setCurrentItem(iMidiChannel);
157        
158          // Audio output device...          // Audio output device...
159          qsamplerDevice audioDevice(m_pChannel->client(),          qsamplerDevice audioDevice(m_pChannel->mainForm(),
160                  qsamplerDevice::Audio, m_pChannel->audioDevice());                  qsamplerDevice::Audio, m_pChannel->audioDevice());
161          // Audio output driver...          // Audio output driver...
162          QString sAudioDriver = audioDevice.driverName();          QString sAudioDriver = audioDevice.driverName();
# Line 162  void qsamplerChannelForm::setup ( qsampl Line 170  void qsamplerChannelForm::setup ( qsampl
170          selectAudioDriver(sAudioDriver);          selectAudioDriver(sAudioDriver);
171          if (!bNew)          if (!bNew)
172                  AudioDeviceComboBox->setCurrentText(audioDevice.deviceName());                  AudioDeviceComboBox->setCurrentText(audioDevice.deviceName());
173            selectAudioDevice(AudioDeviceComboBox->currentItem());
174    
175          // As convenient, make it ready on stabilizeForm() for          // As convenient, make it ready on stabilizeForm() for
176          // prompt acceptance, if we got the minimum required...          // prompt acceptance, if we got the minimum required...
177          if (sEngineName != qsamplerChannel::noEngineName() &&          if (sEngineName != qsamplerChannel::noEngineName() &&
178                  sInstrumentFile != qsamplerChannel::noInstrumentName())                  sInstrumentFile != qsamplerChannel::noInstrumentName())
179                  m_iDirtyCount++;                  m_iDirtyCount++;
         // FIXME: These are better leave diabled...  
     MidiPortTextLabel->setEnabled(false);  
     MidiPortSpinBox->setEnabled(false);  
180      // Done.      // Done.
181      m_iDirtySetup--;      m_iDirtySetup--;
182      stabilizeForm();      stabilizeForm();
# Line 312  void qsamplerChannelForm::updateInstrume Line 318  void qsamplerChannelForm::updateInstrume
318      optionsChanged();      optionsChanged();
319  }  }
320    
321    // Show device options dialog.
322    void qsamplerChannelForm::setupDevice ( qsamplerDevice *pDevice )
323    {
324            if (pDevice == NULL)
325                return;
326    
327            // Create the device form if not already...
328            if (m_pDeviceForm == NULL) {
329                    m_pDeviceForm = new qsamplerDeviceForm(this, 0,
330                            WType_Dialog | WShowModal);
331                    m_pDeviceForm->setMainForm(m_pChannel->mainForm());
332                    m_pDeviceForm->move(QDialog::pos() + QPoint(32, 32));
333            }
334    
335            // Refresh the device form with selected data.
336            if (m_pDeviceForm) {
337                    m_pDeviceForm->setClient(m_pChannel->client()); // <-- refreshDevices().
338                    m_pDeviceForm->setDevice(pDevice->deviceType(),
339                            pDevice->deviceID());
340                    m_pDeviceForm->show();
341            }
342    }
343    
344    
345  // Refresh MIDI device options.  // Refresh MIDI device options.
346  void qsamplerChannelForm::selectMidiDriver ( const QString& sMidiDriver )  void qsamplerChannelForm::selectMidiDriver ( const QString& sMidiDriver )
# Line 325  void qsamplerChannelForm::selectMidiDriv Line 354  void qsamplerChannelForm::selectMidiDriv
354          int *piDeviceIDs = qsamplerDevice::getDevices(m_pChannel->client(),          int *piDeviceIDs = qsamplerDevice::getDevices(m_pChannel->client(),
355                  qsamplerDevice::Midi);                  qsamplerDevice::Midi);
356          for (int i = 0; piDeviceIDs && piDeviceIDs[i] >= 0; i++) {          for (int i = 0; piDeviceIDs && piDeviceIDs[i] >= 0; i++) {
357                  qsamplerDevice *pDevice = new qsamplerDevice(m_pChannel->client(),                  qsamplerDevice *pDevice = new qsamplerDevice(m_pChannel->mainForm(),
358                          qsamplerDevice::Midi, piDeviceIDs[i]);                          qsamplerDevice::Midi, piDeviceIDs[i]);
359                  if (pDevice->driverName().upper() == sDriverName) {                  if (pDevice->driverName().upper() == sDriverName) {
360                          MidiDeviceComboBox->insertItem(midiPixmap, pDevice->deviceName());                          MidiDeviceComboBox->insertItem(midiPixmap, pDevice->deviceName());
# Line 340  void qsamplerChannelForm::selectMidiDriv Line 369  void qsamplerChannelForm::selectMidiDriv
369                  MidiDeviceComboBox->insertItem(tr("(New MIDI device)"));                  MidiDeviceComboBox->insertItem(tr("(New MIDI device)"));
370          MidiDeviceTextLabel->setEnabled(bEnabled);          MidiDeviceTextLabel->setEnabled(bEnabled);
371          MidiDeviceComboBox->setEnabled(bEnabled);          MidiDeviceComboBox->setEnabled(bEnabled);
372            MidiDevicePushButton->setEnabled(bEnabled);
373          optionsChanged();          optionsChanged();
374  }  }
375    
376    
377    // Select MIDI device options.
378    void qsamplerChannelForm::selectMidiDevice ( int iMidiItem )
379    {
380            qsamplerDevice *pDevice = m_midiDevices.at(iMidiItem);
381            if (pDevice) {
382                    const qsamplerDeviceParamMap& params = pDevice->params();
383                    int iPorts = params["PORTS"].value.toInt();
384                    MidiPortTextLabel->setEnabled(iPorts > 0);
385                    MidiPortSpinBox->setEnabled(iPorts > 0);
386                    if (iPorts > 0)
387                            MidiPortSpinBox->setMaxValue(iPorts - 1);
388            }
389            optionsChanged();
390    }
391    
392    
393    // MIDI device options.
394    void qsamplerChannelForm::setupMidiDevice (void)
395    {
396            setupDevice(m_midiDevices.at(MidiDeviceComboBox->currentItem()));
397    }
398    
399    
400  // Refresh Audio device options.  // Refresh Audio device options.
401  void qsamplerChannelForm::selectAudioDriver ( const QString& sAudioDriver )  void qsamplerChannelForm::selectAudioDriver ( const QString& sAudioDriver )
402  {  {
# Line 356  void qsamplerChannelForm::selectAudioDri Line 409  void qsamplerChannelForm::selectAudioDri
409          int *piDeviceIDs = qsamplerDevice::getDevices(m_pChannel->client(),          int *piDeviceIDs = qsamplerDevice::getDevices(m_pChannel->client(),
410                  qsamplerDevice::Audio);                  qsamplerDevice::Audio);
411          for (int i = 0; piDeviceIDs && piDeviceIDs[i] >= 0; i++) {          for (int i = 0; piDeviceIDs && piDeviceIDs[i] >= 0; i++) {
412                  qsamplerDevice *pDevice = new qsamplerDevice(m_pChannel->client(),                  qsamplerDevice *pDevice = new qsamplerDevice(m_pChannel->mainForm(),
413                          qsamplerDevice::Audio, piDeviceIDs[i]);                          qsamplerDevice::Audio, piDeviceIDs[i]);
414                  if (pDevice->driverName().upper() == sDriverName) {                  if (pDevice->driverName().upper() == sDriverName) {
415                          AudioDeviceComboBox->insertItem(audioPixmap, pDevice->deviceName());                          AudioDeviceComboBox->insertItem(audioPixmap, pDevice->deviceName());
# Line 371  void qsamplerChannelForm::selectAudioDri Line 424  void qsamplerChannelForm::selectAudioDri
424                  AudioDeviceComboBox->insertItem(tr("(New Audio device)"));                  AudioDeviceComboBox->insertItem(tr("(New Audio device)"));
425          AudioDeviceTextLabel->setEnabled(bEnabled);          AudioDeviceTextLabel->setEnabled(bEnabled);
426          AudioDeviceComboBox->setEnabled(bEnabled);          AudioDeviceComboBox->setEnabled(bEnabled);
427            AudioDevicePushButton->setEnabled(bEnabled);
428          optionsChanged();          optionsChanged();
429  }  }
430    
431    
432    // Select Audio device options.
433    void qsamplerChannelForm::selectAudioDevice ( int iAudioItem )
434    {
435            qsamplerDevice *pDevice = m_audioDevices.at(iAudioItem);
436            if (pDevice) {
437                    // Is there anything to do here?
438            }
439            optionsChanged();
440    }
441    
442    
443    // Audio device options.
444    void qsamplerChannelForm::setupAudioDevice (void)
445    {
446            setupDevice(m_audioDevices.at(AudioDeviceComboBox->currentItem()));
447    }
448    
449    
450  // Dirty up settings.  // Dirty up settings.
451  void qsamplerChannelForm::optionsChanged (void)  void qsamplerChannelForm::optionsChanged (void)
452  {  {

Legend:
Removed from v.454  
changed lines
  Added in v.487

  ViewVC Help
Powered by ViewVC