138 |
selectMidiDriver(sMidiDriver); |
selectMidiDriver(sMidiDriver); |
139 |
if (!bNew) |
if (!bNew) |
140 |
MidiDeviceComboBox->setCurrentText(midiDevice.deviceName()); |
MidiDeviceComboBox->setCurrentText(midiDevice.deviceName()); |
141 |
|
selectMidiDevice(MidiDeviceComboBox->currentItem()); |
142 |
// MIDI input port... |
// MIDI input port... |
143 |
MidiPortSpinBox->setValue(pChannel->midiPort()); |
MidiPortSpinBox->setValue(pChannel->midiPort()); |
144 |
// MIDI input channel... |
// MIDI input channel... |
147 |
if (iMidiChannel < 0) |
if (iMidiChannel < 0) |
148 |
iMidiChannel = (::lscp_get_channels(m_pChannel->client()) % 16); |
iMidiChannel = (::lscp_get_channels(m_pChannel->client()) % 16); |
149 |
MidiChannelComboBox->setCurrentItem(iMidiChannel); |
MidiChannelComboBox->setCurrentItem(iMidiChannel); |
150 |
|
|
151 |
// Audio output device... |
// Audio output device... |
152 |
qsamplerDevice audioDevice(m_pChannel->client(), |
qsamplerDevice audioDevice(m_pChannel->client(), |
153 |
qsamplerDevice::Audio, m_pChannel->audioDevice()); |
qsamplerDevice::Audio, m_pChannel->audioDevice()); |
163 |
selectAudioDriver(sAudioDriver); |
selectAudioDriver(sAudioDriver); |
164 |
if (!bNew) |
if (!bNew) |
165 |
AudioDeviceComboBox->setCurrentText(audioDevice.deviceName()); |
AudioDeviceComboBox->setCurrentText(audioDevice.deviceName()); |
166 |
|
selectAudioDevice(AudioDeviceComboBox->currentItem()); |
167 |
|
|
168 |
// As convenient, make it ready on stabilizeForm() for |
// As convenient, make it ready on stabilizeForm() for |
169 |
// prompt acceptance, if we got the minimum required... |
// prompt acceptance, if we got the minimum required... |
170 |
if (sEngineName != qsamplerChannel::noEngineName() && |
if (sEngineName != qsamplerChannel::noEngineName() && |
171 |
sInstrumentFile != qsamplerChannel::noInstrumentName()) |
sInstrumentFile != qsamplerChannel::noInstrumentName()) |
172 |
m_iDirtyCount++; |
m_iDirtyCount++; |
173 |
// FIXME: These are better leave diabled... |
// FIXME: These are better leave disabled... |
174 |
MidiPortTextLabel->setEnabled(false); |
MidiPortTextLabel->setEnabled(false); |
175 |
MidiPortSpinBox->setEnabled(false); |
MidiPortSpinBox->setEnabled(false); |
176 |
// Done. |
// Done. |
318 |
// Refresh MIDI device options. |
// Refresh MIDI device options. |
319 |
void qsamplerChannelForm::selectMidiDriver ( const QString& sMidiDriver ) |
void qsamplerChannelForm::selectMidiDriver ( const QString& sMidiDriver ) |
320 |
{ |
{ |
321 |
|
const QString sDriverName = sMidiDriver.upper(); |
322 |
|
|
323 |
MidiDeviceComboBox->clear(); |
MidiDeviceComboBox->clear(); |
324 |
m_audioDevices.clear(); |
m_audioDevices.clear(); |
325 |
|
|
329 |
for (int i = 0; piDeviceIDs && piDeviceIDs[i] >= 0; i++) { |
for (int i = 0; piDeviceIDs && piDeviceIDs[i] >= 0; i++) { |
330 |
qsamplerDevice *pDevice = new qsamplerDevice(m_pChannel->client(), |
qsamplerDevice *pDevice = new qsamplerDevice(m_pChannel->client(), |
331 |
qsamplerDevice::Midi, piDeviceIDs[i]); |
qsamplerDevice::Midi, piDeviceIDs[i]); |
332 |
if (pDevice->driverName() == sMidiDriver) { |
if (pDevice->driverName().upper() == sDriverName) { |
333 |
MidiDeviceComboBox->insertItem(midiPixmap, pDevice->deviceName()); |
MidiDeviceComboBox->insertItem(midiPixmap, pDevice->deviceName()); |
334 |
m_midiDevices.append(pDevice); |
m_midiDevices.append(pDevice); |
335 |
} else { |
} else { |
338 |
} |
} |
339 |
|
|
340 |
bool bEnabled = !m_midiDevices.isEmpty(); |
bool bEnabled = !m_midiDevices.isEmpty(); |
341 |
|
if (!bEnabled) |
342 |
|
MidiDeviceComboBox->insertItem(tr("(New MIDI device)")); |
343 |
MidiDeviceTextLabel->setEnabled(bEnabled); |
MidiDeviceTextLabel->setEnabled(bEnabled); |
344 |
MidiDeviceComboBox->setEnabled(bEnabled); |
MidiDeviceComboBox->setEnabled(bEnabled); |
345 |
optionsChanged(); |
optionsChanged(); |
346 |
} |
} |
347 |
|
|
348 |
|
|
349 |
|
// Select MIDI device options. |
350 |
|
void qsamplerChannelForm::selectMidiDevice ( int iMidiItem ) |
351 |
|
{ |
352 |
|
qsamplerDevice *pDevice = m_midiDevices.at(iMidiItem); |
353 |
|
if (pDevice) { |
354 |
|
const qsamplerDeviceParamMap& params = pDevice->params(); |
355 |
|
int iPorts = params["PORTS"].value.toInt(); |
356 |
|
MidiPortTextLabel->setEnabled(iPorts > 0); |
357 |
|
MidiPortSpinBox->setEnabled(iPorts > 0); |
358 |
|
if (iPorts > 0) |
359 |
|
MidiPortSpinBox->setMaxValue(iPorts - 1); |
360 |
|
} |
361 |
|
optionsChanged(); |
362 |
|
} |
363 |
|
|
364 |
|
|
365 |
// Refresh Audio device options. |
// Refresh Audio device options. |
366 |
void qsamplerChannelForm::selectAudioDriver ( const QString& sAudioDriver ) |
void qsamplerChannelForm::selectAudioDriver ( const QString& sAudioDriver ) |
367 |
{ |
{ |
368 |
|
const QString sDriverName = sAudioDriver.upper(); |
369 |
|
|
370 |
AudioDeviceComboBox->clear(); |
AudioDeviceComboBox->clear(); |
371 |
m_audioDevices.clear(); |
m_audioDevices.clear(); |
372 |
|
|
376 |
for (int i = 0; piDeviceIDs && piDeviceIDs[i] >= 0; i++) { |
for (int i = 0; piDeviceIDs && piDeviceIDs[i] >= 0; i++) { |
377 |
qsamplerDevice *pDevice = new qsamplerDevice(m_pChannel->client(), |
qsamplerDevice *pDevice = new qsamplerDevice(m_pChannel->client(), |
378 |
qsamplerDevice::Audio, piDeviceIDs[i]); |
qsamplerDevice::Audio, piDeviceIDs[i]); |
379 |
if (pDevice->driverName() == sAudioDriver) { |
if (pDevice->driverName().upper() == sDriverName) { |
380 |
AudioDeviceComboBox->insertItem(audioPixmap, pDevice->deviceName()); |
AudioDeviceComboBox->insertItem(audioPixmap, pDevice->deviceName()); |
381 |
m_audioDevices.append(pDevice); |
m_audioDevices.append(pDevice); |
382 |
} else { |
} else { |
385 |
} |
} |
386 |
|
|
387 |
bool bEnabled = !m_audioDevices.isEmpty(); |
bool bEnabled = !m_audioDevices.isEmpty(); |
388 |
|
if (!bEnabled) |
389 |
|
AudioDeviceComboBox->insertItem(tr("(New Audio device)")); |
390 |
AudioDeviceTextLabel->setEnabled(bEnabled); |
AudioDeviceTextLabel->setEnabled(bEnabled); |
391 |
AudioDeviceComboBox->setEnabled(bEnabled); |
AudioDeviceComboBox->setEnabled(bEnabled); |
392 |
optionsChanged(); |
optionsChanged(); |
393 |
} |
} |
394 |
|
|
395 |
|
|
396 |
|
// Select Audio device options. |
397 |
|
void qsamplerChannelForm::selectAudioDevice ( int iAudioItem ) |
398 |
|
{ |
399 |
|
qsamplerDevice *pDevice = m_audioDevices.at(iAudioItem); |
400 |
|
if (pDevice) { |
401 |
|
// Is there anything to do here? |
402 |
|
} |
403 |
|
optionsChanged(); |
404 |
|
} |
405 |
|
|
406 |
|
|
407 |
// Dirty up settings. |
// Dirty up settings. |
408 |
void qsamplerChannelForm::optionsChanged (void) |
void qsamplerChannelForm::optionsChanged (void) |