libfluidsynth  2.0.2
Enumerations | Functions
mod.h File Reference

SoundFont modulator functions and constants. More...

Enumerations

enum  fluid_mod_flags {
  FLUID_MOD_POSITIVE = 0, FLUID_MOD_NEGATIVE = 1, FLUID_MOD_UNIPOLAR = 0, FLUID_MOD_BIPOLAR = 2,
  FLUID_MOD_LINEAR = 0, FLUID_MOD_CONCAVE = 4, FLUID_MOD_CONVEX = 8, FLUID_MOD_SWITCH = 12,
  FLUID_MOD_GC = 0, FLUID_MOD_CC = 16, FLUID_MOD_SIN = 0x80
}
 Flags defining the polarity, mapping function and type of a modulator source. More...
 
enum  fluid_mod_src {
  FLUID_MOD_NONE = 0, FLUID_MOD_VELOCITY = 2, FLUID_MOD_KEY = 3, FLUID_MOD_KEYPRESSURE = 10,
  FLUID_MOD_CHANNELPRESSURE = 13, FLUID_MOD_PITCHWHEEL = 14, FLUID_MOD_PITCHWHEELSENS = 16
}
 General controller (if FLUID_MOD_GC in flags). More...
 

Functions

FLUIDSYNTH_API fluid_mod_tnew_fluid_mod (void)
 Create a new uninitialized modulator structure. More...
 
FLUIDSYNTH_API void delete_fluid_mod (fluid_mod_t *mod)
 Free a modulator structure. More...
 
FLUIDSYNTH_API size_t fluid_mod_sizeof (void)
 Returns the size of the fluid_mod_t structure. More...
 
FLUIDSYNTH_API void fluid_mod_set_source1 (fluid_mod_t *mod, int src, int flags)
 Set a modulator's primary source controller and flags. More...
 
FLUIDSYNTH_API void fluid_mod_set_source2 (fluid_mod_t *mod, int src, int flags)
 Set a modulator's secondary source controller and flags. More...
 
FLUIDSYNTH_API void fluid_mod_set_dest (fluid_mod_t *mod, int dst)
 Set the destination effect of a modulator. More...
 
FLUIDSYNTH_API void fluid_mod_set_amount (fluid_mod_t *mod, double amount)
 Set the scale amount of a modulator. More...
 
FLUIDSYNTH_API int fluid_mod_get_source1 (const fluid_mod_t *mod)
 Get the primary source value from a modulator. More...
 
FLUIDSYNTH_API int fluid_mod_get_flags1 (const fluid_mod_t *mod)
 Get primary source flags from a modulator. More...
 
FLUIDSYNTH_API int fluid_mod_get_source2 (const fluid_mod_t *mod)
 Get the secondary source value from a modulator. More...
 
FLUIDSYNTH_API int fluid_mod_get_flags2 (const fluid_mod_t *mod)
 Get secondary source flags from a modulator. More...
 
FLUIDSYNTH_API int fluid_mod_get_dest (const fluid_mod_t *mod)
 Get destination effect from a modulator. More...
 
FLUIDSYNTH_API double fluid_mod_get_amount (const fluid_mod_t *mod)
 Get the scale amount from a modulator. More...
 
FLUIDSYNTH_API int fluid_mod_test_identity (const fluid_mod_t *mod1, const fluid_mod_t *mod2)
 Checks if two modulators are identical in sources, flags and destination. More...
 
FLUIDSYNTH_API int fluid_mod_has_source (const fluid_mod_t *mod, int cc, int ctrl)
 Check if the modulator has the given source. More...
 
FLUIDSYNTH_API int fluid_mod_has_dest (const fluid_mod_t *mod, int gen)
 Check if the modulator has the given destination. More...
 
FLUIDSYNTH_API void fluid_mod_clone (fluid_mod_t *mod, const fluid_mod_t *src)
 Clone the modulators destination, sources, flags and amount. More...
 

Detailed Description

SoundFont modulator functions and constants.

Enumeration Type Documentation

◆ fluid_mod_flags

Flags defining the polarity, mapping function and type of a modulator source.

