124 |
InstrumentNrComboBox->setCurrentItem(pChannel->instrumentNr()); |
InstrumentNrComboBox->setCurrentItem(pChannel->instrumentNr()); |
125 |
|
|
126 |
// MIDI input device... |
// MIDI input device... |
127 |
qsamplerDevice midiDevice(m_pChannel->client(), |
qsamplerDevice midiDevice(m_pChannel->mainForm(), |
128 |
qsamplerDevice::Midi, m_pChannel->midiDevice()); |
qsamplerDevice::Midi, m_pChannel->midiDevice()); |
129 |
// MIDI input driver... |
// MIDI input driver... |
130 |
QString sMidiDriver = midiDevice.driverName(); |
QString sMidiDriver = midiDevice.driverName(); |
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->mainForm(), |
153 |
qsamplerDevice::Audio, m_pChannel->audioDevice()); |
qsamplerDevice::Audio, m_pChannel->audioDevice()); |
154 |
// Audio output driver... |
// Audio output driver... |
155 |
QString sAudioDriver = audioDevice.driverName(); |
QString sAudioDriver = audioDevice.driverName(); |
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++; |
|
// FIXME: These are better leave diabled... |
|
|
MidiPortTextLabel->setEnabled(false); |
|
|
MidiPortSpinBox->setEnabled(false); |
|
173 |
// Done. |
// Done. |
174 |
m_iDirtySetup--; |
m_iDirtySetup--; |
175 |
stabilizeForm(); |
stabilizeForm(); |
315 |
// Refresh MIDI device options. |
// Refresh MIDI device options. |
316 |
void qsamplerChannelForm::selectMidiDriver ( const QString& sMidiDriver ) |
void qsamplerChannelForm::selectMidiDriver ( const QString& sMidiDriver ) |
317 |
{ |
{ |
318 |
|
const QString sDriverName = sMidiDriver.upper(); |
319 |
|
|
320 |
MidiDeviceComboBox->clear(); |
MidiDeviceComboBox->clear(); |
321 |
m_audioDevices.clear(); |
m_audioDevices.clear(); |
322 |
|
|
324 |
int *piDeviceIDs = qsamplerDevice::getDevices(m_pChannel->client(), |
int *piDeviceIDs = qsamplerDevice::getDevices(m_pChannel->client(), |
325 |
qsamplerDevice::Midi); |
qsamplerDevice::Midi); |
326 |
for (int i = 0; piDeviceIDs && piDeviceIDs[i] >= 0; i++) { |
for (int i = 0; piDeviceIDs && piDeviceIDs[i] >= 0; i++) { |
327 |
qsamplerDevice *pDevice = new qsamplerDevice(m_pChannel->client(), |
qsamplerDevice *pDevice = new qsamplerDevice(m_pChannel->mainForm(), |
328 |
qsamplerDevice::Midi, piDeviceIDs[i]); |
qsamplerDevice::Midi, piDeviceIDs[i]); |
329 |
if (pDevice->driverName() == sMidiDriver) { |
if (pDevice->driverName().upper() == sDriverName) { |
330 |
MidiDeviceComboBox->insertItem(midiPixmap, pDevice->deviceName()); |
MidiDeviceComboBox->insertItem(midiPixmap, pDevice->deviceName()); |
331 |
m_midiDevices.append(pDevice); |
m_midiDevices.append(pDevice); |
332 |
} else { |
} else { |
335 |
} |
} |
336 |
|
|
337 |
bool bEnabled = !m_midiDevices.isEmpty(); |
bool bEnabled = !m_midiDevices.isEmpty(); |
338 |
|
if (!bEnabled) |
339 |
|
MidiDeviceComboBox->insertItem(tr("(New MIDI device)")); |
340 |
MidiDeviceTextLabel->setEnabled(bEnabled); |
MidiDeviceTextLabel->setEnabled(bEnabled); |
341 |
MidiDeviceComboBox->setEnabled(bEnabled); |
MidiDeviceComboBox->setEnabled(bEnabled); |
342 |
optionsChanged(); |
optionsChanged(); |
343 |
} |
} |
344 |
|
|
345 |
|
|
346 |
|
// Select MIDI device options. |
347 |
|
void qsamplerChannelForm::selectMidiDevice ( int iMidiItem ) |
348 |
|
{ |
349 |
|
qsamplerDevice *pDevice = m_midiDevices.at(iMidiItem); |
350 |
|
if (pDevice) { |
351 |
|
const qsamplerDeviceParamMap& params = pDevice->params(); |
352 |
|
int iPorts = params["PORTS"].value.toInt(); |
353 |
|
MidiPortTextLabel->setEnabled(iPorts > 0); |
354 |
|
MidiPortSpinBox->setEnabled(iPorts > 0); |
355 |
|
if (iPorts > 0) |
356 |
|
MidiPortSpinBox->setMaxValue(iPorts - 1); |
357 |
|
} |
358 |
|
optionsChanged(); |
359 |
|
} |
360 |
|
|
361 |
|
|
362 |
// Refresh Audio device options. |
// Refresh Audio device options. |
363 |
void qsamplerChannelForm::selectAudioDriver ( const QString& sAudioDriver ) |
void qsamplerChannelForm::selectAudioDriver ( const QString& sAudioDriver ) |
364 |
{ |
{ |
365 |
|
const QString sDriverName = sAudioDriver.upper(); |
366 |
|
|
367 |
AudioDeviceComboBox->clear(); |
AudioDeviceComboBox->clear(); |
368 |
m_audioDevices.clear(); |
m_audioDevices.clear(); |
369 |
|
|
371 |
int *piDeviceIDs = qsamplerDevice::getDevices(m_pChannel->client(), |
int *piDeviceIDs = qsamplerDevice::getDevices(m_pChannel->client(), |
372 |
qsamplerDevice::Audio); |
qsamplerDevice::Audio); |
373 |
for (int i = 0; piDeviceIDs && piDeviceIDs[i] >= 0; i++) { |
for (int i = 0; piDeviceIDs && piDeviceIDs[i] >= 0; i++) { |
374 |
qsamplerDevice *pDevice = new qsamplerDevice(m_pChannel->client(), |
qsamplerDevice *pDevice = new qsamplerDevice(m_pChannel->mainForm(), |
375 |
qsamplerDevice::Audio, piDeviceIDs[i]); |
qsamplerDevice::Audio, piDeviceIDs[i]); |
376 |
if (pDevice->driverName() == sAudioDriver) { |
if (pDevice->driverName().upper() == sDriverName) { |
377 |
AudioDeviceComboBox->insertItem(audioPixmap, pDevice->deviceName()); |
AudioDeviceComboBox->insertItem(audioPixmap, pDevice->deviceName()); |
378 |
m_audioDevices.append(pDevice); |
m_audioDevices.append(pDevice); |
379 |
} else { |
} else { |
382 |
} |
} |
383 |
|
|
384 |
bool bEnabled = !m_audioDevices.isEmpty(); |
bool bEnabled = !m_audioDevices.isEmpty(); |
385 |
|
if (!bEnabled) |
386 |
|
AudioDeviceComboBox->insertItem(tr("(New Audio device)")); |
387 |
AudioDeviceTextLabel->setEnabled(bEnabled); |
AudioDeviceTextLabel->setEnabled(bEnabled); |
388 |
AudioDeviceComboBox->setEnabled(bEnabled); |
AudioDeviceComboBox->setEnabled(bEnabled); |
389 |
optionsChanged(); |
optionsChanged(); |
390 |
} |
} |
391 |
|
|
392 |
|
|
393 |
|
// Select Audio device options. |
394 |
|
void qsamplerChannelForm::selectAudioDevice ( int iAudioItem ) |
395 |
|
{ |
396 |
|
qsamplerDevice *pDevice = m_audioDevices.at(iAudioItem); |
397 |
|
if (pDevice) { |
398 |
|
// Is there anything to do here? |
399 |
|
} |
400 |
|
optionsChanged(); |
401 |
|
} |
402 |
|
|
403 |
|
|
404 |
// Dirty up settings. |
// Dirty up settings. |
405 |
void qsamplerChannelForm::optionsChanged (void) |
void qsamplerChannelForm::optionsChanged (void) |