mirror of
https://github.com/raysan5/raylib.git
synced 2025-12-25 10:22:33 -05:00
Add rewind for the XM music format
This commit is contained in:
16
src/raudio.c
16
src/raudio.c
@ -1314,6 +1314,20 @@ void ResumeMusicStream(Music music)
|
||||
if (music != NULL) ResumeAudioStream(music->stream);
|
||||
}
|
||||
|
||||
void jar_xm_reset(jar_xm_context_t* ctx)
|
||||
{
|
||||
// I don't know what I am doing
|
||||
// this is probably very broken
|
||||
// but it kinda works
|
||||
for (uint16_t i = 0; i < jar_xm_get_number_of_channels(ctx); i++)
|
||||
{
|
||||
jar_xm_cut_note(&ctx->channels[i]);
|
||||
}
|
||||
ctx->current_row = 0;
|
||||
ctx->current_table_index = 1;
|
||||
ctx->current_tick = 0;
|
||||
}
|
||||
|
||||
// Stop music playing (close stream)
|
||||
// TODO: To clear a buffer, make sure they have been already processed!
|
||||
void StopMusicStream(Music music)
|
||||
@ -1335,7 +1349,7 @@ void StopMusicStream(Music music)
|
||||
case MUSIC_AUDIO_MP3: drmp3_seek_to_pcm_frame(&music->ctxMp3, 0); break;
|
||||
#endif
|
||||
#if defined(SUPPORT_FILEFORMAT_XM)
|
||||
case MUSIC_MODULE_XM: /* TODO: Restart XM context */ break;
|
||||
case MUSIC_MODULE_XM: jar_xm_reset(music->ctxXm); break;
|
||||
#endif
|
||||
#if defined(SUPPORT_FILEFORMAT_MOD)
|
||||
case MUSIC_MODULE_MOD: jar_mod_seek_start(&music->ctxMod); break;
|
||||
|
||||
Reference in New Issue
Block a user