IpatchSF2Zone

IpatchSF2Zone — A base class for SoundFont zones

Synopsis




                    IpatchSF2Zone;
                    IpatchSF2ZoneClass;
#define             IPATCH_SF2_ZONE_GEN_AMT             (zone, genid)
#define             IPATCH_SF2_ZONE_GEN_TEST_FLAG       (zone, genid)
#define             IPATCH_SF2_ZONE_SET_FLAG            (zone, genid)
#define             IPATCH_SF2_ZONE_CLEAR_FLAG          (zone, genid)
#define             ipatch_sf2_zone_add_mod             (zone, mod)
IpatchSF2Zone*      ipatch_sf2_zone_first               (IpatchIter *iter);
IpatchSF2Zone*      ipatch_sf2_zone_next                (IpatchIter *iter);
void                ipatch_sf2_zone_set_item            (IpatchSF2Zone *zone,
                                                         IpatchItem *item);
IpatchItem*         ipatch_sf2_zone_ref_item            (IpatchSF2Zone *zone);
IpatchItem*         ipatch_sf2_zone_peek_item           (IpatchSF2Zone *zone);
gboolean            ipatch_sf2_zone_get_gen             (IpatchSF2Zone *zone,
                                                         int genid,
                                                         IpatchSF2GenAmount *out_amt);
void                ipatch_sf2_zone_set_gen             (IpatchSF2Zone *zone,
                                                         int genid,
                                                         IpatchSF2GenAmount *amt);
void                ipatch_sf2_zone_unset_gen           (IpatchSF2Zone *zone,
                                                         int genid);
guint               ipatch_sf2_zone_gen_count           (IpatchSF2Zone *zone);
const char*         ipatch_sf2_zone_genid_get_prop_name (guint genid);
GParamSpec*         ipatch_sf2_zone_genid_get_pspec     (guint genid,
                                                         gboolean ispreset);
void                ipatch_sf2_zone_copy_gen_array      (IpatchSF2Zone *zone,
                                                         IpatchSF2GenArray *array);
void                ipatch_sf2_zone_fill_gen_array      (IpatchSF2Zone *zone,
                                                         IpatchSF2GenArray *array);
GSList*             ipatch_sf2_zone_get_mods            (IpatchSF2Zone *zone);
void                ipatch_sf2_zone_insert_mod          (IpatchSF2Zone *zone,
                                                         const IpatchSF2Mod *mod,
                                                         int pos);
void                ipatch_sf2_zone_remove_mod          (IpatchSF2Zone *zone,
                                                         const IpatchSF2Mod *modvals);
void                ipatch_sf2_zone_set_mod             (IpatchSF2Zone *zone,
                                                         const IpatchSF2Mod *oldvals,
                                                         const IpatchSF2Mod *newvals);
guint               ipatch_sf2_zone_mod_count           (IpatchSF2Zone *zone);
gboolean            ipatch_sf2_zone_in_range            (IpatchSF2Zone *zone,
                                                         int note,
                                                         int velocity);
void                ipatch_sf2_zone_class_install_gen_properties
                                                        (GObjectClass *klass,
                                                         gboolean ispreset);
gboolean            ipatch_sf2_zone_set_gen_property    (IpatchSF2Zone *zone,
                                                         guint property_id,
                                                         const GValue *value,
                                                         gboolean is_preset);
gboolean            ipatch_sf2_zone_get_gen_property    (IpatchSF2Zone *zone,
                                                         guint property_id,
                                                         GValue *value,
                                                         gboolean is_preset);

Object Hierarchy


  GObject
   +----IpatchItem
         +----IpatchSF2Zone
               +----IpatchSF2IZone
               +----IpatchSF2PZone

Properties


  "item"                     IpatchItem            : Read / Write

Description

The SoundFont zone object defines a base class for preset zones (IpatchSF2PZone) and instrument zones (IpatchSF2IZone). A zone contains a list of generators (IpatchSF2Gen), modulators (IpatchSF2Mod) and a referenced item for the zone. Zones of type IpatchSF2PZone reference IpatchSF2Inst objects and IpatchSF2IZone type zones reference IpatchSF2Sample objects.

Details

IpatchSF2Zone

typedef struct _IpatchSF2Zone IpatchSF2Zone;


IpatchSF2ZoneClass

typedef struct {
  IpatchItemClass parent_class;
} IpatchSF2ZoneClass;


IPATCH_SF2_ZONE_GEN_AMT()

#define             IPATCH_SF2_ZONE_GEN_AMT(zone, genid)

zone :
genid :

IPATCH_SF2_ZONE_GEN_TEST_FLAG()

#define             IPATCH_SF2_ZONE_GEN_TEST_FLAG(zone, genid)

zone :
genid :

IPATCH_SF2_ZONE_SET_FLAG()

#define             IPATCH_SF2_ZONE_SET_FLAG(zone, genid)

