completed audio recording implementation
This commit is contained in:
@@ -26,8 +26,6 @@
|
||||
|
||||
#include "audio/audiomanager.h"
|
||||
#include "config/config.h"
|
||||
#include "dialog/export/exportaudiotab.h"
|
||||
#include "dialog/export/exportformatcombobox.h"
|
||||
|
||||
namespace olive {
|
||||
|
||||
@@ -99,14 +97,22 @@ PreferencesAudioTab::PreferencesAudioTab()
|
||||
|
||||
fmt_layout->addWidget(new QLabel(tr("Format:")));
|
||||
|
||||
ExportFormatComboBox *fmt_combo = new ExportFormatComboBox(ExportFormatComboBox::kShowAudioOnly);
|
||||
fmt_combo->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
|
||||
fmt_layout->addWidget(fmt_combo);
|
||||
record_format_combo_ = new ExportFormatComboBox(ExportFormatComboBox::kShowAudioOnly);
|
||||
record_format_combo_->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
|
||||
record_format_combo_->SetFormat(static_cast<ExportFormat::Format>(OLIVE_CONFIG("AudioRecordingFormat").toInt()));
|
||||
fmt_layout->addWidget(record_format_combo_);
|
||||
|
||||
ExportAudioTab *audio_recording_options = new ExportAudioTab();
|
||||
recording_layout->addWidget(audio_recording_options);
|
||||
record_options_ = new ExportAudioTab();
|
||||
record_options_->SetCodec(static_cast<ExportCodec::Codec>(OLIVE_CONFIG("AudioRecordingCodec").toInt()));
|
||||
record_options_->sample_rate_combobox()->SetSampleRate(OLIVE_CONFIG("AudioRecordingSampleRate").toInt());
|
||||
record_options_->channel_layout_combobox()->SetChannelLayout(OLIVE_CONFIG("AudioRecordingChannelLayout").toULongLong());
|
||||
record_options_->bit_rate_slider()->SetValue(OLIVE_CONFIG("AudioRecordingBitRate").toInt());
|
||||
record_options_->sample_format_combobox()->SetSampleFormat(static_cast<AudioParams::Format>(OLIVE_CONFIG("AudioRecordingSampleFormat").toInt()));
|
||||
recording_layout->addWidget(record_options_);
|
||||
|
||||
connect(fmt_combo, &ExportFormatComboBox::FormatChanged, audio_recording_options, &ExportAudioTab::SetFormat);
|
||||
connect(record_format_combo_, &ExportFormatComboBox::FormatChanged, record_options_, &ExportAudioTab::SetFormat);
|
||||
|
||||
record_options_->SetFormat(record_format_combo_->GetFormat());
|
||||
}
|
||||
|
||||
QHBoxLayout* refresh_layout = new QHBoxLayout();
|
||||
@@ -134,12 +140,19 @@ void PreferencesAudioTab::Accept(MultiUndoCommand *command)
|
||||
PaDeviceIndex input_device = audio_input_devices_->currentData().value<PaDeviceIndex>();
|
||||
|
||||
// Get device names, which seem to be the closest thing we have to a "unique identifier" for them
|
||||
Config::Current()[QStringLiteral("AudioOutput")] = audio_output_devices_->currentText();
|
||||
Config::Current()[QStringLiteral("AudioInput")] = audio_input_devices_->currentText();
|
||||
OLIVE_CONFIG("AudioOutput") = audio_output_devices_->currentText();
|
||||
OLIVE_CONFIG("AudioInput") = audio_input_devices_->currentText();
|
||||
|
||||
// Set devices to be used from now on
|
||||
AudioManager::instance()->SetOutputDevice(output_device);
|
||||
AudioManager::instance()->SetInputDevice(input_device);
|
||||
|
||||
OLIVE_CONFIG("AudioRecordingFormat") = record_format_combo_->GetFormat();
|
||||
OLIVE_CONFIG("AudioRecordingCodec") = record_options_->GetCodec();
|
||||
OLIVE_CONFIG("AudioRecordingSampleRate") = record_options_->sample_rate_combobox()->GetSampleRate();
|
||||
OLIVE_CONFIG("AudioRecordingChannelLayout") = QVariant::fromValue(record_options_->channel_layout_combobox()->GetChannelLayout());
|
||||
OLIVE_CONFIG("AudioRecordingBitRate") = QVariant::fromValue(record_options_->bit_rate_slider()->GetValue());
|
||||
OLIVE_CONFIG("AudioRecordingSampleFormat") = record_options_->sample_format_combobox()->GetSampleFormat();
|
||||
}
|
||||
|
||||
void PreferencesAudioTab::RefreshBackends()
|
||||
|
||||
Reference in New Issue
Block a user