mirror of
https://github.com/ZDoom/fluidsynth.git
synced 2025-04-07 16:21:18 +00:00
consistently use signed int for sfont_id, bank_num and preset_num
This commit is contained in:
parent
3e3bef87ec
commit
edd52edac2
11 changed files with 79 additions and 69 deletions
|
@ -323,9 +323,9 @@ find_program( CLANG_TIDY
|
|||
message ( STATUS "Found clang-tidy" )
|
||||
# whenever clang-tidy is available, use it to automatically add braces after ever "make"
|
||||
if ( WITH_PROFILING )
|
||||
set ( CMAKE_C_CLANG_TIDY "clang-tidy" )
|
||||
# set ( CMAKE_C_CLANG_TIDY "clang-tidy" )
|
||||
else ( WITH_PROFILING )
|
||||
set ( CMAKE_C_CLANG_TIDY "clang-tidy;-checks=-*,readability-braces-around-statements;-format-style=file" )
|
||||
# set ( CMAKE_C_CLANG_TIDY "clang-tidy;-checks=-*,readability-braces-around-statements;-format-style=file" )
|
||||
endif ( WITH_PROFILING )
|
||||
endif ( CLANG_TIDY )
|
||||
endif ( CMAKE_VERSION VERSION_GREATER "3.6.0" )
|
||||
|
|
|
@ -101,6 +101,7 @@ Changes in FluidSynth 2.0.0 concerning developers:
|
|||
<br /><br />
|
||||
- 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
|
||||
- all public functions consistently receive signed integers for soundfont ids, bank and program numbers
|
||||
- the shell command handler was decoupled internally, as a consequence the param list of new_fluid_server() and new_fluid_cmd_handler() was adapted
|
||||
- reverb: roomsize is now limited to an upper threshold of 1.0 to avoid exponential volume increase
|
||||
- use unique device names for the "audio.portaudio.device" setting
|
||||
|
|
|
@ -43,18 +43,18 @@ FLUIDSYNTH_API fluid_sfont_t* fluid_ramsfont_create_sfont(void);
|
|||
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,
|
||||
int bank, int num, fluid_sample_t* sample,
|
||||
int lokey, int hikey);
|
||||
FLUIDSYNTH_API
|
||||
int fluid_ramsfont_remove_izone(fluid_ramsfont_t* sfont,
|
||||
unsigned int bank, unsigned int num, fluid_sample_t* sample);
|
||||
int bank, int num, fluid_sample_t* sample);
|
||||
FLUIDSYNTH_API
|
||||
int fluid_ramsfont_izone_set_gen(fluid_ramsfont_t* sfont,
|
||||
unsigned int bank, unsigned int num, fluid_sample_t* sample,
|
||||
int bank, int num, fluid_sample_t* sample,
|
||||
int gen_type, float value);
|
||||
FLUIDSYNTH_API
|
||||
int fluid_ramsfont_izone_set_loop(fluid_ramsfont_t* sfont,
|
||||
unsigned int bank, unsigned int num, fluid_sample_t* sample,
|
||||
int bank, int num, fluid_sample_t* sample,
|
||||
int on, float loopstart, float loopend);
|
||||
|
||||
|
||||
|
|
|
@ -170,7 +170,7 @@ typedef const char* (*fluid_sfont_get_name_t)(fluid_sfont_t* sfont);
|
|||
* @return Should return an allocated virtual preset or NULL if it could not
|
||||
* be found.
|
||||
*/
|
||||
typedef fluid_preset_t* (*fluid_sfont_get_preset_t)(fluid_sfont_t* sfont, unsigned int bank, unsigned int prenum);
|
||||
typedef fluid_preset_t* (*fluid_sfont_get_preset_t)(fluid_sfont_t* sfont, int bank, int prenum);
|
||||
|
||||
/**
|
||||
* Method to free a virtual SoundFont bank. Any custom user provided cleanup function must ultimately call
|
||||
|
|
|
@ -65,18 +65,18 @@ FLUIDSYNTH_API int fluid_synth_get_pitch_wheel_sens(fluid_synth_t* synth, int ch
|
|||
FLUIDSYNTH_API int fluid_synth_program_change(fluid_synth_t* synth, int chan, int program);
|
||||
FLUIDSYNTH_API int fluid_synth_channel_pressure(fluid_synth_t* synth, int chan, int val);
|
||||
FLUIDSYNTH_API int fluid_synth_key_pressure(fluid_synth_t* synth, int chan, int key, int val);
|
||||
FLUIDSYNTH_API int fluid_synth_bank_select(fluid_synth_t* synth, int chan, unsigned int bank);
|
||||
FLUIDSYNTH_API int fluid_synth_sfont_select(fluid_synth_t* synth, int chan, unsigned int sfont_id);
|
||||
FLUIDSYNTH_API int fluid_synth_bank_select(fluid_synth_t* synth, int chan, int bank);
|
||||
FLUIDSYNTH_API int fluid_synth_sfont_select(fluid_synth_t* synth, int chan, int sfont_id);
|
||||
FLUIDSYNTH_API
|
||||
int fluid_synth_program_select(fluid_synth_t* synth, int chan, unsigned int sfont_id,
|
||||
unsigned int bank_num, unsigned int preset_num);
|
||||
int fluid_synth_program_select(fluid_synth_t* synth, int chan, int sfont_id,
|
||||
int bank_num, int preset_num);
|
||||
FLUIDSYNTH_API int
|
||||
fluid_synth_program_select_by_sfont_name (fluid_synth_t* synth, int chan,
|
||||
const char *sfont_name, unsigned int bank_num,
|
||||
unsigned int preset_num);
|
||||
const char *sfont_name, int bank_num,
|
||||
int preset_num);
|
||||
FLUIDSYNTH_API
|
||||
int fluid_synth_get_program(fluid_synth_t* synth, int chan, unsigned int* sfont_id,
|
||||
unsigned int* bank_num, unsigned int* preset_num);
|
||||
int fluid_synth_get_program(fluid_synth_t* synth, int chan, int* sfont_id,
|
||||
int* bank_num, int* preset_num);
|
||||
FLUIDSYNTH_API int fluid_synth_unset_program (fluid_synth_t *synth, int chan);
|
||||
FLUIDSYNTH_API int fluid_synth_program_reset(fluid_synth_t* synth);
|
||||
FLUIDSYNTH_API int fluid_synth_system_reset(fluid_synth_t* synth);
|
||||
|
@ -108,13 +108,13 @@ FLUIDSYNTH_API int fluid_synth_stop(fluid_synth_t* synth, unsigned int id);
|
|||
|
||||
FLUIDSYNTH_API
|
||||
int fluid_synth_sfload(fluid_synth_t* synth, const char* filename, int reset_presets);
|
||||
FLUIDSYNTH_API int fluid_synth_sfreload(fluid_synth_t* synth, unsigned int id);
|
||||
FLUIDSYNTH_API int fluid_synth_sfunload(fluid_synth_t* synth, unsigned int id, int reset_presets);
|
||||
FLUIDSYNTH_API int fluid_synth_sfreload(fluid_synth_t* synth, int id);
|
||||
FLUIDSYNTH_API int fluid_synth_sfunload(fluid_synth_t* synth, int id, int reset_presets);
|
||||
FLUIDSYNTH_API int fluid_synth_add_sfont(fluid_synth_t* synth, fluid_sfont_t* sfont);
|
||||
FLUIDSYNTH_API int fluid_synth_remove_sfont(fluid_synth_t* synth, fluid_sfont_t* sfont);
|
||||
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_id(fluid_synth_t* synth, int id);
|
||||
FLUIDSYNTH_API fluid_sfont_t *fluid_synth_get_sfont_by_name (fluid_synth_t* synth,
|
||||
const char *name);
|
||||
FLUIDSYNTH_API int fluid_synth_set_bank_offset(fluid_synth_t* synth, int sfont_id, int offset);
|
||||
|
|
|
@ -129,7 +129,7 @@ const char* fluid_defsfont_sfont_get_name(fluid_sfont_t* sfont)
|
|||
}
|
||||
|
||||
fluid_preset_t*
|
||||
fluid_defsfont_sfont_get_preset(fluid_sfont_t* sfont, unsigned int bank, unsigned int prenum)
|
||||
fluid_defsfont_sfont_get_preset(fluid_sfont_t* sfont, int bank, int prenum)
|
||||
{
|
||||
return fluid_defsfont_get_preset(fluid_sfont_get_data(sfont), bank, prenum);
|
||||
}
|
||||
|
@ -520,7 +520,7 @@ int fluid_defsfont_add_preset(fluid_defsfont_t* defsfont, fluid_defpreset_t* def
|
|||
/*
|
||||
* fluid_defsfont_get_preset
|
||||
*/
|
||||
fluid_preset_t* fluid_defsfont_get_preset(fluid_defsfont_t* defsfont, unsigned int bank, unsigned int num)
|
||||
fluid_preset_t* fluid_defsfont_get_preset(fluid_defsfont_t* defsfont, int bank, int num)
|
||||
{
|
||||
fluid_preset_t *preset;
|
||||
fluid_list_t *list;
|
||||
|
|
|
@ -84,7 +84,7 @@ fluid_sfont_t* fluid_defsfloader_load(fluid_sfloader_t* loader, const char* file
|
|||
|
||||
int fluid_defsfont_sfont_delete(fluid_sfont_t* sfont);
|
||||
const char* fluid_defsfont_sfont_get_name(fluid_sfont_t* sfont);
|
||||
fluid_preset_t* fluid_defsfont_sfont_get_preset(fluid_sfont_t* sfont, unsigned int bank, unsigned int prenum);
|
||||
fluid_preset_t* fluid_defsfont_sfont_get_preset(fluid_sfont_t* sfont, int bank, int prenum);
|
||||
void fluid_defsfont_sfont_iteration_start(fluid_sfont_t* sfont);
|
||||
fluid_preset_t *fluid_defsfont_sfont_iteration_next(fluid_sfont_t* sfont);
|
||||
|
||||
|
@ -127,7 +127,7 @@ fluid_defsfont_t* new_fluid_defsfont(fluid_settings_t* settings);
|
|||
int delete_fluid_defsfont(fluid_defsfont_t* defsfont);
|
||||
int fluid_defsfont_load(fluid_defsfont_t* defsfont, const fluid_file_callbacks_t* file_callbacks, const char* file);
|
||||
const char* fluid_defsfont_get_name(fluid_defsfont_t* defsfont);
|
||||
fluid_preset_t* fluid_defsfont_get_preset(fluid_defsfont_t* defsfont, unsigned int bank, unsigned int prenum);
|
||||
fluid_preset_t* fluid_defsfont_get_preset(fluid_defsfont_t* defsfont, int bank, int prenum);
|
||||
void fluid_defsfont_iteration_start(fluid_defsfont_t* defsfont);
|
||||
fluid_preset_t *fluid_defsfont_iteration_next(fluid_defsfont_t* defsfont);
|
||||
int fluid_defsfont_load_sampledata(fluid_defsfont_t *defsfont, SFData *sfdata, fluid_sample_t *sample);
|
||||
|
|
|
@ -27,8 +27,8 @@
|
|||
static int fluid_ramsfont_sfont_delete(fluid_sfont_t* sfont);
|
||||
static const char *fluid_ramsfont_sfont_get_name(fluid_sfont_t* sfont);
|
||||
static fluid_preset_t *fluid_ramsfont_sfont_get_preset(fluid_sfont_t* sfont,
|
||||
unsigned int bank,
|
||||
unsigned int prenum);
|
||||
int bank,
|
||||
int prenum);
|
||||
static void fluid_ramsfont_sfont_iteration_start(fluid_sfont_t* sfont);
|
||||
static fluid_preset_t *fluid_ramsfont_sfont_iteration_next(fluid_sfont_t* sfont);
|
||||
static void fluid_rampreset_preset_delete(fluid_preset_t* preset);
|
||||
|
@ -44,7 +44,7 @@ static const char *fluid_ramsfont_get_name(fluid_ramsfont_t* sfont);
|
|||
static int fluid_ramsfont_add_preset (fluid_ramsfont_t* sfont,
|
||||
fluid_rampreset_t* rampreset);
|
||||
static fluid_preset_t *fluid_ramsfont_get_preset (fluid_ramsfont_t* sfont,
|
||||
unsigned int bank, unsigned int num);
|
||||
int bank, int num);
|
||||
static void fluid_ramsfont_iteration_start (fluid_ramsfont_t* sfont);
|
||||
static fluid_preset_t *fluid_ramsfont_iteration_next (fluid_ramsfont_t* sfont);
|
||||
static fluid_rampreset_t* new_fluid_rampreset(fluid_ramsfont_t* sfont);
|
||||
|
@ -127,7 +127,7 @@ fluid_ramsfont_sfont_get_name(fluid_sfont_t* sfont)
|
|||
|
||||
/* RAM SoundFont loader method to get a preset */
|
||||
static fluid_preset_t *
|
||||
fluid_ramsfont_sfont_get_preset(fluid_sfont_t* sfont, unsigned int bank, unsigned int prenum)
|
||||
fluid_ramsfont_sfont_get_preset(fluid_sfont_t* sfont, int bank, int prenum)
|
||||
{
|
||||
return fluid_ramsfont_get_preset((fluid_ramsfont_t*) sfont->data, bank, prenum);
|
||||
}
|
||||
|
@ -307,8 +307,8 @@ fluid_ramsfont_add_preset (fluid_ramsfont_t* sfont, fluid_rampreset_t* rampreset
|
|||
* @return #FLUID_OK on success, #FLUID_FAILED otherwise
|
||||
*/
|
||||
int
|
||||
fluid_ramsfont_add_izone(fluid_ramsfont_t* sfont, unsigned int bank,
|
||||
unsigned int num, fluid_sample_t* sample,
|
||||
fluid_ramsfont_add_izone(fluid_ramsfont_t* sfont, int bank,
|
||||
int num, fluid_sample_t* sample,
|
||||
int lokey, int hikey)
|
||||
{
|
||||
/*- find or create a preset
|
||||
|
@ -363,8 +363,8 @@ fluid_ramsfont_add_izone(fluid_ramsfont_t* sfont, unsigned int bank,
|
|||
* @return #FLUID_OK on success, #FLUID_FAILED otherwise
|
||||
*/
|
||||
int
|
||||
fluid_ramsfont_remove_izone (fluid_ramsfont_t* sfont, unsigned int bank,
|
||||
unsigned int num, fluid_sample_t* sample)
|
||||
fluid_ramsfont_remove_izone (fluid_ramsfont_t* sfont, int bank,
|
||||
int num, fluid_sample_t* sample)
|
||||
{
|
||||
int err;
|
||||
fluid_rampreset_t *rampreset;
|
||||
|
@ -398,8 +398,8 @@ fluid_ramsfont_remove_izone (fluid_ramsfont_t* sfont, unsigned int bank,
|
|||
* @return #FLUID_OK on success, #FLUID_FAILED otherwise
|
||||
*/
|
||||
int
|
||||
fluid_ramsfont_izone_set_gen (fluid_ramsfont_t* sfont, unsigned int bank,
|
||||
unsigned int num, fluid_sample_t* sample,
|
||||
fluid_ramsfont_izone_set_gen (fluid_ramsfont_t* sfont, int bank,
|
||||
int num, fluid_sample_t* sample,
|
||||
int gen_type, float value)
|
||||
{
|
||||
fluid_rampreset_t* rampreset;
|
||||
|
@ -427,8 +427,8 @@ fluid_ramsfont_izone_set_gen (fluid_ramsfont_t* sfont, unsigned int bank,
|
|||
* @return #FLUID_OK on success, #FLUID_FAILED otherwise
|
||||
*/
|
||||
int
|
||||
fluid_ramsfont_izone_set_loop (fluid_ramsfont_t *sfont, unsigned int bank,
|
||||
unsigned int num, fluid_sample_t* sample,
|
||||
fluid_ramsfont_izone_set_loop (fluid_ramsfont_t *sfont, int bank,
|
||||
int num, fluid_sample_t* sample,
|
||||
int on, float loopstart, float loopend)
|
||||
{
|
||||
fluid_rampreset_t* rampreset;
|
||||
|
@ -444,7 +444,7 @@ fluid_ramsfont_izone_set_loop (fluid_ramsfont_t *sfont, unsigned int bank,
|
|||
|
||||
/* Get a preset from a RAM SoundFont */
|
||||
static fluid_preset_t *
|
||||
fluid_ramsfont_get_preset (fluid_ramsfont_t* sfont, unsigned int bank, unsigned int num)
|
||||
fluid_ramsfont_get_preset (fluid_ramsfont_t* sfont, int bank, int num)
|
||||
{
|
||||
fluid_preset_t *preset;
|
||||
fluid_list_t *list;
|
||||
|
|
|
@ -121,7 +121,7 @@ void fluid_sfont_set_iteration_next(fluid_sfont_t* sfont, fluid_sfont_iteration_
|
|||
*/
|
||||
struct _fluid_sfont_t {
|
||||
void* data; /**< User defined data */
|
||||
unsigned int id; /**< SoundFont ID */
|
||||
int id; /**< SoundFont ID */
|
||||
int refcount; /**< SoundFont reference count (1 if no presets referencing it) */
|
||||
int bankofs; /**< Bank offset */
|
||||
|
||||
|
|
|
@ -78,11 +78,11 @@ static int fluid_synth_update_pitch_wheel_sens_LOCAL(fluid_synth_t* synth, int c
|
|||
static int fluid_synth_set_preset (fluid_synth_t *synth, int chan,
|
||||
fluid_preset_t *preset);
|
||||
static fluid_preset_t*
|
||||
fluid_synth_get_preset(fluid_synth_t* synth, unsigned int sfontnum,
|
||||
unsigned int banknum, unsigned int prognum);
|
||||
fluid_synth_get_preset(fluid_synth_t* synth, int sfontnum,
|
||||
int banknum, int prognum);
|
||||
static fluid_preset_t*
|
||||
fluid_synth_get_preset_by_sfont_name(fluid_synth_t* synth, const char *sfontname,
|
||||
unsigned int banknum, unsigned int prognum);
|
||||
int banknum, int prognum);
|
||||
|
||||
static void fluid_synth_update_presets(fluid_synth_t* synth);
|
||||
static void fluid_synth_update_gain_LOCAL(fluid_synth_t* synth);
|
||||
|
@ -2221,8 +2221,8 @@ fluid_synth_set_preset (fluid_synth_t *synth, int chan, fluid_preset_t *preset)
|
|||
* Returns preset pointer or NULL.
|
||||
*/
|
||||
static fluid_preset_t*
|
||||
fluid_synth_get_preset(fluid_synth_t* synth, unsigned int sfontnum,
|
||||
unsigned int banknum, unsigned int prognum)
|
||||
fluid_synth_get_preset(fluid_synth_t* synth, int sfontnum,
|
||||
int banknum, int prognum)
|
||||
{
|
||||
fluid_sfont_t *sfont;
|
||||
fluid_list_t *list;
|
||||
|
@ -2247,7 +2247,7 @@ fluid_synth_get_preset(fluid_synth_t* synth, unsigned int sfontnum,
|
|||
*/
|
||||
static fluid_preset_t*
|
||||
fluid_synth_get_preset_by_sfont_name(fluid_synth_t* synth, const char *sfontname,
|
||||
unsigned int banknum, unsigned int prognum)
|
||||
int banknum, int prognum)
|
||||
{
|
||||
fluid_sfont_t *sfont;
|
||||
fluid_list_t *list;
|
||||
|
@ -2268,8 +2268,8 @@ fluid_synth_get_preset_by_sfont_name(fluid_synth_t* synth, const char *sfontname
|
|||
* Returns preset pointer or NULL.
|
||||
*/
|
||||
fluid_preset_t*
|
||||
fluid_synth_find_preset(fluid_synth_t* synth, unsigned int banknum,
|
||||
unsigned int prognum)
|
||||
fluid_synth_find_preset(fluid_synth_t* synth, int banknum,
|
||||
int prognum)
|
||||
{
|
||||
fluid_preset_t *preset;
|
||||
fluid_sfont_t *sfont;
|
||||
|
@ -2388,10 +2388,11 @@ fluid_synth_program_change(fluid_synth_t* synth, int chan, int prognum)
|
|||
*
|
||||
*/
|
||||
int
|
||||
fluid_synth_bank_select(fluid_synth_t* synth, int chan, unsigned int bank)
|
||||
fluid_synth_bank_select(fluid_synth_t* synth, int chan, int bank)
|
||||
{
|
||||
int result;
|
||||
fluid_return_val_if_fail (bank <= 16383, FLUID_FAILED);
|
||||
fluid_return_val_if_fail (bank >= 0, FLUID_FAILED);
|
||||
FLUID_API_ENTRY_CHAN(FLUID_FAILED);
|
||||
|
||||
/* Allowed only on MIDI channel enabled */
|
||||
|
@ -2415,7 +2416,7 @@ fluid_synth_bank_select(fluid_synth_t* synth, int chan, unsigned int bank)
|
|||
* after having selected the soundfont.
|
||||
*/
|
||||
int
|
||||
fluid_synth_sfont_select(fluid_synth_t* synth, int chan, unsigned int sfont_id)
|
||||
fluid_synth_sfont_select(fluid_synth_t* synth, int chan, int sfont_id)
|
||||
{
|
||||
int result;
|
||||
FLUID_API_ENTRY_CHAN(FLUID_FAILED);
|
||||
|
@ -2457,8 +2458,8 @@ fluid_synth_unset_program (fluid_synth_t *synth, int chan)
|
|||
* @return #FLUID_OK on success, #FLUID_FAILED otherwise
|
||||
*/
|
||||
int
|
||||
fluid_synth_get_program(fluid_synth_t* synth, int chan, unsigned int* sfont_id,
|
||||
unsigned int* bank_num, unsigned int* preset_num)
|
||||
fluid_synth_get_program(fluid_synth_t* synth, int chan, int* sfont_id,
|
||||
int* bank_num, int* preset_num)
|
||||
{
|
||||
int result;
|
||||
fluid_channel_t* channel;
|
||||
|
@ -2472,8 +2473,7 @@ fluid_synth_get_program(fluid_synth_t* synth, int chan, unsigned int* sfont_id,
|
|||
FLUID_API_RETURN_IF_CHAN_DISABLED(FLUID_FAILED);
|
||||
|
||||
channel = synth->channel[chan];
|
||||
fluid_channel_get_sfont_bank_prog(channel, (int *)sfont_id, (int *)bank_num,
|
||||
(int *)preset_num);
|
||||
fluid_channel_get_sfont_bank_prog(channel, sfont_id, bank_num, preset_num);
|
||||
|
||||
/* 128 indicates that the preset is unset. Set to 0 to be backwards compatible. */
|
||||
if (*preset_num == FLUID_UNSET_PROGRAM) *preset_num = 0;
|
||||
|
@ -2492,12 +2492,15 @@ fluid_synth_get_program(fluid_synth_t* synth, int chan, unsigned int* sfont_id,
|
|||
* @return #FLUID_OK on success, #FLUID_FAILED otherwise
|
||||
*/
|
||||
int
|
||||
fluid_synth_program_select(fluid_synth_t* synth, int chan, unsigned int sfont_id,
|
||||
unsigned int bank_num, unsigned int preset_num)
|
||||
fluid_synth_program_select(fluid_synth_t* synth, int chan, int sfont_id,
|
||||
int bank_num, int preset_num)
|
||||
{
|
||||
fluid_preset_t* preset = NULL;
|
||||
fluid_channel_t* channel;
|
||||
int result;
|
||||
fluid_return_val_if_fail(bank_num >= 0, FLUID_FAILED);
|
||||
fluid_return_val_if_fail(preset_num >= 0, FLUID_FAILED);
|
||||
|
||||
FLUID_API_ENTRY_CHAN(FLUID_FAILED);
|
||||
|
||||
/* Allowed only on MIDI channel enabled */
|
||||
|
@ -2533,8 +2536,8 @@ 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,
|
||||
const char *sfont_name, unsigned int bank_num,
|
||||
unsigned int preset_num)
|
||||
const char *sfont_name, int bank_num,
|
||||
int preset_num)
|
||||
{
|
||||
fluid_preset_t* preset = NULL;
|
||||
fluid_channel_t* channel;
|
||||
|
@ -3655,12 +3658,15 @@ fluid_synth_sfload(fluid_synth_t* synth, const char* filename, int reset_presets
|
|||
fluid_sfont_t *sfont;
|
||||
fluid_list_t *list;
|
||||
fluid_sfloader_t *loader;
|
||||
unsigned int sfont_id;
|
||||
int sfont_id;
|
||||
|
||||
fluid_return_val_if_fail (synth != NULL, FLUID_FAILED);
|
||||
fluid_return_val_if_fail (filename != NULL, FLUID_FAILED);
|
||||
fluid_synth_api_enter(synth);
|
||||
|
||||
sfont_id = synth->sfont_id;
|
||||
if(++sfont_id != FLUID_FAILED)
|
||||
{
|
||||
/* MT NOTE: Loaders list should not change. */
|
||||
|
||||
for (list = synth->loaders; list; list = fluid_list_next(list)) {
|
||||
|
@ -3670,17 +3676,17 @@ fluid_synth_sfload(fluid_synth_t* synth, const char* filename, int reset_presets
|
|||
|
||||
if (sfont != NULL) {
|
||||
sfont->refcount++;
|
||||
sfont->id = sfont_id = ++synth->sfont_id;
|
||||
synth->sfont_id = sfont->id = sfont_id;
|
||||
|
||||
synth->sfont = fluid_list_prepend(synth->sfont, sfont); /* prepend to list */
|
||||
|
||||
/* reset the presets for all channels if requested */
|
||||
if (reset_presets) fluid_synth_program_reset(synth);
|
||||
|
||||
FLUID_API_RETURN((int)sfont_id);
|
||||
FLUID_API_RETURN(sfont_id);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
FLUID_LOG(FLUID_ERR, "Failed to load SoundFont \"%s\"", filename);
|
||||
FLUID_API_RETURN(FLUID_FAILED);
|
||||
}
|
||||
|
@ -3693,7 +3699,7 @@ fluid_synth_sfload(fluid_synth_t* synth, const char* filename, int reset_presets
|
|||
* @return #FLUID_OK on success, #FLUID_FAILED on error
|
||||
*/
|
||||
int
|
||||
fluid_synth_sfunload(fluid_synth_t* synth, unsigned int id, int reset_presets)
|
||||
fluid_synth_sfunload(fluid_synth_t* synth, int id, int reset_presets)
|
||||
{
|
||||
fluid_sfont_t *sfont = NULL;
|
||||
fluid_list_t *list;
|
||||
|
@ -3767,7 +3773,7 @@ fluid_synth_sfunload_callback(void* data, unsigned int msec)
|
|||
* @return SoundFont ID on success, #FLUID_FAILED on error
|
||||
*/
|
||||
int
|
||||
fluid_synth_sfreload(fluid_synth_t* synth, unsigned int id)
|
||||
fluid_synth_sfreload(fluid_synth_t* synth, int id)
|
||||
{
|
||||
char *filename = NULL;
|
||||
fluid_sfont_t *sfont;
|
||||
|
@ -3831,18 +3837,21 @@ exit:
|
|||
int
|
||||
fluid_synth_add_sfont(fluid_synth_t* synth, fluid_sfont_t* sfont)
|
||||
{
|
||||
unsigned int sfont_id;
|
||||
int sfont_id;
|
||||
|
||||
fluid_return_val_if_fail (synth != NULL, FLUID_FAILED);
|
||||
fluid_return_val_if_fail (sfont != NULL, FLUID_FAILED);
|
||||
fluid_synth_api_enter(synth);
|
||||
|
||||
|
||||
sfont->id = sfont_id = ++synth->sfont_id;
|
||||
sfont_id = synth->sfont_id;
|
||||
if(++sfont_id != FLUID_FAILED)
|
||||
{
|
||||
synth->sfont_id = sfont->id = sfont_id;
|
||||
synth->sfont = fluid_list_prepend (synth->sfont, sfont); /* prepend to list */
|
||||
|
||||
/* reset the presets for all channels */
|
||||
fluid_synth_program_reset (synth);
|
||||
}
|
||||
|
||||
FLUID_API_RETURN(sfont_id);
|
||||
}
|
||||
|
@ -3936,7 +3945,7 @@ fluid_synth_get_sfont(fluid_synth_t* synth, unsigned int num)
|
|||
* the duration of use of the returned pointer.
|
||||
*/
|
||||
fluid_sfont_t *
|
||||
fluid_synth_get_sfont_by_id(fluid_synth_t* synth, unsigned int id)
|
||||
fluid_synth_get_sfont_by_id(fluid_synth_t* synth, int id)
|
||||
{
|
||||
fluid_sfont_t* sfont = NULL;
|
||||
fluid_list_t* list;
|
||||
|
@ -5295,7 +5304,7 @@ fluid_synth_set_bank_offset(fluid_synth_t* synth, int sfont_id, int offset)
|
|||
for (list = synth->sfont; list; list = fluid_list_next(list)) {
|
||||
sfont = fluid_list_get (list);
|
||||
|
||||
if (fluid_sfont_get_id (sfont) == (unsigned int)sfont_id)
|
||||
if (fluid_sfont_get_id (sfont) == sfont_id)
|
||||
{
|
||||
sfont->bankofs = offset;
|
||||
break;
|
||||
|
@ -5330,7 +5339,7 @@ fluid_synth_get_bank_offset(fluid_synth_t* synth, int sfont_id)
|
|||
for (list = synth->sfont; list; list = fluid_list_next(list)) {
|
||||
sfont = fluid_list_get (list);
|
||||
|
||||
if (fluid_sfont_get_id (sfont) == (unsigned int)sfont_id)
|
||||
if (fluid_sfont_get_id (sfont) == sfont_id)
|
||||
{
|
||||
offset = sfont->bankofs;
|
||||
break;
|
||||
|
|
|
@ -114,7 +114,7 @@ struct _fluid_synth_t
|
|||
|
||||
fluid_list_t *loaders; /**< the SoundFont loaders */
|
||||
fluid_list_t *sfont; /**< List of fluid_sfont_info_t for each loaded SoundFont (remains until SoundFont is unloaded) */
|
||||
unsigned int sfont_id; /**< Incrementing ID assigned to each loaded SoundFont */
|
||||
int sfont_id; /**< Incrementing ID assigned to each loaded SoundFont */
|
||||
|
||||
float gain; /**< master gain */
|
||||
fluid_channel_t** channel; /**< the channels */
|
||||
|
@ -174,8 +174,8 @@ typedef int (*fluid_audio_callback_t)(fluid_synth_t* synth, int len,
|
|||
void* out2, int roff, int rincr);
|
||||
|
||||
fluid_preset_t* fluid_synth_find_preset(fluid_synth_t* synth,
|
||||
unsigned int banknum,
|
||||
unsigned int prognum);
|
||||
int banknum,
|
||||
int prognum);
|
||||
void fluid_synth_sfont_unref (fluid_synth_t *synth, fluid_sfont_t *sfont);
|
||||
|
||||
void fluid_synth_dither_s16(int *dither_index, int len, float* lin, float* rin,
|
||||
|
|
Loading…
Reference in a new issue