mirror of
https://github.com/eried/portapack-mayhem.git
synced 2025-06-29 17:17:28 -04:00
Persist audio (#1110)
* Add credits * Persist audio, add volume to apps * Remove comment * Hack around apparent alignment problem
This commit is contained in:
parent
9c39061590
commit
af448cf444
15 changed files with 46 additions and 49 deletions
|
@ -119,15 +119,6 @@ void ReceiverModel::set_vga(int32_t v_db) {
|
|||
update_vga();
|
||||
}
|
||||
|
||||
/*int32_t ReceiverModel::tx_gain() const {
|
||||
return tx_gain_db_;
|
||||
}
|
||||
|
||||
void ReceiverModel::set_tx_gain(int32_t v_db) {
|
||||
tx_gain_db_ = v_db;
|
||||
update_tx_gain();
|
||||
}*/
|
||||
|
||||
uint32_t ReceiverModel::sampling_rate() const {
|
||||
return sampling_rate_;
|
||||
}
|
||||
|
@ -147,20 +138,20 @@ void ReceiverModel::set_modulation(const Mode v) {
|
|||
}
|
||||
|
||||
volume_t ReceiverModel::headphone_volume() const {
|
||||
return headphone_volume_;
|
||||
return persistent_memory::headphone_volume();
|
||||
}
|
||||
|
||||
void ReceiverModel::set_headphone_volume(volume_t v) {
|
||||
headphone_volume_ = v;
|
||||
persistent_memory::set_headphone_volume(v);
|
||||
update_headphone_volume();
|
||||
}
|
||||
|
||||
int32_t ReceiverModel::normalized_headphone_volume() const {
|
||||
return (headphone_volume_ - audio::headphone::volume_range().max).decibel() + 99;
|
||||
return (headphone_volume() - audio::headphone::volume_range().max).decibel() + 99;
|
||||
}
|
||||
|
||||
void ReceiverModel::set_normalized_headphone_volume(int32_t v) {
|
||||
// TODO: Linear map instead to ensure 0 is minimal value.
|
||||
// TODO: Linear map instead to ensure 0 is minimal value or fix volume_range_t::normalize.
|
||||
v = clip<int32_t>(v, 0, 99);
|
||||
auto new_volume = volume_t::decibel(v - 99) + audio::headphone::volume_range().max;
|
||||
set_headphone_volume(new_volume);
|
||||
|
@ -183,13 +174,11 @@ void ReceiverModel::enable() {
|
|||
update_rf_amp();
|
||||
update_lna();
|
||||
update_vga();
|
||||
// update_tx_gain();
|
||||
update_baseband_bandwidth();
|
||||
update_sampling_rate();
|
||||
update_modulation();
|
||||
|
||||
// TODO: would challenge if this should belong to the
|
||||
// receiver_model namespace:
|
||||
// TODO: maybe not the perfect place for this, but it's reasonable.
|
||||
update_headphone_volume();
|
||||
|
||||
led_rx.on();
|
||||
|
@ -241,10 +230,6 @@ void ReceiverModel::update_vga() {
|
|||
radio::set_vga_gain(vga_gain_db_);
|
||||
}
|
||||
|
||||
/*void ReceiverModel::update_tx_gain() {
|
||||
radio::set_tx_gain(tx_gain_db_);
|
||||
}*/
|
||||
|
||||
void ReceiverModel::set_am_configuration(const size_t n) {
|
||||
if (n < am_configs.size()) {
|
||||
am_config_index = n;
|
||||
|
@ -277,7 +262,7 @@ void ReceiverModel::update_sampling_rate() {
|
|||
}
|
||||
|
||||
void ReceiverModel::update_headphone_volume() {
|
||||
audio::headphone::set_volume(headphone_volume_);
|
||||
audio::headphone::set_volume(headphone_volume());
|
||||
}
|
||||
|
||||
void ReceiverModel::update_modulation() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue