Changed relevant char * arguments to const char * as per request by Louis B.

Some callback prototypes also changed from char * to const char *, including: fluid_log_function_t, fluid_settings_foreach_option_t, fluid_settings_foreach_t and fluid_server_newclient_func_t.
Fixed fluid_event_note() prototype in event.h (looks like an accidental paste in a text editor).
Added @since 1.1.0 to some enums in public headers.
Provided documentation for missing modulator functions in mod.h and other doc updates.
Added missing docs for fluid_event_callback_t.
Added missing docs for fluid_player_add and fluid_player_get_status.
Added missing docs for fluid_version and fluid_version_str.
Fixed missing docs for fluid_synth_program_reset and fluid_synth_sfcount.
Added missing docs for fluid_get_stdin and fluid_get_stdout.
This commit is contained in:
Josh Green 2009-10-28 19:38:10 +00:00
parent c09f52f50a
commit b3fb606bde
26 changed files with 293 additions and 206 deletions

View file

@ -75,7 +75,7 @@ FLUIDSYNTH_API void fluid_event_set_dest(fluid_event_t* evt, short dest);
FLUIDSYNTH_API void fluid_event_timer(fluid_event_t* evt, void* data);
/* Note events */
FLUIDSYNTH_API void fluid_event_nfluid_event_set_timeote(fluid_event_t* evt, int channel,
FLUIDSYNTH_API void fluid_event_note(fluid_event_t* evt, int channel,
short key, short vel,
unsigned int duration);

View file

@ -67,14 +67,14 @@ enum fluid_log_level {
* @param message Log message text
* @param data User data pointer supplied to fluid_set_log_function().
*/
typedef void (*fluid_log_function_t)(int level, char* message, void* data);
typedef void (*fluid_log_function_t)(int level, const char* message, void* data);
FLUIDSYNTH_API
fluid_log_function_t fluid_set_log_function(int level, fluid_log_function_t fun, void* data);
FLUIDSYNTH_API void fluid_default_log_function(int level, char* message, void* data);
FLUIDSYNTH_API void fluid_default_log_function(int level, const char* message, void* data);
FLUIDSYNTH_API int fluid_log(int level, char * fmt, ...);
FLUIDSYNTH_API int fluid_log(int level, const char *fmt, ...);
#ifdef __cplusplus

View file

@ -54,6 +54,7 @@ FLUIDSYNTH_API int fluid_midi_event_set_sysex(fluid_midi_event_t* evt, void *dat
/**
* MIDI router rule type.
* @since 1.1.0
*/
typedef enum
{
@ -111,6 +112,7 @@ FLUIDSYNTH_API void delete_fluid_midi_driver(fluid_midi_driver_t* driver);
/**
* MIDI player status enum.
* @since 1.1.0
*/
enum fluid_player_status
{
@ -121,7 +123,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 int fluid_player_add(fluid_player_t* player, char* midifile);
FLUIDSYNTH_API int fluid_player_add(fluid_player_t* player, const char *midifile);
FLUIDSYNTH_API int fluid_player_play(fluid_player_t* player);
FLUIDSYNTH_API int fluid_player_stop(fluid_player_t* player);
FLUIDSYNTH_API int fluid_player_join(fluid_player_t* player);

View file

@ -60,8 +60,8 @@ extern "C" {
#define FLUID_FAILED (-1)
FLUIDSYNTH_API int fluid_is_soundfont(char* filename);
FLUIDSYNTH_API int fluid_is_midifile(char* filename);
FLUIDSYNTH_API int fluid_is_soundfont (const char *filename);
FLUIDSYNTH_API int fluid_is_midifile (const char *filename);
#ifdef WIN32

View file

@ -52,11 +52,11 @@ struct _fluid_mod_t
};
/**
* Flags defining the polarity and mapping function of a modulator source.
* Flags defining the polarity, mapping function and type of a modulator source.
* Compare with SoundFont 2.04 PDF section 8.2.
*
* Note: The numbers of the bits are different! (for example: in the flags of
* a SoundFont modulator, the polarity bit is bit #9).
* Note: Bit values do not correspond to the SoundFont spec! Also note that
* #FLUID_MOD_GC and #FLUID_MOD_CC are in the flags field instead of the source field.
*/
enum fluid_mod_flags
{
@ -68,12 +68,12 @@ enum fluid_mod_flags
FLUID_MOD_CONCAVE = 4, /**< Concave mapping function */
FLUID_MOD_CONVEX = 8, /**< Convex mapping function */
FLUID_MOD_SWITCH = 12, /**< Switch (on/off) mapping function */
FLUID_MOD_GC = 0, /**< General controller */
FLUID_MOD_CC = 16 /**< MIDI CC controller */
FLUID_MOD_GC = 0, /**< General controller source type (#fluid_mod_src) */
FLUID_MOD_CC = 16 /**< MIDI CC controller (source will be a MIDI CC number) */
};
/**
* Flags indicating the source of a modulator (if #FLUID_MOD_GC). This
* General controller (if #FLUID_MOD_GC in flags). This
* corresponds to SoundFont 2.04 PDF section 8.2.1
*/
enum fluid_mod_src

View file

@ -40,7 +40,7 @@ extern "C" {
*/
FLUIDSYNTH_API fluid_sfont_t* fluid_ramsfont_create_sfont(void);
FLUIDSYNTH_API int fluid_ramsfont_set_name(fluid_ramsfont_t* sfont, char * name);
FLUIDSYNTH_API int fluid_ramsfont_set_name(fluid_ramsfont_t* sfont, const char *name);
FLUIDSYNTH_API
int fluid_ramsfont_add_izone(fluid_ramsfont_t* sfont,
unsigned int bank, unsigned int num, fluid_sample_t* sample,
@ -59,7 +59,7 @@ int fluid_ramsfont_izone_set_loop(fluid_ramsfont_t* sfont,
FLUIDSYNTH_API fluid_sample_t* new_fluid_ramsample(void);
FLUIDSYNTH_API int delete_fluid_ramsample(fluid_sample_t* sample);
FLUIDSYNTH_API int fluid_sample_set_name(fluid_sample_t* sample, char * name);
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,
unsigned int nbframes, short copy_data, int rootkey);

View file

@ -30,6 +30,13 @@ extern "C" {
* @brief MIDI event sequencer.
*/
/**
* Event callback prototype for destination clients.
* @param time Current sequencer tick value (see fluid_sequencer_get_tick()).
* @param event The event being received
* @param seq The sequencer instance
* @param data User defined data registered with the client
*/
typedef void (*fluid_event_callback_t)(unsigned int time, fluid_event_t* event,
fluid_sequencer_t* seq, void* data);
@ -39,7 +46,7 @@ FLUIDSYNTH_API fluid_sequencer_t* new_fluid_sequencer2(int use_system_timer);
FLUIDSYNTH_API void delete_fluid_sequencer(fluid_sequencer_t* seq);
FLUIDSYNTH_API int fluid_sequencer_get_use_system_timer(fluid_sequencer_t* seq);
FLUIDSYNTH_API
short fluid_sequencer_register_client(fluid_sequencer_t* seq, char* name,
short fluid_sequencer_register_client(fluid_sequencer_t* seq, const char *name,
fluid_event_callback_t callback, void* data);
FLUIDSYNTH_API void fluid_sequencer_unregister_client(fluid_sequencer_t* seq, short id);
FLUIDSYNTH_API int fluid_sequencer_count_clients(fluid_sequencer_t* seq);

View file

@ -130,56 +130,56 @@ FLUIDSYNTH_API fluid_settings_t* new_fluid_settings(void);
FLUIDSYNTH_API void delete_fluid_settings(fluid_settings_t* settings);
FLUIDSYNTH_API
int fluid_settings_get_type(fluid_settings_t* settings, char* name);
int fluid_settings_get_type(fluid_settings_t* settings, const char *name);
FLUIDSYNTH_API
int fluid_settings_get_hints(fluid_settings_t* settings, char* name);
int fluid_settings_get_hints(fluid_settings_t* settings, const char *name);
FLUIDSYNTH_API
int fluid_settings_is_realtime(fluid_settings_t* settings, char* name);
int fluid_settings_is_realtime(fluid_settings_t* settings, const char *name);
FLUIDSYNTH_API
int fluid_settings_setstr(fluid_settings_t* settings, char* name, char* str);
int fluid_settings_setstr(fluid_settings_t* settings, const char *name, const char *str);
FLUIDSYNTH_API
int fluid_settings_copystr(fluid_settings_t* settings, char* name, char* str, int len);
int fluid_settings_copystr(fluid_settings_t* settings, const char *name, char *str, int len);
FLUIDSYNTH_API
int fluid_settings_dupstr(fluid_settings_t* settings, char* name, char** str);
int fluid_settings_dupstr(fluid_settings_t* settings, const char *name, char** str);
FLUIDSYNTH_API
int fluid_settings_getstr(fluid_settings_t* settings, char* name, char** str);
int fluid_settings_getstr(fluid_settings_t* settings, const char *name, char** str);
FLUIDSYNTH_API
char* fluid_settings_getstr_default(fluid_settings_t* settings, char* name);
char* fluid_settings_getstr_default(fluid_settings_t* settings, const char *name);
FLUIDSYNTH_API
int fluid_settings_str_equal(fluid_settings_t* settings, char* name, char* value);
int fluid_settings_str_equal(fluid_settings_t* settings, const char *name, const char *value);
FLUIDSYNTH_API
int fluid_settings_setnum(fluid_settings_t* settings, char* name, double val);
int fluid_settings_setnum(fluid_settings_t* settings, const char *name, double val);
FLUIDSYNTH_API
int fluid_settings_getnum(fluid_settings_t* settings, char* name, double* val);
int fluid_settings_getnum(fluid_settings_t* settings, const char *name, double* val);
FLUIDSYNTH_API
double fluid_settings_getnum_default(fluid_settings_t* settings, char* name);
double fluid_settings_getnum_default(fluid_settings_t* settings, const char *name);
FLUIDSYNTH_API
void fluid_settings_getnum_range(fluid_settings_t* settings, char* name,
void fluid_settings_getnum_range(fluid_settings_t* settings, const char *name,
double* min, double* max);
FLUIDSYNTH_API
int fluid_settings_setint(fluid_settings_t* settings, char* name, int val);
int fluid_settings_setint(fluid_settings_t* settings, const char *name, int val);
FLUIDSYNTH_API
int fluid_settings_getint(fluid_settings_t* settings, char* name, int* val);
int fluid_settings_getint(fluid_settings_t* settings, const char *name, int* val);
FLUIDSYNTH_API
int fluid_settings_getint_default(fluid_settings_t* settings, char* name);
int fluid_settings_getint_default(fluid_settings_t* settings, const char *name);
FLUIDSYNTH_API
void fluid_settings_getint_range(fluid_settings_t* settings, char* name,
void fluid_settings_getint_range(fluid_settings_t* settings, const char *name,
int* min, int* max);
/**
@ -188,14 +188,15 @@ void fluid_settings_getint_range(fluid_settings_t* settings, char* name,
* @param name Setting name
* @param option A string option for this setting (iterates through the list)
*/
typedef void (*fluid_settings_foreach_option_t)(void* data, char* name, char* option);
typedef void (*fluid_settings_foreach_option_t)(void *data, const char *name,
const char *option);
FLUIDSYNTH_API
void fluid_settings_foreach_option(fluid_settings_t* settings,
char* name, void* data,
const char* name, void* data,
fluid_settings_foreach_option_t func);
FLUIDSYNTH_API
int fluid_settings_option_count (fluid_settings_t* settings, char* name);
int fluid_settings_option_count (fluid_settings_t* settings, const char* name);
FLUIDSYNTH_API char *fluid_settings_option_concat (fluid_settings_t* settings,
const char* name,
const char* separator);
@ -206,7 +207,7 @@ FLUIDSYNTH_API char *fluid_settings_option_concat (fluid_settings_t* settings,
* @param name Setting name
* @param type Setting type (#fluid_types_enum)
*/
typedef void (*fluid_settings_foreach_t)(void* data, char* name, int type);
typedef void (*fluid_settings_foreach_t)(void *data, const char *name, int type);
FLUIDSYNTH_API
void fluid_settings_foreach(fluid_settings_t* settings, void* data,

View file

@ -72,16 +72,16 @@ FLUIDSYNTH_API
int fluid_cmd_handler_register(fluid_cmd_handler_t* handler, fluid_cmd_t* cmd);
FLUIDSYNTH_API
int fluid_cmd_handler_unregister(fluid_cmd_handler_t* handler, char* cmd);
int fluid_cmd_handler_unregister(fluid_cmd_handler_t* handler, const char *cmd);
/* Command function */
FLUIDSYNTH_API
int fluid_command(fluid_cmd_handler_t* handler, char* cmd, fluid_ostream_t out);
int fluid_command(fluid_cmd_handler_t* handler, const char *cmd, fluid_ostream_t out);
FLUIDSYNTH_API
int fluid_source(fluid_cmd_handler_t* handler, char* filename);
int fluid_source(fluid_cmd_handler_t* handler, const char *filename);
FLUIDSYNTH_API
void fluid_usershell(fluid_settings_t* settings, fluid_cmd_handler_t* handler);
@ -105,7 +105,7 @@ FLUIDSYNTH_API void delete_fluid_shell(fluid_shell_t* shell);
* @param addr The IP address of the client (can be NULL)
* @return Should return a new command handler for the connection (new_fluid_cmd_handler()).
*/
typedef fluid_cmd_handler_t* (*fluid_server_newclient_func_t)(void* data, char* addr);
typedef fluid_cmd_handler_t* (*fluid_server_newclient_func_t)(void* data, const char* addr);
FLUIDSYNTH_API
fluid_server_t* new_fluid_server(fluid_settings_t* settings,

View file

@ -57,7 +57,7 @@ FLUIDSYNTH_API int fluid_synth_noteon(fluid_synth_t* synth, int chan, int key, i
FLUIDSYNTH_API int fluid_synth_noteoff(fluid_synth_t* synth, int chan, int key);
FLUIDSYNTH_API int fluid_synth_cc(fluid_synth_t* synth, int chan, int ctrl, int val);
FLUIDSYNTH_API int fluid_synth_get_cc(fluid_synth_t* synth, int chan, int ctrl, int* pval);
FLUIDSYNTH_API int fluid_synth_sysex(fluid_synth_t *synth, char *data, int len,
FLUIDSYNTH_API int fluid_synth_sysex(fluid_synth_t *synth, const char *data, int len,
char *response, int *response_len, int *handled, int dryrun);
FLUIDSYNTH_API int fluid_synth_pitch_bend(fluid_synth_t* synth, int chan, int val);
FLUIDSYNTH_API int fluid_synth_get_pitch_bend(fluid_synth_t* synth, int chan, int* ppitch_bend);
@ -72,7 +72,7 @@ int fluid_synth_program_select(fluid_synth_t* synth, int chan, unsigned int sfon
unsigned int bank_num, unsigned int preset_num);
FLUIDSYNTH_API int
fluid_synth_program_select_by_sfont_name (fluid_synth_t* synth, int chan,
char* sfont_name, unsigned int bank_num,
const char *sfont_name, unsigned int bank_num,
unsigned int preset_num);
FLUIDSYNTH_API
int fluid_synth_get_program(fluid_synth_t* synth, int chan, unsigned int* sfont_id,
@ -101,7 +101,7 @@ FLUIDSYNTH_API int fluid_synth_sfcount(fluid_synth_t* synth);
FLUIDSYNTH_API fluid_sfont_t* fluid_synth_get_sfont(fluid_synth_t* synth, unsigned int num);
FLUIDSYNTH_API fluid_sfont_t* fluid_synth_get_sfont_by_id(fluid_synth_t* synth, unsigned int id);
FLUIDSYNTH_API fluid_sfont_t *fluid_synth_get_sfont_by_name (fluid_synth_t* synth,
char *name);
const char *name);
FLUIDSYNTH_API int fluid_synth_set_bank_offset(fluid_synth_t* synth, int sfont_id, int offset);
FLUIDSYNTH_API int fluid_synth_get_bank_offset(fluid_synth_t* synth, int sfont_id);
@ -195,19 +195,19 @@ FLUIDSYNTH_API float fluid_synth_get_gen(fluid_synth_t* synth, int chan, int par
FLUIDSYNTH_API
int fluid_synth_create_key_tuning(fluid_synth_t* synth, int bank, int prog,
char* name, double* pitch);
const char* name, const double* pitch);
FLUIDSYNTH_API
int fluid_synth_activate_key_tuning(fluid_synth_t* synth, int bank, int prog,
char* name, double* pitch, int apply);
const char* name, const double* pitch, int apply);
FLUIDSYNTH_API
int fluid_synth_create_octave_tuning(fluid_synth_t* synth, int bank, int prog,
char* name, double* pitch);
const char* name, const double* pitch);
FLUIDSYNTH_API
int fluid_synth_activate_octave_tuning(fluid_synth_t* synth, int bank, int prog,
char* name, double* pitch, int apply);
const char* name, const double* pitch, int apply);
FLUIDSYNTH_API
int fluid_synth_tune_notes(fluid_synth_t* synth, int bank, int prog,
int len, int *keys, double* pitch, int apply);
int len, const int *keys, const double* pitch, int apply);
FLUIDSYNTH_API
int fluid_synth_select_tuning(fluid_synth_t* synth, int chan, int bank, int prog);
FLUIDSYNTH_API

View file

@ -178,7 +178,7 @@ fluid_cmd_t fluid_commands[] = {
* 1 if 'cmd' is a comment or is empty and -2 if quit was issued
*/
int
fluid_command(fluid_cmd_handler_t* handler, char* cmd, fluid_ostream_t out)
fluid_command(fluid_cmd_handler_t* handler, const char *cmd, fluid_ostream_t out)
{
char* token[MAX_TOKENS];
char buf[MAX_COMMAND_LEN+1];
@ -346,7 +346,7 @@ fluid_usershell(fluid_settings_t* settings, fluid_cmd_handler_t* handler)
* @return 0 on success, a value >1 on error
*/
int
fluid_source(fluid_cmd_handler_t* handler, char* filename)
fluid_source(fluid_cmd_handler_t* handler, const char *filename)
{
int file;
fluid_shell_t shell;
@ -1320,7 +1320,7 @@ struct _fluid_handle_settings_data_t {
fluid_ostream_t out;
};
static void fluid_handle_settings_iter1(void* data, char* name, int type)
static void fluid_handle_settings_iter1(void* data, const char* name, int type)
{
struct _fluid_handle_settings_data_t* d = (struct _fluid_handle_settings_data_t*) data;
@ -1330,7 +1330,7 @@ static void fluid_handle_settings_iter1(void* data, char* name, int type)
}
}
static void fluid_handle_settings_iter2(void* data, char* name, int type)
static void fluid_handle_settings_iter2(void* data, const char* name, int type)
{
struct _fluid_handle_settings_data_t* d = (struct _fluid_handle_settings_data_t*) data;
@ -1390,7 +1390,7 @@ struct _fluid_handle_option_data_t {
fluid_ostream_t out;
};
void fluid_handle_print_option(void* data, char* name, char* option)
void fluid_handle_print_option(void* data, const char* name, const char* option)
{
struct _fluid_handle_option_data_t* d = (struct _fluid_handle_option_data_t*) data;
@ -1726,7 +1726,7 @@ fluid_cmd_handler_register(fluid_cmd_handler_t* handler, fluid_cmd_t* cmd)
* @return TRUE if command was found and unregistered, FALSE otherwise
*/
int
fluid_cmd_handler_unregister(fluid_cmd_handler_t* handler, char* cmd)
fluid_cmd_handler_unregister(fluid_cmd_handler_t* handler, const char *cmd)
{
return fluid_hashtable_remove(handler, cmd);
}

View file

@ -882,7 +882,7 @@ fluid_hashtable_remove_internal (fluid_hashtable_t *hashtable, const void *key,
* Return value: %TRUE if the key was found and removed from the #fluid_hashtable_t.
**/
int
fluid_hashtable_remove (fluid_hashtable_t *hashtable, void *key)
fluid_hashtable_remove (fluid_hashtable_t *hashtable, const void *key)
{
return fluid_hashtable_remove_internal (hashtable, key, TRUE);
}

View file

@ -106,7 +106,7 @@ int fluid_hashtable_lookup_extended (fluid_hashtable_t *hashtable, const void *l
void fluid_hashtable_insert (fluid_hashtable_t *hashtable, void *key, void *value);
void fluid_hashtable_replace (fluid_hashtable_t *hashtable, void *key, void *value);
int fluid_hashtable_remove (fluid_hashtable_t *hashtable, void *key);
int fluid_hashtable_remove (fluid_hashtable_t *hashtable, const void *key);
int fluid_hashtable_steal (fluid_hashtable_t *hashtable, const void *key);
void fluid_hashtable_remove_all (fluid_hashtable_t *hashtable);
void fluid_hashtable_steal_all (fluid_hashtable_t *hashtable);

View file

@ -1227,11 +1227,18 @@ fluid_track_t* fluid_player_get_track(fluid_player_t* player, int i)
}
}
int fluid_player_add(fluid_player_t* player, char* midifile)
/**
* Add a MIDI file to a player queue.
* @param player MIDI player instance
* @param midifile File name of the MIDI file to add
* @return #FLUID_OK
*/
int
fluid_player_add(fluid_player_t* player, const char* midifile)
{
char *s = FLUID_STRDUP(midifile);
player->playlist = fluid_list_append(player->playlist, s);
return 0;
return FLUID_OK;
}
/*
@ -1413,8 +1420,14 @@ int fluid_player_stop(fluid_player_t* player)
return FLUID_OK;
}
int fluid_player_get_status(fluid_player_t* player)
/**
* Get MIDI player status.
* @param player MIDI player instance
* @return Player status (#fluid_player_status)
* @since 1.1.0
*/
int
fluid_player_get_status(fluid_player_t* player)
{
return player->status;
}

View file

@ -36,8 +36,13 @@ fluid_mod_clone(fluid_mod_t* mod, fluid_mod_t* src)
mod->amount = src->amount;
}
/*
* fluid_mod_set_source1
/**
* Set a modulator's primary source controller and flags.
* @param mod Modulator
* @param src Modulator source (#fluid_mod_src or a MIDI controller number)
* @param flags Flags determining mapping function and whether the source
* controller is a general controller (#FLUID_MOD_GC) or a MIDI CC controller
* (#FLUID_MOD_CC), see #fluid_mod_flags.
*/
void
fluid_mod_set_source1(fluid_mod_t* mod, int src, int flags)
@ -46,8 +51,13 @@ fluid_mod_set_source1(fluid_mod_t* mod, int src, int flags)
mod->flags1 = flags;
}
/*
* fluid_mod_set_source2
/**
* Set a modulator's secondary source controller and flags.
* @param mod Modulator
* @param src Modulator source (#fluid_mod_src or a MIDI controller number)
* @param flags Flags determining mapping function and whether the source
* controller is a general controller (#FLUID_MOD_GC) or a MIDI CC controller
* (#FLUID_MOD_CC), see #fluid_mod_flags.
*/
void
fluid_mod_set_source2(fluid_mod_t* mod, int src, int flags)
@ -56,8 +66,10 @@ fluid_mod_set_source2(fluid_mod_t* mod, int src, int flags)
mod->flags2 = flags;
}
/*
* fluid_mod_set_dest
/**
* Set the destination effect of a modulator.
* @param mod Modulator
* @param dest Destination generator (#fluid_gen_type)
*/
void
fluid_mod_set_dest(fluid_mod_t* mod, int dest)
@ -65,8 +77,10 @@ fluid_mod_set_dest(fluid_mod_t* mod, int dest)
mod->dest = dest;
}
/*
* fluid_mod_set_amount
/**
* Set the scale amount of a modulator.
* @param mod Modulator
* @param amount Scale amount to assign
*/
void
fluid_mod_set_amount(fluid_mod_t* mod, double amount)
@ -74,32 +88,68 @@ fluid_mod_set_amount(fluid_mod_t* mod, double amount)
mod->amount = (double) amount;
}
int fluid_mod_get_source1(fluid_mod_t* mod)
/**
* Get the primary source value from a modulator.
* @param mod Modulator
* @return The primary source value (#fluid_mod_src or a MIDI CC controller value).
*/
int
fluid_mod_get_source1(fluid_mod_t* mod)
{
return mod->src1;
}
int fluid_mod_get_flags1(fluid_mod_t* mod)
/**
* Get primary source flags from a modulator.
* @param mod Modulator
* @return The primary source flags (#fluid_mod_flags).
*/
int
fluid_mod_get_flags1(fluid_mod_t* mod)
{
return mod->flags1;
}
int fluid_mod_get_source2(fluid_mod_t* mod)
/**
* Get the secondary source value from a modulator.
* @param mod Modulator
* @return The secondary source value (#fluid_mod_src or a MIDI CC controller value).
*/
int
fluid_mod_get_source2(fluid_mod_t* mod)
{
return mod->src2;
}
int fluid_mod_get_flags2(fluid_mod_t* mod)
/**
* Get secondary source flags from a modulator.
* @param mod Modulator
* @return The secondary source flags (#fluid_mod_flags).
*/
int
fluid_mod_get_flags2(fluid_mod_t* mod)
{
return mod->flags2;
}
int fluid_mod_get_dest(fluid_mod_t* mod)
/**
* Get destination effect from a modulator.
* @param mod Modulator
* @return Destination generator (#fluid_gen_type)
*/
int
fluid_mod_get_dest(fluid_mod_t* mod)
{
return mod->dest;
}
double fluid_mod_get_amount(fluid_mod_t* mod)
/**
* Get the scale amount from a modulator.
* @param mod Modulator
* @return Scale amount
*/
double
fluid_mod_get_amount(fluid_mod_t* mod)
{
return (fluid_real_t) mod->amount;
}
@ -342,44 +392,48 @@ fluid_mod_get_value(fluid_mod_t* mod, fluid_channel_t* chan, fluid_voice_t* voic
return (fluid_real_t) mod->amount * v1 * v2;
}
/*
* fluid_mod_new
/**
* Create a new uninitialized modulator structure.
* @return New allocated modulator or NULL if out of memory
*/
fluid_mod_t*
fluid_mod_new()
{
fluid_mod_t* mod = FLUID_NEW(fluid_mod_t);
fluid_mod_t* mod = FLUID_NEW (fluid_mod_t);
if (mod == NULL) {
FLUID_LOG(FLUID_ERR, "Out of memory");
return NULL;
}
return mod;
};
}
/*
* fluid_mod_delete
/**
* Free a modulator structure.
* @param mod Modulator to free
*/
void
fluid_mod_delete(fluid_mod_t * mod)
fluid_mod_delete (fluid_mod_t *mod)
{
FLUID_FREE(mod);
};
}
/*
* fluid_mod_test_identity
/**
* Checks if two modulators are identical in sources, flags and destination.
* @param mod1 First modulator
* @param mod2 Second modulator
* @return TRUE if identical, FALSE otherwise
*
* SF2.01 section 9.5.1 page 69, 'bullet' 3 defines 'identical'.
*/
/* Purpose:
* Checks, if two modulators are identical.
* 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){
if (mod1->dest != mod2->dest){return 0;};
if (mod1->src1 != mod2->src1){return 0;};
if (mod1->src2 != mod2->src2){return 0;};
if (mod1->flags1 != mod2->flags1){return 0;}
if (mod1->flags2 != mod2->flags2){return 0;}
return 1;
};
int
fluid_mod_test_identity (fluid_mod_t *mod1, fluid_mod_t *mod2)
{
return mod1->dest == mod2->dest
&& mod1->src1 == mod2->src1
&& mod1->src2 == mod2->src2
&& mod1->flags1 == mod2->flags1
&& mod1->flags2 == mod2->flags2;
}
/* debug function: Prints the contents of a modulator */
void fluid_dump_modulator(fluid_mod_t * mod){

View file

@ -293,7 +293,7 @@ fluid_ramsfont_get_name(fluid_ramsfont_t* sfont)
* @return #FLUID_OK
*/
int
fluid_ramsfont_set_name (fluid_ramsfont_t *sfont, char *name)
fluid_ramsfont_set_name (fluid_ramsfont_t *sfont, const char *name)
{
FLUID_MEMCPY(sfont->name, name, 20);
return FLUID_OK;
@ -1116,7 +1116,7 @@ fluid_rampreset_noteon (fluid_rampreset_t* preset, fluid_synth_t* synth, int cha
* @return #FLUID_OK
*/
int
fluid_sample_set_name(fluid_sample_t* sample, char* name)
fluid_sample_set_name(fluid_sample_t* sample, const char *name)
{
FLUID_MEMCPY(sample->name, name, 20);
return FLUID_OK;

View file

@ -266,7 +266,7 @@ void fluid_seq_dotrace(fluid_sequencer_t* seq, char *fmt, ...) {}
* register a callback.
*/
short
fluid_sequencer_register_client (fluid_sequencer_t* seq, char* name,
fluid_sequencer_register_client (fluid_sequencer_t* seq, const char *name,
fluid_event_callback_t callback, void* data)
{
fluid_sequencer_client_t * client;

View file

@ -84,7 +84,7 @@ typedef struct {
static fluid_str_setting_t*
new_fluid_str_setting(char* value, char* def, int hints, fluid_str_update_t fun, void* data)
new_fluid_str_setting(const char* value, char* def, int hints, fluid_str_update_t fun, void* data)
{
fluid_str_setting_t* str;
@ -377,7 +377,7 @@ fluid_settings_get(fluid_settings_t* settings, const char *name,
* @return 1 if the value has been set, zero otherwise
*/
static int
fluid_settings_set(fluid_settings_t* settings, char* name, void* value)
fluid_settings_set(fluid_settings_t* settings, const char *name, void* value)
{
fluid_hashtable_t* table = settings;
fluid_setting_node_t *node;
@ -578,7 +578,7 @@ fluid_settings_register_int(fluid_settings_t* settings, char* name, int def,
* @return the type for the named setting, or #FLUID_NO_TYPE when it does not exist
*/
int
fluid_settings_get_type(fluid_settings_t* settings, char* name)
fluid_settings_get_type(fluid_settings_t* settings, const char *name)
{
fluid_setting_node_t *node;
int type;
@ -601,7 +601,7 @@ fluid_settings_get_type(fluid_settings_t* settings, char* name)
* @return the hints associated to the named setting if it exists, zero otherwise
*/
int
fluid_settings_get_hints(fluid_settings_t* settings, char* name)
fluid_settings_get_hints(fluid_settings_t* settings, const char *name)
{
fluid_setting_node_t *node;
int hints = 0;
@ -637,7 +637,7 @@ fluid_settings_get_hints(fluid_settings_t* settings, char* name)
* @return non zero if the setting is changeable in real-time
*/
int
fluid_settings_is_realtime(fluid_settings_t* settings, char* name)
fluid_settings_is_realtime(fluid_settings_t* settings, const char *name)
{
fluid_setting_node_t *node;
int isrealtime = FALSE;
@ -674,7 +674,7 @@ fluid_settings_is_realtime(fluid_settings_t* settings, char* name)
* @return 1 if the value has been set, 0 otherwise
*/
int
fluid_settings_setstr(fluid_settings_t* settings, char* name, char* str)
fluid_settings_setstr(fluid_settings_t* settings, const char *name, const char *str)
{
fluid_setting_node_t *node;
int retval = 0;
@ -740,7 +740,8 @@ fluid_settings_setstr(fluid_settings_t* settings, char* name, char* str)
* more than sufficient for the string buffer.
*/
int
fluid_settings_copystr(fluid_settings_t* settings, char* name, char* str, int len)
fluid_settings_copystr(fluid_settings_t* settings, const char *name,
char *str, int len)
{
fluid_setting_node_t *node;
int retval = 0;
@ -799,7 +800,7 @@ fluid_settings_copystr(fluid_settings_t* settings, char* name, char* str, int le
* owns the string and should free it with free() when done using it.
*/
int
fluid_settings_dupstr(fluid_settings_t* settings, char* name, char** str)
fluid_settings_dupstr(fluid_settings_t* settings, const char *name, char** str)
{
fluid_setting_node_t *node;
int retval = 0;
@ -861,7 +862,7 @@ fluid_settings_dupstr(fluid_settings_t* settings, char* name, char** str)
* or fluid_settings_dupstr() which does not have this restriction.
*/
int
fluid_settings_getstr(fluid_settings_t* settings, char* name, char** str)
fluid_settings_getstr(fluid_settings_t* settings, const char *name, char** str)
{
fluid_setting_node_t *node;
int retval = 0;
@ -907,7 +908,7 @@ fluid_settings_getstr(fluid_settings_t* settings, char* name, char** str)
* @return 1 if the value exists and is equal to 's', 0 otherwise
*/
int
fluid_settings_str_equal (fluid_settings_t* settings, char* name, char* s)
fluid_settings_str_equal (fluid_settings_t* settings, const char *name, const char *s)
{
fluid_setting_node_t *node;
int retval = 0;
@ -948,7 +949,7 @@ fluid_settings_str_equal (fluid_settings_t* settings, char* name, char* s)
* @return the default string value of the setting if it exists, NULL otherwise
*/
char*
fluid_settings_getstr_default(fluid_settings_t* settings, char* name)
fluid_settings_getstr_default(fluid_settings_t* settings, const char *name)
{
fluid_setting_node_t *node;
char *retval = NULL;
@ -989,7 +990,7 @@ fluid_settings_getstr_default(fluid_settings_t* settings, char* name)
* Causes the setting's #FLUID_HINT_OPTIONLIST hint to be set.
*/
int
fluid_settings_add_option(fluid_settings_t* settings, char* name, const char* s)
fluid_settings_add_option(fluid_settings_t* settings, const char *name, const char *s)
{
fluid_setting_node_t *node;
int retval = 0;
@ -1022,7 +1023,7 @@ fluid_settings_add_option(fluid_settings_t* settings, char* name, const char* s)
* @return 1 if the setting exists and option was removed, 0 otherwise
*/
int
fluid_settings_remove_option(fluid_settings_t* settings, char* name, const char* s)
fluid_settings_remove_option(fluid_settings_t* settings, const char *name, const char* s)
{
fluid_setting_node_t *node;
int retval = 0;
@ -1065,7 +1066,7 @@ fluid_settings_remove_option(fluid_settings_t* settings, char* name, const char*
* @return 1 if the value has been set, 0 otherwise
*/
int
fluid_settings_setnum(fluid_settings_t* settings, char* name, double val)
fluid_settings_setnum(fluid_settings_t* settings, const char *name, double val)
{
fluid_setting_node_t *node;
fluid_num_setting_t* setting;
@ -1112,7 +1113,7 @@ fluid_settings_setnum(fluid_settings_t* settings, char* name, double val)
* @return 1 if the value exists, 0 otherwise
*/
int
fluid_settings_getnum(fluid_settings_t* settings, char* name, double* val)
fluid_settings_getnum(fluid_settings_t* settings, const char *name, double* val)
{
fluid_setting_node_t *node;
int retval = 0;
@ -1144,7 +1145,8 @@ fluid_settings_getnum(fluid_settings_t* settings, char* name, double* val)
* @param max setting's range upper limit
*/
void
fluid_settings_getnum_range(fluid_settings_t* settings, char* name, double* min, double* max)
fluid_settings_getnum_range(fluid_settings_t* settings, const char *name,
double* min, double* max)
{
fluid_setting_node_t *node;
@ -1173,7 +1175,7 @@ fluid_settings_getnum_range(fluid_settings_t* settings, char* name, double* min,
* @return the default value if the named setting exists, 0.0f otherwise
*/
double
fluid_settings_getnum_default(fluid_settings_t* settings, char* name)
fluid_settings_getnum_default(fluid_settings_t* settings, const char *name)
{
fluid_setting_node_t *node;
double retval = 0.0;
@ -1203,7 +1205,7 @@ fluid_settings_getnum_default(fluid_settings_t* settings, char* name)
* @return 1 if the value has been set, 0 otherwise
*/
int
fluid_settings_setint(fluid_settings_t* settings, char* name, int val)
fluid_settings_setint(fluid_settings_t* settings, const char *name, int val)
{
fluid_setting_node_t *node;
fluid_int_setting_t* setting;
@ -1250,7 +1252,7 @@ fluid_settings_setint(fluid_settings_t* settings, char* name, int val)
* @return 1 if the value exists, 0 otherwise
*/
int
fluid_settings_getint(fluid_settings_t* settings, char* name, int* val)
fluid_settings_getint(fluid_settings_t* settings, const char *name, int* val)
{
fluid_setting_node_t *node;
int retval = 0;
@ -1281,7 +1283,8 @@ fluid_settings_getint(fluid_settings_t* settings, char* name, int* val)
* @param max setting's range upper limit
*/
void
fluid_settings_getint_range(fluid_settings_t* settings, char* name, int* min, int* max)
fluid_settings_getint_range(fluid_settings_t* settings, const char *name,
int* min, int* max)
{
fluid_setting_node_t *node;
@ -1310,7 +1313,7 @@ fluid_settings_getint_range(fluid_settings_t* settings, char* name, int* min, in
* @return the setting's default integer value it it exists, zero otherwise
*/
int
fluid_settings_getint_default(fluid_settings_t* settings, char* name)
fluid_settings_getint_default(fluid_settings_t* settings, const char *name)
{
fluid_setting_node_t *node;
int retval = 0;
@ -1344,8 +1347,8 @@ fluid_settings_getint_default(fluid_settings_t* settings, char* name)
* option in alphabetical order. Sort order was undefined in previous versions.
*/
void
fluid_settings_foreach_option (fluid_settings_t* settings, char* name, void* data,
fluid_settings_foreach_option_t func)
fluid_settings_foreach_option (fluid_settings_t* settings, const char *name,
void* data, fluid_settings_foreach_option_t func)
{
fluid_setting_node_t *node;
fluid_str_setting_t *setting;
@ -1373,7 +1376,7 @@ fluid_settings_foreach_option (fluid_settings_t* settings, char* name, void* dat
newlist = fluid_list_sort (newlist, fluid_list_str_compare_func);
for (p = newlist; p; p = p->next)
(*func)(data, name, (char *)fluid_list_get (p));
(*func)(data, name, (const char *)fluid_list_get (p));
fluid_rec_mutex_unlock (settings->mutex); /* -- unlock */
@ -1389,7 +1392,7 @@ fluid_settings_foreach_option (fluid_settings_t* settings, char* name, void* dat
* @since 1.1.0
*/
int
fluid_settings_option_count (fluid_settings_t *settings, char *name)
fluid_settings_option_count (fluid_settings_t *settings, const char *name)
{
fluid_setting_node_t *node;
int count = -1;
@ -1561,7 +1564,7 @@ fluid_settings_foreach (fluid_settings_t* settings, void* data,
for (p = bag.names; p; p = p->next)
{
r = fluid_settings_get (settings, (char *)(p->data), &node);
if (r && node) (*func) (data, (char *)(p->data), node->type);
if (r && node) (*func) (data, (const char *)(p->data), node->type);
FLUID_FREE (p->data); /* -- Free name */
}

View file

@ -25,15 +25,15 @@
/** returns 1 if the option was added, 0 otherwise */
int fluid_settings_add_option(fluid_settings_t* settings, char* name, const char* s);
int fluid_settings_add_option(fluid_settings_t* settings, const char* name, const char* s);
/** returns 1 if the option was added, 0 otherwise */
int fluid_settings_remove_option(fluid_settings_t* settings, char* name, const char* s);
int fluid_settings_remove_option(fluid_settings_t* settings, const char* name, const char* s);
typedef int (*fluid_num_update_t)(void* data, char* name, double value);
typedef int (*fluid_str_update_t)(void* data, char* name, char* value);
typedef int (*fluid_int_update_t)(void* data, char* name, int value);
typedef int (*fluid_num_update_t)(void* data, const char* name, double value);
typedef int (*fluid_str_update_t)(void* data, const char* name, const char* value);
typedef int (*fluid_int_update_t)(void* data, const char* name, int value);
/** returns 0 if the value has been registered correctly, non-zero
otherwise */

View file

@ -61,7 +61,7 @@ static int fluid_synth_cc_real(fluid_synth_t* synth, int channum, int num,
int value, int noqueue);
static int fluid_synth_update_device_id (fluid_synth_t *synth, char *name,
int value);
static int fluid_synth_sysex_midi_tuning (fluid_synth_t *synth, char *data,
static int fluid_synth_sysex_midi_tuning (fluid_synth_t *synth, const char *data,
int len, char *response,
int *response_len, int avail_response,
int *handled, int dryrun);
@ -217,8 +217,11 @@ void fluid_synth_settings(fluid_settings_t* settings)
fluid_settings_register_int(settings, "synth.min-note-length", 10, 0, 65535, 0, NULL, NULL);
}
/*
* fluid_version
/**
* Get FluidSynth runtime version.
* @param major Location to store major number
* @param minor Location to store minor number
* @param micro Location to store micro number
*/
void fluid_version(int *major, int *minor, int *micro)
{
@ -227,10 +230,13 @@ void fluid_version(int *major, int *minor, int *micro)
*micro = FLUIDSYNTH_VERSION_MICRO;
}
/*
* fluid_version_str
/**
* Get FluidSynth runtime version as a string.
* @return FluidSynth version string, which is internal and should not be
* modified or freed.
*/
char* fluid_version_str(void)
char *
fluid_version_str (void)
{
return FLUIDSYNTH_VERSION;
}
@ -1590,7 +1596,7 @@ fluid_synth_update_device_id (fluid_synth_t *synth, char *name, int value)
* Tuning messages: 0xF0 0x7E/0x7F <DeviceId> 0x08 <sub ID2> [BODY] <ChkSum> 0xF7
*/
int
fluid_synth_sysex(fluid_synth_t *synth, char *data, int len,
fluid_synth_sysex(fluid_synth_t *synth, const char *data, int len,
char *response, int *response_len, int *handled, int dryrun)
{
int avail_response = 0;
@ -1621,7 +1627,7 @@ fluid_synth_sysex(fluid_synth_t *synth, char *data, int len,
/* Handler for MIDI tuning SYSEX messages */
static int
fluid_synth_sysex_midi_tuning (fluid_synth_t *synth, char *data, int len,
fluid_synth_sysex_midi_tuning (fluid_synth_t *synth, const char *data, int len,
char *response, int *response_len, int avail_response,
int *handled, int dryrun)
{
@ -1633,7 +1639,8 @@ fluid_synth_sysex_midi_tuning (fluid_synth_t *synth, char *data, int len,
int note, frac, frac2;
uint8 chksum;
int i, count, index;
char *dataptr;
const char *dataptr;
char *resptr;;
realtime = data[0] == MIDI_SYSEX_UNIV_REALTIME;
msgid = data[3];
@ -1675,19 +1682,19 @@ fluid_synth_sysex_midi_tuning (fluid_synth_t *synth, char *data, int len,
return FLUID_OK;
}
dataptr = response;
resptr = response;
*dataptr++ = MIDI_SYSEX_UNIV_NON_REALTIME;
*dataptr++ = synth->device_id;
*dataptr++ = MIDI_SYSEX_MIDI_TUNING_ID;
*dataptr++ = MIDI_SYSEX_TUNING_BULK_DUMP;
*resptr++ = MIDI_SYSEX_UNIV_NON_REALTIME;
*resptr++ = synth->device_id;
*resptr++ = MIDI_SYSEX_MIDI_TUNING_ID;
*resptr++ = MIDI_SYSEX_TUNING_BULK_DUMP;
if (msgid == MIDI_SYSEX_TUNING_BULK_DUMP_REQ_BANK)
*dataptr++ = bank;
*resptr++ = bank;
*dataptr++ = prog;
FLUID_STRNCPY (dataptr, name, 16);
dataptr += 16;
*resptr++ = prog;
FLUID_STRNCPY (resptr, name, 16);
resptr += 16;
for (i = 0; i < 128; i++)
{
@ -1697,9 +1704,9 @@ fluid_synth_sysex_midi_tuning (fluid_synth_t *synth, char *data, int len,
frac = ((tunedata[i] - note * 100.0) * 16384.0 + 50.0) / 100.0;
fluid_clip (frac, 0, 16383);
*dataptr++ = note;
*dataptr++ = frac >> 7;
*dataptr++ = frac & 0x7F;
*resptr++ = note;
*resptr++ = frac >> 7;
*resptr++ = frac & 0x7F;
}
if (msgid == MIDI_SYSEX_TUNING_BULK_DUMP_REQ)
@ -1716,7 +1723,7 @@ fluid_synth_sysex_midi_tuning (fluid_synth_t *synth, char *data, int len,
chksum ^= response[i];
}
*dataptr++ = chksum & 0x7F;
*resptr++ = chksum & 0x7F;
if (handled) *handled = TRUE;
break;
@ -2440,7 +2447,7 @@ fluid_synth_program_select(fluid_synth_t* synth, int chan, unsigned int sfont_id
*/
int
fluid_synth_program_select_by_sfont_name (fluid_synth_t* synth, int chan,
char* sfont_name, unsigned int bank_num,
const char *sfont_name, unsigned int bank_num,
unsigned int preset_num)
{
fluid_preset_t* preset = NULL;
@ -2635,7 +2642,7 @@ fluid_synth_get_internal_bufsize(fluid_synth_t* synth)
return FLUID_BUFSIZE;
}
/*
/**
* Resend a bank select and a program change for every channel.
* @param synth FluidSynth instance
* @return FLUID_OK on success, FLUID_FAILED otherwise
@ -3966,7 +3973,7 @@ fluid_synth_remove_sfont(fluid_synth_t* synth, fluid_sfont_t* sfont)
fluid_synth_program_reset (synth);
}
/*
/**
* Count number of loaded SoundFont files.
* @param synth FluidSynth instance
* @return Count of loaded SoundFont files.
@ -4051,7 +4058,7 @@ fluid_synth_get_sfont_by_id(fluid_synth_t* synth, unsigned int id)
* the duration of use of the returned pointer.
*/
fluid_sfont_t *
fluid_synth_get_sfont_by_name(fluid_synth_t* synth, char *name)
fluid_synth_get_sfont_by_name(fluid_synth_t* synth, const char *name)
{
fluid_sfont_t* sfont = NULL;
fluid_list_t* list;
@ -4809,7 +4816,7 @@ fluid_synth_update_voice_tuning_LOCAL (fluid_synth_t *synth, fluid_channel_t *ch
*/
int
fluid_synth_create_key_tuning(fluid_synth_t* synth, int bank, int prog,
char* name, double* pitch)
const char* name, const double* pitch)
{
return fluid_synth_activate_key_tuning (synth, bank, prog, name, pitch, FALSE);
}
@ -4830,7 +4837,7 @@ fluid_synth_create_key_tuning(fluid_synth_t* synth, int bank, int prog,
*/
int
fluid_synth_activate_key_tuning(fluid_synth_t* synth, int bank, int prog,
char* name, double* pitch, int apply)
const char* name, const double* pitch, int apply)
{
fluid_tuning_t* tuning;
int retval = FLUID_OK;
@ -4874,7 +4881,7 @@ fluid_synth_activate_key_tuning(fluid_synth_t* synth, int bank, int prog,
*/
int
fluid_synth_create_octave_tuning(fluid_synth_t* synth, int bank, int prog,
char* name, double* pitch)
const char* name, const double* pitch)
{
return fluid_synth_activate_octave_tuning (synth, bank, prog, name, pitch, FALSE);
}
@ -4895,7 +4902,7 @@ fluid_synth_create_octave_tuning(fluid_synth_t* synth, int bank, int prog,
*/
int
fluid_synth_activate_octave_tuning(fluid_synth_t* synth, int bank, int prog,
char* name, double* pitch, int apply)
const char* name, const double* pitch, int apply)
{
fluid_tuning_t* tuning;
int retval = FLUID_OK;
@ -4942,7 +4949,7 @@ fluid_synth_activate_octave_tuning(fluid_synth_t* synth, int bank, int prog,
*/
int
fluid_synth_tune_notes(fluid_synth_t* synth, int bank, int prog,
int len, int *key, double* pitch, int apply)
int len, const int *key, const double* pitch, int apply)
{
fluid_tuning_t* old_tuning, *new_tuning;
int retval = FLUID_OK;
@ -5290,7 +5297,7 @@ fluid_synth_get_settings(fluid_synth_t* synth)
* @return FLUID_OK on success, FLUID_FAILED otherwise
*/
int
fluid_synth_setstr(fluid_synth_t* synth, char* name, char* str)
fluid_synth_setstr(fluid_synth_t* synth, const char* name, const char* str)
{
fluid_return_val_if_fail (synth != NULL, FLUID_FAILED);
fluid_return_val_if_fail (name != NULL, FLUID_FAILED);
@ -5309,7 +5316,7 @@ fluid_synth_setstr(fluid_synth_t* synth, char* name, char* str)
* when finished with it.
*/
int
fluid_synth_dupstr(fluid_synth_t* synth, char* name, char** str)
fluid_synth_dupstr(fluid_synth_t* synth, const char* name, char** str)
{
fluid_return_val_if_fail (synth != NULL, FLUID_FAILED);
fluid_return_val_if_fail (name != NULL, FLUID_FAILED);
@ -5326,7 +5333,7 @@ fluid_synth_dupstr(fluid_synth_t* synth, char* name, char** str)
* @return FLUID_OK on success, FLUID_FAILED otherwise
*/
int
fluid_synth_setnum(fluid_synth_t* synth, char* name, double val)
fluid_synth_setnum(fluid_synth_t* synth, const char* name, double val)
{
fluid_return_val_if_fail (synth != NULL, FLUID_FAILED);
fluid_return_val_if_fail (name != NULL, FLUID_FAILED);
@ -5342,7 +5349,7 @@ fluid_synth_setnum(fluid_synth_t* synth, char* name, double val)
* @return FLUID_OK on success, FLUID_FAILED otherwise
*/
int
fluid_synth_getnum(fluid_synth_t* synth, char* name, double* val)
fluid_synth_getnum(fluid_synth_t* synth, const char* name, double* val)
{
fluid_return_val_if_fail (synth != NULL, FLUID_FAILED);
fluid_return_val_if_fail (name != NULL, FLUID_FAILED);
@ -5358,7 +5365,7 @@ fluid_synth_getnum(fluid_synth_t* synth, char* name, double* val)
* @return FLUID_OK on success, FLUID_FAILED otherwise
*/
int
fluid_synth_setint(fluid_synth_t* synth, char* name, int val)
fluid_synth_setint(fluid_synth_t* synth, const char* name, int val)
{
fluid_return_val_if_fail (synth != NULL, FLUID_FAILED);
fluid_return_val_if_fail (name != NULL, FLUID_FAILED);
@ -5374,7 +5381,7 @@ fluid_synth_setint(fluid_synth_t* synth, char* name, int val)
* @return FLUID_OK on success, FLUID_FAILED otherwise
*/
int
fluid_synth_getint(fluid_synth_t* synth, char* name, int* val)
fluid_synth_getint(fluid_synth_t* synth, const char* name, int* val)
{
fluid_return_val_if_fail (synth != NULL, FLUID_FAILED);
fluid_return_val_if_fail (name != NULL, FLUID_FAILED);

View file

@ -245,23 +245,12 @@ struct _fluid_synth_t
#endif
};
/** returns 1 if the value has been set, 0 otherwise */
int fluid_synth_setstr(fluid_synth_t* synth, char* name, char* str);
/** returns 1 if the value exists, 0 otherwise */
int fluid_synth_dupstr(fluid_synth_t* synth, char* name, char** str);
/** returns 1 if the value has been set, 0 otherwise */
int fluid_synth_setnum(fluid_synth_t* synth, char* name, double val);
/** returns 1 if the value exists, 0 otherwise */
int fluid_synth_getnum(fluid_synth_t* synth, char* name, double* val);
/** returns 1 if the value has been set, 0 otherwise */
int fluid_synth_setint(fluid_synth_t* synth, char* name, int val);
/** returns 1 if the value exists, 0 otherwise */
int fluid_synth_getint(fluid_synth_t* synth, char* name, int* val);
int fluid_synth_setstr(fluid_synth_t* synth, const char* name, const char* str);
int fluid_synth_dupstr(fluid_synth_t* synth, const char* name, char** str);
int fluid_synth_setnum(fluid_synth_t* synth, const char* name, double val);
int fluid_synth_getnum(fluid_synth_t* synth, const char* name, double* val);
int fluid_synth_setint(fluid_synth_t* synth, const char* name, int val);
int fluid_synth_getint(fluid_synth_t* synth, const char* name, int* val);
fluid_preset_t* fluid_synth_find_preset(fluid_synth_t* synth,
unsigned int banknum,

View file

@ -131,7 +131,7 @@ fluid_set_log_function(int level, fluid_log_function_t fun, void* data)
* @param data User supplied data (not used)
*/
void
fluid_default_log_function(int level, char* message, void* data)
fluid_default_log_function(int level, const char* message, void* data)
{
FILE* out;
@ -210,7 +210,7 @@ fluid_log_config(void)
* @return Always returns #FLUID_FAILED
*/
int
fluid_log(int level, char* fmt, ...)
fluid_log(int level, const char* fmt, ...)
{
fluid_log_function_t fun = NULL;
@ -316,7 +316,7 @@ fluid_error()
* It is useful only to distinguish between SoundFont and MIDI files.
*/
int
fluid_is_midifile(char* filename)
fluid_is_midifile(const char *filename)
{
FILE* fp = fopen(filename, "rb");
char id[4];
@ -342,7 +342,7 @@ fluid_is_midifile(char* filename)
* It is useful only to distinguish between SoundFont and MIDI files.
*/
int
fluid_is_soundfont(char* filename)
fluid_is_soundfont(const char *filename)
{
FILE* fp = fopen(filename, "rb");
char id[4];
@ -550,6 +550,15 @@ void fluid_profiling_print(void)
*
*/
/* Rather than inline this one, we just declare it as a function, to prevent
* GCC warning about inline failure. */
fluid_cond_t *
new_fluid_cond (void)
{
if (!g_thread_supported ()) g_thread_init (NULL);
return g_cond_new ();
}
static gpointer
fluid_thread_high_prio (gpointer data)
{
@ -745,12 +754,20 @@ fluid_timer_join (fluid_timer_t *timer)
*
*/
/**
* Get standard in stream handle.
* @return Standard in stream.
*/
fluid_istream_t
fluid_get_stdin (void)
{
return STDIN_FILENO;
}
/**
* Get standard output stream handle.
* @return Standard out stream.
*/
fluid_ostream_t
fluid_get_stdout (void)
{

View file

@ -166,18 +166,12 @@ new_fluid_cond_mutex (void)
/* Thread condition signaling */
typedef GCond fluid_cond_t;
fluid_cond_t *new_fluid_cond (void);
#define delete_fluid_cond(cond) g_cond_free(cond)
#define fluid_cond_signal(cond) g_cond_signal(cond)
#define fluid_cond_broadcast(cond) g_cond_broadcast(cond)
#define fluid_cond_wait(cond, mutex) g_cond_wait(cond, mutex)
static FLUID_INLINE fluid_cond_t *
new_fluid_cond (void)
{
if (!g_thread_supported ()) g_thread_init (NULL);
return g_cond_new ();
}
/* Atomic operations */

View file

@ -24,7 +24,7 @@
#include "fluid_sys.h"
fluid_tuning_t* new_fluid_tuning(char* name, int bank, int prog)
fluid_tuning_t* new_fluid_tuning(const char* name, int bank, int prog)
{
fluid_tuning_t* tuning;
int i;
@ -148,7 +148,7 @@ void fluid_tuning_set_key(fluid_tuning_t* tuning, int key, double pitch)
tuning->pitch[key] = pitch;
}
void fluid_tuning_set_octave(fluid_tuning_t* tuning, double* pitch_deriv)
void fluid_tuning_set_octave(fluid_tuning_t* tuning, const double* pitch_deriv)
{
int i;
@ -157,7 +157,7 @@ void fluid_tuning_set_octave(fluid_tuning_t* tuning, double* pitch_deriv)
}
}
void fluid_tuning_set_all(fluid_tuning_t* tuning, double* pitch)
void fluid_tuning_set_all(fluid_tuning_t* tuning, const double* pitch)
{
int i;

View file

@ -42,7 +42,7 @@ struct _fluid_tuning_t {
int refcount; /* Tuning reference count */
};
fluid_tuning_t* new_fluid_tuning(char* name, int bank, int prog);
fluid_tuning_t* new_fluid_tuning(const char* name, int bank, int prog);
void delete_fluid_tuning (fluid_tuning_t *tuning);
fluid_tuning_t *fluid_tuning_duplicate (fluid_tuning_t *tuning);
void fluid_tuning_ref (fluid_tuning_t *tuning);
@ -57,9 +57,9 @@ char* fluid_tuning_get_name(fluid_tuning_t* tuning);
void fluid_tuning_set_pitch(fluid_tuning_t* tuning, int key, double pitch);
#define fluid_tuning_get_pitch(_t, _key) ((_t)->pitch[_key])
void fluid_tuning_set_octave(fluid_tuning_t* tuning, double* pitch_deriv);
void fluid_tuning_set_octave(fluid_tuning_t* tuning, const double* pitch_deriv);
void fluid_tuning_set_all(fluid_tuning_t* tuning, double* pitch);
void fluid_tuning_set_all(fluid_tuning_t* tuning, const double* pitch);
#define fluid_tuning_get_all(_t) (&(_t)->pitch[0])

View file

@ -53,7 +53,7 @@ void print_usage(void);
void print_help(fluid_settings_t *settings);
void print_welcome(void);
static fluid_cmd_handler_t* newclient(void* data, char* addr);
static fluid_cmd_handler_t* newclient(void* data, const char* addr);
/*
* the globals
@ -149,7 +149,7 @@ typedef struct
/* Function to display each string option value */
static void
settings_option_foreach_func (void *data, char *name, char *option)
settings_option_foreach_func (void *data, const char *name, const char *option)
{
OptionBag *bag = data;
@ -162,7 +162,7 @@ settings_option_foreach_func (void *data, char *name, char *option)
/* fluid_settings_foreach function for displaying option help "-o help" */
static void
settings_foreach_func (void *data, char *name, int type)
settings_foreach_func (void *data, const char *name, int type)
{
fluid_settings_t *settings = (fluid_settings_t *)data;
double dmin, dmax, ddef;
@ -793,7 +793,7 @@ int main(int argc, char** argv)
return 0;
}
static fluid_cmd_handler_t* newclient(void* data, char* addr)
static fluid_cmd_handler_t* newclient(void* data, const char* addr)
{
fluid_synth_t* synth = (fluid_synth_t*) data;
return new_fluid_cmd_handler(synth);