mirror of
https://github.com/eried/portapack-mayhem.git
synced 2024-12-24 14:59:24 -05:00
ReceiverModel: Use Mode instead of integer.
This commit is contained in:
parent
371c6e0906
commit
f05d917a7c
@ -119,7 +119,7 @@ AnalogAudioView::AnalogAudioView(
|
||||
};
|
||||
|
||||
const auto modulation = receiver_model.modulation();
|
||||
options_modulation.set_by_value(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));
|
||||
};
|
||||
@ -286,7 +286,7 @@ void AnalogAudioView::update_modulation(const ReceiverModel::Mode modulation) {
|
||||
baseband::run_image(image_tag);
|
||||
|
||||
const auto is_wideband_spectrum_mode = (modulation == ReceiverModel::Mode::SpectrumAnalysis);
|
||||
receiver_model.set_modulation(toUType(modulation));
|
||||
receiver_model.set_modulation(modulation);
|
||||
receiver_model.set_sampling_rate(is_wideband_spectrum_mode ? 20000000 : 3072000);
|
||||
receiver_model.set_baseband_bandwidth(is_wideband_spectrum_mode ? 12000000 : 1750000);
|
||||
receiver_model.enable();
|
||||
|
@ -124,11 +124,11 @@ void ReceiverModel::set_sampling_rate(uint32_t v) {
|
||||
update_sampling_rate();
|
||||
}
|
||||
|
||||
uint32_t ReceiverModel::modulation() const {
|
||||
ReceiverModel::Mode ReceiverModel::modulation() const {
|
||||
return mode_;
|
||||
}
|
||||
|
||||
void ReceiverModel::set_modulation(const uint32_t v) {
|
||||
void ReceiverModel::set_modulation(const Mode v) {
|
||||
mode_ = v;
|
||||
update_modulation();
|
||||
}
|
||||
@ -171,7 +171,7 @@ void ReceiverModel::disable() {
|
||||
}
|
||||
|
||||
int32_t ReceiverModel::tuning_offset() {
|
||||
if( (modulation() == 4) ) {
|
||||
if( (modulation() == Mode::SpectrumAnalysis) ) {
|
||||
return 0;
|
||||
} else {
|
||||
return -(sampling_rate() / 4);
|
||||
@ -242,7 +242,7 @@ void ReceiverModel::update_headphone_volume() {
|
||||
}
|
||||
|
||||
void ReceiverModel::update_modulation() {
|
||||
switch(static_cast<Mode>(modulation())) {
|
||||
switch(modulation()) {
|
||||
default:
|
||||
case Mode::AMAudio:
|
||||
update_am_configuration();
|
||||
|
@ -64,8 +64,8 @@ public:
|
||||
uint32_t sampling_rate() const;
|
||||
void set_sampling_rate(uint32_t v);
|
||||
|
||||
uint32_t modulation() const;
|
||||
void set_modulation(uint32_t v);
|
||||
Mode modulation() const;
|
||||
void set_modulation(Mode v);
|
||||
|
||||
volume_t headphone_volume() const;
|
||||
void set_headphone_volume(volume_t v);
|
||||
@ -92,7 +92,7 @@ private:
|
||||
int32_t lna_gain_db_ { 32 };
|
||||
uint32_t baseband_bandwidth_ { max2837::filter::bandwidth_minimum };
|
||||
int32_t vga_gain_db_ { 32 };
|
||||
uint32_t mode_ { 1 };
|
||||
Mode mode_ { Mode::NarrowbandFMAudio };
|
||||
uint32_t sampling_rate_ { 3072000 };
|
||||
size_t decimation_factor_ { 1 };
|
||||
size_t am_config_index = 0;
|
||||
|
Loading…
Reference in New Issue
Block a user