mirror of
https://github.com/eried/portapack-mayhem.git
synced 2025-06-30 09:37:53 -04:00
Add AudioVolumeField -- cleanup (#1107)
* WIP Adding AudioVolumeField * Fix build break * Add Bernd to about --------- Co-authored-by: kallanreed <kallanreed@outlook.com>
This commit is contained in:
parent
7e8a139732
commit
28319652c1
22 changed files with 91 additions and 186 deletions
|
@ -35,6 +35,7 @@ using namespace portapack;
|
|||
#include "dsp_fir_taps.hpp"
|
||||
#include "dsp_iir.hpp"
|
||||
#include "dsp_iir_config.hpp"
|
||||
#include "utility.hpp"
|
||||
|
||||
namespace {
|
||||
|
||||
|
@ -154,6 +155,17 @@ void ReceiverModel::set_headphone_volume(volume_t v) {
|
|||
update_headphone_volume();
|
||||
}
|
||||
|
||||
int32_t ReceiverModel::normalized_headphone_volume() const {
|
||||
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.
|
||||
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);
|
||||
}
|
||||
|
||||
uint8_t ReceiverModel::squelch_level() const {
|
||||
return squelch_level_;
|
||||
}
|
||||
|
@ -265,9 +277,6 @@ void ReceiverModel::update_sampling_rate() {
|
|||
}
|
||||
|
||||
void ReceiverModel::update_headphone_volume() {
|
||||
// TODO: Manipulating audio codec here, and in ui_receiver.cpp. Good to do
|
||||
// both?
|
||||
|
||||
audio::headphone::set_volume(headphone_volume_);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue