small fixes

This commit is contained in:
Sandro Sobczyński
2020-11-10 20:31:15 +01:00
parent f3a1bcb47d
commit c6af82943a
2 changed files with 13 additions and 2 deletions
+5 -1
View File
@@ -127,7 +127,11 @@ private:
std::vector<AudioListenerRef> songListeners;
FILE *wav;
audsrv_fmt_t format;
char wavChunk[2048];
// we have some sema problems here (sound freezing)
// this probably should be changed to smth like this:
// this thread (A) : play next chunks
// other thread (B) : load chunks (fread()) for thread A
char wavChunk[2 * 1024] __attribute__((aligned(16)));
s32 chunkReadStatus;
u8 threadStack[8 * 1024] __attribute__((aligned(16)));
+8 -1
View File
@@ -66,6 +66,8 @@ void Audio::playSong()
{
if (!songLoaded)
PRINT_ERR("Cant play song because was not loaded!");
if (songFinished)
rewindSongToStart();
volume = realVolume;
songPlaying = true;
}
@@ -178,15 +180,20 @@ void Audio::threadLoop()
return;
if (songFinished)
{
printf("Audio: Song finished. ");
if (songInLoop)
{
printf("Audio: Song finished. Running again.\n");
printf("Running again.\n");
for (u32 i = 0; i < getSongListenersCount(); i++)
songListeners[i].listener->onAudioFinish();
rewindSongToStart();
}
else
{
printf("Stopping song.\n");
stopSong();
return;
}
}
if (chunkReadStatus > 0)