mirror of
https://github.com/ZDoom/fluidsynth.git
synced 2025-01-19 07:50:49 +00:00
Introduce fluid_msleep function.
This commit is contained in:
parent
2d83700dc7
commit
f638fd90ba
3 changed files with 18 additions and 6 deletions
|
@ -1823,11 +1823,7 @@ fluid_player_join(fluid_player_t *player)
|
|||
} else if (player->sample_timer) {
|
||||
/* Busy-wait loop, since there's no thread to wait for... */
|
||||
while (player->status != FLUID_PLAYER_DONE) {
|
||||
#if defined(WIN32)
|
||||
Sleep(10);
|
||||
#else
|
||||
usleep(10000);
|
||||
#endif
|
||||
fluid_msleep(10);
|
||||
}
|
||||
}
|
||||
return FLUID_OK;
|
||||
|
|
|
@ -344,6 +344,19 @@ fluid_is_soundfont(const char *filename)
|
|||
return strncmp(id, "RIFF", 4) == 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Suspend the execution of the current thread for the specified amount of time.
|
||||
* @param milliseconds to wait.
|
||||
*/
|
||||
void fluid_msleep(unsigned int msecs)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
Sleep(msecs);
|
||||
#else
|
||||
g_usleep(msecs * 1000);
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
* Get time in milliseconds to be used in relative timing operations.
|
||||
* @return Unix time in milliseconds.
|
||||
|
@ -692,7 +705,7 @@ fluid_timer_run (void *data)
|
|||
two callbacks bringing in the "absolute" time (count *
|
||||
timer->msec) */
|
||||
delay = (count * timer->msec) - (fluid_curtime() - start);
|
||||
if (delay > 0) g_usleep (delay * 1000);
|
||||
if (delay > 0) fluid_msleep(delay);
|
||||
}
|
||||
|
||||
FLUID_LOG (FLUID_DBG, "Timer thread finished");
|
||||
|
|
|
@ -460,4 +460,7 @@ extern fluid_profile_data_t fluid_profile_data[];
|
|||
unsigned int fluid_check_fpe_i386(char * explanation_in_case_of_fpe);
|
||||
void fluid_clear_fpe_i386(void);
|
||||
|
||||
/* System control */
|
||||
void fluid_msleep(unsigned int msecs);
|
||||
|
||||
#endif /* _FLUID_SYS_H */
|
||||
|
|
Loading…
Reference in a new issue