mirror of
https://github.com/ZDoom/fluidsynth.git
synced 2025-03-02 15:31:52 +00:00
Fix div by zero in fluid_player_set_tempo()
This commit is contained in:
parent
41f00ec8cb
commit
58ec0d8eb7
1 changed files with 10 additions and 0 deletions
|
@ -2336,6 +2336,12 @@ static void fluid_player_update_tempo(fluid_player_t *player)
|
||||||
int tempo; /* tempo in micro seconds by quarter note */
|
int tempo; /* tempo in micro seconds by quarter note */
|
||||||
float deltatime;
|
float deltatime;
|
||||||
|
|
||||||
|
/* do nothing if the division is still unknown to avoid a div by zero */
|
||||||
|
if(player->division == 0)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if(fluid_atomic_int_get(&player->sync_mode))
|
if(fluid_atomic_int_get(&player->sync_mode))
|
||||||
{
|
{
|
||||||
/* take internal tempo from MIDI file */
|
/* take internal tempo from MIDI file */
|
||||||
|
@ -2400,6 +2406,10 @@ static void fluid_player_update_tempo(fluid_player_t *player)
|
||||||
* #FLUID_PLAYER_TEMPO_INTERNAL will set the player to follow this internal
|
* #FLUID_PLAYER_TEMPO_INTERNAL will set the player to follow this internal
|
||||||
* tempo.
|
* tempo.
|
||||||
*
|
*
|
||||||
|
* @warning If the function is called when no MIDI file is loaded or currently playing, it
|
||||||
|
* would have caused a division by zero in fluidsynth 2.2.7 and earlier. Starting with 2.2.8, the
|
||||||
|
* new tempo change will be stashed and applied later.
|
||||||
|
*
|
||||||
* @return #FLUID_OK if success or #FLUID_FAILED otherwise (incorrect parameters).
|
* @return #FLUID_OK if success or #FLUID_FAILED otherwise (incorrect parameters).
|
||||||
* @since 2.2.0
|
* @since 2.2.0
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Reference in a new issue