Rewind playlist if calling fluid_player_play after all loops complete (#994)

This commit is contained in:
Bill Peterson 2021-10-30 08:01:58 -05:00 committed by GitHub
parent de05ef2a1c
commit a3dd7fddcb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -2200,6 +2200,9 @@ fluid_player_callback(void *data, unsigned int msec)
* Activates play mode for a MIDI player if not already playing.
* @param player MIDI player instance
* @return #FLUID_OK on success, #FLUID_FAILED otherwise
*
* If the list of files added to the player has completed its requested number of loops,
* the playlist will be restarted from the beginning with a loop count of 1.
*/
int
fluid_player_play(fluid_player_t *player)
@ -2215,10 +2218,17 @@ fluid_player_play(fluid_player_t *player)
fluid_sample_timer_reset(player->synth, player->sample_timer);
}
/* If we're at the end of the playlist and there are no loops left, loop once */
if(player->currentfile == NULL && player->loop == 0)
{
player->loop = 1;
}
fluid_atomic_int_set(&player->status, FLUID_PLAYER_PLAYING);
return FLUID_OK;
}
/**
* Pauses the MIDI playback.
*