settings.h File Reference

Synthesizer settings. More...

Defines

#define FLUID_HINT_BOUNDED_BELOW   0x1
 Hint FLUID_HINT_BOUNDED_BELOW indicates that the LowerBound field of the FLUID_PortRangeHint should be considered meaningful.
#define FLUID_HINT_BOUNDED_ABOVE   0x2
 Hint FLUID_HINT_BOUNDED_ABOVE indicates that the UpperBound field of the FLUID_PortRangeHint should be considered meaningful.
#define FLUID_HINT_TOGGLED   0x4
 Hint FLUID_HINT_TOGGLED indicates that the data item should be considered a Boolean toggle.
#define FLUID_HINT_SAMPLE_RATE   0x8
 Hint FLUID_HINT_SAMPLE_RATE indicates that any bounds specified should be interpreted as multiples of the sample rate.
#define FLUID_HINT_LOGARITHMIC   0x10
 Hint FLUID_HINT_LOGARITHMIC indicates that it is likely that the user will find it more intuitive to view values using a logarithmic scale.
#define FLUID_HINT_INTEGER   0x20
 Hint FLUID_HINT_INTEGER indicates that a user interface would probably wish to provide a stepped control taking only integer values.
#define FLUID_HINT_FILENAME   0x01
 String setting is a file name.
#define FLUID_HINT_OPTIONLIST   0x02
 Setting is a list of string options.

Typedefs

typedef void(* fluid_settings_foreach_option_t )(void *data, char *name, char *option)
 Callback function type used with fluid_settings_foreach_option().
typedef void(* fluid_settings_foreach_t )(void *data, char *name, int type)
 Callback function type used with fluid_settings_foreach().

Enumerations

enum  fluid_types_enum {
  FLUID_NO_TYPE = -1, FLUID_NUM_TYPE, FLUID_INT_TYPE, FLUID_STR_TYPE,
  FLUID_SET_TYPE
}
 

Settings type.

More...

Functions

FLUIDSYNTH_API fluid_settings_tnew_fluid_settings (void)
 Create a new settings object.
FLUIDSYNTH_API void delete_fluid_settings (fluid_settings_t *settings)
 Delete the provided settings object.
FLUIDSYNTH_API int fluid_settings_get_type (fluid_settings_t *settings, const char *name)
 Get the type of the setting with the given name.
FLUIDSYNTH_API int fluid_settings_get_hints (fluid_settings_t *settings, const char *name)
 Get the hints for the named setting as an integer bitmap.
FLUIDSYNTH_API int fluid_settings_is_realtime (fluid_settings_t *settings, const char *name)
 Ask whether the setting is changeable in real-time.
FLUIDSYNTH_API int fluid_settings_setstr (fluid_settings_t *settings, const char *name, const char *str)
 Set a string value for a named setting.
FLUIDSYNTH_API int fluid_settings_copystr (fluid_settings_t *settings, const char *name, char *str, int len)
 Copy the value of a string setting.
FLUIDSYNTH_API int fluid_settings_dupstr (fluid_settings_t *settings, const char *name, char **str)
 Duplicate the value of a string setting.
FLUIDSYNTH_API int fluid_settings_getstr (fluid_settings_t *settings, const char *name, char **str)
 Get the value of a string setting.
FLUIDSYNTH_API char * fluid_settings_getstr_default (fluid_settings_t *settings, const char *name)
 Get the default value of a string setting.
FLUIDSYNTH_API int fluid_settings_str_equal (fluid_settings_t *settings, const char *name, const char *value)
 Test a string setting for some value.
FLUIDSYNTH_API int fluid_settings_setnum (fluid_settings_t *settings, const char *name, double val)
 Set a numeric value for a named setting.
FLUIDSYNTH_API int fluid_settings_getnum (fluid_settings_t *settings, const char *name, double *val)
 Get the numeric value of a named setting.
FLUIDSYNTH_API double fluid_settings_getnum_default (fluid_settings_t *settings, const char *name)
 Get the default value of a named numeric (double) setting.
FLUIDSYNTH_API void fluid_settings_getnum_range (fluid_settings_t *settings, const char *name, double *min, double *max)
 Get the range of values of a numeric setting.
