void Configure::slotByteOrderChanged(int selection) { emit audioDeviceChanged(widget.audioDeviceComboBox->itemData(widget.audioDeviceComboBox->currentIndex()).value<QAudioDeviceInfo >(), widget.sampleRateComboBox->currentText().toInt(), widget.audioChannelsSpinBox->value(), widget.byteOrderComboBox->currentText()=="LittleEndian"?QAudioFormat::LittleEndian:QAudioFormat::BigEndian ); }
void SynthSettings::setAudioDevice(const QString &audioDevice) { if (m_audioDevice != audioDevice) { m_audioDevice = audioDevice; emit audioDeviceChanged(); } }
void OptionsDialog::on_comboBox_AudioDevice_activated( const QString deviceName ) { QByteArray charArray = deviceName.toLocal8Bit(); const String outputDeviceName = charArray.data(); // Get current audio settings AudioDeviceManager::AudioDeviceSetup config; m_deviceManager.getAudioDeviceSetup( config ); String error; // Update audio settings if ( outputDeviceName != config.outputDeviceName ) { tearDownMidiInputTestSynth(); if ( outputDeviceName != getNoDeviceString().toLocal8Bit().data() ) { config.outputDeviceName = outputDeviceName; } else { config.outputDeviceName = String::empty; } if ( ! isJackAudioEnabled() ) { config.useDefaultOutputChannels = true; } error = m_deviceManager.setAudioDeviceSetup( config, true ); const bool isJackMidiEnabled = outputDeviceName.startsWith( "JACK" ) && outputDeviceName.contains( "MIDI" ); // If necessary, disable ALSA MIDI inputs as they conflict with JACK MIDI inputs if ( isJackMidiEnabled ) { disableAlsaMidiInputs(); } // When a new audio device is selected the following widgets should be updated updateOutputChannelComboBox(); updateSampleRateComboBox(); updateBufferSizeComboBox(); updateMidiInputListWidget( isJackMidiEnabled ); if ( error.isEmpty() ) { if ( m_ui->checkBox_MidiInputTestTone->isChecked() ) { setUpMidiInputTestSynth(); } emit audioDeviceChanged(); } else { m_ui->checkBox_MidiInputTestTone->setChecked( false ); MessageBoxes::showWarningDialog( tr("Error when trying to open audio device!"), error.toRawUTF8() ); } } }
void OptionsDialog::on_comboBox_AudioBackend_activated( const int index ) { tearDownMidiInputTestSynth(); // Set audio backend AudioIODeviceType* const audioBackendType = m_deviceManager.getAvailableDeviceTypes()[ index ]; const String audioBackendName = audioBackendType->getTypeName(); String error = m_deviceManager.setCurrentAudioDeviceType( audioBackendName, true ); AudioDeviceManager::AudioDeviceSetup config; m_deviceManager.getAudioDeviceSetup( config ); if ( error.isEmpty() ) { // Set the default number of outputs config.outputChannels.clear(); config.outputChannels.setRange( 0, OutputChannels::MIN, true); config.useDefaultOutputChannels = false; error = m_deviceManager.setAudioDeviceSetup( config, true ); } const bool isJackMidiEnabled = config.outputDeviceName.startsWith( "JACK" ) && config.outputDeviceName.contains( "MIDI" ); // If necessary, disable ALSA MIDI inputs as they conflict with JACK MIDI inputs if ( isJackMidiEnabled ) { disableAlsaMidiInputs(); } // When a new audio backend is selected all widgets should be updated updateAudioDeviceComboBox(); updateOutputChannelComboBox(); updateSampleRateComboBox(); updateBufferSizeComboBox(); updateMidiInputListWidget( isJackMidiEnabled ); if ( isJackAudioEnabled() && isRealtimeModeEnabled() ) { m_ui->checkBox_JackSync->setEnabled( true ); } else { m_ui->checkBox_JackSync->setEnabled( false ); m_ui->checkBox_JackSync->setChecked( false ); } if ( isJackAudioEnabled() && error.isEmpty() ) { emit jackAudioEnabled( true ); } else { emit jackAudioEnabled( false ); } if ( error.isEmpty() ) { if ( m_ui->checkBox_MidiInputTestTone->isChecked() ) { setUpMidiInputTestSynth(); } emit audioDeviceChanged(); } else { m_ui->checkBox_MidiInputTestTone->setChecked( false ); MessageBoxes::showWarningDialog( tr("Error when trying to open audio device!"), error.toRawUTF8() ); } }