09-11-2025, 04:31 AM
I've roped a musician friend in to doing some tunes for me and I think I've found a bit of a bug - if I use VGM_PlayBGM_X_Times() then it seems to leave the player in an invalid state when it finishes - sometimes this will lead to the speaker just buzzing for a while - I think I've tracked it down to this snippet in VGM_SendData()
What I'm doing is, instead of playing a single tune in a loop, I play it once and then, when it's finished, starting a new one - sort of an adaptive music system.
I've added a function to expose the play_bgm variable (VGM_Is_Music_Playing()) and then when the loop is finished, I send the next snippet
I've changed this in my working version as follows:
But I think it might be clipping the music off when I do that? Does this make sense?
What I'm doing is, instead of playing a single tune in a loop, I play it once and then, when it's finished, starting a new one - sort of an adaptive music system.
I've added a function to expose the play_bgm variable (VGM_Is_Music_Playing()) and then when the loop is finished, I send the next snippet
Code:
if(bgm_end_reached){
vgm_readpos_start=bgm_loop_offset;
vgm_readpos_end=vgm_readpos_start;
bgm_end_reached=0;
if (bgm_limited_play){
if(bgm_play_count) bgm_play_count--;
if (!bgm_play_count) play_bgm=0;
}I've changed this in my working version as follows:
Code:
if(bgm_end_reached){
vgm_readpos_start=bgm_loop_offset;
vgm_readpos_end=vgm_readpos_start;
bgm_end_reached=0;
if (bgm_limited_play){
if(bgm_play_count) bgm_play_count--;
if (!bgm_play_count) VGM_StopBGM();
}But I think it might be clipping the music off when I do that? Does this make sense?