Compare with SoundFont 2.04 PDF section 8.2.

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.

Enumerator
FLUID_MOD_POSITIVE 

Mapping function is positive.

FLUID_MOD_NEGATIVE 

Mapping function is negative.

FLUID_MOD_UNIPOLAR 

Mapping function is unipolar.

FLUID_MOD_BIPOLAR 

Mapping function is bipolar.

FLUID_MOD_LINEAR 

Linear mapping function.

FLUID_MOD_CONCAVE 

Concave mapping function.

FLUID_MOD_CONVEX 

Convex mapping function.

FLUID_MOD_SWITCH 

Switch (on/off) mapping function.

FLUID_MOD_GC 

General controller source type (fluid_mod_src)

FLUID_MOD_CC 

MIDI CC controller (source will be a MIDI CC number)

FLUID_MOD_SIN 

Custom non-standard sinus mapping function.

◆ fluid_mod_src

General controller (if FLUID_MOD_GC in flags).

This corresponds to SoundFont 2.04 PDF section 8.2.1

Enumerator
FLUID_MOD_NONE 

No source controller.

FLUID_MOD_VELOCITY 

MIDI note-on velocity.

FLUID_MOD_KEY 

MIDI note-on note number.

FLUID_MOD_KEYPRESSURE 

MIDI key pressure.

FLUID_MOD_CHANNELPRESSURE 

MIDI channel pressure.

FLUID_MOD_PITCHWHEEL 

Pitch wheel.

FLUID_MOD_PITCHWHEELSENS 

Pitch wheel sensitivity.

Function Documentation

◆ new_fluid_mod()

FLUIDSYNTH_API fluid_mod_t* new_fluid_mod ( void  )

Create a new uninitialized modulator structure.

Returns
New allocated modulator or NULL if out of memory

References FLUID_ERR.

Referenced by fluid_synth_add_default_mod(), and new_fluid_defsfloader().

◆ delete_fluid_mod()

FLUIDSYNTH_API void delete_fluid_mod ( fluid_mod_t mod)

Free a modulator structure.

Parameters
modModulator to free

Referenced by delete_fluid_synth(), fluid_synth_remove_default_mod(), and new_fluid_defsfloader().

◆ fluid_mod_sizeof()

FLUIDSYNTH_API size_t fluid_mod_sizeof ( void  )

Returns the size of the fluid_mod_t structure.

Useful in low latency scenarios e.g. to allocate a modulator on the stack.

Returns
Size of fluid_mod_t in bytes

◆ fluid_mod_set_source1()

FLUIDSYNTH_API void fluid_mod_set_source1 ( fluid_mod_t mod,
int  src,
int  flags 
)

Set a modulator's primary source controller and flags.

Parameters
modThe modulator instance
srcModulator source (fluid_mod_src or a MIDI controller number)
flagsFlags 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.

◆ fluid_mod_set_source2()

FLUIDSYNTH_API void fluid_mod_set_source2 ( fluid_mod_t mod,
int  src,
int  flags 
)

Set a modulator's secondary source controller and flags.

Parameters
modThe modulator instance
srcModulator source (fluid_mod_src or a MIDI controller number)
flagsFlags 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.

◆ fluid_mod_set_dest()

FLUIDSYNTH_API void fluid_mod_set_dest ( fluid_mod_t mod,
int  dest 
)

Set the destination effect of a modulator.

Parameters
modThe modulator instance
destDestination generator (fluid_gen_type)

◆ fluid_mod_set_amount()

FLUIDSYNTH_API void fluid_mod_set_amount ( fluid_mod_t mod,
double  amount 
)

Set the scale amount of a modulator.

Parameters
modThe modulator instance
amountScale amount to assign

◆ fluid_mod_get_source1()

FLUIDSYNTH_API int fluid_mod_get_source1 ( const fluid_mod_t mod)

Get the primary source value from a modulator.

Parameters
modThe modulator instance
Returns
The primary source value (fluid_mod_src or a MIDI CC controller value).

◆ fluid_mod_get_flags1()

FLUIDSYNTH_API int fluid_mod_get_flags1 ( const fluid_mod_t mod)

