[rtttl] Add get_gain() (#7647)

This commit is contained in:
Edward Firmo 2024-10-22 05:29:16 +02:00 committed by GitHub
parent 6330177d24
commit 2597975ae0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 5 additions and 1 deletions

View File

@ -26,7 +26,10 @@ inline double deg2rad(double degrees) {
return degrees * PI_ON_180;
}
void Rtttl::dump_config() { ESP_LOGCONFIG(TAG, "Rtttl"); }
void Rtttl::dump_config() {
ESP_LOGCONFIG(TAG, "Rtttl:");
ESP_LOGCONFIG(TAG, " Gain: %f", gain_);
}
void Rtttl::play(std::string rtttl) {
if (this->state_ != State::STATE_STOPPED && this->state_ != State::STATE_STOPPING) {

View File

@ -39,6 +39,7 @@ class Rtttl : public Component {
#ifdef USE_SPEAKER
void set_speaker(speaker::Speaker *speaker) { this->speaker_ = speaker; }
#endif
float get_gain() { return gain_; }
void set_gain(float gain) {
if (gain < 0.1f)
gain = 0.1f;