mirror of
https://github.com/portapack-mayhem/mayhem-firmware.git
synced 2026-09-13 18:19:33 +00:00
Add retry mechanism for volume write (#3121)
This commit is contained in:
@@ -306,21 +306,22 @@ class WM8731 : public audio::Codec {
|
||||
});
|
||||
}
|
||||
|
||||
void set_wm_headphone_volume(const volume_t volume) {
|
||||
bool set_wm_headphone_volume(const volume_t volume) {
|
||||
const auto normalized = headphone_gain_range().normalize(volume);
|
||||
auto n = normalized.centibel() / 10;
|
||||
|
||||
write(LeftHeadphoneOut{
|
||||
bool tag = write(LeftHeadphoneOut{
|
||||
.lhpvol = static_cast<reg_t>(n),
|
||||
.lzcen = 0,
|
||||
.lrhpboth = 1,
|
||||
.reserved0 = 0,
|
||||
});
|
||||
return tag;
|
||||
}
|
||||
|
||||
void set_headphone_volume(const volume_t volume) override {
|
||||
bool set_headphone_volume(const volume_t volume) override {
|
||||
headphone_volume = volume;
|
||||
set_wm_headphone_volume(volume);
|
||||
return set_wm_headphone_volume(volume);
|
||||
}
|
||||
|
||||
volume_range_t headphone_gain_range() const override {
|
||||
@@ -422,8 +423,8 @@ class WM8731 : public audio::Codec {
|
||||
|
||||
void write(const LeftLineIn value);
|
||||
void write(const RightLineIn value);
|
||||
void write(const LeftHeadphoneOut value);
|
||||
void write(const RightHeadphoneOut value);
|
||||
bool write(const LeftHeadphoneOut value);
|
||||
bool write(const RightHeadphoneOut value);
|
||||
void write(const AnalogAudioPathControl value);
|
||||
void write(const DigitalAudioPathControl value);
|
||||
void write(const PowerDownControl value);
|
||||
|
||||
Reference in New Issue
Block a user