zone :
genid :

IPATCH_SF2_ZONE_CLEAR_FLAG()

#define             IPATCH_SF2_ZONE_CLEAR_FLAG(zone, genid)

zone :
genid :

ipatch_sf2_zone_add_mod()

#define             ipatch_sf2_zone_add_mod(zone, mod)

zone :
mod :

ipatch_sf2_zone_first ()

IpatchSF2Zone*      ipatch_sf2_zone_first               (IpatchIter *iter);

Gets the first item in a zone iterator. A convenience wrapper for ipatch_iter_first().

iter : Patch item iterator containing IpatchSF2Zone items
Returns : The first zone in iter or NULL if empty.

ipatch_sf2_zone_next ()

IpatchSF2Zone*      ipatch_sf2_zone_next                (IpatchIter *iter);

Gets the next item in a zone iterator. A convenience wrapper for ipatch_iter_next().

iter : Patch item iterator containing IpatchSF2Zone items
Returns : The next zone in iter or NULL if at the end of the list.

ipatch_sf2_zone_set_item ()

void                ipatch_sf2_zone_set_item            (IpatchSF2Zone *zone,
                                                         IpatchItem *item);

Sets the referenced item of a zone (a IpatchSF2Inst for preset zones, IpatchSF2Sample for instrument zones). The type specific item set routines for each zone type may be preferred, as this one doesn't do strict type checking. Note that once a zone has its item set it cannot revert to a global zone (because of multi-thread issues).

zone : Zone to set zone item of
item : New item for zone to use

ipatch_sf2_zone_ref_item ()

IpatchItem*         ipatch_sf2_zone_ref_item            (IpatchSF2Zone *zone);

Gets the referenced item from a zone (a IpatchSF2Inst for preset zones, IpatchSF2Sample for instrument zones). The type specific item set routines for each zone type may be preferred, as this one doesn't do strict type checking. The returned item's reference count is incremented and the caller is responsible for unrefing it with g_object_unref().

zone : Zone to get referenced item of
Returns : Zone's referenced item or NULL if global zone. Remember to unreference the item with g_object_unref() when done with it.

ipatch_sf2_zone_peek_item ()

IpatchItem*         ipatch_sf2_zone_peek_item           (IpatchSF2Zone *zone);

Like ipatch_sf2_zone_ref_item() but does not add a reference to the returned item. This function should only be used if a reference of the returned item is ensured or only the pointer value is of interest.

zone : Zone to get referenced item of
Returns : Zone's referenced item or NULL if global zone. Remember that the item has NOT been referenced.

ipatch_sf2_zone_get_gen ()

gboolean            ipatch_sf2_zone_get_gen             (IpatchSF2Zone *zone,
                                                         int genid,
                                                         IpatchSF2GenAmount *out_amt);

Get a generator value from a zone

zone : Zone to get generator value from
genid : Generator ID (IpatchSF2GenType) of value to get
out_amt : Output: Pointer to store generator amount to
Returns : TRUE if generator is set in Zone or the generators are stored as an array and FALSE if not set, in which case the value stored to output_amt is the default value for the given generator ID.

ipatch_sf2_zone_set_gen ()

void                ipatch_sf2_zone_set_gen             (IpatchSF2Zone *zone,
                                                         int genid,
                                                         IpatchSF2GenAmount *amt);

Set a generator value in a zone.

Emits "prop_change_hook" and calls ipatch_item_changed().

zone : Zone to set generator in
genid : Generator ID (IpatchSF2GenType) of generator to set
amt : Value to set generator to

ipatch_sf2_zone_unset_gen ()

void                ipatch_sf2_zone_unset_gen           (IpatchSF2Zone *zone,
                                                         int genid);

Unsets a generator in a zone by removing it from the zone's generator list, thereby using its default value.

Emits "prop_change_hook" and calls ipatch_item_changed().

zone : Zone to unset generator in
genid : Generator ID (IpatchSF2GenType) to unset

ipatch_sf2_zone_gen_count ()

guint               ipatch_sf2_zone_gen_count           (IpatchSF2Zone *zone);

Get count of "set" generators in a zone.

zone : SoundFont Zone
Returns : Count of generators.

ipatch_sf2_zone_genid_get_prop_name ()

const char*         ipatch_sf2_zone_genid_get_prop_name (guint genid);

Get the GObject property name for a given generator ID.

genid : Generator ID
Returns : Property name or NULL if no property name for genid. The returned string is internal and should not be modified or freed.

ipatch_sf2_zone_genid_get_pspec ()

GParamSpec*         ipatch_sf2_zone_genid_get_pspec     (guint genid,
                                                         gboolean ispreset);

Get the parameter specification for a given generator ID.

genid : Generator ID
ispreset : TRUE to get a preset zone parameter spec, FALSE to get an instrument zone parameter spec.
Returns : The parameter specification for the generator or NULL if the given genid and ispreset are not valid.

