small fixes
This commit is contained in:
@@ -127,7 +127,11 @@ private:
|
|||||||
std::vector<AudioListenerRef> songListeners;
|
std::vector<AudioListenerRef> songListeners;
|
||||||
FILE *wav;
|
FILE *wav;
|
||||||
audsrv_fmt_t format;
|
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;
|
s32 chunkReadStatus;
|
||||||
|
|
||||||
u8 threadStack[8 * 1024] __attribute__((aligned(16)));
|
u8 threadStack[8 * 1024] __attribute__((aligned(16)));
|
||||||
|
|||||||
@@ -66,6 +66,8 @@ void Audio::playSong()
|
|||||||
{
|
{
|
||||||
if (!songLoaded)
|
if (!songLoaded)
|
||||||
PRINT_ERR("Cant play song because was not loaded!");
|
PRINT_ERR("Cant play song because was not loaded!");
|
||||||
|
if (songFinished)
|
||||||
|
rewindSongToStart();
|
||||||
volume = realVolume;
|
volume = realVolume;
|
||||||
songPlaying = true;
|
songPlaying = true;
|
||||||
}
|
}
|
||||||
@@ -178,15 +180,20 @@ void Audio::threadLoop()
|
|||||||
return;
|
return;
|
||||||
if (songFinished)
|
if (songFinished)
|
||||||
{
|
{
|
||||||
|
printf("Audio: Song finished. ");
|
||||||
if (songInLoop)
|
if (songInLoop)
|
||||||
{
|
{
|
||||||
printf("Audio: Song finished. Running again.\n");
|
printf("Running again.\n");
|
||||||
for (u32 i = 0; i < getSongListenersCount(); i++)
|
for (u32 i = 0; i < getSongListenersCount(); i++)
|
||||||
songListeners[i].listener->onAudioFinish();
|
songListeners[i].listener->onAudioFinish();
|
||||||
rewindSongToStart();
|
rewindSongToStart();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
|
printf("Stopping song.\n");
|
||||||
|
stopSong();
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (chunkReadStatus > 0)
|
if (chunkReadStatus > 0)
|
||||||
|
|||||||
Reference in New Issue
Block a user