Merge branch 'master' into ladspa

Resolve conflicts in:
	src/bindings/fluid_ladspa.c
This commit is contained in:
Marcus Weseloh 2017-11-10 19:36:30 +01:00
commit 007cd2b5fc
50 changed files with 331 additions and 438 deletions

View file

@ -85,6 +85,7 @@ Changes in FluidSynth 2.0.0 concerning developers:
- remove struct _fluid_gen_t, fluid_gen_set_default_values() and enum fluid_gen_flags from public API
- all public \c fluid_settings_* functions that return an integer which is not meant to be interpreted as bool consistently return either FLUID_OK or FLUID_FAILED
- all public delete_* functions return void and are safe when called with NULL
- the shell command handler was decoupled internally, as a consequence the param list of new_fluid_server() and new_fluid_cmd_handler() was adapted
- add "synth.volenv" a setting for volume envelope processing

View file

@ -31,7 +31,7 @@ extern "C" {
*/
FLUIDSYNTH_API fluid_midi_event_t* new_fluid_midi_event(void);
FLUIDSYNTH_API int delete_fluid_midi_event(fluid_midi_event_t* event);
FLUIDSYNTH_API void delete_fluid_midi_event(fluid_midi_event_t* event);
FLUIDSYNTH_API int fluid_midi_event_set_type(fluid_midi_event_t* evt, int type);
FLUIDSYNTH_API int fluid_midi_event_get_type(fluid_midi_event_t* evt);
@ -84,7 +84,7 @@ typedef int (*handle_midi_event_func_t)(void* data, fluid_midi_event_t* event);
FLUIDSYNTH_API fluid_midi_router_t* new_fluid_midi_router(fluid_settings_t* settings,
handle_midi_event_func_t handler,
void* event_handler_data);
FLUIDSYNTH_API int delete_fluid_midi_router(fluid_midi_router_t* handler);
FLUIDSYNTH_API void delete_fluid_midi_router(fluid_midi_router_t* handler);
FLUIDSYNTH_API int fluid_midi_router_set_default_rules (fluid_midi_router_t *router);
FLUIDSYNTH_API int fluid_midi_router_clear_rules (fluid_midi_router_t *router);
FLUIDSYNTH_API int fluid_midi_router_add_rule (fluid_midi_router_t *router,
@ -122,7 +122,7 @@ enum fluid_player_status
};
FLUIDSYNTH_API fluid_player_t* new_fluid_player(fluid_synth_t* synth);
FLUIDSYNTH_API int delete_fluid_player(fluid_player_t* player);
FLUIDSYNTH_API void delete_fluid_player(fluid_player_t* player);
FLUIDSYNTH_API int fluid_player_add(fluid_player_t* player, const char *midifile);
FLUIDSYNTH_API int fluid_player_add_mem(fluid_player_t* player, const void *buffer, size_t len);
FLUIDSYNTH_API int fluid_player_play(fluid_player_t* player);

View file

@ -76,18 +76,18 @@ FLUIDSYNTH_API void fluid_mod_set_source2(fluid_mod_t* mod, int src, int flags);
FLUIDSYNTH_API void fluid_mod_set_dest(fluid_mod_t* mod, int dst);
FLUIDSYNTH_API void fluid_mod_set_amount(fluid_mod_t* mod, double amount);
FLUIDSYNTH_API int fluid_mod_get_source1(fluid_mod_t* mod);
FLUIDSYNTH_API int fluid_mod_get_flags1(fluid_mod_t* mod);
FLUIDSYNTH_API int fluid_mod_get_source2(fluid_mod_t* mod);
FLUIDSYNTH_API int fluid_mod_get_flags2(fluid_mod_t* mod);
FLUIDSYNTH_API int fluid_mod_get_dest(fluid_mod_t* mod);
FLUIDSYNTH_API double fluid_mod_get_amount(fluid_mod_t* mod);
FLUIDSYNTH_API int fluid_mod_get_source1(const fluid_mod_t* mod);
FLUIDSYNTH_API int fluid_mod_get_flags1(const fluid_mod_t* mod);
FLUIDSYNTH_API int fluid_mod_get_source2(const fluid_mod_t* mod);
FLUIDSYNTH_API int fluid_mod_get_flags2(const fluid_mod_t* mod);
FLUIDSYNTH_API int fluid_mod_get_dest(const fluid_mod_t* mod);
FLUIDSYNTH_API double fluid_mod_get_amount(const fluid_mod_t* mod);
FLUIDSYNTH_API int fluid_mod_test_identity(fluid_mod_t * mod1, fluid_mod_t * mod2);
FLUIDSYNTH_API int fluid_mod_has_source(fluid_mod_t * mod, int cc, int ctrl);
FLUIDSYNTH_API int fluid_mod_has_dest(fluid_mod_t * mod, int gen);
FLUIDSYNTH_API int fluid_mod_test_identity(const fluid_mod_t * mod1, const fluid_mod_t * mod2);
FLUIDSYNTH_API int fluid_mod_has_source(const fluid_mod_t * mod, int cc, int ctrl);
FLUIDSYNTH_API int fluid_mod_has_dest(const fluid_mod_t * mod, int gen);
FLUIDSYNTH_API void fluid_mod_clone(fluid_mod_t* mod, fluid_mod_t* src);
FLUIDSYNTH_API void fluid_mod_clone(fluid_mod_t* mod, const fluid_mod_t* src);
#ifdef __cplusplus
}

View file

