mirror of
https://github.com/ZDoom/fluidsynth.git
synced 2024-12-03 09:32:02 +00:00
Only send all_notes_off when stopping player (#934)
This commit is contained in:
parent
e096919477
commit
be79856caa
2 changed files with 17 additions and 10 deletions
|
@ -1577,12 +1577,12 @@ fluid_track_send_events(fluid_track_t *track,
|
|||
return;
|
||||
}
|
||||
|
||||
/* printf("track=%02d\tticks=%05u\ttrack=%05u\tdtime=%05u\tnext=%05u\n", */
|
||||
/* track->num, */
|
||||
/* ticks, */
|
||||
/* track->ticks, */
|
||||
/* event->dtime, */
|
||||
/* track->ticks + event->dtime); */
|
||||
/* printf("track=%02d\tticks=%05u\ttrack=%05u\tdtime=%05u\tnext=%05u\n", */
|
||||
/* track->num, */
|
||||
/* ticks, */
|
||||
/* track->ticks, */
|
||||
/* event->dtime, */
|
||||
/* track->ticks + event->dtime); */
|
||||
|
||||
if(track->ticks + event->dtime > ticks)
|
||||
{
|
||||
|
@ -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;
|
||||
|
||||
|
@ -1786,9 +1787,9 @@ fluid_player_reset(fluid_player_t *player)
|
|||
}
|
||||
}
|
||||
|
||||
/* player->current_file = NULL; */
|
||||
/* player->status = FLUID_PLAYER_READY; */
|
||||
/* player->loop = 1; */
|
||||
/* player->current_file = NULL; */
|
||||
/* player->status = FLUID_PLAYER_READY; */
|
||||
/* player->loop = 1; */
|
||||
player->ntracks = 0;
|
||||
player->division = 0;
|
||||
player->miditempo = 500000;
|
||||
|
@ -2088,7 +2089,11 @@ fluid_player_callback(void *data, unsigned int msec)
|
|||
|
||||
if(fluid_player_get_status(player) != FLUID_PLAYER_PLAYING)
|
||||
{
|
||||
fluid_synth_all_notes_off(synth, -1);
|
||||
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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue