clang-format
This commit is contained in:
@@ -249,8 +249,9 @@ int CmdDbIndex(int argc, char** argv) {
|
||||
return -1;
|
||||
}
|
||||
if (res->values().at(choice).track()) {
|
||||
AppConsole::sTrackQueue->IncludeLast(std::make_shared<playlist::IndexRecordSource>(
|
||||
AppConsole::sDatabase, res, 0, res, choice));
|
||||
AppConsole::sTrackQueue->IncludeLast(
|
||||
std::make_shared<playlist::IndexRecordSource>(AppConsole::sDatabase,
|
||||
res, 0, res, choice));
|
||||
}
|
||||
auto cont = res->values().at(choice).Expand(20);
|
||||
if (!cont) {
|
||||
|
||||
@@ -81,10 +81,8 @@ auto Timer::AddBytes(std::size_t bytes) -> void {
|
||||
total_duration_seconds_ = current_seconds_;
|
||||
}
|
||||
|
||||
PlaybackUpdate ev{
|
||||
.seconds_elapsed = current_seconds_,
|
||||
.seconds_total = total_duration_seconds_
|
||||
};
|
||||
PlaybackUpdate ev{.seconds_elapsed = current_seconds_,
|
||||
.seconds_total = total_duration_seconds_};
|
||||
events::Audio().Dispatch(ev);
|
||||
events::Ui().Dispatch(ev);
|
||||
}
|
||||
|
||||
@@ -48,7 +48,7 @@ I2SAudioOutput::I2SAudioOutput(drivers::IGpios* expander,
|
||||
current_config_(),
|
||||
left_difference_(0),
|
||||
current_volume_(kDefaultVolume),
|
||||
max_volume_(kLineLevelVolume){
|
||||
max_volume_(kLineLevelVolume) {
|
||||
SetVolume(GetVolume());
|
||||
dac_->SetSource(stream());
|
||||
}
|
||||
@@ -82,13 +82,13 @@ auto I2SAudioOutput::SetVolume(uint_fast8_t percent) -> void {
|
||||
|
||||
using drivers::wm8523::Register;
|
||||
drivers::wm8523::WriteRegister(Register::kDacGainLeft, left);
|
||||
drivers::wm8523::WriteRegister(Register::kDacGainRight, current_volume_ | 0x200);
|
||||
drivers::wm8523::WriteRegister(Register::kDacGainRight,
|
||||
current_volume_ | 0x200);
|
||||
}
|
||||
|
||||
auto I2SAudioOutput::GetVolume() -> uint_fast8_t {
|
||||
return
|
||||
static_cast<uint_fast8_t>(
|
||||
static_cast<float>(current_volume_) / max_volume_ * 100.0f);
|
||||
return static_cast<uint_fast8_t>(static_cast<float>(current_volume_) /
|
||||
max_volume_ * 100.0f);
|
||||
}
|
||||
|
||||
auto I2SAudioOutput::AdjustVolumeUp() -> bool {
|
||||
|
||||
@@ -28,10 +28,10 @@
|
||||
#include "hal/i2c_types.h"
|
||||
|
||||
#include "gpios.hpp"
|
||||
#include "wm8523.hpp"
|
||||
#include "hal/i2s_types.h"
|
||||
#include "i2c.hpp"
|
||||
#include "soc/clk_tree_defs.h"
|
||||
#include "wm8523.hpp"
|
||||
|
||||
namespace drivers {
|
||||
|
||||
@@ -106,7 +106,7 @@ auto I2SDac::Start() -> void {
|
||||
vTaskDelay(pdMS_TO_TICKS(1));
|
||||
wm8523::WriteRegister(wm8523::Register::kPsCtrl, 0b10);
|
||||
|
||||
uint8_t zeroes[256] {0};
|
||||
uint8_t zeroes[256]{0};
|
||||
size_t bytes_loaded = 0;
|
||||
esp_err_t res = ESP_OK;
|
||||
do {
|
||||
@@ -180,7 +180,8 @@ auto I2SDac::Reconfigure(Channels ch, BitsPerSample bps, SampleRate rate)
|
||||
// Set the correct word size, and set the input format to I2S-justified.
|
||||
wm8523::WriteRegister(wm8523::Register::kAifCtrl1, (word_length << 3) | 0b10);
|
||||
// Tell the DAC the clock ratio instead of waiting for it to auto detect.
|
||||
wm8523::WriteRegister(wm8523::Register::kAifCtrl2, bps == BPS_24 ? 0b100 : 0b011);
|
||||
wm8523::WriteRegister(wm8523::Register::kAifCtrl2,
|
||||
bps == BPS_24 ? 0b100 : 0b011);
|
||||
|
||||
if (i2s_active_) {
|
||||
i2s_channel_enable(i2s_handle_);
|
||||
|
||||
@@ -27,5 +27,5 @@ auto ReadRegister(Register reg) -> std::optional<uint16_t>;
|
||||
auto WriteRegister(Register reg, uint16_t data) -> bool;
|
||||
auto WriteRegister(Register reg, uint8_t msb, uint8_t lsb) -> bool;
|
||||
|
||||
}
|
||||
}
|
||||
} // namespace wm8523
|
||||
} // namespace drivers
|
||||
|
||||
@@ -47,5 +47,5 @@ auto WriteRegister(Register reg, uint8_t msb, uint8_t lsb) -> bool {
|
||||
return transaction.Execute() == ESP_OK;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
} // namespace wm8523
|
||||
} // namespace drivers
|
||||
|
||||
Reference in New Issue
Block a user