void AnalogAudioView::on_modulation_changed(const ReceiverModel::Mode modulation) { // TODO: Terrible kludge because widget system doesn't notify Waterfall that // it's being shown or hidden. waterfall.on_hide(); update_modulation(modulation); on_show_options_modulation(); waterfall.on_show(); }
AnalogAudioView::AnalogAudioView( NavigationView& nav ) { add_children({ { &rssi, &channel, &audio, &field_frequency, &field_lna, &field_vga, &options_modulation, &field_volume, &record_view, &waterfall, } }); field_frequency.set_value(receiver_model.tuning_frequency()); field_frequency.set_step(receiver_model.frequency_step()); field_frequency.on_change = [this](rf::Frequency f) { this->on_tuning_frequency_changed(f); }; field_frequency.on_edit = [this, &nav]() { // TODO: Provide separate modal method/scheme? auto new_view = nav.push<FrequencyKeypadView>(receiver_model.tuning_frequency()); new_view->on_changed = [this](rf::Frequency f) { this->on_tuning_frequency_changed(f); this->field_frequency.set_value(f); }; }; field_frequency.on_show_options = [this]() { this->on_show_options_frequency(); }; field_lna.on_show_options = [this]() { this->on_show_options_rf_gain(); }; field_vga.on_show_options = [this]() { this->on_show_options_rf_gain(); }; const auto modulation = receiver_model.modulation(); options_modulation.set_by_value(toUType(modulation)); options_modulation.on_change = [this](size_t, OptionsField::value_t v) { this->on_modulation_changed(static_cast<ReceiverModel::Mode>(v)); }; options_modulation.on_show_options = [this]() { this->on_show_options_modulation(); }; field_volume.set_value((receiver_model.headphone_volume() - audio::headphone::volume_range().max).decibel() + 99); field_volume.on_change = [this](int32_t v) { this->on_headphone_volume_changed(v); }; record_view.on_error = [&nav](std::string message) { nav.display_modal("Error", message); }; audio::output::start(); update_modulation(static_cast<ReceiverModel::Mode>(modulation)); }
void ReceiverModel::set_modulation(uint32_t v) { baseband_configuration.mode = v; update_modulation(); }