Only send all_notes_off when stopping player (#934)

This commit is contained in:
Bill Peterson 2021-07-06 04:04:59 -05:00 committed by GitHub
parent e096919477
commit be79856caa
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 17 additions and 10 deletions

View file

@ -1651,6 +1651,7 @@ new_fluid_player(fluid_synth_t *synth)
}
fluid_atomic_int_set(&player->status, FLUID_PLAYER_READY);
fluid_atomic_int_set(&player->stopping, 0);
player->loop = 1;
player->ntracks = 0;
@ -2087,8 +2088,12 @@ fluid_player_callback(void *data, unsigned int msec)
loadnextfile = player->currentfile == NULL ? 1 : 0;
if(fluid_player_get_status(player) != FLUID_PLAYER_PLAYING)
{
if(fluid_atomic_int_get(&player->stopping))
{
fluid_synth_all_notes_off(synth, -1);
fluid_atomic_int_set(&player->stopping, 0);
}
return 1;
}
do
@ -2198,6 +2203,7 @@ int
fluid_player_stop(fluid_player_t *player)
{
fluid_atomic_int_set(&player->status, FLUID_PLAYER_DONE);
fluid_atomic_int_set(&player->stopping, 1);
fluid_player_seek(player, fluid_player_get_current_tick(player));
return FLUID_OK;
}

View file

@ -285,6 +285,7 @@ typedef struct
struct _fluid_player_t
{
fluid_atomic_int_t status;
fluid_atomic_int_t stopping; /* Flag for sending all_notes_off when player is stopped */
int ntracks;
fluid_track_t *track[MAX_NUMBER_OF_TRACKS];
fluid_synth_t *synth;