mirror of
https://github.com/ZDoom/fluidsynth.git
synced 2025-04-15 20:30:49 +00:00
Regression fix for fluid_player_join()
df893bbfa4
caused to wait for the system timer thread to join for ever.
This commit is contained in:
parent
5351d9dcb9
commit
58022a11fa
1 changed files with 6 additions and 15 deletions
|
@ -2055,7 +2055,7 @@ fluid_player_callback(void *data, unsigned int msec)
|
|||
|
||||
loadnextfile = player->currentfile == NULL ? 1 : 0;
|
||||
|
||||
if(player->status == FLUID_PLAYER_READY)
|
||||
if(player->status == FLUID_PLAYER_DONE)
|
||||
{
|
||||
fluid_synth_all_notes_off(synth, -1);
|
||||
return 1;
|
||||
|
@ -2146,7 +2146,7 @@ fluid_player_play(fluid_player_t *player)
|
|||
int
|
||||
fluid_player_stop(fluid_player_t *player)
|
||||
{
|
||||
player->status = FLUID_PLAYER_READY;
|
||||
player->status = FLUID_PLAYER_DONE;
|
||||
fluid_player_seek(player, fluid_player_get_current_tick(player));
|
||||
return FLUID_OK;
|
||||
}
|
||||
|
@ -2233,26 +2233,17 @@ int fluid_player_set_bpm(fluid_player_t *player, int bpm)
|
|||
}
|
||||
|
||||
/**
|
||||
* Wait for a MIDI player to terminate (when done playing).
|
||||
* Wait for a MIDI player until the playback has been stopped.
|
||||
* @param player MIDI player instance
|
||||
* @return #FLUID_OK on success, #FLUID_FAILED otherwise
|
||||
* @return Always #FLUID_OK
|
||||
*/
|
||||
int
|
||||
fluid_player_join(fluid_player_t *player)
|
||||
{
|
||||
if(player->system_timer)
|
||||
while(player->status != FLUID_PLAYER_DONE)
|
||||
{
|
||||
return fluid_timer_join(player->system_timer);
|
||||
fluid_msleep(10);
|
||||
}
|
||||
else if(player->sample_timer)
|
||||
{
|
||||
/* Busy-wait loop, since there's no thread to wait for... */
|
||||
while(player->status == FLUID_PLAYER_PLAYING)
|
||||
{
|
||||
fluid_msleep(10);
|
||||
}
|
||||
}
|
||||
|
||||
return FLUID_OK;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue