update game

This commit is contained in:
2021-12-11 20:21:44 +01:00
parent 16410f5d6a
commit 59c60b765e
6 changed files with 80 additions and 34 deletions

View File

@@ -9,7 +9,7 @@ uint8_t audio_current_Song = 0;
const char* nextAudioFile = "";
uint8_t n = 0;
bool audio_start = false;
bool audioState = false;
bool audioInitOk = false;
@@ -57,6 +57,9 @@ void playSong(String filename)
id3->RegisterMetadataCB(MDCallback, (void *)"ID3TAG");
mp3->begin(id3, out);
}
else{
log_e("no filenae specified");
}
}
@@ -76,35 +79,33 @@ void initAudio()
//playSong(audio_current_Song);
}
void setAudioState(bool state)
{
audioState = state;
}
bool getAudioState(void)
{
return audioState;
}
bool getAudioInitStatus(void)
{
return audioInitOk;
}
void setAudioFileName(String filename)
{
nextAudioFile = filename;
}
void handleAudio()
{
if (hallIsIdle())
if (!audioState)
{
if (mp3->isRunning())
{
log_w("Audio: stop playback");
mp3->stop();
audio_start = false;
}
}
else
{
if(!audio_start)
{
playSong(audio_current_Song);
audio_start = true;
}
if (mp3->isRunning())
{
if (!mp3->loop())