142 |
MidiDriverComboBox->insertItem(sMidiDriver); |
MidiDriverComboBox->insertItem(sMidiDriver); |
143 |
MidiDriverComboBox->setCurrentText(sMidiDriver); |
MidiDriverComboBox->setCurrentText(sMidiDriver); |
144 |
} |
} |
145 |
selectMidiDriver(sMidiDriver); |
selectMidiDriverItem(sMidiDriver); |
146 |
if (!bNew) |
if (!bNew) |
147 |
MidiDeviceComboBox->setCurrentText(midiDevice.deviceName()); |
MidiDeviceComboBox->setCurrentText(midiDevice.deviceName()); |
148 |
selectMidiDevice(MidiDeviceComboBox->currentItem()); |
selectMidiDeviceItem(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... |
167 |
AudioDriverComboBox->insertItem(sAudioDriver); |
AudioDriverComboBox->insertItem(sAudioDriver); |
168 |
AudioDriverComboBox->setCurrentText(sAudioDriver); |
AudioDriverComboBox->setCurrentText(sAudioDriver); |
169 |
} |
} |
170 |
selectAudioDriver(sAudioDriver); |
selectAudioDriverItem(sAudioDriver); |
171 |
if (!bNew) |
if (!bNew) |
172 |
AudioDeviceComboBox->setCurrentText(audioDevice.deviceName()); |
AudioDeviceComboBox->setCurrentText(audioDevice.deviceName()); |
173 |
selectAudioDevice(AudioDeviceComboBox->currentItem()); |
selectAudioDeviceItem(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... |
329 |
m_pDeviceForm = new qsamplerDeviceForm(this, 0, |
m_pDeviceForm = new qsamplerDeviceForm(this, 0, |
330 |
WType_Dialog | WShowModal); |
WType_Dialog | WShowModal); |
331 |
m_pDeviceForm->setMainForm(m_pChannel->mainForm()); |
m_pDeviceForm->setMainForm(m_pChannel->mainForm()); |
332 |
m_pDeviceForm->move(QDialog::pos() + QPoint(32, 32)); |
QObject::connect(m_pDeviceForm, SIGNAL(devicesChanged()), |
333 |
|
this, SLOT(updateDevices())); |
334 |
} |
} |
335 |
|
|
336 |
// Refresh the device form with selected data. |
// Refresh the device form with selected data. |
343 |
} |
} |
344 |
|
|
345 |
|
|
346 |
// Refresh MIDI device options. |
// Refresh MIDI driver item devices. |
347 |
void qsamplerChannelForm::selectMidiDriver ( const QString& sMidiDriver ) |
void qsamplerChannelForm::selectMidiDriverItem ( const QString& sMidiDriver ) |
348 |
{ |
{ |
349 |
const QString sDriverName = sMidiDriver.upper(); |
const QString sDriverName = sMidiDriver.upper(); |
350 |
|
|
351 |
|
// Save current device id. |
352 |
|
int iDeviceID = -1; |
353 |
|
qsamplerDevice *pDevice = m_midiDevices.at(MidiDeviceComboBox->currentItem()); |
354 |
|
if (pDevice) |
355 |
|
iDeviceID = pDevice->deviceID(); |
356 |
|
|
357 |
|
// Clean maplist. |
358 |
MidiDeviceComboBox->clear(); |
MidiDeviceComboBox->clear(); |
359 |
m_audioDevices.clear(); |
m_midiDevices.clear(); |
360 |
|
|
361 |
|
// Populate with the current ones... |
362 |
const QPixmap& midiPixmap = QPixmap::fromMimeSource("midi2.png"); |
const QPixmap& midiPixmap = QPixmap::fromMimeSource("midi2.png"); |
363 |
int *piDeviceIDs = qsamplerDevice::getDevices(m_pChannel->client(), |
int *piDeviceIDs = qsamplerDevice::getDevices(m_pChannel->client(), |
364 |
qsamplerDevice::Midi); |
qsamplerDevice::Midi); |
365 |
for (int i = 0; piDeviceIDs && piDeviceIDs[i] >= 0; i++) { |
for (int i = 0; piDeviceIDs && piDeviceIDs[i] >= 0; i++) { |
366 |
qsamplerDevice *pDevice = new qsamplerDevice(m_pChannel->mainForm(), |
pDevice = new qsamplerDevice(m_pChannel->mainForm(), |
367 |
qsamplerDevice::Midi, piDeviceIDs[i]); |
qsamplerDevice::Midi, piDeviceIDs[i]); |
368 |
if (pDevice->driverName().upper() == sDriverName) { |
if (pDevice->driverName().upper() == sDriverName) { |
369 |
MidiDeviceComboBox->insertItem(midiPixmap, pDevice->deviceName()); |
MidiDeviceComboBox->insertItem(midiPixmap, pDevice->deviceName()); |
373 |
} |
} |
374 |
} |
} |
375 |
|
|
376 |
|
// Do proper enabling... |
377 |
bool bEnabled = !m_midiDevices.isEmpty(); |
bool bEnabled = !m_midiDevices.isEmpty(); |
378 |
if (!bEnabled) |
if (!bEnabled) |
379 |
MidiDeviceComboBox->insertItem(tr("(New MIDI device)")); |
MidiDeviceComboBox->insertItem(tr("(New MIDI device)")); |
380 |
|
else if (iDeviceID >= 0) { |
381 |
|
// Select the previous current device... |
382 |
|
int iMidiItem = 0; |
383 |
|
for (pDevice = m_midiDevices.first(); |
384 |
|
pDevice; |
385 |
|
pDevice = m_midiDevices.next()) { |
386 |
|
if (pDevice->deviceID() == iDeviceID) { |
387 |
|
MidiDeviceComboBox->setCurrentItem(iMidiItem); |
388 |
|
// selectMidiDeviceItem(iMidiItem); |
389 |
|
break; |
390 |
|
} |
391 |
|
iMidiItem++; |
392 |
|
} |
393 |
|
} |
394 |
MidiDeviceTextLabel->setEnabled(bEnabled); |
MidiDeviceTextLabel->setEnabled(bEnabled); |
395 |
MidiDeviceComboBox->setEnabled(bEnabled); |
MidiDeviceComboBox->setEnabled(bEnabled); |
396 |
MidiDevicePushButton->setEnabled(bEnabled); |
} |
397 |
|
|
398 |
|
|
399 |
|
// Refresh MIDI device options slot. |
400 |
|
void qsamplerChannelForm::selectMidiDriver ( const QString& sMidiDriver ) |
401 |
|
{ |
402 |
|
if (m_iDirtySetup > 0) |
403 |
|
return; |
404 |
|
|
405 |
|
selectMidiDriverItem(sMidiDriver); |
406 |
optionsChanged(); |
optionsChanged(); |
407 |
} |
} |
408 |
|
|
409 |
|
|
410 |
// Select MIDI device options. |
// Select MIDI device item. |
411 |
void qsamplerChannelForm::selectMidiDevice ( int iMidiItem ) |
void qsamplerChannelForm::selectMidiDeviceItem ( int iMidiItem ) |
412 |
{ |
{ |
413 |
qsamplerDevice *pDevice = m_midiDevices.at(iMidiItem); |
qsamplerDevice *pDevice = m_midiDevices.at(iMidiItem); |
414 |
if (pDevice) { |
if (pDevice) { |
419 |
if (iPorts > 0) |
if (iPorts > 0) |
420 |
MidiPortSpinBox->setMaxValue(iPorts - 1); |
MidiPortSpinBox->setMaxValue(iPorts - 1); |
421 |
} |
} |
422 |
|
} |
423 |
|
|
424 |
|
|
425 |
|
// Select MIDI device options slot. |
426 |
|
void qsamplerChannelForm::selectMidiDevice ( int iMidiItem ) |
427 |
|
{ |
428 |
|
if (m_iDirtySetup > 0) |
429 |
|
return; |
430 |
|
|
431 |
|
selectMidiDeviceItem(iMidiItem); |
432 |
optionsChanged(); |
optionsChanged(); |
433 |
} |
} |
434 |
|
|
440 |
} |
} |
441 |
|
|
442 |
|
|
443 |
// Refresh Audio device options. |
// Refresh Audio driver item devices. |
444 |
void qsamplerChannelForm::selectAudioDriver ( const QString& sAudioDriver ) |
void qsamplerChannelForm::selectAudioDriverItem ( const QString& sAudioDriver ) |
445 |
{ |
{ |
446 |
const QString sDriverName = sAudioDriver.upper(); |
const QString sDriverName = sAudioDriver.upper(); |
447 |
|
|
448 |
|
// Save current device id. |
449 |
|
int iDeviceID = -1; |
450 |
|
qsamplerDevice *pDevice = m_audioDevices.at(AudioDeviceComboBox->currentItem()); |
451 |
|
if (pDevice) |
452 |
|
iDeviceID = pDevice->deviceID(); |
453 |
|
|
454 |
|
// Clean maplist. |
455 |
AudioDeviceComboBox->clear(); |
AudioDeviceComboBox->clear(); |
456 |
m_audioDevices.clear(); |
m_audioDevices.clear(); |
457 |
|
|
458 |
|
// Populate with the current ones... |
459 |
const QPixmap& audioPixmap = QPixmap::fromMimeSource("audio2.png"); |
const QPixmap& audioPixmap = QPixmap::fromMimeSource("audio2.png"); |
460 |
int *piDeviceIDs = qsamplerDevice::getDevices(m_pChannel->client(), |
int *piDeviceIDs = qsamplerDevice::getDevices(m_pChannel->client(), |
461 |
qsamplerDevice::Audio); |
qsamplerDevice::Audio); |
462 |
for (int i = 0; piDeviceIDs && piDeviceIDs[i] >= 0; i++) { |
for (int i = 0; piDeviceIDs && piDeviceIDs[i] >= 0; i++) { |
463 |
qsamplerDevice *pDevice = new qsamplerDevice(m_pChannel->mainForm(), |
pDevice = new qsamplerDevice(m_pChannel->mainForm(), |
464 |
qsamplerDevice::Audio, piDeviceIDs[i]); |
qsamplerDevice::Audio, piDeviceIDs[i]); |
465 |
if (pDevice->driverName().upper() == sDriverName) { |
if (pDevice->driverName().upper() == sDriverName) { |
466 |
AudioDeviceComboBox->insertItem(audioPixmap, pDevice->deviceName()); |
AudioDeviceComboBox->insertItem(audioPixmap, pDevice->deviceName()); |
470 |
} |
} |
471 |
} |
} |
472 |
|
|
473 |
|
// Do proper enabling... |
474 |
bool bEnabled = !m_audioDevices.isEmpty(); |
bool bEnabled = !m_audioDevices.isEmpty(); |
475 |
if (!bEnabled) |
if (!bEnabled) |
476 |
AudioDeviceComboBox->insertItem(tr("(New Audio device)")); |
AudioDeviceComboBox->insertItem(tr("(New Audio device)")); |
477 |
|
else if (iDeviceID >= 0) { |
478 |
|
// Select the previous current device... |
479 |
|
int iAudioItem = 0; |
480 |
|
for (pDevice = m_audioDevices.first(); |
481 |
|
pDevice; |
482 |
|
pDevice = m_audioDevices.next()) { |
483 |
|
if (pDevice->deviceID() == iDeviceID) { |
484 |
|
AudioDeviceComboBox->setCurrentItem(iAudioItem); |
485 |
|
// selectAudioDeviceItem(iAudioItem); |
486 |
|
break; |
487 |
|
} |
488 |
|
iAudioItem++; |
489 |
|
} |
490 |
|
} |
491 |
AudioDeviceTextLabel->setEnabled(bEnabled); |
AudioDeviceTextLabel->setEnabled(bEnabled); |
492 |
AudioDeviceComboBox->setEnabled(bEnabled); |
AudioDeviceComboBox->setEnabled(bEnabled); |
493 |
AudioDevicePushButton->setEnabled(bEnabled); |
} |
494 |
|
|
495 |
|
|
496 |
|
// Refresh Audio device options slot. |
497 |
|
void qsamplerChannelForm::selectAudioDriver ( const QString& sAudioDriver ) |
498 |
|
{ |
499 |
|
if (m_iDirtySetup > 0) |
500 |
|
return; |
501 |
|
|
502 |
|
selectAudioDriverItem(sAudioDriver); |
503 |
optionsChanged(); |
optionsChanged(); |
504 |
} |
} |
505 |
|
|
506 |
|
|
507 |
// Select Audio device options. |
// Select Audio device item. |
508 |
void qsamplerChannelForm::selectAudioDevice ( int iAudioItem ) |
void qsamplerChannelForm::selectAudioDeviceItem ( int iAudioItem ) |
509 |
{ |
{ |
510 |
qsamplerDevice *pDevice = m_audioDevices.at(iAudioItem); |
qsamplerDevice *pDevice = m_audioDevices.at(iAudioItem); |
511 |
if (pDevice) { |
if (pDevice) { |
512 |
// Is there anything to do here? |
// Is there anything to do here? |
513 |
} |
} |
514 |
|
} |
515 |
|
|
516 |
|
|
517 |
|
// Select Audio device options slot. |
518 |
|
void qsamplerChannelForm::selectAudioDevice ( int iAudioItem ) |
519 |
|
{ |
520 |
|
if (m_iDirtySetup > 0) |
521 |
|
return; |
522 |
|
|
523 |
|
selectAudioDeviceItem(iAudioItem); |
524 |
optionsChanged(); |
optionsChanged(); |
525 |
} |
} |
526 |
|
|
532 |
} |
} |
533 |
|
|
534 |
|
|
535 |
|
// UPdate all device lists slot. |
536 |
|
void qsamplerChannelForm::updateDevices (void) |
537 |
|
{ |
538 |
|
if (m_iDirtySetup > 0) |
539 |
|
return; |
540 |
|
|
541 |
|
selectMidiDriverItem(MidiDriverComboBox->currentText()); |
542 |
|
selectAudioDriverItem(AudioDriverComboBox->currentText()); |
543 |
|
optionsChanged(); |
544 |
|
} |
545 |
|
|
546 |
|
|
547 |
// Dirty up settings. |
// Dirty up settings. |
548 |
void qsamplerChannelForm::optionsChanged (void) |
void qsamplerChannelForm::optionsChanged (void) |
549 |
{ |
{ |