FLUIDSYNTH_API int fluid_settings_setint (fluid_settings_t *settings, const char *name, int val)
 Set an integer value for a setting.
FLUIDSYNTH_API int fluid_settings_getint (fluid_settings_t *settings, const char *name, int *val)
 Get an integer value setting.
FLUIDSYNTH_API int fluid_settings_getint_default (fluid_settings_t *settings, const char *name)
 Get the default value of an integer setting.
FLUIDSYNTH_API void fluid_settings_getint_range (fluid_settings_t *settings, const char *name, int *min, int *max)
 Get the range of values of an integer setting.
FLUIDSYNTH_API void fluid_settings_foreach_option (fluid_settings_t *settings, const char *name, void *data, fluid_settings_foreach_option_t func)
 Iterate the available options for a named string setting, calling the provided callback function for each existing option.
FLUIDSYNTH_API int fluid_settings_option_count (fluid_settings_t *settings, const char *name)
 Count option string values for a string setting.
FLUIDSYNTH_API char * fluid_settings_option_concat (fluid_settings_t *settings, const char *name, const char *separator)
 Concatenate options for a string setting together with a separator between.
FLUIDSYNTH_API void fluid_settings_foreach (fluid_settings_t *settings, void *data, fluid_settings_foreach_t func)
 Iterate the existing settings defined in a settings object, calling the provided callback function for each setting.

Detailed Description

Synthesizer settings.


Define Documentation

#define FLUID_HINT_BOUNDED_BELOW   0x1

Hint FLUID_HINT_BOUNDED_BELOW indicates that the LowerBound field of the FLUID_PortRangeHint should be considered meaningful.

The value in this field should be considered the (inclusive) lower bound of the valid range. If FLUID_HINT_SAMPLE_RATE is also specified then the value of LowerBound should be multiplied by the sample rate.

#define FLUID_HINT_BOUNDED_ABOVE   0x2

Hint FLUID_HINT_BOUNDED_ABOVE indicates that the UpperBound field of the FLUID_PortRangeHint should be considered meaningful.

The value in this field should be considered the (inclusive) upper bound of the valid range. If FLUID_HINT_SAMPLE_RATE is also specified then the value of UpperBound should be multiplied by the sample rate.

#define FLUID_HINT_TOGGLED   0x4

Hint FLUID_HINT_TOGGLED indicates that the data item should be considered a Boolean toggle.

