Skip to content

Commit

Permalink
Use set volume for reporting
Browse files Browse the repository at this point in the history
  • Loading branch information
pschatzmann committed Oct 21, 2024
1 parent a12b2de commit 47ed8f8
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/AudioBoard.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,13 @@ class AudioBoard {
if (line == power_amp_line) setPAPower(!enable);
return driver->setMute(enable, line);
}
bool setVolume(int volume) { return driver->setVolume(volume); }
int getVolume() { return driver->getVolume(); }
bool setVolume(int volume) {
// when we get the volume we make sure that we report the same value
// w/o rounding issues
this->volume = volume;
return driver->setVolume(volume);
}
int getVolume() { return volume >= 0 ? volume : driver->getVolume(); }
DriverPins& getPins() { return *pins; }
bool setPAPower(bool enable) { return driver->setPAPower(enable); }
/// set volume for adc: this is only supported on some defined codecs
Expand All @@ -72,6 +77,7 @@ class AudioBoard {
CodecConfig codec_cfg;
AudioDriver* driver = nullptr;
int power_amp_line = ES8388_PA_LINE;
int volume = -1;
};

// -- Boards
Expand Down

0 comments on commit 47ed8f8

Please sign in to comment.