copy audacious' math it looks good

custom
jacqueline 1 year ago
parent ade0094595
commit 166e8feb3c
  1. 5
      src/audio/bt_audio_output.cpp

@ -29,6 +29,8 @@
namespace audio { namespace audio {
static constexpr uint16_t kVolumeRange = 60;
BluetoothAudioOutput::BluetoothAudioOutput(StreamBufferHandle_t s, BluetoothAudioOutput::BluetoothAudioOutput(StreamBufferHandle_t s,
drivers::Bluetooth& bt, drivers::Bluetooth& bt,
tasks::WorkerPool& p) tasks::WorkerPool& p)
@ -51,7 +53,8 @@ auto BluetoothAudioOutput::SetVolumeImbalance(int_fast8_t balance) -> void {
auto BluetoothAudioOutput::SetVolume(uint16_t v) -> void { auto BluetoothAudioOutput::SetVolume(uint16_t v) -> void {
volume_ = std::clamp<uint16_t>(v, 0, 100); volume_ = std::clamp<uint16_t>(v, 0, 100);
bg_worker_.Dispatch<void>([&]() { bg_worker_.Dispatch<void>([&]() {
float factor = volume_ / 100.; float factor =
pow(10, static_cast<double>(kVolumeRange) * (volume_ - 100) / 100 / 20);
bluetooth_.SetVolumeFactor(factor); bluetooth_.SetVolumeFactor(factor);
}); });
} }

Loading…
Cancel
Save