Data less than or equal to zero should be considered `off' or `false,' and data above zero should be considered `on' or `true.' FLUID_HINT_TOGGLED may not be used in conjunction with any other hint.

Referenced by fluid_settings_copystr(), fluid_settings_dupstr(), fluid_settings_getstr(), fluid_settings_getstr_default(), fluid_settings_setstr(), and fluid_settings_str_equal().

#define FLUID_HINT_SAMPLE_RATE   0x8

Hint FLUID_HINT_SAMPLE_RATE indicates that any bounds specified should be interpreted as multiples of the sample rate.

For instance, a frequency range from 0Hz to the Nyquist frequency (half the sample rate) could be requested by this hint in conjunction with LowerBound = 0 and UpperBound = 0.5. Hosts that support bounds at all must support this hint to retain meaning.

#define FLUID_HINT_LOGARITHMIC   0x10

Hint FLUID_HINT_LOGARITHMIC indicates that it is likely that the user will find it more intuitive to view values using a logarithmic scale.

This is particularly useful for frequencies and gains.

#define FLUID_HINT_INTEGER   0x20

Hint FLUID_HINT_INTEGER indicates that a user interface would probably wish to provide a stepped control taking only integer values.

Deprecated:

As there is an integer setting type, this hint is not used.


Typedef Documentation

typedef void(* fluid_settings_foreach_option_t)(void *data, char *name, char *option)

Callback function type used with fluid_settings_foreach_option().

Parameters:
data User defined data pointer
name Setting name
option A string option for this setting (iterates through the list)
typedef void(* fluid_settings_foreach_t)(void *data, char *name, int type)

Callback function type used with fluid_settings_foreach().

Parameters:
data User defined data pointer
name Setting name
type Setting type (fluid_types_enum)

Enumeration Type Documentation

Settings type.

Each setting has a defined type: numeric (double), integer, string or a set of values. The type of each setting can be retrieved using the function fluid_settings_get_type()

Enumerator:
FLUID_NO_TYPE 

Undefined type.

FLUID_NUM_TYPE 

Numeric (double).

FLUID_INT_TYPE 

Integer.

FLUID_STR_TYPE 

String.

FLUID_SET_TYPE 

Set of values.


Function Documentation

FLUIDSYNTH_API fluid_settings_t* new_fluid_settings ( void   ) 

Create a new settings object.

Returns:
the pointer to the settings object
Examples:
example.c, fluidsynth_arpeggio.c, fluidsynth_fx.c, fluidsynth_metronome.c, and fluidsynth_simple.c.

References new_fluid_settings().

Referenced by new_fluid_settings().

FLUIDSYNTH_API void delete_fluid_settings ( fluid_settings_t settings  ) 

Delete the provided settings object.

Parameters:
settings a settings object
Examples:
example.c, fluidsynth_arpeggio.c, fluidsynth_fx.c, fluidsynth_metronome.c, and fluidsynth_simple.c.

References delete_fluid_settings().

Referenced by delete_fluid_settings().

FLUIDSYNTH_API int fluid_settings_get_type ( fluid_settings_t settings,
const char *  name 
)

Get the type of the setting with the given name.

Parameters:
settings a settings object
name a setting's name
Returns:
the type for the named setting, or FLUID_NO_TYPE when it does not exist

References FLUID_NO_TYPE, and fluid_settings_get_type().

Referenced by fluid_settings_get_type().

FLUIDSYNTH_API int fluid_settings_get_hints ( fluid_settings_t settings,
const char *  name 
)

Get the hints for the named setting as an integer bitmap.

Parameters:
settings a settings object
name a setting's name
Returns:
the hints associated to the named setting if it exists, zero otherwise

References FLUID_INT_TYPE, FLUID_NUM_TYPE, fluid_settings_get_hints(), and FLUID_STR_TYPE.

Referenced by fluid_settings_get_hints().

FLUIDSYNTH_API int fluid_settings_is_realtime ( fluid_settings_t settings,
const char *  name 
)

Ask whether the setting is changeable in real-time.

Parameters:
settings a settings object
name a setting's name
Returns:
non zero if the setting is changeable in real-time

References FLUID_INT_TYPE, FLUID_NUM_TYPE, fluid_settings_is_realtime(), and FLUID_STR_TYPE.

Referenced by fluid_settings_is_realtime().

FLUIDSYNTH_API int fluid_settings_setstr ( fluid_settings_t settings,
const char *  name,
const char *  str 
)

Set a string value for a named setting.

Parameters:
settings a settings object
name a setting's name
str new string value
Returns:
1 if the value has been set, 0 otherwise

References FLUID_HINT_TOGGLED, FLUID_INT_TYPE, fluid_settings_setstr(), and FLUID_STR_TYPE.

Referenced by fluid_settings_setstr().

FLUIDSYNTH_API int fluid_settings_copystr ( fluid_settings_t settings,
const char *  name,
char *  str,
int  len 
)

Copy the value of a string setting.

Parameters:
settings a settings object
name a setting's name
str Caller supplied buffer to copy string value to
len Size of 'str' buffer (no more than len bytes will be written, which will always include a zero terminator)
Returns:
1 if the value exists, 0 otherwise
Since:
1.1.0

Like fluid_settings_getstr() but is thread safe. A size of 256 should be more than sufficient for the string buffer.

References FLUID_HINT_TOGGLED, FLUID_INT_TYPE, fluid_settings_copystr(), and FLUID_STR_TYPE.

Referenced by fluid_settings_copystr().

FLUIDSYNTH_API int fluid_settings_dupstr ( fluid_settings_t settings,
const char *  name,
char **  str 
)

Duplicate the value of a string setting.

Parameters:
settings a settings object
name a setting's name
str Location to store pointer to allocated duplicate string
Returns:
1 if the value exists and was successfully duplicated, 0 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 free() when done using it.

References FLUID_ERR, FLUID_HINT_TOGGLED, FLUID_INT_TYPE, fluid_settings_dupstr(), and FLUID_STR_TYPE.

Referenced by fluid_settings_dupstr(), new_fluid_audio_driver(), new_fluid_audio_driver2(), and new_fluid_file_renderer().

FLUIDSYNTH_API int fluid_settings_getstr ( fluid_settings_t settings,
const char *  name,
char **  str 
)

Get the value of a string setting.

Parameters:
settings a settings object
name a setting's name
str Location to store pointer to the settings string value
Returns:
1 if the value exists, 0 otherwise
Deprecated:

If the value does not exists, 'str' is set to NULL. Otherwise, 'str' will point to the value. The application does not own the returned value and it is valid only until a new value is assigned to the setting of the given name.

NOTE: In a multi-threaded environment, caller must ensure that the setting being read by fluid_settings_getstr() is not assigned during the duration of callers use of the setting's value. Use fluid_settings_copystr() or fluid_settings_dupstr() which does not have this restriction.

References FLUID_HINT_TOGGLED, FLUID_INT_TYPE, fluid_settings_getstr(), and FLUID_STR_TYPE.

Referenced by fluid_settings_getstr().

FLUIDSYNTH_API char* fluid_settings_getstr_default ( fluid_settings_t settings,
const char *  name 
)

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.

Parameters:
settings a settings object
name a setting's name
Returns:
the default string value of the setting if it exists, NULL otherwise

References FLUID_HINT_TOGGLED, FLUID_INT_TYPE, fluid_settings_getstr_default(), and FLUID_STR_TYPE.

Referenced by fluid_settings_getstr_default().

FLUIDSYNTH_API int fluid_settings_str_equal ( fluid_settings_t settings,
const char *  name,
const char *  s 
)

Test a string setting for some value.

Parameters:
settings a settings object
name a setting's name
s a string to be tested
Returns:
1 if the value exists and is equal to 's', 0 otherwise

References FLUID_HINT_TOGGLED, FLUID_INT_TYPE, fluid_settings_str_equal(), and FLUID_STR_TYPE.

Referenced by fluid_settings_str_equal(), new_fluid_audio_driver(), new_fluid_audio_driver2(), new_fluid_midi_driver(), new_fluid_player(), and new_fluid_synth().

FLUIDSYNTH_API int fluid_settings_setnum ( fluid_settings_t settings,
const char *  name,
double  val 
)

Set a numeric value for a named setting.

Parameters:
settings a settings object
name a setting's name
val new setting's value
Returns:
1 if the value has been set, 0 otherwise

References FLUID_NUM_TYPE, and fluid_settings_setnum().

Referenced by fluid_settings_setnum().

FLUIDSYNTH_API int fluid_settings_getnum ( fluid_settings_t settings,
const char *  name,
double *  val 
)

Get the numeric value of a named setting.

Parameters:
settings a settings object
name a setting's name
val variable pointer to receive the setting's numeric value
Returns:
1 if the value exists, 0 otherwise

References FLUID_NUM_TYPE, and fluid_settings_getnum().

Referenced by fluid_settings_getnum(), new_fluid_file_renderer(), and new_fluid_synth().

FLUIDSYNTH_API double fluid_settings_getnum_default ( fluid_settings_t settings,
const char *  name 
)

Get the default value of a named numeric (double) setting.

Parameters:
settings a settings object
name a setting's name
Returns:
the default value if the named setting exists, 0.0f otherwise

References FLUID_NUM_TYPE, and fluid_settings_getnum_default().

Referenced by fluid_settings_getnum_default().

FLUIDSYNTH_API void fluid_settings_getnum_range ( fluid_settings_t settings,
const char *  name,
double *  min,
double *  max 
)

Get the range of values of a numeric setting.

Parameters:
settings a settings object
name a setting's name
min setting's range lower limit
max setting's range upper limit

References FLUID_NUM_TYPE, and fluid_settings_getnum_range().

Referenced by fluid_settings_getnum_range().

FLUIDSYNTH_API int fluid_settings_setint ( fluid_settings_t settings,
const char *  name,
int  val 
)

Set an integer value for a setting.

Parameters:
settings a settings object
name a setting's name
val new setting's integer value
Returns:
1 if the value has been set, 0 otherwise

References FLUID_INT_TYPE, and fluid_settings_setint().

Referenced by fluid_settings_setint(), and new_fluid_synth().

FLUIDSYNTH_API int fluid_settings_getint ( fluid_settings_t settings,
const char *  name,
int *  val 
)

Get an integer value setting.

Parameters:
settings a settings object
name a setting's name
val pointer to a variable to receive the setting's integer value
Returns:
1 if the value exists, 0 otherwise

References FLUID_INT_TYPE, and fluid_settings_getint().

Referenced by fluid_settings_getint(), fluid_synth_set_sample_rate(), new_fluid_file_renderer(), new_fluid_midi_router(), new_fluid_player(), new_fluid_server(), and new_fluid_synth().

FLUIDSYNTH_API int fluid_settings_getint_default ( fluid_settings_t settings,
const char *  name 
)

Get the default value of an integer setting.

Parameters:
settings a settings object
name a setting's name
Returns:
the setting's default integer value it it exists, zero otherwise

References FLUID_INT_TYPE, and fluid_settings_getint_default().

Referenced by fluid_settings_getint_default().

FLUIDSYNTH_API void fluid_settings_getint_range ( fluid_settings_t settings,
const char *  name,
int *  min,
int *  max 
)

Get the range of values of an integer setting.

Parameters:
settings a settings object
name a setting's name
min setting's range lower limit
max setting's range upper limit

References FLUID_INT_TYPE, and fluid_settings_getint_range().

Referenced by fluid_settings_getint_range().

FLUIDSYNTH_API void fluid_settings_foreach_option ( fluid_settings_t settings,
const char *  name,
void *  data,
fluid_settings_foreach_option_t  func 
)

Iterate the available options for a named string setting, calling the provided callback function for each existing option.

Parameters:
settings a settings object
name a setting's name
data any user provided pointer
func callback function to be called on each iteration

NOTE: Starting with FluidSynth 1.1.0 the func callback is called for each option in alphabetical order. Sort order was undefined in previous versions.

References fluid_settings_foreach_option(), and FLUID_STR_TYPE.

Referenced by fluid_settings_foreach_option().

FLUIDSYNTH_API int fluid_settings_option_count ( fluid_settings_t settings,
const char *  name 
)

Count option string values for a string setting.

Parameters:
settings a settings object
name Name of setting
Returns:
Count of options for this string setting (0 if none, -1 if not found or not a string setting)
Since:
1.1.0

References fluid_settings_option_count(), and FLUID_STR_TYPE.

Referenced by fluid_settings_option_count().

FLUIDSYNTH_API char* fluid_settings_option_concat ( fluid_settings_t settings,
const char *  name,
const char *  separator 
)

Concatenate options for a string setting together with a separator between.

Parameters:
settings Settings object
name Settings name
separator String to use between options (NULL to use ", ")
Returns:
Newly allocated string or NULL on error (out of memory, not a valid setting name or not a string setting). Free the string when finished with it.
Since:
1.1.0

References FLUID_ERR, fluid_settings_option_concat(), and FLUID_STR_TYPE.

Referenced by fluid_settings_option_concat(), new_fluid_audio_driver(), and new_fluid_midi_driver().

FLUIDSYNTH_API void fluid_settings_foreach ( fluid_settings_t settings,
void *  data,
fluid_settings_foreach_t  func 
)

Iterate the existing settings defined in a settings object, calling the provided callback function for each setting.

Parameters:
settings a settings object
data any user provided pointer
func callback function to be called on each iteration

NOTE: Starting with FluidSynth 1.1.0 the func callback is called for each setting in alphabetical order. Sort order was undefined in previous versions.

References fluid_settings_foreach().

Referenced by fluid_settings_foreach().

Generated on Mon Sep 6 12:29:27 2010 for libfluidsynth by  doxygen 1.6.3