small fixes
This commit is contained in:
@@ -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)));
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user