Create audio recording thread in the right place.

Was always creating, finding a timing issue when switching baseband modes, would freeze, probably due to a dangling pointer. TODO: Make stream recording setup synchronous.
This commit is contained in:
Jared Boone 2016-04-06 11:15:45 -07:00
parent 56e448d355
commit b3e2e89e51

View File

@ -135,8 +135,6 @@ AnalogAudioView::AnalogAudioView(
audio::output::start();
update_modulation(static_cast<ReceiverModel::Mode>(modulation));
audio_thread = std::make_unique<AudioThread>("audio.s16");
}
AnalogAudioView::~AnalogAudioView() {
@ -281,6 +279,7 @@ void AnalogAudioView::on_headphone_volume_changed(int32_t v) {
void AnalogAudioView::update_modulation(const ReceiverModel::Mode modulation) {
audio::output::mute();
audio_thread.reset();
const auto is_wideband_spectrum_mode = (modulation == ReceiverModel::Mode::SpectrumAnalysis);
receiver_model.set_baseband_configuration({
@ -292,6 +291,7 @@ void AnalogAudioView::update_modulation(const ReceiverModel::Mode modulation) {
receiver_model.enable();
if( !is_wideband_spectrum_mode ) {
audio_thread = std::make_unique<AudioThread>("audio.s16");
audio::output::unmute();
}
}