Skip to content

Commit 4b3fb69

Browse files
committed
use callback into the audio lib
* log info messages from the audio lib for debugging * use the EOF signal from the audio lib to advance to next file (instead of 2 second timeout) * change the two second timeout back to produce an error flash on the neopixel ring; also log this as an error
1 parent 98773fe commit 4b3fb69

File tree

5 files changed

+21
-1
lines changed

5 files changed

+21
-1
lines changed

src/AudioPlayer.cpp

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,20 @@ void Audio_TaskResume(void) {
9999
bool audio_active = true;
100100
}
101101

102+
void Audio_InfoCallback(Audio::msg_t m) {
103+
switch(m.e) {
104+
case Audio::evt_info:
105+
Log_Printf(LOGLEVEL_DEBUG, "Audio lib info event: %s", m.msg);
106+
break;
107+
case Audio::evt_eof:
108+
Log_Printf(LOGLEVEL_DEBUG, "Audio lib: finished playing file %s", m.msg);
109+
gPlayProperties.trackFinished = true;
110+
break;
111+
default:
112+
break;
113+
}
114+
}
115+
102116
void AudioPlayer_Init(void) {
103117
// create audio object
104118
#ifdef BOARD_HAS_PSRAM
@@ -210,6 +224,7 @@ void AudioPlayer_Init(void) {
210224
gPrefsSettings.getChar("gainHighPass", 0));
211225

212226
audio->setAudioTaskCore(1);
227+
audio->audio_info_callback = Audio_InfoCallback;
213228

214229
audio_active = true;
215230
}
@@ -927,7 +942,8 @@ void AudioPlayer_Loop() {
927942
// we check for timeout
928943
if (noAudio && timeout) {
929944
// Audio playback timed out, move on to the next
930-
// System_IndicateError();
945+
Log_Println(audioPlaybackTimeout, LOGLEVEL_ERROR);
946+
System_IndicateError();
931947
gPlayProperties.trackFinished = true;
932948
playbackTimeoutStart = millis();
933949
}

src/LogMessages_DE.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -236,4 +236,5 @@ const char wifiSetLastSSID[] = "Schreibe letzte erfolgreiche SSID in NVS für WL
236236
const char mDNSStarted[] = "mDNS gestartet: http://%s.local";
237237
const char mDNSFailed[] = "mDNS Start fehlgeschlagen, Hostname: %s";
238238
const char restartAfterOperationModeChange[] = "Operation Mode geändert. ESPuino wird neu gestartet...";
239+
const char audioPlaybackTimeout[] = "Zeitüberschreitung bei der Musikwiedergabe, springe zum nächstem Titel";
239240
#endif

src/LogMessages_EN.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -237,4 +237,5 @@ const char wifiSetLastSSID[] = "Write last successful SSID to NVS for WiFi fast-
237237
const char mDNSStarted[] = "mDNS started: http://%s.local";
238238
const char mDNSFailed[] = "mDNS failure, hostname: %s";
239239
const char restartAfterOperationModeChange[] = "Operation Mode changed. Restart ESPuino now...";
240+
const char audioPlaybackTimeout[] = "Playback timed out, advancing to the next track";
240241
#endif

src/LogMessages_FR.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -235,4 +235,5 @@ const char wifiSetLastSSID[] = "Écrire le dernier SSID réussi dans le NVS pour
235235
const char mDNSStarted[] = "mDNS démarré : http://%s.local";
236236
const char mDNSFailed[] = "Échec de mDNS, nom d'hôte : %s";
237237
const char restartAfterOperationModeChange[] = "Le mode de fonctionnement a changé. Redémarrez ESPuino maintenant...";
238+
const char audioPlaybackTimeout[] = "La lecture audio a expiré, passage à la piste suivante";
238239
#endif

src/logmessages.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -236,3 +236,4 @@ extern const char mDNSFailed[];
236236
extern const char restartAfterOperationModeChange[];
237237
extern const char jumpForwardsToFolder[];
238238
extern const char jumpBackwardsToFolder[];
239+
extern const char audioPlaybackTimeout[];

0 commit comments

Comments
 (0)