|
|
@ -9,6 +9,7 @@ |
|
|
|
#include <algorithm> |
|
|
|
#include <algorithm> |
|
|
|
#include <cstddef> |
|
|
|
#include <cstddef> |
|
|
|
#include <cstdint> |
|
|
|
#include <cstdint> |
|
|
|
|
|
|
|
#include <cmath> |
|
|
|
#include <memory> |
|
|
|
#include <memory> |
|
|
|
#include <variant> |
|
|
|
#include <variant> |
|
|
|
|
|
|
|
|
|
|
@ -58,19 +59,22 @@ auto BluetoothAudioOutput::GetVolumePct() -> uint_fast8_t { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
auto BluetoothAudioOutput::SetVolumePct(uint_fast8_t val) -> bool { |
|
|
|
auto BluetoothAudioOutput::SetVolumePct(uint_fast8_t val) -> bool { |
|
|
|
// TODO
|
|
|
|
if (val < 100) { |
|
|
|
ESP_LOGE(kTag, "Not implemented"); |
|
|
|
|
|
|
|
return false; |
|
|
|
return false; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
SetVolume(val / 100 * 0x7f); |
|
|
|
|
|
|
|
return true; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
auto BluetoothAudioOutput::GetVolumeDb() -> int_fast16_t { |
|
|
|
auto BluetoothAudioOutput::GetVolumeDb() -> int_fast16_t { |
|
|
|
return 0; |
|
|
|
return log(GetVolumePct()/100) * 20; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
auto BluetoothAudioOutput::SetVolumeDb(int_fast16_t) -> bool { |
|
|
|
auto BluetoothAudioOutput::SetVolumeDb(int_fast16_t val) -> bool { |
|
|
|
// TODO
|
|
|
|
auto pct = pow(2, val / 20.0) * 100; |
|
|
|
ESP_LOGE(kTag, "Not implemented"); |
|
|
|
ESP_LOGI("Audio", "Bluetooth audio pct: %d", (int)pct); |
|
|
|
return false; |
|
|
|
SetVolumePct(pct); |
|
|
|
|
|
|
|
return true; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
auto BluetoothAudioOutput::AdjustVolumeUp() -> bool { |
|
|
|
auto BluetoothAudioOutput::AdjustVolumeUp() -> bool { |
|
|
|