fluidsynth: Import upstream release 2.3.4.
This commit is contained in:
parent
7914be3ca5
commit
839fb09bf0
3 changed files with 67 additions and 35 deletions
|
@ -31,10 +31,10 @@ extern "C" {
|
|||
*
|
||||
* @{
|
||||
*/
|
||||
#define FLUIDSYNTH_VERSION "2.3.3" /**< String constant of libfluidsynth version. */
|
||||
#define FLUIDSYNTH_VERSION "2.3.4" /**< String constant of libfluidsynth version. */
|
||||
#define FLUIDSYNTH_VERSION_MAJOR 2 /**< libfluidsynth major version integer constant. */
|
||||
#define FLUIDSYNTH_VERSION_MINOR 3 /**< libfluidsynth minor version integer constant. */
|
||||
#define FLUIDSYNTH_VERSION_MICRO 3 /**< libfluidsynth micro version integer constant. */
|
||||
#define FLUIDSYNTH_VERSION_MICRO 4 /**< libfluidsynth micro version integer constant. */
|
||||
|
||||
FLUIDSYNTH_API void fluid_version(int *major, int *minor, int *micro);
|
||||
FLUIDSYNTH_API char* fluid_version_str(void);
|
||||
|
|
|
@ -1641,6 +1641,23 @@ fluid_player_handle_reset_synth(void *data, const char *name, int value)
|
|||
player->reset_synth_between_songs = value;
|
||||
}
|
||||
|
||||
static int check_for_on_notes(fluid_synth_t *synth)
|
||||
{
|
||||
fluid_voice_t* v[1024];
|
||||
int i, res=FALSE;
|
||||
fluid_synth_get_voicelist(synth, v, FLUID_N_ELEMENTS(v), -1);
|
||||
for(i=0; i<FLUID_N_ELEMENTS(v) && v[i] != NULL; i++)
|
||||
{
|
||||
fluid_voice_t *vv = v[i];
|
||||
if(vv != NULL && fluid_voice_is_on(vv))
|
||||
{
|
||||
res = TRUE;
|
||||
FLUID_LOG(FLUID_DBG, "Voice is on! channel %d, key %d", fluid_voice_get_channel(vv), fluid_voice_get_key(vv));
|
||||
}
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new MIDI player.
|
||||
* @param synth Fluid synthesizer instance to create player for
|
||||
|
@ -2197,10 +2214,16 @@ fluid_player_callback(void *data, unsigned int msec)
|
|||
/* The first time we notice we've run out of MIDI events but there are still active voices, disable all hold pedals */
|
||||
if(!player->end_pedals_disabled)
|
||||
{
|
||||
if(check_for_on_notes(synth))
|
||||
{
|
||||
FLUID_LOG(FLUID_WARN, "End of the MIDI file reached, but not all notes have received a note off event! OFFing them now! Run with --verbose to spot pending voices.");
|
||||
}
|
||||
|
||||
for(i = 0; i < synth->midi_channels; i++)
|
||||
{
|
||||
fluid_synth_cc(player->synth, i, SUSTAIN_SWITCH, 0);
|
||||
fluid_synth_cc(player->synth, i, SOSTENUTO_SWITCH, 0);
|
||||
fluid_synth_cc(player->synth, i, ALL_NOTES_OFF, 0);
|
||||
}
|
||||
|
||||
player->end_pedals_disabled = 1;
|
||||
|
@ -2268,6 +2291,7 @@ fluid_player_play(fluid_player_t *player)
|
|||
if(!player->use_system_timer)
|
||||
{
|
||||
fluid_sample_timer_reset(player->synth, player->sample_timer);
|
||||
player->cur_msec = 0;
|
||||
}
|
||||
|
||||
/* If we're at the end of the playlist and there are no loops left, loop once */
|
||||
|
|
|
@ -1606,12 +1606,12 @@ fluid_server_socket_t *
|
|||
new_fluid_server_socket(int port, fluid_server_func_t func, void *data)
|
||||
{
|
||||
fluid_server_socket_t *server_socket;
|
||||
struct sockaddr_in addr4;
|
||||
#ifdef IPV6_SUPPORT
|
||||
struct sockaddr_in6 addr;
|
||||
#else
|
||||
struct sockaddr_in addr;
|
||||
struct sockaddr_in6 addr6;
|
||||
#endif
|
||||
|
||||
const struct sockaddr *addr;
|
||||
size_t addr_size;
|
||||
fluid_socket_t sock;
|
||||
|
||||
fluid_return_val_if_fail(func != NULL, NULL);
|
||||
|
@ -1621,38 +1621,46 @@ new_fluid_server_socket(int port, fluid_server_func_t func, void *data)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
FLUID_MEMSET(&addr4, 0, sizeof(addr4));
|
||||
addr4.sin_family = AF_INET;
|
||||
addr4.sin_port = htons((uint16_t)port);
|
||||
addr4.sin_addr.s_addr = htonl(INADDR_ANY);
|
||||
|
||||
#ifdef IPV6_SUPPORT
|
||||
sock = socket(AF_INET6, SOCK_STREAM, 0);
|
||||
|
||||
if(sock == INVALID_SOCKET)
|
||||
{
|
||||
FLUID_LOG(FLUID_ERR, "Failed to create server socket: %d", fluid_socket_get_error());
|
||||
fluid_socket_cleanup();
|
||||
return NULL;
|
||||
}
|
||||
|
||||
FLUID_MEMSET(&addr, 0, sizeof(addr));
|
||||
addr.sin6_family = AF_INET6;
|
||||
addr.sin6_port = htons((uint16_t)port);
|
||||
addr.sin6_addr = in6addr_any;
|
||||
#else
|
||||
|
||||
sock = socket(AF_INET, SOCK_STREAM, 0);
|
||||
|
||||
if(sock == INVALID_SOCKET)
|
||||
{
|
||||
FLUID_LOG(FLUID_ERR, "Failed to create server socket: %d", fluid_socket_get_error());
|
||||
fluid_socket_cleanup();
|
||||
return NULL;
|
||||
}
|
||||
|
||||
FLUID_MEMSET(&addr, 0, sizeof(addr));
|
||||
addr.sin_family = AF_INET;
|
||||
addr.sin_port = htons((uint16_t)port);
|
||||
addr.sin_addr.s_addr = htonl(INADDR_ANY);
|
||||
FLUID_MEMSET(&addr6, 0, sizeof(addr6));
|
||||
addr6.sin6_family = AF_INET6;
|
||||
addr6.sin6_port = htons((uint16_t)port);
|
||||
addr6.sin6_addr = in6addr_any;
|
||||
#endif
|
||||
|
||||
if(bind(sock, (const struct sockaddr *) &addr, sizeof(addr)) == SOCKET_ERROR)
|
||||
#ifdef IPV6_SUPPORT
|
||||
sock = socket(AF_INET6, SOCK_STREAM, 0);
|
||||
addr = (const struct sockaddr *) &addr6;
|
||||
addr_size = sizeof(addr6);
|
||||
|
||||
if(sock == INVALID_SOCKET)
|
||||
{
|
||||
FLUID_LOG(FLUID_WARN, "Failed to create IPv6 server socket: %d (will try with IPv4)", fluid_socket_get_error());
|
||||
|
||||
sock = socket(AF_INET, SOCK_STREAM, 0);
|
||||
addr = (const struct sockaddr *) &addr4;
|
||||
addr_size = sizeof(addr4);
|
||||
}
|
||||
|
||||
#else
|
||||
sock = socket(AF_INET, SOCK_STREAM, 0);
|
||||
addr = (const struct sockaddr *) &addr4;
|
||||
addr_size = sizeof(addr4);
|
||||
#endif
|
||||
|
||||
if(sock == INVALID_SOCKET)
|
||||
{
|
||||
FLUID_LOG(FLUID_ERR, "Failed to create server socket: %d", fluid_socket_get_error());
|
||||
fluid_socket_cleanup();
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if(bind(sock, addr, addr_size) == SOCKET_ERROR)
|
||||
{
|
||||
FLUID_LOG(FLUID_ERR, "Failed to bind server socket: %d", fluid_socket_get_error());
|
||||
fluid_socket_close(sock);
|
||||
|
|
Loading…
Add table
Reference in a new issue