Add rewind for the XM music format
This commit is contained in:
parent
978f3a9570
commit
78817305c5
1 changed files with 15 additions and 1 deletions
16
src/raudio.c
16
src/raudio.c
|
@ -1314,6 +1314,20 @@ void ResumeMusicStream(Music music)
|
||||||
if (music != NULL) ResumeAudioStream(music->stream);
|
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)
|
// Stop music playing (close stream)
|
||||||
// TODO: To clear a buffer, make sure they have been already processed!
|
// TODO: To clear a buffer, make sure they have been already processed!
|
||||||
void StopMusicStream(Music music)
|
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;
|
case MUSIC_AUDIO_MP3: drmp3_seek_to_pcm_frame(&music->ctxMp3, 0); break;
|
||||||
#endif
|
#endif
|
||||||
#if defined(SUPPORT_FILEFORMAT_XM)
|
#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
|
#endif
|
||||||
#if defined(SUPPORT_FILEFORMAT_MOD)
|
#if defined(SUPPORT_FILEFORMAT_MOD)
|
||||||
case MUSIC_MODULE_MOD: jar_mod_seek_start(&music->ctxMod); break;
|
case MUSIC_MODULE_MOD: jar_mod_seek_start(&music->ctxMod); break;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue