Top | ![]() |
![]() |
![]() |
![]() |
void | (*IpatchSF2VoiceCacheItemFunc) () |
int | (*IpatchSF2VoiceCacheUpdateHandler) () |
#define | ipatch_sf2_voice_cache_declare_item() |
#define | IPATCH_SF2_VOICE_CACHE_GET_VOICE() |
IpatchSF2VoiceCache * | ipatch_sf2_voice_cache_new () |
void | ipatch_sf2_voice_cache_set_default_mods () |
void | ipatch_sf2_voice_cache_set_override_mods () |
IpatchSF2Voice * | ipatch_sf2_voice_cache_add_voice () |
void | ipatch_sf2_voice_cache_set_voice_range () |
void | ipatch_sf2_voice_set_sample_data () |
gboolean | ipatch_sf2_voice_cache_sample_data () |
void | ipatch_sf2_voice_copy () |
void | ipatch_sf2_voice_cache_optimize () |
int | ipatch_sf2_voice_cache_select () |
int | ipatch_sf2_voice_cache_update () |
struct | IpatchSF2Voice |
struct | IpatchSF2VoiceUpdate |
enum | IpatchSF2VoiceSelType |
struct | IpatchSF2VoiceSelInfo |
#define | IPATCH_SF2_VOICE_CACHE_MAX_SEL_VALUES |
#define | IPATCH_SF2_VOICE_SEL_WILDCARD |
This is used for pre-processing instruments into arrays of SoundFont compatible voices which can then be accessed very quickly without multi-thread locking or other issues (during synthesis for example).
void (*IpatchSF2VoiceCacheItemFunc) (IpatchSF2VoiceCache *cache
,GObject *item
);
A callback function type which is called during voice cache population for each item which the voice cache is dependent on. This can be useful for determining when a voice cache needs to be updated or for real time effects.
int (*IpatchSF2VoiceCacheUpdateHandler) (IpatchSF2VoiceCache *cache
,int *select_values
,GObject *cache_item
,GObject *item
,GParamSpec *pspec
,const GValue *value
,IpatchSF2VoiceUpdate *updates
,guint max_updates
);
Function prototype used to re-calculate SoundFont effect generators for a single object property change. Useful for real time effect changes.
cache |
Voice cache to get updates for |
|
select_values |
The voice selection criteria to use, should be the same
number of select values as in |
|
cache_item |
Original item |
|
item |
Object for which a property changed |
|
pspec |
Parameter specification of property which changed |
|
value |
The new value of the property |
|
updates |
Output array to store updates to |
|
max_updates |
Size of |
IpatchSF2VoiceCache * ipatch_sf2_voice_cache_new (IpatchSF2VoiceSelInfo *info
,int sel_count
);
Create a new SoundFont voice cache object. The sel_count
parameter
defines the number of selection ranges for the cache. Examples of selection
ranges include MIDI note and velocity ranges for a voice. The info
parameter should be a pointer to an array of selection info structures
which describes each selection type.
[skip]
void ipatch_sf2_voice_cache_set_default_mods (IpatchSF2VoiceCache *cache
,GSList *mods
);
Set the default modulator list for the voice cache. Modulator list is used directly and the allocation of the list is taken over by the voice cache.
[skip]
void ipatch_sf2_voice_cache_set_override_mods (IpatchSF2VoiceCache *cache
,GSList *mods
);
Set the override modulator list for the voice cache. Modulator list is used directly and the allocation of the list is taken over by the voice cache.
[skip]
cache |
Voice cache |
|
mods |
SoundFont modulator list which overrides rendered voice modulators (used directly). |
[element-type IpatchSF2Mod][transfer full] |
Since: 1.1.0
IpatchSF2Voice *
ipatch_sf2_voice_cache_add_voice (IpatchSF2VoiceCache *cache
);
Adds a new initialized voice to a SoundFont voice cache.
[skip]
void ipatch_sf2_voice_cache_set_voice_range (IpatchSF2VoiceCache *cache
,IpatchSF2Voice *voice
,guint sel_index
,int low
,int high
);
Set a voice selection range. Selection ranges are used for selection criteria such as MIDI velocity and note ranges.
[skip]
void ipatch_sf2_voice_set_sample_data (IpatchSF2Voice *voice
,IpatchSampleData *sample_data
);
Assign sample data to a SoundFont voice.
[skip]
gboolean ipatch_sf2_voice_cache_sample_data (IpatchSF2Voice *voice
,GError **err
);
Cache an already assigned sample data object of a voice. The sample data is cached as 16 bit mono native endian format, if not already cached, and the new cached sample is assigned to the sample_store field.
[skip]
void ipatch_sf2_voice_copy (IpatchSF2Voice *dest
,IpatchSF2Voice *src
);
Copy a source (src
) voice's information to a destination voice (dest
).
Does not copy selection criteria integers in parent IpatchSF2VoiceCache
objects.
[skip]
void
ipatch_sf2_voice_cache_optimize (IpatchSF2VoiceCache *cache
);
Can be called after all voices have been added to a voice cache.
Will optimize voice cache for use with ipatch_sf2_voice_cache_select()
.
NOTE: Currently does nothing, but will in the future..
[skip]
int ipatch_sf2_voice_cache_select (IpatchSF2VoiceCache *cache
,int *select_values
,guint16 *index_array
,guint16 max_indexes
);
Stores pointers to voices matching select_values
criteria.
[skip]
cache |
SoundFont voice cache |
|
select_values |
Array of select values which must be the same length as the voice cache was initialized with. Each selection value is tested against each voice's selection ranges (use IPATCH_SF2_VOICE_SEL_WILDCARD as a wildcard selection value). |
|
index_array |
Voice indexes are stored in this array. |
|
max_indexes |
Maximum number of voices to match. |
int ipatch_sf2_voice_cache_update (IpatchSF2VoiceCache *cache
,int *select_values
,GObject *cache_item
,GObject *item
,GParamSpec *pspec
,const GValue *value
,IpatchSF2VoiceUpdate *updates
,guint max_updates
);
struct IpatchSF2Voice { /* Set by SF2VoiceCache converter via ipatch_sf2_voice_set_sample_data() */ IpatchSampleData *sample_data; /* sample data for voice */ IpatchSampleStore *sample_store; /* Cached store */ guint32 sample_size; /* size of sample in frames */ /* Set by SF2VoiceCache converter */ guint32 loop_start; /* loop start offset (in samples) */ guint32 loop_end; /* loop end offset (in samples, 1st sample after loop) */ guint32 rate; /* sample rate */ guint8 root_note; /* MIDI root note of sample */ gint8 fine_tune; /* fine tune (in cents, -99 - 99) */ guint16 reserved; /* reserved (should be 0) */ IpatchSF2GenArray gen_array; /* generator effect values */ GSList *mod_list; /* modulator list */ /* IpatchSF2VoiceCache user defined */ gpointer user_data; /* Arbitrary data defined by IpatchSF2VoiceCache user */ /* Set internally */ int range_index; /* index in ranges array (int *) to first selection range */ };
struct IpatchSF2VoiceUpdate { guint16 voice; /* index of voice with parameter to update */ union /* new value for parameter */ { gint16 ival; guint16 uval; }; guint8 genid; /* if type == IPATCH_SF2_VOICE_UPDATE_GEN: id of gen */ guint8 reserved[3]; /* padding to 4 bytes */ };
struct IpatchSF2VoiceSelInfo { IpatchSF2VoiceSelType type; int param1; int param2; /* currently not used */ };