![]() |
![]() |
![]() |
libInstPatch Reference Manual | ![]() |
---|---|---|---|---|
IpatchSF2Sample; IpatchSF2SampleClass; enum IpatchSF2SampleFlags; #define IPATCH_SF2_SAMPLE_RATE_MIN #define IPATCH_SF2_SAMPLE_RATE_MAX #define IPATCH_SF2_SAMPLE_LENGTH_MIN IpatchSF2Sample* ipatch_sf2_sample_new (void); IpatchSF2Sample* ipatch_sf2_sample_first (IpatchIter *iter); IpatchSF2Sample* ipatch_sf2_sample_next (IpatchIter *iter); void ipatch_sf2_sample_set_name (IpatchSF2Sample *sample, const char *name); char* ipatch_sf2_sample_get_name (IpatchSF2Sample *sample); void ipatch_sf2_sample_set_data (IpatchSF2Sample *sample, IpatchSampleData *sampledata); IpatchSampleData* ipatch_sf2_sample_ref_data (IpatchSF2Sample *sample); IpatchSampleData* ipatch_sf2_sample_peek_data (IpatchSF2Sample *sample); void ipatch_sf2_sample_set_linked (IpatchSF2Sample *sample, IpatchSF2Sample *linked); IpatchSF2Sample* ipatch_sf2_sample_ref_linked (IpatchSF2Sample *sample); IpatchSF2Sample* ipatch_sf2_sample_peek_linked (IpatchSF2Sample *sample); void ipatch_sf2_sample_set_blank (IpatchSF2Sample *sample); guint ipatch_sf2_sample_get_size (IpatchSF2Sample *sample); IpatchSampleStore* ipatch_sf2_sample_find_store_ref (IpatchSF2Sample *sample, GType store_type, int format, int find_flags);
"fine-tune" gint : Read / Write "linked-sample" IpatchSF2Sample : Read / Write "loop-end" guint : Read / Write "loop-start" guint : Read / Write "name" gchararray : Read / Write "root-note" gint : Read / Write "sample-data" IpatchSampleData : Read / Write "sample-rate" gint : Read / Write "type" IpatchSF2SampleFlags : Read / Write
The SoundFont sample object holds a IpatchSampleData object and SoundFont specific sample properties.
typedef enum /*< flags >*/ { IPATCH_SF2_SAMPLE_MONO = 1 << 0, IPATCH_SF2_SAMPLE_RIGHT = 1 << 1, IPATCH_SF2_SAMPLE_LEFT = 1 << 2, IPATCH_SF2_SAMPLE_LINKED = 1 << 3, IPATCH_SF2_SAMPLE_ROM = 0x8000 } IpatchSF2SampleFlags;
Flags for the "type" property of a sample.
#define IPATCH_SF2_SAMPLE_RATE_MIN 400 /* min sample rate (by standard) */
Minimum sampling rate suggestion for SoundFont samples.
#define IPATCH_SF2_SAMPLE_RATE_MAX 50000 /* max rate (by the standard) */
Maximum sampling rate suggestion for SoundFont samples.
#define IPATCH_SF2_SAMPLE_LENGTH_MIN 32 /* min length (by the standard) */
Minimum sample length suggestion for SoundFont samples.
IpatchSF2Sample* ipatch_sf2_sample_new (void);
Create a new SoundFont sample object.
Returns : | New SoundFont sample with a reference count of 1. Caller owns the reference and removing it will destroy the item, unless another reference is added (if its parented for example). |
IpatchSF2Sample* ipatch_sf2_sample_first (IpatchIter *iter);
Gets the first item in a sample iterator. A convenience wrapper for
ipatch_iter_first()
.
iter : |
Patch item iterator containing IpatchSF2Sample items |
Returns : | The first sample in iter or NULL if empty.
|
IpatchSF2Sample* ipatch_sf2_sample_next (IpatchIter *iter);
Gets the next item in a sample iterator. A convenience wrapper for
ipatch_iter_next()
.
iter : |
Patch item iterator containing IpatchSF2Sample items |
Returns : | The next sample in iter or NULL if at the end of the list.
|
void ipatch_sf2_sample_set_name (IpatchSF2Sample *sample, const char *name);
Sets the name of a SoundFont sample.
sample : |
Sample to set name of |
name : |
Value to set name to |
char* ipatch_sf2_sample_get_name (IpatchSF2Sample *sample);
Gets the name of a SoundFont sample.
sample : |
Sample to get name of |
Returns : | Name of sample or NULL if not set. String value should be freed
when finished with it.
|
void ipatch_sf2_sample_set_data (IpatchSF2Sample *sample, IpatchSampleData *sampledata);
Set a sample's sample data object.
sample : |
Sample to set sample data of |
sampledata : |
Sample data to set sample to |
IpatchSampleData* ipatch_sf2_sample_ref_data (IpatchSF2Sample *sample);
Get the IpatchSampleData item of a sample. Sample data item is referenced
before returning and caller is responsible for unreferencing it with
g_object_unref()
when finished with it.
sample : |
Sample to get sample data from |
Returns : | Sample data object of sample or NULL if none. Remember to
unreference with g_object_unref() when finished with it.
|
IpatchSampleData* ipatch_sf2_sample_peek_data (IpatchSF2Sample *sample);
Get the IpatchSampleData item of a sample. Like
ipatch_sf2_sample_ref_data()
but sample data object is not referenced.
This function should only be used if a reference of the sample data object
is ensured or only the pointer value is of importance.
sample : |
Sample to get sample data from |
Returns : | Sample data object of sample or NULL if none. Remember that a
reference is NOT added.
|
void ipatch_sf2_sample_set_linked (IpatchSF2Sample *sample, IpatchSF2Sample *linked);
Sets the stereo linked sample of a sample item.
sample : |
Sample to set linked sample of |
linked : |
Sample that is stereo linked to sample or NULL to unset.
|
IpatchSF2Sample* ipatch_sf2_sample_ref_linked (IpatchSF2Sample *sample);
Get the stereo linked sample from sample
. If a sample is returned the
caller owns a reference and should unref it with g_object_unref()
when finished with it.
sample : |
Sample to get linked sample from |
Returns : | The linked stereo sample or NULL if no linked sample. Remember to
unref the returned sample with g_object_unref() when finished with it.
|
IpatchSF2Sample* ipatch_sf2_sample_peek_linked (IpatchSF2Sample *sample);
Get the stereo linked sample from sample
. Like
ipatch_sf2_sample_ref_linked()
but sample object is not referenced.
This function should only be used if a reference of the sample object
is ensured or only the pointer value is of importance.
sample : |
Sample to get linked sample from |
Returns : | Linked sample object of sample or NULL if none. Remember that a
reference is NOT added.
|
void ipatch_sf2_sample_set_blank (IpatchSF2Sample *sample);
Set the sample data of a sample item to blank data.
sample : |
Sample to set to blank sample data |
guint ipatch_sf2_sample_get_size (IpatchSF2Sample *sample);
Get the size of a sample. Sample should have been assigned a sample data object before calling this function.
sample : |
Sample to get size of |
Returns : | Size of sample data (in samples). |
IpatchSampleStore* ipatch_sf2_sample_find_store_ref (IpatchSF2Sample *sample, GType store_type, int format, int find_flags);
Find a sample store in a SoundFont sample object by
criteria. A convenience function, since a sample's IpatchSampleData object
could be retrieved and ipatch_sample_data_find_store_ref()
used instead.
Returned sample store's reference count has been
incremented and should be removed by the caller with
g_object_unref()
when finished with it.
sample : |
Sample object to find sample store in |
store_type : |
Sample store type to find (0 as a wildcard). |
format : |
Sample store format to find (0 as a wildcard). |
find_flags : |
Criteria for finding a sample store (IpatchSampleDataFindFlags). |
Returns : | A sample store matching the criteria or NULL on error or
if no match (there might not be any stores in the sample). Remember
to unref the sample store with g_object_unref() when finished with
it.
|
fine-tune
" property"fine-tune" gint : Read / Write
Fine tune amount (in cents)
Allowed values: [-99,99]
Default value: 0
linked-sample
" property"linked-sample" IpatchSF2Sample : Read / Write
Stereo linked sample object.
loop-end
" property"loop-end" guint : Read / Write
End of sample loop (in samples)
Default value: 0
loop-start
" property"loop-start" guint : Read / Write
Start of sample loop (in samples)
Default value: 0
root-note
" property"root-note" gint : Read / Write
Root MIDI note of sample (i.e., playing this note plays the sample at its original rate).
Allowed values: [0,127]
Default value: 60
sample-rate
" property"sample-rate" gint : Read / Write
Sampling rate in Hertz.
Allowed values: [8000,192000]
Default value: 44100
type
" property"type" IpatchSF2SampleFlags : Read / Write
Sample type flags (IpatchSF2SampleFlags)
Default value: IPATCH_SF2_SAMPLE_MONO