@ -58,7 +58,7 @@ int fluid_ramsfont_izone_set_loop(fluid_ramsfont_t* sfont,
int on, float loopstart, float loopend);
FLUIDSYNTH_API fluid_sample_t* new_fluid_ramsample(void);
FLUIDSYNTH_API int delete_fluid_ramsample(fluid_sample_t* sample);
FLUIDSYNTH_API void delete_fluid_ramsample(fluid_sample_t* sample);
FLUIDSYNTH_API int fluid_sample_set_name(fluid_sample_t* sample, const char *name);
FLUIDSYNTH_API
int fluid_sample_set_sound_data(fluid_sample_t* sample, short *data,

View file

@ -63,7 +63,7 @@ struct _fluid_synth_channel_info_t
};
FLUIDSYNTH_API fluid_synth_t* new_fluid_synth(fluid_settings_t* settings);
FLUIDSYNTH_API int delete_fluid_synth(fluid_synth_t* synth);
FLUIDSYNTH_API void delete_fluid_synth(fluid_synth_t* synth);
FLUIDSYNTH_API fluid_settings_t* fluid_synth_get_settings(fluid_synth_t* synth);
@ -295,6 +295,7 @@ enum fluid_synth_add_mod {
};
FLUIDSYNTH_API int fluid_synth_add_default_mod(fluid_synth_t* synth, fluid_mod_t* mod, int mode);
FLUIDSYNTH_API int fluid_synth_remove_default_mod(fluid_synth_t* synth, const fluid_mod_t* mod);
/*

View file

@ -298,6 +298,8 @@ fluid_shell_init(fluid_shell_t* shell,
void
delete_fluid_shell(fluid_shell_t* shell)
{
fluid_return_if_fail(shell != NULL);
if (shell->thread != NULL) {
delete_fluid_thread(shell->thread);
}
@ -2244,16 +2246,11 @@ fluid_cmd_t* fluid_cmd_copy(fluid_cmd_t* cmd)
void delete_fluid_cmd(fluid_cmd_t* cmd)
{
if (cmd->name) {
fluid_return_if_fail(cmd != NULL);
FLUID_FREE(cmd->name);
}
if (cmd->topic) {
FLUID_FREE(cmd->topic);
}
if (cmd->help) {
FLUID_FREE(cmd->help);
}
FLUID_FREE(cmd);
FLUID_FREE(cmd);
}
/*
@ -2316,6 +2313,8 @@ fluid_cmd_handler_t* new_fluid_cmd_handler(fluid_synth_t* synth, fluid_midi_rout
void
delete_fluid_cmd_handler(fluid_cmd_handler_t* handler)
{
fluid_return_if_fail(handler != NULL);
delete_fluid_hashtable(handler->commands);
FLUID_FREE(handler);
}
@ -2426,9 +2425,7 @@ new_fluid_server(fluid_settings_t* settings,
void
delete_fluid_server(fluid_server_t* server)
{
if (server == NULL) {
return;
}
fluid_return_if_fail(server != NULL);
fluid_server_close(server);
@ -2441,9 +2438,7 @@ static void fluid_server_close(fluid_server_t* server)
fluid_list_t* clients;
fluid_client_t* client;
if (server == NULL) {
return;
}
fluid_return_if_fail(server != NULL);
fluid_mutex_lock(server->mutex);
clients = server->clients;
@ -2565,10 +2560,8 @@ error_recovery:
void fluid_client_quit(fluid_client_t* client)
{
if (client->socket != INVALID_SOCKET) {
fluid_socket_close(client->socket);
client->socket = INVALID_SOCKET;
}
FLUID_LOG(FLUID_DBG, "fluid_client_quit: joining");
fluid_thread_join(client->thread);
FLUID_LOG(FLUID_DBG, "fluid_client_quit: done");
@ -2576,20 +2569,12 @@ void fluid_client_quit(fluid_client_t* client)
void delete_fluid_client(fluid_client_t* client)
{
if(client->handler != NULL)
{
fluid_return_if_fail(client != NULL);
delete_fluid_cmd_handler(client->handler);
client->handler = NULL;
}
if (client->socket != INVALID_SOCKET) {
fluid_socket_close(client->socket);
client->socket = INVALID_SOCKET;
}
if (client->thread != NULL) {
delete_fluid_thread(client->thread);
client->thread = NULL;
}
FLUID_FREE(client);
}

View file

@ -326,9 +326,7 @@ fluid_file_set_encoding_quality(fluid_file_renderer_t* r, double q)
*/
void delete_fluid_file_renderer(fluid_file_renderer_t* dev)
{
if (dev == NULL) {
return;
}
fluid_return_if_fail(dev != NULL);
#if LIBSNDFILE_SUPPORT
if (dev->sndfile != NULL) {
@ -342,12 +340,8 @@ void delete_fluid_file_renderer(fluid_file_renderer_t* dev)
}
#endif
if (dev->buf != NULL) {
FLUID_FREE(dev->buf);
}
FLUID_FREE(dev->buf);
FLUID_FREE(dev);
return;
}
/**

View file

@ -219,17 +219,19 @@ fluid_ladspa_fx_t *new_fluid_ladspa_fx(fluid_real_t sample_rate, int buffer_size
fx->run_finished_mutex = new_fluid_cond_mutex();
if (fx->run_finished_mutex == NULL)
{
delete_fluid_ladspa_fx(fx);
return NULL;
goto error_recovery;
}
fx->run_finished_cond = new_fluid_cond();
if (fx->run_finished_cond == NULL)
{
delete_fluid_ladspa_fx(fx);
return NULL;
goto error_recovery;
}
return fx;
error_recovery:
delete_fluid_ladspa_fx(fx);
return NULL;
}
/**
@ -246,6 +248,7 @@ fluid_ladspa_fx_t *new_fluid_ladspa_fx(fluid_real_t sample_rate, int buffer_size
void delete_fluid_ladspa_fx(fluid_ladspa_fx_t *fx)
{
int i;
fluid_return_if_fail (fx != NULL);
clear_ladspa(fx);
@ -1209,26 +1212,16 @@ new_fluid_ladspa_effect(fluid_ladspa_fx_t *fx, const fluid_ladspa_lib_t *lib, co
static void delete_fluid_ladspa_effect(fluid_ladspa_effect_t *effect)
{
if (effect == NULL)
{
return;
}
fluid_return_if_fail (effect != NULL);
if (effect->port_nodes != NULL)
{
FLUID_FREE(effect->port_nodes);
}
FLUID_FREE(effect->port_nodes);
if (effect->handle != NULL && effect->desc != NULL && effect->desc->cleanup != NULL)
{
effect->desc->cleanup(effect->handle);
}
if (effect->name != NULL)
{
FLUID_FREE(effect->name);
}
FLUID_FREE(effect->name);
FLUID_FREE(effect);
}
@ -1319,6 +1312,8 @@ static fluid_ladspa_node_t *new_fluid_ladspa_node(fluid_ladspa_fx_t *fx, const c
static void delete_fluid_ladspa_node(fluid_ladspa_node_t *node)
{
fluid_return_if_fail(node != NULL);
/* If effect_buffer the same as host_buffer, then the effect_buffer has been
* provided externally, so don't free */
if ((node->effect_buffer != NULL) && ((void *)node->effect_buffer != (void *)node->host_buffer))
@ -1326,11 +1321,7 @@ static void delete_fluid_ladspa_node(fluid_ladspa_node_t *node)
FLUID_FREE(node->effect_buffer);
}
if (node->name != NULL)
{
FLUID_FREE(node->name);
}
FLUID_FREE(node->name);
FLUID_FREE(node);
}
@ -1396,11 +1387,9 @@ static fluid_ladspa_lib_t *new_fluid_ladspa_lib(fluid_ladspa_fx_t *fx, const cha
static void delete_fluid_ladspa_lib(fluid_ladspa_lib_t *lib)
{
if (lib->filename != NULL)
{
FLUID_FREE(lib->filename);
}
fluid_return_if_fail(lib != NULL);
FLUID_FREE(lib->filename);
FLUID_FREE(lib);
}

View file

@ -32,7 +32,7 @@ typedef struct _fluid_audriver_definition_t
fluid_audio_driver_t* (*new2)(fluid_settings_t* settings,
fluid_audio_func_t func,
void* data);
int (*free)(fluid_audio_driver_t* driver);
void (*free)(fluid_audio_driver_t* driver);
void (*settings)(fluid_settings_t* settings);
} fluid_audriver_definition_t;
@ -42,7 +42,7 @@ fluid_audio_driver_t* new_fluid_pulse_audio_driver(fluid_settings_t* settings,
fluid_synth_t* synth);
fluid_audio_driver_t* new_fluid_pulse_audio_driver2(fluid_settings_t* settings,
fluid_audio_func_t func, void* data);
int delete_fluid_pulse_audio_driver(fluid_audio_driver_t* p);
void delete_fluid_pulse_audio_driver(fluid_audio_driver_t* p);
void fluid_pulse_audio_driver_settings(fluid_settings_t* settings);
#endif
@ -51,7 +51,7 @@ fluid_audio_driver_t* new_fluid_alsa_audio_driver(fluid_settings_t* settings,
fluid_synth_t* synth);
fluid_audio_driver_t* new_fluid_alsa_audio_driver2(fluid_settings_t* settings,
fluid_audio_func_t func, void* data);
int delete_fluid_alsa_audio_driver(fluid_audio_driver_t* p);
void delete_fluid_alsa_audio_driver(fluid_audio_driver_t* p);
void fluid_alsa_audio_driver_settings(fluid_settings_t* settings);
#endif
@ -60,7 +60,7 @@ fluid_audio_driver_t* new_fluid_oss_audio_driver(fluid_settings_t* settings,
fluid_synth_t* synth);
fluid_audio_driver_t* new_fluid_oss_audio_driver2(fluid_settings_t* settings,
fluid_audio_func_t func, void* data);
int delete_fluid_oss_audio_driver(fluid_audio_driver_t* p);
void delete_fluid_oss_audio_driver(fluid_audio_driver_t* p);
void fluid_oss_audio_driver_settings(fluid_settings_t* settings);
#endif
@ -70,14 +70,14 @@ fluid_audio_driver_t* new_fluid_core_audio_driver(fluid_settings_t* settings,
fluid_audio_driver_t* new_fluid_core_audio_driver2(fluid_settings_t* settings,
fluid_audio_func_t func,
void* data);
int delete_fluid_core_audio_driver(fluid_audio_driver_t* p);
void delete_fluid_core_audio_driver(fluid_audio_driver_t* p);
void fluid_core_audio_driver_settings(fluid_settings_t* settings);
#endif
#if DSOUND_SUPPORT
fluid_audio_driver_t* new_fluid_dsound_audio_driver(fluid_settings_t* settings,
fluid_synth_t* synth);
int delete_fluid_dsound_audio_driver(fluid_audio_driver_t* p);
void delete_fluid_dsound_audio_driver(fluid_audio_driver_t* p);
void fluid_dsound_audio_driver_settings(fluid_settings_t* settings);
#endif
@ -85,14 +85,14 @@ void fluid_dsound_audio_driver_settings(fluid_settings_t* settings);
void fluid_portaudio_driver_settings (fluid_settings_t *settings);
fluid_audio_driver_t* new_fluid_portaudio_driver(fluid_settings_t* settings,
fluid_synth_t* synth);
int delete_fluid_portaudio_driver(fluid_audio_driver_t* p);
void delete_fluid_portaudio_driver(fluid_audio_driver_t* p);
#endif
#if JACK_SUPPORT
fluid_audio_driver_t* new_fluid_jack_audio_driver(fluid_settings_t* settings, fluid_synth_t* synth);
fluid_audio_driver_t* new_fluid_jack_audio_driver2(fluid_settings_t* settings,
fluid_audio_func_t func, void* data);
int delete_fluid_jack_audio_driver(fluid_audio_driver_t* p);
void delete_fluid_jack_audio_driver(fluid_audio_driver_t* p);
void fluid_jack_audio_driver_settings(fluid_settings_t* settings);
#endif
@ -102,20 +102,20 @@ fluid_audio_driver_t* new_fluid_sndmgr_audio_driver(fluid_settings_t* settings,
fluid_audio_driver_t* new_fluid_sndmgr_audio_driver2(fluid_settings_t* settings,
fluid_audio_func_t func,
void* data);
int delete_fluid_sndmgr_audio_driver(fluid_audio_driver_t* p);
void delete_fluid_sndmgr_audio_driver(fluid_audio_driver_t* p);
#endif
#if DART_SUPPORT
fluid_audio_driver_t* new_fluid_dart_audio_driver(fluid_settings_t* settings,
fluid_synth_t* synth);
int delete_fluid_dart_audio_driver(fluid_audio_driver_t* p);
void delete_fluid_dart_audio_driver(fluid_audio_driver_t* p);
void fluid_dart_audio_driver_settings(fluid_settings_t* settings);
#endif
#if AUFILE_SUPPORT
fluid_audio_driver_t* new_fluid_file_audio_driver(fluid_settings_t* settings,
fluid_synth_t* synth);
int delete_fluid_file_audio_driver(fluid_audio_driver_t* p);
void delete_fluid_file_audio_driver(fluid_audio_driver_t* p);
#endif
/* Available audio drivers, listed in order of preference */
@ -369,6 +369,7 @@ void
delete_fluid_audio_driver(fluid_audio_driver_t* driver)
{
unsigned int i;
fluid_return_if_fail(driver != NULL);
for (i = 0; i < FLUID_N_ELEMENTS(fluid_audio_drivers); i++) {
if (fluid_audio_drivers[i].name == driver->name) {

View file

@ -70,7 +70,7 @@ fluid_audio_driver_t* new_fluid_alsa_audio_driver(fluid_settings_t* settings,
fluid_audio_driver_t* new_fluid_alsa_audio_driver2(fluid_settings_t* settings,
fluid_audio_func_t func, void* data);
int delete_fluid_alsa_audio_driver(fluid_audio_driver_t* p);
void delete_fluid_alsa_audio_driver(fluid_audio_driver_t* p);
void fluid_alsa_audio_driver_settings(fluid_settings_t* settings);
static fluid_thread_return_t fluid_alsa_audio_run_float(void* d);
static fluid_thread_return_t fluid_alsa_audio_run_s16(void* d);
@ -117,7 +117,7 @@ fluid_midi_driver_t* new_fluid_alsa_rawmidi_driver(fluid_settings_t* settings,
handle_midi_event_func_t handler,
void* event_handler_data);
int delete_fluid_alsa_rawmidi_driver(fluid_midi_driver_t* p);
void delete_fluid_alsa_rawmidi_driver(fluid_midi_driver_t* p);
static fluid_thread_return_t fluid_alsa_midi_run(void* d);
@ -140,7 +140,7 @@ typedef struct {
fluid_midi_driver_t* new_fluid_alsa_seq_driver(fluid_settings_t* settings,
handle_midi_event_func_t handler,
void* data);
int delete_fluid_alsa_seq_driver(fluid_midi_driver_t* p);
void delete_fluid_alsa_seq_driver(fluid_midi_driver_t* p);
static fluid_thread_return_t fluid_alsa_seq_run(void* d);
/**************************************************************
@ -320,13 +320,10 @@ new_fluid_alsa_audio_driver2(fluid_settings_t* settings,
return NULL;
}
int delete_fluid_alsa_audio_driver(fluid_audio_driver_t* p)
void delete_fluid_alsa_audio_driver(fluid_audio_driver_t* p)
{
fluid_alsa_audio_driver_t* dev = (fluid_alsa_audio_driver_t*) p;
if (dev == NULL) {
return FLUID_OK;
}
fluid_return_if_fail(dev != NULL);
dev->cont = 0;
@ -337,8 +334,6 @@ int delete_fluid_alsa_audio_driver(fluid_audio_driver_t* p)
snd_pcm_close (dev->pcm);
FLUID_FREE(dev);
return FLUID_OK;
}
/* handle error after an ALSA write call */
@ -651,15 +646,11 @@ new_fluid_alsa_rawmidi_driver(fluid_settings_t* settings,
/*
* delete_fluid_alsa_rawmidi_driver
*/
int
void
delete_fluid_alsa_rawmidi_driver(fluid_midi_driver_t* p)
{
fluid_alsa_rawmidi_driver_t* dev;
dev = (fluid_alsa_rawmidi_driver_t*) p;
if (dev == NULL) {
return FLUID_OK;
}
fluid_alsa_rawmidi_driver_t* dev = (fluid_alsa_rawmidi_driver_t*) p;
fluid_return_if_fail(dev != NULL);
/* cancel the thread and wait for it before cleaning up */
fluid_atomic_int_set(&dev->should_quit, 1);
@ -674,7 +665,6 @@ delete_fluid_alsa_rawmidi_driver(fluid_midi_driver_t* p)
delete_fluid_midi_parser(dev->parser);
}
FLUID_FREE(dev);
return FLUID_OK;
}
/*
@ -1008,15 +998,11 @@ new_fluid_alsa_seq_driver(fluid_settings_t* settings,
/*
* delete_fluid_alsa_seq_driver
*/
int
void
delete_fluid_alsa_seq_driver(fluid_midi_driver_t* p)
{
fluid_alsa_seq_driver_t* dev;
dev = (fluid_alsa_seq_driver_t*) p;
if (dev == NULL) {
return FLUID_OK;
}
fluid_alsa_seq_driver_t* dev = (fluid_alsa_seq_driver_t*) p;
fluid_return_if_fail(dev != NULL);
/* cancel the thread and wait for it before cleaning up */
fluid_atomic_int_set(&dev->should_quit, 1);
@ -1031,7 +1017,6 @@ delete_fluid_alsa_seq_driver(fluid_midi_driver_t* p)
if (dev->pfd) FLUID_FREE (dev->pfd);
FLUID_FREE(dev);
return FLUID_OK;
}
/*

View file

@ -51,7 +51,7 @@ typedef struct {
fluid_audio_driver_t* new_fluid_file_audio_driver(fluid_settings_t* settings,
fluid_synth_t* synth);
int delete_fluid_file_audio_driver(fluid_audio_driver_t* p);
void delete_fluid_file_audio_driver(fluid_audio_driver_t* p);
static int fluid_file_audio_run_s16(void* d, unsigned int msec);
/**************************************************************
@ -100,24 +100,15 @@ new_fluid_file_audio_driver(fluid_settings_t* settings,
return NULL;
}
int delete_fluid_file_audio_driver(fluid_audio_driver_t* p)
void delete_fluid_file_audio_driver(fluid_audio_driver_t* p)
{
fluid_file_audio_driver_t* dev = (fluid_file_audio_driver_t*) p;
fluid_return_if_fail(dev != NULL);
if (dev == NULL) {
return FLUID_OK;
}
if (dev->timer != NULL) {
delete_fluid_timer(dev->timer);
}
if (dev->renderer != NULL) {
delete_fluid_file_renderer(dev->renderer);
}
FLUID_FREE(dev);
return FLUID_OK;
}
static int fluid_file_audio_run_s16(void* d, unsigned int clock_time)

View file

@ -66,7 +66,7 @@ OSStatus fluid_core_audio_callback (void *data,
UInt32 inNumberFrames,
AudioBufferList *ioData);
int delete_fluid_core_audio_driver (fluid_audio_driver_t* p);
void delete_fluid_core_audio_driver (fluid_audio_driver_t* p);
/**************************************************************
@ -315,14 +315,11 @@ error_recovery:
/*
* delete_fluid_core_audio_driver
*/
int
void
delete_fluid_core_audio_driver(fluid_audio_driver_t* p)
{
fluid_core_audio_driver_t* dev = (fluid_core_audio_driver_t*) p;
if (dev == NULL) {
return FLUID_OK;
}
fluid_return_if_fail(dev != NULL);
CloseComponent (dev->outputUnit);
@ -334,8 +331,6 @@ delete_fluid_core_audio_driver(fluid_audio_driver_t* p)
}
FLUID_FREE(dev);
return FLUID_OK;
}
OSStatus

View file

@ -61,7 +61,7 @@ typedef struct {
fluid_midi_driver_t* new_fluid_coremidi_driver(fluid_settings_t* settings,
handle_midi_event_func_t handler, void* data);
int delete_fluid_coremidi_driver(fluid_midi_driver_t* p);
void delete_fluid_coremidi_driver(fluid_midi_driver_t* p);
void fluid_coremidi_callback(const MIDIPacketList *list, void *p, void *src);
void fluid_coremidi_driver_settings(fluid_settings_t* settings)
@ -158,10 +158,12 @@ error_recovery:
/*
* delete_fluid_coremidi_driver
*/
int
void
delete_fluid_coremidi_driver(fluid_midi_driver_t* p)
{
fluid_coremidi_driver_t* dev = (fluid_coremidi_driver_t*) p;
fluid_return_if_fail(dev != NULL);
if (dev->client != NULL) {
MIDIClientDispose(dev->client);
}

View file

@ -62,7 +62,7 @@ static ULONG (APIENTRY *m_pfnmciSendCommand)(USHORT, USHORT, ULONG, PVOID, USHOR
fluid_audio_driver_t* new_fluid_dart_audio_driver(fluid_settings_t* settings,
fluid_synth_t* synth);
int delete_fluid_dart_audio_driver(fluid_audio_driver_t* p);
void delete_fluid_dart_audio_driver(fluid_audio_driver_t* p);
void fluid_dart_audio_driver_settings(fluid_settings_t* settings);
static LONG APIENTRY fluid_dart_audio_run( ULONG ulStatus, PMCI_MIX_BUFFER pBuffer, ULONG ulFlags );
@ -212,13 +212,10 @@ error_recovery:
return NULL;
}
int delete_fluid_dart_audio_driver(fluid_audio_driver_t* p)
void delete_fluid_dart_audio_driver(fluid_audio_driver_t* p)
{
fluid_dart_audio_driver_t* dev = (fluid_dart_audio_driver_t*) p;
if (dev == NULL) {
return FLUID_OK;
}
fluid_return_if_fail(dev != NULL);
if (dev->usDeviceID != 0) {
MCI_GENERIC_PARMS GenericParms;
@ -241,7 +238,6 @@ int delete_fluid_dart_audio_driver(fluid_audio_driver_t* p)
}
FLUID_FREE(dev);
return FLUID_OK;
}
static LONG APIENTRY fluid_dart_audio_run( ULONG ulStatus, PMCI_MIX_BUFFER pBuffer, ULONG ulFlags )

View file

@ -32,7 +32,7 @@
fluid_audio_driver_t*
new_fluid_dsound_audio_driver(fluid_settings_t* settings, fluid_synth_t* synth);
int delete_fluid_dsound_audio_driver(fluid_audio_driver_t* data);
void delete_fluid_dsound_audio_driver(fluid_audio_driver_t* data);
DWORD WINAPI fluid_dsound_audio_run(LPVOID lpParameter);
HWND fluid_win32_get_window(void);
@ -270,13 +270,10 @@ new_fluid_dsound_audio_driver(fluid_settings_t* settings, fluid_synth_t* synth)
}
int delete_fluid_dsound_audio_driver(fluid_audio_driver_t* d)
void delete_fluid_dsound_audio_driver(fluid_audio_driver_t* d)
{
fluid_dsound_audio_driver_t* dev = (fluid_dsound_audio_driver_t*) d;
if (dev == NULL) {
return FLUID_OK;
}
fluid_return_if_fail(dev != NULL);
/* tell the audio thread to stop its loop */
dev->cont = 0;
@ -292,9 +289,7 @@ int delete_fluid_dsound_audio_driver(fluid_audio_driver_t* d)
/* release all the allocated ressources */
if (dev->format != NULL) {
FLUID_FREE(dev->format);
}
if (dev->sec_buffer != NULL) {
IDirectSoundBuffer_Stop(dev->sec_buffer);
@ -308,10 +303,6 @@ int delete_fluid_dsound_audio_driver(fluid_audio_driver_t* d)
}
FLUID_FREE(dev);
// fluid_win32_destroy_window();
return 0;
}
DWORD WINAPI fluid_dsound_audio_run(LPVOID lpParameter)

View file

@ -91,12 +91,12 @@ static int fluid_jack_client_register_ports (void *driver, int isaudio,
fluid_settings_t *settings);
fluid_audio_driver_t*
new_fluid_jack_audio_driver2(fluid_settings_t* settings, fluid_audio_func_t func, void* data);
int delete_fluid_jack_audio_driver(fluid_audio_driver_t* p);
void delete_fluid_jack_audio_driver(fluid_audio_driver_t* p);
void fluid_jack_driver_shutdown(void *arg);
int fluid_jack_driver_srate(jack_nframes_t nframes, void *arg);
int fluid_jack_driver_bufsize(jack_nframes_t nframes, void *arg);
int fluid_jack_driver_process(jack_nframes_t nframes, void *arg);
int delete_fluid_jack_midi_driver(fluid_midi_driver_t *p);
void delete_fluid_jack_midi_driver(fluid_midi_driver_t *p);
static fluid_mutex_t last_client_mutex = G_STATIC_MUTEX_INIT; /* Probably not necessary, but just in case drivers are created by multiple threads */
@ -491,30 +491,20 @@ new_fluid_jack_audio_driver2(fluid_settings_t* settings, fluid_audio_func_t func
/*
* delete_fluid_jack_audio_driver
*/
int
void
delete_fluid_jack_audio_driver(fluid_audio_driver_t* p)
{
fluid_jack_audio_driver_t* dev = (fluid_jack_audio_driver_t*) p;
if (dev == NULL) return 0;
fluid_return_if_fail (dev != NULL);
if (dev->client_ref != NULL)
fluid_jack_client_close (dev->client_ref, dev);
if (dev->output_bufs)
FLUID_FREE (dev->output_bufs);
if (dev->output_ports)
FLUID_FREE (dev->output_ports);
if (dev->fx_bufs)
FLUID_FREE(dev->fx_bufs);
if (dev->fx_ports)
FLUID_FREE(dev->fx_ports);
FLUID_FREE(dev);
return 0;
}
/* Process function for audio and MIDI Jack drivers */
@ -674,20 +664,16 @@ new_fluid_jack_midi_driver (fluid_settings_t *settings,
return (fluid_midi_driver_t *)dev;
}
int
void
delete_fluid_jack_midi_driver(fluid_midi_driver_t *p)
{
fluid_jack_midi_driver_t *dev = (fluid_jack_midi_driver_t *)p;
if (dev == NULL) return FLUID_OK;
fluid_return_if_fail (dev != NULL);
if (dev->client_ref != NULL)
fluid_jack_client_close (dev->client_ref, dev);
if (dev->parser != NULL)
delete_fluid_midi_parser (dev->parser);
FLUID_FREE (dev);
return FLUID_OK;
}

View file

@ -27,13 +27,13 @@
fluid_midi_driver_t* new_fluid_alsa_rawmidi_driver(fluid_settings_t* settings,
handle_midi_event_func_t handler,
void* event_handler_data);
int delete_fluid_alsa_rawmidi_driver(fluid_midi_driver_t* p);
void delete_fluid_alsa_rawmidi_driver(fluid_midi_driver_t* p);
void fluid_alsa_rawmidi_driver_settings(fluid_settings_t* settings);
fluid_midi_driver_t* new_fluid_alsa_seq_driver(fluid_settings_t* settings,
handle_midi_event_func_t handler,
void* event_handler_data);
int delete_fluid_alsa_seq_driver(fluid_midi_driver_t* p);
void delete_fluid_alsa_seq_driver(fluid_midi_driver_t* p);
void fluid_alsa_seq_driver_settings(fluid_settings_t* settings);
#endif
@ -43,7 +43,7 @@ void fluid_jack_midi_driver_settings (fluid_settings_t *settings);
fluid_midi_driver_t *new_fluid_jack_midi_driver (fluid_settings_t *settings,
handle_midi_event_func_t handler,
void *data);
int delete_fluid_jack_midi_driver(fluid_midi_driver_t *p);
void delete_fluid_jack_midi_driver(fluid_midi_driver_t *p);
#endif
/* OSS */
@ -51,7 +51,7 @@ int delete_fluid_jack_midi_driver(fluid_midi_driver_t *p);
fluid_midi_driver_t* new_fluid_oss_midi_driver(fluid_settings_t* settings,
handle_midi_event_func_t handler,
void* event_handler_data);
int delete_fluid_oss_midi_driver(fluid_midi_driver_t* p);
void delete_fluid_oss_midi_driver(fluid_midi_driver_t* p);
void fluid_oss_midi_driver_settings(fluid_settings_t* settings);
#endif
@ -60,7 +60,7 @@ void fluid_oss_midi_driver_settings(fluid_settings_t* settings);
fluid_midi_driver_t* new_fluid_winmidi_driver(fluid_settings_t* settings,
handle_midi_event_func_t handler,
void* event_handler_data);
int delete_fluid_winmidi_driver(fluid_midi_driver_t* p);
void delete_fluid_winmidi_driver(fluid_midi_driver_t* p);
void fluid_winmidi_midi_driver_settings(fluid_settings_t* settings);
#endif
@ -69,7 +69,7 @@ void fluid_winmidi_midi_driver_settings(fluid_settings_t* settings);
fluid_midi_driver_t* new_fluid_midishare_midi_driver(fluid_settings_t* settings,
handle_midi_event_func_t handler,
void* event_handler_data);
int delete_fluid_midishare_midi_driver(fluid_midi_driver_t* p);
void delete_fluid_midishare_midi_driver(fluid_midi_driver_t* p);
#endif
/* definitions for the CoreMidi driver */
@ -77,7 +77,7 @@ int delete_fluid_midishare_midi_driver(fluid_midi_driver_t* p);
fluid_midi_driver_t* new_fluid_coremidi_driver(fluid_settings_t* settings,
handle_midi_event_func_t handler,
void* event_handler_data);
int delete_fluid_coremidi_driver(fluid_midi_driver_t* p);
void delete_fluid_coremidi_driver(fluid_midi_driver_t* p);
void fluid_coremidi_driver_settings(fluid_settings_t* settings);
#endif
@ -90,7 +90,7 @@ struct fluid_mdriver_definition_t {
fluid_midi_driver_t* (*new)(fluid_settings_t* settings,
handle_midi_event_func_t event_handler,
void* event_handler_data);
int (*free)(fluid_midi_driver_t* p);
void (*free)(fluid_midi_driver_t* p);
void (*settings)(fluid_settings_t* settings);
};
@ -234,6 +234,7 @@ fluid_midi_driver_t* new_fluid_midi_driver(fluid_settings_t* settings, handle_mi
void delete_fluid_midi_driver(fluid_midi_driver_t* driver)
{
unsigned int i;
fluid_return_if_fail(driver != NULL);
for (i = 0; i < FLUID_N_ELEMENTS(fluid_midi_drivers); i++) {
if (fluid_midi_drivers[i].name == driver->name) {

View file

@ -69,7 +69,7 @@ fluid_midi_driver_t* new_fluid_midishare_midi_driver(fluid_settings_t* settings,
handle_midi_event_func_t handler,
void* data);
int delete_fluid_midishare_midi_driver(fluid_midi_driver_t* p);
void delete_fluid_midishare_midi_driver(fluid_midi_driver_t* p);
int fluid_midishare_midi_driver_status(fluid_midi_driver_t* p);
static void fluid_midishare_midi_driver_receive(short ref);
@ -156,14 +156,10 @@ new_fluid_midishare_midi_driver(fluid_settings_t* settings,
/*
* delete_fluid_midishare_midi_driver
*/
int delete_fluid_midishare_midi_driver(fluid_midi_driver_t* p)
void delete_fluid_midishare_midi_driver(fluid_midi_driver_t* p)
{
fluid_midishare_midi_driver_t* dev;
dev = (fluid_midishare_midi_driver_t*) p;
if (dev == NULL) {
return FLUID_OK;
}
fluid_midishare_midi_driver_t* dev = (fluid_midishare_midi_driver_t*) p;
fluid_return_if_fail(dev != NULL);
if (dev->filter) MidiFreeFilter(dev->filter);
@ -183,7 +179,6 @@ int delete_fluid_midishare_midi_driver(fluid_midi_driver_t* p)
dev->status = FLUID_MIDI_DONE;
FLUID_FREE(dev);
return FLUID_OK;
}

View file

@ -73,7 +73,7 @@ typedef struct {
float* buffers[2];
} fluid_oss_audio_driver_t;
int delete_fluid_oss_audio_driver(fluid_audio_driver_t* p);
void delete_fluid_oss_audio_driver(fluid_audio_driver_t* p);
/* local utilities */
static int fluid_oss_set_queue_size(fluid_oss_audio_driver_t* dev, int ss, int ch, int qs, int bs);
@ -93,7 +93,7 @@ typedef struct {
fluid_midi_driver_t*
new_fluid_oss_midi_driver(fluid_settings_t* settings,
handle_midi_event_func_t handler, void* data);
int delete_fluid_oss_midi_driver(fluid_midi_driver_t* p);
void delete_fluid_oss_midi_driver(fluid_midi_driver_t* p);
int fluid_oss_midi_driver_status(fluid_midi_driver_t* p);
static fluid_thread_return_t fluid_oss_midi_run(void* d);
@ -368,14 +368,11 @@ error_recovery:
/*
* delete_fluid_oss_audio_driver
*/
int
void
delete_fluid_oss_audio_driver(fluid_audio_driver_t* p)
{
fluid_oss_audio_driver_t* dev = (fluid_oss_audio_driver_t*) p;
if (dev == NULL) {
return FLUID_OK;
}
fluid_return_if_fail(dev != NULL);
dev->cont = 0;
@ -385,11 +382,9 @@ delete_fluid_oss_audio_driver(fluid_audio_driver_t* p)
if (dev->dspfd >= 0) {
close(dev->dspfd);
}
if (dev->buffer != NULL) {
FLUID_FREE(dev->buffer);
}
FLUID_FREE(dev->buffer);
FLUID_FREE(dev);
return FLUID_OK;
}
/**
@ -596,15 +591,11 @@ new_fluid_oss_midi_driver(fluid_settings_t* settings,
/*
* delete_fluid_oss_midi_driver
*/
int
void
delete_fluid_oss_midi_driver(fluid_midi_driver_t* p)
{
fluid_oss_midi_driver_t* dev;
dev = (fluid_oss_midi_driver_t*) p;
if (dev == NULL) {
return FLUID_OK;
}
fluid_oss_midi_driver_t* dev = (fluid_oss_midi_driver_t*) p;
fluid_return_if_fail(dev != NULL);
/* cancel the thread and wait for it before cleaning up */
dev->status = FLUID_MIDI_DONE;
@ -615,11 +606,9 @@ delete_fluid_oss_midi_driver(fluid_midi_driver_t* p)
if (dev->fd >= 0) {
close(dev->fd);
}
if (dev->parser != NULL) {
delete_fluid_midi_parser(dev->parser);
}
delete_fluid_midi_parser(dev->parser);
FLUID_FREE(dev);
return FLUID_OK;
}
/*

View file

@ -57,7 +57,7 @@ static int
fluid_portaudio_run (const void *input, void *output, unsigned long frameCount,
const PaStreamCallbackTimeInfo* timeInfo,
PaStreamCallbackFlags statusFlags, void *userData);
int delete_fluid_portaudio_driver (fluid_audio_driver_t *p);
void delete_fluid_portaudio_driver (fluid_audio_driver_t *p);
#define PORTAUDIO_DEFAULT_DEVICE "PortAudio Default"
@ -249,14 +249,12 @@ fluid_portaudio_run (const void *input, void *output, unsigned long frameCount,
/*
* delete_fluid_portaudio_driver
*/
int
void
delete_fluid_portaudio_driver(fluid_audio_driver_t *p)
{
fluid_portaudio_driver_t* dev;
fluid_portaudio_driver_t* dev = (fluid_portaudio_driver_t*)p;
PaError err;
dev = (fluid_portaudio_driver_t*)p;
if (dev == NULL) return FLUID_OK;
fluid_return_if_fail(dev != NULL);
/* PortAudio section */
if (dev->stream) Pa_CloseStream (dev->stream);
@ -267,7 +265,6 @@ delete_fluid_portaudio_driver(fluid_audio_driver_t *p)
printf ("PortAudio termination error: %s\n", Pa_GetErrorText (err) );
FLUID_FREE (dev);
return FLUID_OK;
}
#endif /*#if PORTAUDIO_SUPPORT */

View file

@ -53,7 +53,7 @@ fluid_audio_driver_t* new_fluid_pulse_audio_driver(fluid_settings_t* settings,
fluid_synth_t* synth);
fluid_audio_driver_t* new_fluid_pulse_audio_driver2(fluid_settings_t* settings,
fluid_audio_func_t func, void* data);
int delete_fluid_pulse_audio_driver(fluid_audio_driver_t* p);
void delete_fluid_pulse_audio_driver(fluid_audio_driver_t* p);
void fluid_pulse_audio_driver_settings(fluid_settings_t* settings);
static fluid_thread_return_t fluid_pulse_audio_run(void* d);
static fluid_thread_return_t fluid_pulse_audio_run2(void* d);
@ -174,13 +174,10 @@ new_fluid_pulse_audio_driver2(fluid_settings_t* settings,
return NULL;
}
int delete_fluid_pulse_audio_driver(fluid_audio_driver_t* p)
void delete_fluid_pulse_audio_driver(fluid_audio_driver_t* p)
{
fluid_pulse_audio_driver_t* dev = (fluid_pulse_audio_driver_t*) p;
if (dev == NULL) {
return FLUID_OK;
}
fluid_return_if_fail(dev != NULL);
dev->cont = 0;
@ -191,8 +188,6 @@ int delete_fluid_pulse_audio_driver(fluid_audio_driver_t* p)
pa_simple_free(dev->pa_handle);
FLUID_FREE(dev);
return FLUID_OK;
}
/* Thread without audio callback, more efficient */

View file

@ -52,7 +52,7 @@ fluid_audio_driver_t* new_fluid_sndmgr_audio_driver2(fluid_settings_t* settings,
fluid_audio_func_t func,
void* data);
int delete_fluid_sndmgr_audio_driver(fluid_audio_driver_t* p);
void delete_fluid_sndmgr_audio_driver(fluid_audio_driver_t* p);
void pascal fluid_sndmgr_callback(SndChannelPtr chan, SndDoubleBufferPtr doubleBuffer);
Fixed fluid_sndmgr_double_to_fix(long double theLD);
@ -226,36 +226,29 @@ new_fluid_sndmgr_audio_driver2(fluid_settings_t* settings, fluid_audio_func_t fu
/*
* delete_fluid_sndmgr_audio_driver
*/
int delete_fluid_sndmgr_audio_driver(fluid_audio_driver_t* p)
void delete_fluid_sndmgr_audio_driver(fluid_audio_driver_t* p)
{
fluid_sndmgr_audio_driver_t* dev = (fluid_sndmgr_audio_driver_t*) p;
fluid_return_if_fail(dev != NULL);
if (dev != NULL) {
if (dev->channel != NULL) {
SndDisposeChannel(dev->channel, 1);
}
if (dev->doubleCallbackProc != NULL) {
DisposeRoutineDescriptor(dev->doubleCallbackProc);
}
if (dev->doubleHeader != NULL) {
if(dev->doubleHeader->dbhBufferPtr[0] != NULL) {
FLUID_FREE(dev->doubleHeader->dbhBufferPtr[0]);
}
if (dev->doubleHeader->dbhBufferPtr[1] != NULL) {
FLUID_FREE(dev->doubleHeader->dbhBufferPtr[1]);
}
FLUID_FREE(dev->doubleHeader);
if (dev->doubleHeader != NULL)
{
FLUID_FREE(dev->doubleHeader->dbhBufferPtr[0]);
FLUID_FREE(dev->doubleHeader->dbhBufferPtr[1]);
FLUID_FREE(dev->doubleHeader);
}
if (dev->convbuffers[0] != NULL) {
FLUID_FREE(dev->convbuffers[0]);
}
if (dev->convbuffers[1] != NULL) {
FLUID_FREE(dev->convbuffers[1]);
}
FLUID_FREE(dev->convbuffers[0]);
FLUID_FREE(dev->convbuffers[1]);
FLUID_FREE(dev);
}
return 0;
}
/*

View file

@ -72,7 +72,7 @@ static char fluid_winmidi_error_buffer[256];
fluid_midi_driver_t* new_fluid_winmidi_driver(fluid_settings_t* settings,
handle_midi_event_func_t handler, void* data);
int delete_fluid_winmidi_driver(fluid_midi_driver_t* p);
void delete_fluid_winmidi_driver(fluid_midi_driver_t* p);
void CALLBACK fluid_winmidi_callback(HMIDIIN hmi, UINT wMsg, DWORD_PTR dwInstance,
DWORD_PTR msg, DWORD_PTR extra);
@ -243,10 +243,12 @@ new_fluid_winmidi_driver(fluid_settings_t* settings,
/*
* delete_fluid_winmidi_driver
*/
int
void
delete_fluid_winmidi_driver(fluid_midi_driver_t* p)
{
fluid_winmidi_driver_t* dev = (fluid_winmidi_driver_t*) p;
fluid_return_if_fail (dev != NULL);
if (dev->hmidiin != NULL) {
fluid_atomic_int_set (&dev->closing, TRUE);
@ -268,7 +270,6 @@ delete_fluid_winmidi_driver(fluid_midi_driver_t* p)
if (dev->cond) delete_fluid_cond (dev->cond);
FLUID_FREE(dev);
return 0;
}
void CALLBACK

View file

@ -118,11 +118,9 @@ fluid_file_read_full(fluid_file fp, size_t* length)
void
delete_fluid_midi_file (fluid_midi_file *mf)
{
if (mf == NULL) {
return;
}
fluid_return_if_fail(mf != NULL);
FLUID_FREE(mf);
return;
}
/*
@ -801,10 +799,11 @@ new_fluid_midi_event ()
* @param evt MIDI event structure
* @return Always returns #FLUID_OK
*/
int
void
delete_fluid_midi_event(fluid_midi_event_t *evt)
{
fluid_midi_event_t *temp;
fluid_return_if_fail(evt != NULL);
while (evt) {
temp = evt->next;
@ -816,7 +815,6 @@ delete_fluid_midi_event(fluid_midi_event_t *evt)
FLUID_FREE(evt);
evt = temp;
}
return FLUID_OK;
}
/**
@ -1061,17 +1059,14 @@ new_fluid_track(int num)
/*
* delete_fluid_track
*/
int
void
delete_fluid_track(fluid_track_t *track)
{
if (track->name != NULL) {
FLUID_FREE(track->name);
}
if (track->first != NULL) {
delete_fluid_midi_event(track->first);
}
fluid_return_if_fail(track != NULL);
FLUID_FREE(track->name);
delete_fluid_midi_event(track->first);
FLUID_FREE(track);
return FLUID_OK;
}
/*
@ -1303,15 +1298,14 @@ new_fluid_player(fluid_synth_t *synth)
* @param player MIDI player instance
* @return Always returns #FLUID_OK
*/
int
void
delete_fluid_player(fluid_player_t *player)
{
fluid_list_t *q;
fluid_playlist_item* pi;
if (player == NULL) {
return FLUID_OK;
}
fluid_return_if_fail(player != NULL);
fluid_player_stop(player);
fluid_player_reset(player);
@ -1326,7 +1320,6 @@ delete_fluid_player(fluid_player_t *player)
}
FLUID_FREE(player);
return FLUID_OK;
}
/**
@ -1904,11 +1897,12 @@ new_fluid_midi_parser ()
/*
* delete_fluid_midi_parser
*/
int
void
delete_fluid_midi_parser(fluid_midi_parser_t *parser)
{
fluid_return_if_fail(parser != NULL);
FLUID_FREE(parser);
return FLUID_OK;
}
/**

View file

@ -28,7 +28,7 @@
typedef struct _fluid_midi_parser_t fluid_midi_parser_t;
fluid_midi_parser_t* new_fluid_midi_parser(void);
int delete_fluid_midi_parser(fluid_midi_parser_t* parser);
void delete_fluid_midi_parser(fluid_midi_parser_t* parser);
fluid_midi_event_t* fluid_midi_parser_parse(fluid_midi_parser_t* parser, unsigned char c);
@ -248,7 +248,7 @@ struct _fluid_track_t {
typedef struct _fluid_track_t fluid_track_t;
fluid_track_t* new_fluid_track(int num);
int delete_fluid_track(fluid_track_t* track);
void delete_fluid_track(fluid_track_t* track);
int fluid_track_set_name(fluid_track_t* track, char* name);
char* fluid_track_get_name(fluid_track_t* track);
int fluid_track_add_event(fluid_track_t* track, fluid_midi_event_t* evt);

View file

@ -125,14 +125,14 @@ new_fluid_midi_router(fluid_settings_t *settings, handle_midi_event_func_t handl
* @return Returns #FLUID_OK on success, #FLUID_FAILED otherwise (only if NULL
* \a router passed really)
*/
int
void
delete_fluid_midi_router (fluid_midi_router_t *router)
{
fluid_midi_router_rule_t *rule;
fluid_midi_router_rule_t *next_rule;
int i;
fluid_return_val_if_fail (router != NULL, FLUID_FAILED);
fluid_return_if_fail (router != NULL);
for (i = 0; i < FLUID_MIDI_ROUTER_RULE_COUNT; i++)
{
@ -145,8 +145,6 @@ delete_fluid_midi_router (fluid_midi_router_t *router)
fluid_mutex_destroy (router->rules_mutex);
FLUID_FREE (router);
return FLUID_OK;
}
/**

View file

@ -154,10 +154,7 @@ new_fluid_sequencer2 (int use_system_timer)
void
delete_fluid_sequencer (fluid_sequencer_t* seq)
{
if (seq == NULL) {
return;
}
fluid_return_if_fail(seq != NULL);
/* cleanup clients */
while (seq->clients) {

View file

@ -53,9 +53,7 @@ void fluid_seq_fluidsynth_callback(unsigned int time, fluid_event_t* event, flui
void
delete_fluid_seqbind(fluid_seqbind_t* seqbind)
{
if (seqbind == NULL) {
return;
}
fluid_return_if_fail(seqbind != NULL);
if ((seqbind->client_id != -1) && (seqbind->seq != NULL)) {
fluid_sequencer_unregister_client(seqbind->seq, seqbind->client_id);

View file

@ -205,19 +205,11 @@ new_fluid_chorus(fluid_real_t sample_rate)
void
delete_fluid_chorus(fluid_chorus_t* chorus)
{
if (chorus == NULL) {
return;
}
if (chorus->chorusbuf != NULL) {
fluid_return_if_fail(chorus != NULL);
FLUID_FREE(chorus->chorusbuf);
}
if (chorus->lookup_tab != NULL) {
FLUID_FREE(chorus->lookup_tab);
}
FLUID_FREE(chorus);
FLUID_FREE(chorus);
}
int

View file

@ -9,6 +9,7 @@
Translated to C by Peter Hanappe, Mai 2001
*/
#include "fluid_sys.h"
#include "fluid_rev.h"
/***************************************************************
@ -334,6 +335,8 @@ void
delete_fluid_revmodel(fluid_revmodel_t* rev)
{
int i;
fluid_return_if_fail(rev != NULL);
for (i = 0; i < numcombs;i++) {
fluid_comb_release(&rev->combL[i]);
fluid_comb_release(&rev->combR[i]);

View file

@ -280,7 +280,8 @@ fluid_rvoice_eventhandler_dispatch_all(fluid_rvoice_eventhandler_t* handler)
void
delete_fluid_rvoice_eventhandler(fluid_rvoice_eventhandler_t* handler)
{
if (handler == NULL) return;
fluid_return_if_fail(handler != NULL);
delete_fluid_rvoice_mixer(handler->mixer);
delete_fluid_ringbuffer(handler->queue);
delete_fluid_ringbuffer(handler->finished_voices);

View file

@ -607,8 +607,8 @@ fluid_mixer_buffers_free(fluid_mixer_buffers_t* buffers)
void delete_fluid_rvoice_mixer(fluid_rvoice_mixer_t* mixer)
{
if (!mixer)
return;
fluid_return_if_fail(mixer != NULL);
fluid_rvoice_mixer_set_threads(mixer, 0, 0);
#ifdef ENABLE_MIXER_THREADS
if (mixer->thread_ready)

View file

@ -54,10 +54,10 @@ fluid_sfloader_t* new_fluid_defsfloader(fluid_settings_t* settings)
int delete_fluid_defsfloader(fluid_sfloader_t* loader)
{
if (loader) {
fluid_return_val_if_fail(loader != NULL, 0);
FLUID_FREE(loader);
}
return FLUID_OK;
return 0;
}
fluid_sfont_t* fluid_defsfloader_load(fluid_sfloader_t* loader, const char* filename)
@ -101,7 +101,7 @@ fluid_sfont_t* fluid_defsfloader_load(fluid_sfloader_t* loader, const char* file
int fluid_defsfont_sfont_delete(fluid_sfont_t* sfont)
{
if (delete_fluid_defsfont(sfont->data) != 0) {
if (delete_fluid_defsfont(sfont->data) != FLUID_OK) {
return -1;
}
FLUID_FREE(sfont);
@ -490,11 +490,13 @@ int delete_fluid_defsfont(fluid_defsfont_t* sfont)
fluid_defpreset_t* preset;
fluid_sample_t* sample;
fluid_return_val_if_fail(sfont != NULL, FLUID_OK);
/* Check that no samples are currently used */
for (list = sfont->sample; list; list = fluid_list_next(list)) {
sample = (fluid_sample_t*) fluid_list_get(list);
if (fluid_sample_refcount(sample) != 0) {
return -1;
return FLUID_FAILED;
}
}
@ -611,8 +613,7 @@ int fluid_defsfont_load(fluid_defsfont_t* sfont, const char* file)
err_exit:
sfont_close (sfdata);
if (preset != NULL)
delete_fluid_defpreset(preset);
delete_fluid_defpreset(preset);
return FLUID_FAILED;
}
@ -737,27 +738,23 @@ new_fluid_defpreset(fluid_defsfont_t* sfont)
/*
* delete_fluid_defpreset
*/
int
void
delete_fluid_defpreset(fluid_defpreset_t* preset)
{
int err = FLUID_OK;
fluid_preset_zone_t* zone;
if (preset->global_zone != NULL) {
if (delete_fluid_preset_zone(preset->global_zone) != FLUID_OK) {
err = FLUID_FAILED;
}
fluid_return_if_fail(preset != NULL);
delete_fluid_preset_zone(preset->global_zone);
preset->global_zone = NULL;
}
zone = preset->zone;
while (zone != NULL) {
preset->zone = zone->next;
if (delete_fluid_preset_zone(zone) != FLUID_OK) {
err = FLUID_FAILED;
}
delete_fluid_preset_zone(zone);
zone = preset->zone;
}
FLUID_FREE(preset);
return err;
}
int
@ -1155,11 +1152,13 @@ new_fluid_preset_zone(char *name)
/*
* delete_fluid_preset_zone
*/
int
void
delete_fluid_preset_zone(fluid_preset_zone_t* zone)
{
fluid_mod_t *mod, *tmp;
fluid_return_if_fail(zone != NULL);
mod = zone->mod;
while (mod) /* delete the modulators */
{
@ -1168,10 +1167,9 @@ delete_fluid_preset_zone(fluid_preset_zone_t* zone)
fluid_mod_delete (tmp);
}
if (zone->name) FLUID_FREE (zone->name);
if (zone->inst) delete_fluid_inst (zone->inst);
FLUID_FREE (zone->name);
delete_fluid_inst (zone->inst);
FLUID_FREE(zone);
return FLUID_OK;
}
/*
@ -1392,27 +1390,23 @@ new_fluid_inst()
/*
* delete_fluid_inst
*/
int
void
delete_fluid_inst(fluid_inst_t* inst)
{
fluid_inst_zone_t* zone;
int err = FLUID_OK;
if (inst->global_zone != NULL) {
if (delete_fluid_inst_zone(inst->global_zone) != FLUID_OK) {
err = FLUID_FAILED;
}
fluid_return_if_fail(inst != NULL);
delete_fluid_inst_zone(inst->global_zone);
inst->global_zone = NULL;
}
zone = inst->zone;
while (zone != NULL) {
inst->zone = zone->next;
if (delete_fluid_inst_zone(zone) != FLUID_OK) {
err = FLUID_FAILED;
}
delete_fluid_inst_zone(zone);
zone = inst->zone;
}
FLUID_FREE(inst);
return err;
}
/*
@ -1550,11 +1544,13 @@ new_fluid_inst_zone(char* name)
/*
* delete_fluid_inst_zone
*/
int
void
delete_fluid_inst_zone(fluid_inst_zone_t* zone)
{
fluid_mod_t *mod, *tmp;
fluid_return_if_fail(zone != NULL);
mod = zone->mod;
while (mod) /* delete the modulators */
{
@ -1563,9 +1559,8 @@ delete_fluid_inst_zone(fluid_inst_zone_t* zone)
fluid_mod_delete (tmp);
}
if (zone->name) FLUID_FREE (zone->name);
FLUID_FREE (zone->name);
FLUID_FREE(zone);
return FLUID_OK;
}
/*
@ -1796,19 +1791,19 @@ new_fluid_sample()
/*
* delete_fluid_sample
*/
int
void
delete_fluid_sample(fluid_sample_t* sample)
{
fluid_return_if_fail(sample != NULL);
if (sample->sampletype & FLUID_SAMPLETYPE_OGG_VORBIS)
{
#if LIBSNDFILE_SUPPORT
if (sample->data)
FLUID_FREE(sample->data);
#endif
}
FLUID_FREE(sample);
return FLUID_OK;
}
/*

View file

@ -416,7 +416,7 @@ struct _fluid_defpreset_t
};
fluid_defpreset_t* new_fluid_defpreset(fluid_defsfont_t* sfont);
int delete_fluid_defpreset(fluid_defpreset_t* preset);
void delete_fluid_defpreset(fluid_defpreset_t* preset);
fluid_defpreset_t* fluid_defpreset_next(fluid_defpreset_t* preset);
int fluid_defpreset_import_sfont(fluid_defpreset_t* preset, SFPreset* sfpreset, fluid_defsfont_t* sfont);
int fluid_defpreset_set_global_zone(fluid_defpreset_t* preset, fluid_preset_zone_t* zone);
@ -445,7 +445,7 @@ struct _fluid_preset_zone_t
};
fluid_preset_zone_t* new_fluid_preset_zone(char* name);
int delete_fluid_preset_zone(fluid_preset_zone_t* zone);
void delete_fluid_preset_zone(fluid_preset_zone_t* zone);
fluid_preset_zone_t* fluid_preset_zone_next(fluid_preset_zone_t* preset);
int fluid_preset_zone_import_sfont(fluid_preset_zone_t* zone, SFZone* sfzone, fluid_defsfont_t* sfont);
int fluid_preset_zone_inside_range(fluid_preset_zone_t* zone, int key, int vel);
@ -462,7 +462,7 @@ struct _fluid_inst_t
};
fluid_inst_t* new_fluid_inst(void);
int delete_fluid_inst(fluid_inst_t* inst);
void delete_fluid_inst(fluid_inst_t* inst);
int fluid_inst_import_sfont(fluid_inst_t* inst, SFInst *sfinst, fluid_defsfont_t* sfont);
int fluid_inst_set_global_zone(fluid_inst_t* inst, fluid_inst_zone_t* zone);
int fluid_inst_add_zone(fluid_inst_t* inst, fluid_inst_zone_t* zone);
@ -486,7 +486,7 @@ struct _fluid_inst_zone_t
};
fluid_inst_zone_t* new_fluid_inst_zone(char* name);
int delete_fluid_inst_zone(fluid_inst_zone_t* zone);
void delete_fluid_inst_zone(fluid_inst_zone_t* zone);
fluid_inst_zone_t* fluid_inst_zone_next(fluid_inst_zone_t* zone);
int fluid_inst_zone_import_sfont(fluid_inst_zone_t* zone, SFZone *sfzone, fluid_defsfont_t* sfont);
int fluid_inst_zone_inside_range(fluid_inst_zone_t* zone, int key, int vel);
@ -495,7 +495,7 @@ fluid_sample_t* fluid_inst_zone_get_sample(fluid_inst_zone_t* zone);
fluid_sample_t* new_fluid_sample(void);
int delete_fluid_sample(fluid_sample_t* sample);
void delete_fluid_sample(fluid_sample_t* sample);
int fluid_sample_import_sfont(fluid_sample_t* sample, SFSample* sfsample, fluid_defsfont_t* sfont);
int fluid_sample_in_rom(fluid_sample_t* sample);

View file

@ -52,7 +52,7 @@ static void fluid_ramsfont_iteration_start (fluid_ramsfont_t* sfont);
static int fluid_ramsfont_iteration_next (fluid_ramsfont_t* sfont,
fluid_preset_t* preset);
static fluid_rampreset_t* new_fluid_rampreset(fluid_ramsfont_t* sfont);
static int delete_fluid_rampreset (fluid_rampreset_t* preset);
static void delete_fluid_rampreset (fluid_rampreset_t* preset);
static int fluid_rampreset_get_banknum (fluid_rampreset_t* preset);
static int fluid_rampreset_get_num (fluid_rampreset_t* preset);
static const char *fluid_rampreset_get_name (fluid_rampreset_t* preset);
@ -251,6 +251,7 @@ delete_fluid_ramsfont (fluid_ramsfont_t* sfont)
{
fluid_list_t *list;
fluid_rampreset_t* preset;
fluid_return_val_if_fail(sfont != NULL, FLUID_OK);
/* Check that no samples are currently used */
for (list = sfont->sample; list; list = fluid_list_next(list)) {
@ -534,25 +535,21 @@ new_fluid_rampreset(fluid_ramsfont_t* sfont)
}
/* Delete a RAM SoundFont preset */
static int
static void
delete_fluid_rampreset (fluid_rampreset_t* preset)
{
int err = FLUID_OK;
fluid_preset_zone_t* zone;
fluid_rampreset_voice_t *data;
fluid_return_if_fail(preset != NULL);
if (preset->global_zone != NULL) {
if (delete_fluid_preset_zone(preset->global_zone) != FLUID_OK) {
err = FLUID_FAILED;
}
delete_fluid_preset_zone(preset->global_zone);
preset->global_zone = NULL;
}
zone = preset->zone;
while (zone != NULL) {
preset->zone = zone->next;
if (delete_fluid_preset_zone(zone) != FLUID_OK) {
err = FLUID_FAILED;
}
delete_fluid_preset_zone(zone);
zone = preset->zone;
}
@ -570,7 +567,6 @@ delete_fluid_rampreset (fluid_rampreset_t* preset)
preset->presetvoices = NULL;
FLUID_FREE(preset);
return err;
}
/* Get a RAM SoundFont preset bank */
@ -1217,14 +1213,12 @@ new_fluid_ramsample (void)
* @param sample Sample to delete
* @return #FLUID_OK
*/
int
void
delete_fluid_ramsample (fluid_sample_t* sample)
{
fluid_return_if_fail(sample != NULL);
/* same as delete_fluid_sample, plus frees the data */
if (sample->data != NULL) {
FLUID_FREE(sample->data);
}
sample->data = NULL;
FLUID_FREE(sample);
return FLUID_OK;
}

View file

@ -174,12 +174,13 @@ fluid_channel_init_ctrl(fluid_channel_t* chan, int is_all_ctrl_off)
}
/* Only called by delete_fluid_synth(), so no need to queue a preset free event */
int
void
delete_fluid_channel(fluid_channel_t* chan)
{
if (chan->preset) delete_fluid_preset (chan->preset);
fluid_return_if_fail(chan != NULL);
delete_fluid_preset (chan->preset);
FLUID_FREE(chan);
return FLUID_OK;
}
/* FIXME - Calls fluid_channel_init() potentially in synthesis context */

View file

@ -87,7 +87,7 @@ struct _fluid_channel_t
fluid_channel_t* new_fluid_channel(fluid_synth_t* synth, int num);
void fluid_channel_init_ctrl(fluid_channel_t* chan, int is_all_ctrl_off);
int delete_fluid_channel(fluid_channel_t* chan);
void delete_fluid_channel(fluid_channel_t* chan);
void fluid_channel_reset(fluid_channel_t* chan);
int fluid_channel_set_preset(fluid_channel_t* chan, fluid_preset_t* preset);
fluid_preset_t* fluid_channel_get_preset(fluid_channel_t* chan);

View file

@ -75,10 +75,7 @@ new_fluid_event()
void
delete_fluid_event(fluid_event_t* evt)
{
if (evt == NULL) {
return;
}
fluid_return_if_fail(evt != NULL);
FLUID_FREE(evt);
}

View file

@ -29,7 +29,7 @@
* @note The \c next member of \c mod will be left unchanged.
*/
void
fluid_mod_clone(fluid_mod_t* mod, fluid_mod_t* src)
fluid_mod_clone(fluid_mod_t* mod, const fluid_mod_t* src)
{
mod->dest = src->dest;
mod->src1 = src->src1;
@ -97,7 +97,7 @@ fluid_mod_set_amount(fluid_mod_t* mod, double amount)
* @return The primary source value (#fluid_mod_src or a MIDI CC controller value).
*/
int
fluid_mod_get_source1(fluid_mod_t* mod)
fluid_mod_get_source1(const fluid_mod_t* mod)
{
return mod->src1;
}
@ -108,7 +108,7 @@ fluid_mod_get_source1(fluid_mod_t* mod)
* @return The primary source flags (#fluid_mod_flags).
*/
int
fluid_mod_get_flags1(fluid_mod_t* mod)
fluid_mod_get_flags1(const fluid_mod_t* mod)
{
return mod->flags1;
}
@ -119,7 +119,7 @@ fluid_mod_get_flags1(fluid_mod_t* mod)
* @return The secondary source value (#fluid_mod_src or a MIDI CC controller value).
*/
int
fluid_mod_get_source2(fluid_mod_t* mod)
fluid_mod_get_source2(const fluid_mod_t* mod)
{
return mod->src2;
}
@ -130,7 +130,7 @@ fluid_mod_get_source2(fluid_mod_t* mod)
* @return The secondary source flags (#fluid_mod_flags).
*/
int
fluid_mod_get_flags2(fluid_mod_t* mod)
fluid_mod_get_flags2(const fluid_mod_t* mod)
{
return mod->flags2;
}
@ -141,7 +141,7 @@ fluid_mod_get_flags2(fluid_mod_t* mod)
* @return Destination generator (#fluid_gen_type)
*/
int
fluid_mod_get_dest(fluid_mod_t* mod)
fluid_mod_get_dest(const fluid_mod_t* mod)
{
return mod->dest;
}
@ -152,7 +152,7 @@ fluid_mod_get_dest(fluid_mod_t* mod)
* @return Scale amount
*/
double
fluid_mod_get_amount(fluid_mod_t* mod)
fluid_mod_get_amount(const fluid_mod_t* mod)
{
return (double) mod->amount;
}
@ -412,7 +412,7 @@ fluid_mod_delete (fluid_mod_t *mod)
* SF2.01 section 9.5.1 page 69, 'bullet' 3 defines 'identical'.
*/
int
fluid_mod_test_identity (fluid_mod_t *mod1, fluid_mod_t *mod2)
fluid_mod_test_identity (const fluid_mod_t *mod1, const fluid_mod_t *mod2)
{
return mod1->dest == mod2->dest
&& mod1->src1 == mod2->src1
@ -429,7 +429,7 @@ fluid_mod_test_identity (fluid_mod_t *mod1, fluid_mod_t *mod2)
*
* @return TRUE if the modulator has the given source, FALSE otherwise.
*/
int fluid_mod_has_source(fluid_mod_t * mod, int cc, int ctrl)
int fluid_mod_has_source(const fluid_mod_t * mod, int cc, int ctrl)
{
return
(
@ -450,7 +450,7 @@ int fluid_mod_has_source(fluid_mod_t * mod, int cc, int ctrl)
* @param gen The destination generator of type #fluid_gen_type to check for
* @return TRUE if the modulator has the given destination, FALSE otherwise.
*/
int fluid_mod_has_dest(fluid_mod_t * mod, int gen)
int fluid_mod_has_dest(const fluid_mod_t * mod, int gen)
{
return mod->dest == gen;
}

View file

@ -501,19 +501,21 @@ fluid_sample_timer_t* new_fluid_sample_timer(fluid_synth_t* synth, fluid_timer_c
return result;
}
int delete_fluid_sample_timer(fluid_synth_t* synth, fluid_sample_timer_t* timer)
void delete_fluid_sample_timer(fluid_synth_t* synth, fluid_sample_timer_t* timer)
{
fluid_sample_timer_t** ptr = &synth->sample_timers;
fluid_sample_timer_t** ptr;
fluid_return_if_fail(synth != NULL);
fluid_return_if_fail(timer != NULL);
ptr = &synth->sample_timers;
while (*ptr) {
if (*ptr == timer) {
*ptr = timer->next;
FLUID_FREE(timer);
return FLUID_OK;
return;
}
ptr = &((*ptr)->next);
}
FLUID_LOG(FLUID_ERR,"delete_fluid_sample_timer failed, no timer found");
return FLUID_FAILED;
}
@ -821,7 +823,7 @@ new_fluid_synth(fluid_settings_t *settings)
* @note Other users of a synthesizer instance, such as audio and MIDI drivers,
* should be deleted prior to freeing the FluidSynth instance.
*/
int
void
delete_fluid_synth(fluid_synth_t* synth)
{
int i, k;
@ -831,9 +833,7 @@ delete_fluid_synth(fluid_synth_t* synth)
fluid_mod_t* default_mod;
fluid_mod_t* mod;
if (synth == NULL) {
return FLUID_OK;
}
fluid_return_if_fail(synth != NULL);
fluid_profiling_print();
@ -863,10 +863,8 @@ delete_fluid_synth(fluid_synth_t* synth)
/* also unset all presets for clean SoundFont unload */
if (synth->channel != NULL)
for (i = 0; i < synth->midi_channels; i++)
if (synth->channel[i] != NULL)
fluid_channel_set_preset(synth->channel[i], NULL);
if (synth->eventhandler)
delete_fluid_rvoice_eventhandler(synth->eventhandler);
/* delete all the SoundFonts */
@ -880,7 +878,7 @@ delete_fluid_synth(fluid_synth_t* synth)
/* Delete the SoundFont info hash */
if (synth->sfont_hash) delete_fluid_hashtable (synth->sfont_hash);
delete_fluid_hashtable (synth->sfont_hash);
/* delete all the SoundFont loaders */
@ -895,18 +893,14 @@ delete_fluid_synth(fluid_synth_t* synth)
if (synth->channel != NULL) {
for (i = 0; i < synth->midi_channels; i++) {
if (synth->channel[i] != NULL) {
delete_fluid_channel(synth->channel[i]);
}
}
FLUID_FREE(synth->channel);
}
if (synth->voice != NULL) {
for (i = 0; i < synth->nvoice; i++) {
if (synth->voice[i] != NULL) {
delete_fluid_voice(synth->voice[i]);
}
}
FLUID_FREE(synth->voice);
}
@ -917,9 +911,7 @@ delete_fluid_synth(fluid_synth_t* synth)
for (i = 0; i < 128; i++) {
if (synth->tuning[i] != NULL) {
for (k = 0; k < 128; k++) {
if (synth->tuning[i][k] != NULL) {
delete_fluid_tuning(synth->tuning[i][k]);
}
}
FLUID_FREE(synth->tuning[i]);
}
@ -931,9 +923,7 @@ delete_fluid_synth(fluid_synth_t* synth)
#ifdef LADSPA
/* Release the LADSPA effects unit */
if (synth->ladspa_fx) {
delete_fluid_ladspa_fx(synth->ladspa_fx);
}
#endif
/* delete all default modulators */
@ -947,8 +937,6 @@ delete_fluid_synth(fluid_synth_t* synth)
fluid_rec_mutex_destroy(synth->mutex);
FLUID_FREE(synth);
return FLUID_OK;
}
/**
@ -1157,6 +1145,46 @@ fluid_synth_add_default_mod(fluid_synth_t* synth, fluid_mod_t* mod, int mode)
FLUID_API_RETURN(FLUID_OK);
}
/**
* Removes the specified modulator \c mod from the synth's default modulator list.
* fluid_mod_test_identity() will be used to test modulator matching.
* @param synth synth instance
* @param mod The modulator to remove
* @return FLUID_OK if a matching modulator was found and successfully removed, FLUID_FAILED otherwise
*/
int
fluid_synth_remove_default_mod(fluid_synth_t* synth, const fluid_mod_t* mod)
{
fluid_mod_t* default_mod;
fluid_mod_t* last_mod;
fluid_return_val_if_fail (synth != NULL, FLUID_FAILED);
fluid_return_val_if_fail (mod != NULL, FLUID_FAILED);
fluid_synth_api_enter(synth);
last_mod = default_mod = synth->default_mod;
while (default_mod != NULL) {
if (fluid_mod_test_identity(default_mod, mod))
{
if(synth->default_mod == default_mod)
{
synth->default_mod = synth->default_mod->next;
}
else
{
last_mod->next = default_mod->next;
}
fluid_mod_delete(default_mod);
FLUID_API_RETURN(FLUID_OK);
}
last_mod = default_mod;
default_mod = default_mod->next;
}
FLUID_API_RETURN(FLUID_FAILED);
}
/**
* Send a MIDI controller event on a MIDI channel.

View file

@ -200,7 +200,7 @@ int fluid_synth_set_chorus_full(fluid_synth_t* synth, int set, int nr, double le
double speed, double depth_ms, int type);
fluid_sample_timer_t* new_fluid_sample_timer(fluid_synth_t* synth, fluid_timer_callback_t callback, void* data);
int delete_fluid_sample_timer(fluid_synth_t* synth, fluid_sample_timer_t* timer);
void delete_fluid_sample_timer(fluid_synth_t* synth, fluid_sample_timer_t* timer);
void fluid_synth_api_enter(fluid_synth_t* synth);
void fluid_synth_api_exit(fluid_synth_t* synth);

View file

@ -94,8 +94,10 @@ fluid_tuning_duplicate (fluid_tuning_t *tuning)
void
delete_fluid_tuning (fluid_tuning_t *tuning)
{
if (tuning->name) FLUID_FREE (tuning->name);
FLUID_FREE (tuning);
fluid_return_if_fail(tuning != NULL);
FLUID_FREE (tuning->name);
FLUID_FREE (tuning);
}
/* Add a reference to a tuning object */

View file

@ -217,20 +217,17 @@ new_fluid_voice(fluid_real_t output_rate)
/*
* delete_fluid_voice
*/
int
void
delete_fluid_voice(fluid_voice_t* voice)
{
if (voice == NULL) {
return FLUID_OK;
}
fluid_return_if_fail(voice != NULL);
if (!voice->can_access_rvoice || !voice->can_access_overflow_rvoice) {
/* stop rvoice before deleting voice! */
return FLUID_FAILED;
FLUID_LOG(FLUID_WARN, "Deleting voice %u which has locked rvoices!", voice->id);
}
FLUID_FREE(voice->overflow_rvoice);
FLUID_FREE(voice->rvoice);
FLUID_FREE(voice);
return FLUID_OK;
}
/* fluid_voice_init

View file

@ -111,7 +111,7 @@ struct _fluid_voice_t
fluid_voice_t* new_fluid_voice(fluid_real_t output_rate);
int delete_fluid_voice(fluid_voice_t* voice);
void delete_fluid_voice(fluid_voice_t* voice);
void fluid_voice_start(fluid_voice_t* voice);
void fluid_voice_calculate_gen_pitch(fluid_voice_t* voice);

View file

@ -38,8 +38,7 @@ fluid_rvoice_handler_t* new_fluid_rvoice_handler(void)
void delete_fluid_rvoice_handler(fluid_rvoice_handler_t* handler)
{
if (handler == NULL)
return;
fluid_return_if_fail(handler != NULL);
#if 0
FLUID_FREE(handler->finished_voices);

View file

@ -26,6 +26,7 @@
#include "fluid_sys.h"
#include "fluid_list.h"
@ -43,6 +44,8 @@ void
delete_fluid_list(fluid_list_t *list)
{
fluid_list_t *next;
fluid_return_if_fail(list != NULL);
while (list) {
next = list->next;
FLUID_FREE(list);
@ -53,9 +56,7 @@ delete_fluid_list(fluid_list_t *list)
void
delete1_fluid_list(fluid_list_t *list)
{
if (list) {
FLUID_FREE(list);
}
}
fluid_list_t*

View file

@ -57,8 +57,8 @@ new_fluid_ringbuffer (int count, int elementsize)
if (!queue->array)
{
FLUID_FREE (queue);
FLUID_LOG (FLUID_ERR, "Out of memory");
delete_fluid_ringbuffer(queue);
return NULL;
}
@ -84,9 +84,7 @@ new_fluid_ringbuffer (int count, int elementsize)
void
delete_fluid_ringbuffer (fluid_ringbuffer_t *queue)
{
if(queue != NULL)
{
fluid_return_if_fail(queue != NULL);
FLUID_FREE (queue->array);
FLUID_FREE (queue);
}
}

View file

@ -115,7 +115,7 @@ new_fluid_str_setting(const char* value, const char* def, int hints, fluid_str_u
static void
delete_fluid_str_setting(fluid_setting_node_t* node)
{
if (!node) return;
fluid_return_if_fail(node != NULL);
FLUID_ASSERT(node->type, FLUID_STR_TYPE);
@ -169,7 +169,7 @@ new_fluid_num_setting(double min, double max, double def,
static void
delete_fluid_num_setting(fluid_setting_node_t* node)
{
if (!node) return;
fluid_return_if_fail(node != NULL);
FLUID_ASSERT (node->type, FLUID_NUM_TYPE);
FLUID_FREE(node);
@ -206,7 +206,7 @@ new_fluid_int_setting(int min, int max, int def,
static void
delete_fluid_int_setting(fluid_setting_node_t* node)
{
if (!node) return;
fluid_return_if_fail(node != NULL);
FLUID_ASSERT (node->type, FLUID_INT_TYPE);
FLUID_FREE(node);
@ -244,12 +244,11 @@ new_fluid_set_setting(void)
static void
delete_fluid_set_setting(fluid_setting_node_t* node)
{
if (node)
{
fluid_return_if_fail(node != NULL);
FLUID_ASSERT (node->type, FLUID_SET_TYPE);
delete_fluid_hashtable(node->set.hashtable);
FLUID_FREE(node);
}
}
/**

View file

@ -741,10 +741,13 @@ new_fluid_timer (int msec, fluid_timer_callback_t callback, void* data,
return timer;
}
int
void
delete_fluid_timer (fluid_timer_t *timer)
{
int auto_destroy = timer->auto_destroy;
int auto_destroy;
fluid_return_if_fail(timer != NULL);
auto_destroy = timer->auto_destroy;
timer->cont = 0;
fluid_timer_join (timer);
@ -752,8 +755,6 @@ delete_fluid_timer (fluid_timer_t *timer)
/* Shouldn't access timer now if auto_destroy enabled, since it has been destroyed */
if (!auto_destroy) FLUID_FREE (timer);
return FLUID_OK;
}
int
@ -1087,8 +1088,10 @@ new_fluid_server_socket(int port, fluid_server_func_t func, void* data)
return server_socket;
}
int delete_fluid_server_socket(fluid_server_socket_t* server_socket)
void delete_fluid_server_socket(fluid_server_socket_t* server_socket)
{
fluid_return_if_fail(server_socket != NULL);
server_socket->cont = 0;
if (server_socket->socket != INVALID_SOCKET) {
fluid_socket_close(server_socket->socket);
@ -1097,7 +1100,6 @@ int delete_fluid_server_socket(fluid_server_socket_t* server_socket)
delete_fluid_thread(server_socket->thread);
}
FLUID_FREE(server_socket);
return FLUID_OK;
}
@ -1279,8 +1281,10 @@ new_fluid_server_socket(int port, fluid_server_func_t func, void* data)
return server_socket;
}
int delete_fluid_server_socket(fluid_server_socket_t *server_socket)
void delete_fluid_server_socket(fluid_server_socket_t *server_socket)
{
fluid_return_if_fail(server_socket != NULL);
server_socket->cont = 0;
if (server_socket->socket != INVALID_SOCKET)
@ -1292,8 +1296,6 @@ int delete_fluid_server_socket(fluid_server_socket_t *server_socket)
FLUID_FREE (server_socket);
WSACleanup (); // Should be called the same number of times as WSAStartup
return FLUID_OK;
}
#endif

View file

@ -56,8 +56,6 @@ void fluid_time_config(void);
/* Misc */
#define fluid_return_val_if_fail g_return_val_if_fail
#define fluid_return_if_fail g_return_if_fail
#define FLUID_INLINE inline
#define FLUID_POINTER_TO_UINT GPOINTER_TO_UINT
#define FLUID_UINT_TO_POINTER GUINT_TO_POINTER
@ -70,6 +68,15 @@ void fluid_time_config(void);
#define FLUID_LE32TOH(x) GINT32_FROM_LE(x)
#define FLUID_LE16TOH(x) GINT16_FROM_LE(x)
#define fluid_return_val_if_fail(cond, val) \
if(cond) \
; \
else \
return val
#define fluid_return_if_fail(cond) fluid_return_val_if_fail(cond, ((void)(0)))
/*
* Utility functions
*/
@ -102,7 +109,7 @@ fluid_timer_t* new_fluid_timer(int msec, fluid_timer_callback_t callback,
void* data, int new_thread, int auto_destroy,
int high_priority);
int delete_fluid_timer(fluid_timer_t* timer);
void delete_fluid_timer(fluid_timer_t* timer);
int fluid_timer_join(fluid_timer_t* timer);
int fluid_timer_stop(fluid_timer_t* timer);
@ -148,6 +155,7 @@ new_fluid_cond_mutex (void)
static FLUID_INLINE void
delete_fluid_cond_mutex (fluid_cond_mutex_t *m)
{
fluid_return_if_fail(m != NULL);
g_mutex_clear (m);
g_free (m);
}
@ -170,6 +178,7 @@ new_fluid_cond (void)
static FLUID_INLINE void
delete_fluid_cond (fluid_cond_t *cond)
{
fluid_return_if_fail(cond != NULL);
g_cond_clear (cond);
g_free (cond);
}
@ -322,7 +331,7 @@ int fluid_ostream_printf (fluid_ostream_t out, char* format, ...);
typedef int (*fluid_server_func_t)(void* data, fluid_socket_t client_socket, char* addr);
fluid_server_socket_t* new_fluid_server_socket(int port, fluid_server_func_t func, void* data);
int delete_fluid_server_socket(fluid_server_socket_t* sock);
void delete_fluid_server_socket(fluid_server_socket_t* sock);
int fluid_server_socket_join(fluid_server_socket_t* sock);
void fluid_socket_close(fluid_socket_t sock);
fluid_istream_t fluid_socket_get_istream(fluid_socket_t sock);