From 899d367d45194430eb498325a1efecaa4d409de5 Mon Sep 17 00:00:00 2001 From: pschatzmann Date: Fri, 4 Oct 2024 11:23:19 +0200 Subject: [PATCH] AudioBoardStream: volume inc value --- library.properties | 2 +- src/AudioLibs/AudioBoardStream.h | 15 +++++++++++++-- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/library.properties b/library.properties index c6d5d12d6..ce23b7548 100644 --- a/library.properties +++ b/library.properties @@ -1,5 +1,5 @@ name=audio-tools -version=0.9.8 +version=0.9.9 author=Phil Schatzmann maintainer=Phil Schatzmann sentence=Some useful audio processing classes diff --git a/src/AudioLibs/AudioBoardStream.h b/src/AudioLibs/AudioBoardStream.h index 6ca0916ac..9d2c373a6 100644 --- a/src/AudioLibs/AudioBoardStream.h +++ b/src/AudioLibs/AudioBoardStream.h @@ -100,7 +100,7 @@ class AudioBoardStream : public I2SCodecStream { */ static void actionVolumeUp(bool, int, void *) { TRACEI(); - selfAudioBoard->incrementVolume(+0.02); + selfAudioBoard->incrementVolume(+selfAudioBoard->actionVolumeIncrementValue()); } /** @@ -109,9 +109,10 @@ class AudioBoardStream : public I2SCodecStream { */ static void actionVolumeDown(bool, int, void *) { TRACEI(); - selfAudioBoard->incrementVolume(-0.02); + selfAudioBoard->incrementVolume(-selfAudioBoard->actionVolumeIncrementValue()); } + /** * @brief Toggle start stop * @@ -323,10 +324,20 @@ class AudioBoardStream : public I2SCodecStream { addVolumeActions(); } + /// Defines the increment value used by actionVolumeDown/actionVolumeUp + void setActionVolumeIncrementValue(float value){ + action_increment_value = value; + } + + float actionVolumeIncrementValue() { + return action_increment_value; + } + protected: AudioActions actions; bool headphoneIsConnected = false; bool active = true; + float action_increment_value = 0.02; int getSdCsPin() { static GpioPin sd_cs = -2;