![]() |
![]() |
![]() |
libinstpatch Reference Manual | ![]() |
---|---|---|---|---|
Top | Description |
IpatchSF2Mod; typedef IpatchSF2ModList; #define IPATCH_TYPE_SF2_MOD #define IPATCH_TYPE_SF2_MOD_LIST #define IPATCH_SF2_MOD_ARE_IDENTICAL (a, b) #define IPATCH_SF2_MOD_ARE_IDENTICAL_AMOUNT (a, b) enum IpatchSF2ModFieldMasks; enum IpatchSF2ModFieldShifts; enum IpatchSF2ModControl; enum IpatchSF2ModControlPalette; enum IpatchSF2ModDirection; enum IpatchSF2ModPolarity; enum IpatchSF2ModType; enum IpatchSF2ModTransform; enum IpatchSF2ModFlags; GType ipatch_sf2_mod_get_type (void); GType ipatch_sf2_mod_list_get_type (void); IpatchSF2Mod * ipatch_sf2_mod_new (void); void ipatch_sf2_mod_free (IpatchSF2Mod *mod); IpatchSF2Mod * ipatch_sf2_mod_duplicate (const IpatchSF2Mod *mod); GSList * ipatch_sf2_mod_list_duplicate (const GSList *list); GSList * ipatch_sf2_mod_list_override (const GSList *alist, const GSList *blist, gboolean copy); void ipatch_sf2_mod_list_boxed_free (GSList *list); GSList * ipatch_sf2_mod_list_insert (GSList *mods, const IpatchSF2Mod *modvals, int pos); GSList * ipatch_sf2_mod_list_remove (GSList *mods, const IpatchSF2Mod *modvals, gboolean *changed); gboolean ipatch_sf2_mod_list_change (GSList *mods, const IpatchSF2Mod *oldvals, const IpatchSF2Mod *newvals); GSList * ipatch_sf2_mod_list_offset (const GSList *alist, const GSList *blist); void ipatch_sf2_mod_list_free (GSList *list, gboolean free_mods); const GSList * ipatch_sf2_mod_list_get_default (void);
typedef struct { guint16 src; /* source modulator (MIDI controller, etc) */ guint16 dest; /* destination generator */ gint16 amount; /* degree of modulation */ guint16 amtsrc; /* second source controls amount of first */ guint16 trans; /* transform function applied to source */ } IpatchSF2Mod;
typedef enum { IPATCH_SF2_MOD_MASK_CONTROL = 0x007F, IPATCH_SF2_MOD_MASK_CC = 0x0080, IPATCH_SF2_MOD_MASK_DIRECTION = 0x0100, IPATCH_SF2_MOD_MASK_POLARITY = 0x0200, IPATCH_SF2_MOD_MASK_TYPE = 0xFC00 } IpatchSF2ModFieldMasks;
typedef enum { IPATCH_SF2_MOD_SHIFT_CONTROL = 0, IPATCH_SF2_MOD_SHIFT_CC = 7, IPATCH_SF2_MOD_SHIFT_DIRECTION = 8, IPATCH_SF2_MOD_SHIFT_POLARITY = 9, IPATCH_SF2_MOD_SHIFT_TYPE = 10 } IpatchSF2ModFieldShifts;
typedef enum { IPATCH_SF2_MOD_CONTROL_NONE = 0, IPATCH_SF2_MOD_CONTROL_NOTE_ON_VELOCITY = 2, IPATCH_SF2_MOD_CONTROL_NOTE_NUMBER = 3, IPATCH_SF2_MOD_CONTROL_POLY_PRESSURE = 10, IPATCH_SF2_MOD_CONTROL_CHAN_PRESSURE = 13, IPATCH_SF2_MOD_CONTROL_PITCH_WHEEL = 14, IPATCH_SF2_MOD_CONTROL_BEND_RANGE = 16 } IpatchSF2ModControl;
typedef enum { IPATCH_SF2_MOD_CC_GENERAL = (0 << IPATCH_SF2_MOD_SHIFT_CC), IPATCH_SF2_MOD_CC_MIDI = (1 << IPATCH_SF2_MOD_SHIFT_CC) } IpatchSF2ModControlPalette;
typedef enum { IPATCH_SF2_MOD_DIRECTION_POSITIVE = (0 << IPATCH_SF2_MOD_SHIFT_DIRECTION), IPATCH_SF2_MOD_DIRECTION_NEGATIVE = (1 << IPATCH_SF2_MOD_SHIFT_DIRECTION) } IpatchSF2ModDirection;
typedef enum { IPATCH_SF2_MOD_POLARITY_UNIPOLAR = (0 << IPATCH_SF2_MOD_SHIFT_POLARITY), IPATCH_SF2_MOD_POLARITY_BIPOLAR = (1 << IPATCH_SF2_MOD_SHIFT_POLARITY) } IpatchSF2ModPolarity;
typedef enum { IPATCH_SF2_MOD_TYPE_LINEAR = (0 << IPATCH_SF2_MOD_SHIFT_TYPE), IPATCH_SF2_MOD_TYPE_CONCAVE = (1 << IPATCH_SF2_MOD_SHIFT_TYPE), IPATCH_SF2_MOD_TYPE_CONVEX = (2 << IPATCH_SF2_MOD_SHIFT_TYPE), IPATCH_SF2_MOD_TYPE_SWITCH = (3 << IPATCH_SF2_MOD_SHIFT_TYPE) } IpatchSF2ModType;
typedef enum { IPATCH_SF2_MOD_TRANSFORM_LINEAR = 0 } IpatchSF2ModTransform;
typedef enum { IPATCH_SF2_MOD_NO_DUPLICATE = 1 << 0, /* don't duplicate mod list (owned!) */ IPATCH_SF2_MOD_NO_NOTIFY = 1 << 1 /* don't do item property notify */ } IpatchSF2ModFlags;
IpatchSF2Mod * ipatch_sf2_mod_new (void);
Create a new modulator
Returns : |
New modulator |
void ipatch_sf2_mod_free (IpatchSF2Mod *mod);
Free an IpatchSF2Mod structure
|
Modulator to free, should not be referenced by any zones. |
IpatchSF2Mod * ipatch_sf2_mod_duplicate (const IpatchSF2Mod *mod);
Duplicate a modulator
|
Modulator to duplicate |
Returns : |
New duplicate modulator |
GSList * ipatch_sf2_mod_list_duplicate (const GSList *list);
Duplicates a modulator list (GSList and modulator data).
|
Modulator list to duplicate |
Returns : |
New duplicate modulator list which should be freed with
ipatch_sf2_mod_list_free() with free_mods set to TRUE when finished with it.
|
GSList * ipatch_sf2_mod_list_override (const GSList *alist, const GSList *blist, gboolean copy);
Creates a new modulator list by combining alist
and blist
. Modulators
in blist
override identical modulators in alist
. If copy
is set then
the modulator data is also duplicated (a new GSList is created).
|
First modulator list |
|
Second modulator list |
|
If TRUE then modulator data is duplicated
|
Returns : |
New GSList of combined modulator lists. Should be freed with
ipatch_sf2_mod_list_free() with the free_mods parameter set to the value of
copy .
|
GSList * ipatch_sf2_mod_list_insert (GSList *mods, const IpatchSF2Mod *modvals, int pos);
Inserts a modulator into a modulator list. Does not check for
duplicates! The modulator is not used directly, a new one is created and
the values in mod
are copied to it.
|
Modulator list to insert into |
|
Modulator values to insert (a new modulator is created and the values are copied to it) |
|
Index position in zone's modulator list to insert (0 = first, < 0 = last) |
Returns : |
New start (root) of mods list.
|
GSList * ipatch_sf2_mod_list_remove (GSList *mods, const IpatchSF2Mod *modvals, gboolean *changed);
Remove a modulator from a modulator list. The modulator values in modvals
are used to search the modulator list. The first modulator
that matches all fields in modvals
is removed.
|
Modulator list to remove from |
|
Values of modulator to remove |
|
Pointer to store bool of whether the list was changed
(NULL to ignore)
|
gboolean ipatch_sf2_mod_list_change (GSList *mods, const IpatchSF2Mod *oldvals, const IpatchSF2Mod *newvals);
Sets the values of an existing modulator in a modulator list. The list
is searched for a modulator that matches the values in oldvals
. If a
modulator is found its values are set to those in newvals
. If it is not
found, nothing is done.
|
Modulator list to change a modulator in |
|
Current values of modulator to set |
|
New modulator values |
Returns : |
TRUE if changed, FALSE otherwise (no match)
|
GSList * ipatch_sf2_mod_list_offset (const GSList *alist, const GSList *blist);
Creates a new modulator list by combining list
and blist
. Modulators
in blist
offset (amounts are added) identical modulators in alist
.
Operation is non-destructive as a new list is created and modulator data
is duplicated.
NOTE: Optimized for empty blist
.
|
First modulator list |
|
Second modulator list |
Returns : |
New GSList of combined modulator lists. Should be freed with
ipatch_sf2_mod_list_free() with free_mods set to TRUE when finished with it.
|
void ipatch_sf2_mod_list_free (GSList *list, gboolean free_mods);
Like ipatch_sf2_mod_list_free()
but used for boxed type declaration and so
therefore frees all modulators in the list.
|
Modulator list to free |
const GSList * ipatch_sf2_mod_list_get_default (void);
Get the list of default instrument modulators.
Returns : |
The list of default modulators. The same modulator list is returned on subsequent calls and should not be modified or freed. |