ipatch_sf2_zone_copy_gen_array ()

void                ipatch_sf2_zone_copy_gen_array      (IpatchSF2Zone *zone,
                                                         IpatchSF2GenArray *array);

Copies a zone's generators to a caller supplied generator array.

zone : Zone to get generators from
array : Destination generator array to store to

ipatch_sf2_zone_fill_gen_array ()

void                ipatch_sf2_zone_fill_gen_array      (IpatchSF2Zone *zone,
                                                         IpatchSF2GenArray *array);

Copies a zone's "set" generators to a caller supplied generator array. This function differs from ipatch_sf2_zone_copy_gen_array() in that it only copies generators that are set. It can be used to override values in one array with set values in another.

zone : Zone to get generators from
array : Destination generator array to store to

ipatch_sf2_zone_get_mods ()

GSList*             ipatch_sf2_zone_get_mods            (IpatchSF2Zone *zone);

Gets a list of modulators from a SoundFont zone. List should be freed with ipatch_sf2_mod_list_free() (free_mods set to TRUE) when finished with it.

zone : Zone to get modulators from
Returns : New list of modulators (IpatchSF2Mod) in zone or NULL if no modulators. Remember to free it when finished.

ipatch_sf2_zone_insert_mod ()

void                ipatch_sf2_zone_insert_mod          (IpatchSF2Zone *zone,
                                                         const IpatchSF2Mod *mod,
                                                         int pos);

Inserts a modulator into a zones 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.

Emits changed signal on zone.

zone : Zone to insert into
mod : Modulator values to insert (a new modulator is created and the values are copied to it)
pos : Index position in zone's modulator list to insert (0 = first, < 0 = last)

ipatch_sf2_zone_remove_mod ()

void                ipatch_sf2_zone_remove_mod          (IpatchSF2Zone *zone,
                                                         const IpatchSF2Mod *modvals);

Remove a modulator from a zone. The modulator values in modvals are used to search the modulator list in zone. The first modulator that matches all fields in modvals is removed.

Emits changed signal on zone.

zone : Zone to remove modulator from
modvals : Values of modulator to remove

ipatch_sf2_zone_set_mod ()

void                ipatch_sf2_zone_set_mod             (IpatchSF2Zone *zone,
                                                         const IpatchSF2Mod *oldvals,
                                                         const IpatchSF2Mod *newvals);

Sets the values of an existing modulator in a SoundFont zone. The zone 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.

zone : Zone to set modulator of
oldvals : Current values of modulator to set
newvals : New modulator values

ipatch_sf2_zone_mod_count ()

guint               ipatch_sf2_zone_mod_count           (IpatchSF2Zone *zone);

Count number of modulators in a zone

zone : Zone to count modulators in
Returns : Count of modulators

ipatch_sf2_zone_in_range ()

gboolean            ipatch_sf2_zone_in_range            (IpatchSF2Zone *zone,
                                                         int note,
                                                         int velocity);

Check if a key and velocity falls in a zone's ranges

zone : Zone to check if in range
note : MIDI note number or -1 for wildcard
velocity : MIDI velocity or -1 for wildcard
Returns : TRUE if zone is in key and velocity range, FALSE otherwise

ipatch_sf2_zone_class_install_gen_properties ()

void                ipatch_sf2_zone_class_install_gen_properties
                                                        (GObjectClass *klass,
                                                         gboolean ispreset);

Installs generator properties for a class. Used internally by IpatchSF2Zone derived types.

klass : Class
ispreset : TRUE for preset properties, FALSE for instrument

ipatch_sf2_zone_set_gen_property ()

gboolean            ipatch_sf2_zone_set_gen_property    (IpatchSF2Zone *zone,
                                                         guint property_id,
                                                         const GValue *value,
                                                         gboolean is_preset);

Used internally by IpatchSF2Zone sub classes to set generator properties.

zone : SoundFont zone
property_id : Property id to set
value : Value to set property to
is_preset : Set to TRUE for preset zones, FALSE for instrument zones
Returns : TRUE if property_id handled, FALSE otherwise

ipatch_sf2_zone_get_gen_property ()

gboolean            ipatch_sf2_zone_get_gen_property    (IpatchSF2Zone *zone,
                                                         guint property_id,
                                                         GValue *value,
                                                         gboolean is_preset);

Used internally by IpatchSF2Zone sub classes to get generator properties.

zone : SoundFont zone
property_id : Property id to get
value : Value to store property value in
is_preset : Set to TRUE for preset zones, FALSE for instrument zones
Returns : TRUE if property_id handled, FALSE otherwise

Property Details

The "item" property

  "item"                     IpatchItem            : Read / Write

Set the referenced item.

See Also

IpatchSF2PZone, IpatchSF2IZone