diff --git a/jail_audio.cpp b/jail_audio.cpp index 9b6d9a1..f58f16d 100644 --- a/jail_audio.cpp +++ b/jail_audio.cpp @@ -144,6 +144,7 @@ JA_Music_t *JA_LoadMusic(Uint8* buffer, Uint32 length) free(music->output); music->output = (short*)cvt.buf; } + music->length = music->samples * chan * 2; music->pos = 0; music->state = JA_MUSIC_STOPPED; diff --git a/main.cpp b/main.cpp index abf71cd..1aaae5e 100644 --- a/main.cpp +++ b/main.cpp @@ -16,7 +16,7 @@ int main(int argc, char **argv) { JA_Sound_t *peiv = JA_LoadSound("menu_select.wav"); int channel = -1; - JA_PlayMusic(music, true); + JA_PlayMusic(music, -1); int volume = 128; bool should_exit = false; while(!should_exit) { @@ -42,6 +42,9 @@ int main(int argc, char **argv) { case SDL_SCANCODE_6: // Si pulsem la tecla '6' stopem definitivament el wav infinit JA_StopChannel(channel); break; + case SDL_SCANCODE_7: + JA_PlayMusic(music, 0); + break; case SDL_SCANCODE_0: // Si pulsem la tecla '1' pausem o despausem la música JA_FadeOutMusic(1000); break;