Get primary source flags from a modulator.

Parameters
modThe modulator instance
Returns
The primary source flags (fluid_mod_flags).

◆ fluid_mod_get_source2()

FLUIDSYNTH_API int fluid_mod_get_source2 ( const fluid_mod_t mod)

Get the secondary source value from a modulator.

Parameters
modThe modulator instance
Returns
The secondary source value (fluid_mod_src or a MIDI CC controller value).

◆ fluid_mod_get_flags2()

FLUIDSYNTH_API int fluid_mod_get_flags2 ( const fluid_mod_t mod)

Get secondary source flags from a modulator.

Parameters
modThe modulator instance
Returns
The secondary source flags (fluid_mod_flags).

◆ fluid_mod_get_dest()

FLUIDSYNTH_API int fluid_mod_get_dest ( const fluid_mod_t mod)

Get destination effect from a modulator.

Parameters
modThe modulator instance
Returns
Destination generator (fluid_gen_type)

Referenced by fluid_voice_update_param().

◆ fluid_mod_get_amount()

FLUIDSYNTH_API double fluid_mod_get_amount ( const fluid_mod_t mod)

◆ fluid_mod_test_identity()

FLUIDSYNTH_API int fluid_mod_test_identity ( const fluid_mod_t mod1,
const fluid_mod_t mod2 
)

Checks if two modulators are identical in sources, flags and destination.

Parameters
mod1First modulator
mod2Second modulator
Returns
TRUE if identical, FALSE otherwise

SF2.01 section 9.5.1 page 69, 'bullet' 3 defines 'identical'.

Referenced by fluid_mod_get_amount(), fluid_synth_add_default_mod(), fluid_synth_alloc_voice(), fluid_synth_remove_default_mod(), fluid_voice_add_mod(), and new_fluid_defsfloader().

◆ fluid_mod_has_source()

FLUIDSYNTH_API int fluid_mod_has_source ( const fluid_mod_t mod,
int  cc,
int  ctrl 
)

Check if the modulator has the given source.

Parameters
modThe modulator instance
ccBoolean value indicating if ctrl is a CC controller or not
ctrlThe source to check for (if cc == FALSE : a value of type fluid_mod_src, else the value of the MIDI CC to check for)
Returns
TRUE if the modulator has the given source, FALSE otherwise.

References FLUID_MOD_CC.

Referenced by fluid_voice_update_param().

◆ fluid_mod_has_dest()

FLUIDSYNTH_API int fluid_mod_has_dest ( const fluid_mod_t mod,
int  gen 
)

Check if the modulator has the given destination.

Parameters
modThe modulator instance
genThe destination generator of type fluid_gen_type to check for
Returns
TRUE if the modulator has the given destination, FALSE otherwise.

References FLUID_MOD_BIPOLAR, FLUID_MOD_CC, FLUID_MOD_CHANNELPRESSURE, FLUID_MOD_KEY, FLUID_MOD_KEYPRESSURE, FLUID_MOD_NEGATIVE, FLUID_MOD_NONE, FLUID_MOD_PITCHWHEEL, FLUID_MOD_PITCHWHEELSENS, FLUID_MOD_VELOCITY, GEN_ATTENUATION, GEN_CHORUSSEND, GEN_CUSTOM_BALANCE, GEN_CUSTOM_FILTERFC, GEN_CUSTOM_FILTERQ, GEN_FILTERFC, GEN_FILTERQ, GEN_MODENVTOPITCH, GEN_MODLFOTOPITCH, GEN_PAN, GEN_REVERBSEND, and GEN_VIBLFOTOPITCH.

Referenced by fluid_voice_update_param().

◆ fluid_mod_clone()

FLUIDSYNTH_API void fluid_mod_clone ( fluid_mod_t mod,
const fluid_mod_t src 
)

Clone the modulators destination, sources, flags and amount.

Parameters
modthe modulator to store the copy to
srcthe source modulator to retrieve the information from
Note
The next member of mod will be left unchanged.

Referenced by fluid_synth_add_default_mod(), and fluid_voice_add_mod().