Update to fluidsynth-2.1

see https://github.com/FluidSynth/fluidsynth/releases/tag/v2.1.0

- new, less "ringing" reverb engine
- new, stereophonic chorus engine
- improved integrity checking of SoundFont modulators
...
This commit is contained in:
Robin Gareus 2019-12-02 23:58:15 +01:00
parent c5066dcf38
commit d425f6dcb5
No known key found for this signature in database
GPG key ID: A090BCE02CF57F04
23 changed files with 1329 additions and 619 deletions

View file

@ -192,6 +192,29 @@ fluid_log(int level, const char *fmt, ...)
return FLUID_FAILED;
}
void* fluid_alloc(size_t len)
{
void* ptr = malloc(len);
#if defined(DEBUG) && !defined(_MSC_VER)
// garbage initialize allocated memory for debug builds to ease reproducing
// bugs like 44453ff23281b3318abbe432fda90888c373022b .
//
// MSVC++ already garbage initializes allocated memory by itself (debug-heap).
//
// 0xCC because
// * it makes pointers reliably crash when dereferencing them,
// * floating points are still some valid but insanely huge negative number, and
// * if for whatever reason this allocated memory is executed, it'll trigger
// INT3 (...at least on x86)
if(ptr != NULL)
{
memset(ptr, 0xCC, len);
}
#endif
return ptr;
}
/**
* Convenience wrapper for free() that satisfies at least C90 requirements.
* Especially useful when using fluidsynth with programming languages that do not provide malloc() and free().
@ -291,22 +314,21 @@ void fluid_msleep(unsigned int msecs)
/**
* Get time in milliseconds to be used in relative timing operations.
* @return Unix time in milliseconds.
* @return Monotonic time in milliseconds.
*/
unsigned int fluid_curtime(void)
{
static glong initial_seconds = 0;
GTimeVal timeval;
float now;
static float initial_time = 0;
if(initial_seconds == 0)
if(initial_time == 0)
{
g_get_current_time(&timeval);
initial_seconds = timeval.tv_sec;
initial_time = (float)fluid_utime();
}
g_get_current_time(&timeval);
now = (float)fluid_utime();
return (unsigned int)((timeval.tv_sec - initial_seconds) * 1000.0 + timeval.tv_usec / 1000.0);
return (unsigned int)((now - initial_time) / 1000.0f);
}
/**
@ -1460,7 +1482,7 @@ static fluid_thread_return_t fluid_server_socket_run(void *data)
{
if(server_socket->cont)
{
FLUID_LOG(FLUID_ERR, "Failed to accept connection: %ld", fluid_socket_get_error());
FLUID_LOG(FLUID_ERR, "Failed to accept connection: %d", fluid_socket_get_error());
}
server_socket->cont = 0;
@ -1519,7 +1541,7 @@ new_fluid_server_socket(int port, fluid_server_func_t func, void *data)
if(sock == INVALID_SOCKET)
{
FLUID_LOG(FLUID_ERR, "Failed to create server socket: %ld", fluid_socket_get_error());
FLUID_LOG(FLUID_ERR, "Failed to create server socket: %d", fluid_socket_get_error());
fluid_socket_cleanup();
return NULL;
}
@ -1534,7 +1556,7 @@ new_fluid_server_socket(int port, fluid_server_func_t func, void *data)
if(sock == INVALID_SOCKET)
{
FLUID_LOG(FLUID_ERR, "Failed to create server socket: %ld", fluid_socket_get_error());
FLUID_LOG(FLUID_ERR, "Failed to create server socket: %d", fluid_socket_get_error());
fluid_socket_cleanup();
return NULL;
}
@ -1547,7 +1569,7 @@ new_fluid_server_socket(int port, fluid_server_func_t func, void *data)
if(bind(sock, (const struct sockaddr *) &addr, sizeof(addr)) == SOCKET_ERROR)
{
FLUID_LOG(FLUID_ERR, "Failed to bind server socket: %ld", fluid_socket_get_error());
FLUID_LOG(FLUID_ERR, "Failed to bind server socket: %d", fluid_socket_get_error());
fluid_socket_close(sock);
fluid_socket_cleanup();
return NULL;
@ -1555,7 +1577,7 @@ new_fluid_server_socket(int port, fluid_server_func_t func, void *data)
if(listen(sock, SOMAXCONN) == SOCKET_ERROR)
{
FLUID_LOG(FLUID_ERR, "Failed to listen on server socket: %ld", fluid_socket_get_error());
FLUID_LOG(FLUID_ERR, "Failed to listen on server socket: %d", fluid_socket_get_error());
fluid_socket_close(sock);
fluid_socket_cleanup();
return NULL;