Update to fluidsynth-2.2

This commit is contained in:
Robin Gareus 2021-04-18 21:25:20 +02:00
parent dd060b04dc
commit 71788ecfe4
No known key found for this signature in database
GPG key ID: A090BCE02CF57F04
62 changed files with 4719 additions and 2064 deletions

View file

@ -252,6 +252,7 @@ delete_fluid_set_setting(fluid_setting_node_t *node)
/**
* Create a new settings object
*
* @return the pointer to the settings object
*/
fluid_settings_t *
@ -275,6 +276,7 @@ new_fluid_settings(void)
/**
* Delete the provided settings object
*
* @param settings a settings object
*/
void
@ -543,6 +545,7 @@ fluid_settings_register_str(fluid_settings_t *settings, const char *name, const
if(node->type == FLUID_STR_TYPE)
{
fluid_str_setting_t *setting = &node->str;
FLUID_FREE(setting->def);
setting->def = def ? FLUID_STRDUP(def) : NULL;
setting->hints = hints;
retval = FLUID_OK;
@ -790,6 +793,40 @@ int fluid_settings_callback_int(fluid_settings_t *settings, const char *name,
return FLUID_OK;
}
void* fluid_settings_get_user_data(fluid_settings_t * settings, const char *name)
{
fluid_setting_node_t *node;
void* retval = NULL;
fluid_return_val_if_fail(settings != NULL, NULL);
fluid_return_val_if_fail(name != NULL, NULL);
fluid_return_val_if_fail(name[0] != '\0', NULL);
fluid_rec_mutex_lock(settings->mutex);
if(fluid_settings_get(settings, name, &node) == FLUID_OK)
{
if(node->type == FLUID_NUM_TYPE)
{
fluid_num_setting_t *setting = &node->num;
retval = setting->data;
}
else if(node->type == FLUID_STR_TYPE)
{
fluid_str_setting_t *setting = &node->str;
retval = setting->data;
}
else if(node->type == FLUID_INT_TYPE)
{
fluid_int_setting_t *setting = &node->i;
retval = setting->data;
}
}
fluid_rec_mutex_unlock(settings->mutex);
return retval;
}
/**
* Get the type of the setting with the given name
*
@ -872,6 +909,10 @@ fluid_settings_get_hints(fluid_settings_t *settings, const char *name, int *hint
* @param settings a settings object
* @param name a setting's name
* @return TRUE if the setting is changeable in real-time, FALSE otherwise
*
* @note Before using this function, make sure the @p settings object has already been used to create
* a synthesizer, a MIDI driver, an audio driver, a MIDI player, or a command handler (depending on
* which settings you want to query).
*/
int
fluid_settings_is_realtime(fluid_settings_t *settings, const char *name)
@ -980,15 +1021,17 @@ error_recovery:
/**
* Copy the value of a string setting into the provided buffer (thread safe)
*
* @param settings a settings object
* @param name a setting's name
* @param str Caller supplied buffer to copy string value to
* @param len Size of 'str' buffer (no more than len bytes will be written, which
* will always include a zero terminator)
* @return #FLUID_OK if the value exists, #FLUID_FAILED otherwise
* @since 1.1.0
*
* @note A size of 256 should be more than sufficient for the string buffer.
*
* @since 1.1.0
*/
int
fluid_settings_copystr(fluid_settings_t *settings, const char *name,
@ -1040,14 +1083,16 @@ fluid_settings_copystr(fluid_settings_t *settings, const char *name,
/**
* Duplicate the value of a string setting
*
* @param settings a settings object
* @param name a setting's name
* @param str Location to store pointer to allocated duplicate string
* @return #FLUID_OK if the value exists and was successfully duplicated, #FLUID_FAILED otherwise
* @since 1.1.0
*
* Like fluid_settings_copystr() but allocates a new copy of the string. Caller
* owns the string and should free it with fluid_free() when done using it.
*
* @since 1.1.0
*/
int
fluid_settings_dupstr(fluid_settings_t *settings, const char *name, char **str)
@ -1159,19 +1204,20 @@ fluid_settings_str_equal(fluid_settings_t *settings, const char *name, const cha
}
/**
* Get the default value of a string setting. Note that the returned string is
* not owned by the caller and should not be modified or freed.
* Get the default value of a string setting.
*
* @param settings a settings object
* @param name a setting's name
* @param def the default string value of the setting if it exists
* @return FLUID_OK on success, FLUID_FAILED otherwise
* @return FLUID_OK if a default vaule exists, FLUID_FAILED otherwise
*
* @note The returned string is not owned by the caller and should not be modified or freed.
*/
int
fluid_settings_getstr_default(fluid_settings_t *settings, const char *name, char **def)
fluid_settings_getstr_default(fluid_settings_t *settings, const char *name, char const **def)
{
fluid_setting_node_t *node;
char *retval = NULL;
char const *retval = NULL;
fluid_return_val_if_fail(settings != NULL, FLUID_FAILED);
fluid_return_val_if_fail(name != NULL, FLUID_FAILED);
@ -1205,6 +1251,7 @@ fluid_settings_getstr_default(fluid_settings_t *settings, const char *name, char
/**
* Add an option to a string setting (like an enumeration value).
*
* @param settings a settings object
* @param name a setting's name
* @param s option string to add
@ -1242,6 +1289,7 @@ fluid_settings_add_option(fluid_settings_t *settings, const char *name, const ch
/**
* Remove an option previously assigned by fluid_settings_add_option().
*
* @param settings a settings object
* @param name a setting's name
* @param s option string to remove
@ -1567,6 +1615,7 @@ fluid_settings_getint(fluid_settings_t *settings, const char *name, int *val)
/**
* Get the range of values of an integer setting
*
* @param settings a settings object
* @param name a setting's name
* @param min setting's range lower limit
@ -1692,10 +1741,12 @@ fluid_settings_foreach_option(fluid_settings_t *settings, const char *name,
/**
* Count option string values for a string setting.
*
* @param settings a settings object
* @param name Name of setting
* @return Count of options for this string setting (0 if none, -1 if not found
* or not a string setting)
*
* @since 1.1.0
*/
int
@ -1723,11 +1774,13 @@ fluid_settings_option_count(fluid_settings_t *settings, const char *name)
/**
* Concatenate options for a string setting together with a separator between.
*
* @param settings Settings object
* @param name Settings name
* @param separator String to use between options (NULL to use ", ")
* @return Newly allocated string or NULL on error (out of memory, not a valid
* setting \p name or not a string setting). Free the string when finished with it by using fluid_free().
*
* @since 1.1.0
*/
char *