From 69c6db777f279503efc250448a957eafda8074cf Mon Sep 17 00:00:00 2001 From: Dennis Frett Date: Tue, 6 Sep 2022 19:01:38 +0200 Subject: [PATCH] Update MiniDSP example for input source retrieval. --- examples/MiniDSP/MiniDSP.ino | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/examples/MiniDSP/MiniDSP.ino b/examples/MiniDSP/MiniDSP.ino index 8048b25c..bb4d51be 100644 --- a/examples/MiniDSP/MiniDSP.ino +++ b/examples/MiniDSP/MiniDSP.ino @@ -25,6 +25,20 @@ void OnMutedChange(bool isMuted) { Serial.println("Muted status: " + String(isMuted ? "muted" : "unmuted")); } +void OnInputSourceChange(MiniDSP::InputSource inputSource) { + String inputSourceStr; + + if(inputSource == MiniDSP::InputSource::ANALOG) { + inputSourceStr = "Analog"; + } else if(inputSource == MiniDSP::InputSource::TOSLINK) { + inputSourceStr = "Toslink"; + } else if(inputSource == MiniDSP::InputSource::USB) { + inputSourceStr = "USB"; + } + + Serial.println("Input source: " + inputSourceStr); +} + void setup() { Serial.begin(115200); #if !defined(__MIPSEL__) @@ -40,6 +54,7 @@ void setup() { MiniDSP.attachOnInit(&OnMiniDSPConnected); MiniDSP.attachOnVolumeChange(&OnVolumeChange); MiniDSP.attachOnMutedChange(&OnMutedChange); + MiniDSP.attachOnInputSourceChange(&OnInputSourceChange); } void loop() {