Top | ![]() |
![]() |
![]() |
![]() |
IpatchList * | ipatch_get_sample_data_list () |
gboolean | ipatch_migrate_file_sample_data () |
IpatchSampleData * | ipatch_sample_data_new () |
void | ipatch_sample_data_used () |
void | ipatch_sample_data_unused () |
void | ipatch_sample_data_add () |
void | ipatch_sample_data_remove () |
void | ipatch_sample_data_replace_native_sample () |
IpatchList * | ipatch_sample_data_get_samples () |
guint | ipatch_sample_data_get_size () |
IpatchSampleStore * | ipatch_sample_data_get_native_sample () |
int | ipatch_sample_data_get_native_format () |
gboolean | ipatch_sample_data_open_native_sample () |
IpatchSampleStore * | ipatch_sample_data_get_cache_sample () |
IpatchSampleStore * | ipatch_sample_data_lookup_cache_sample () |
gboolean | ipatch_sample_data_open_cache_sample () |
guint64 | ipatch_sample_cache_get_unused_size () |
void | ipatch_sample_cache_clean () |
IpatchSampleData * | ipatch_sample_data_get_blank () |
An object which acts as a proxy for sample data and one or more cached versions of the same audio but potentially differing in sample format and/or storage media. IpatchSampleStore is used instead of the IpatchSample interface, for increased performance.
IpatchList *
ipatch_get_sample_data_list (void
);
Creates an object list copy of the master sample data list (all existing sample data objects).
New object list populated with all IpatchSampleData objects with a reference count of 1 which the caller owns, removing the reference will free the list.
[transfer full]
Since: 1.1.0
gboolean ipatch_migrate_file_sample_data (IpatchFile *oldfile
,IpatchFile *newfile
,const char *filename
,guint flags
,GError **err
);
Used for migrating sample data when saving, deleting, replacing or closing instrument files.
If oldfile
is set, sample data will be migrated for those that have native sample references to it, and the
old sample stores are removed.
When saving a file, newfile
can be set. In this case new IpatchSampleStore objects should have already been
added to their applicable IpatchSampleData objects. IpatchSampleData objects will be migrated to these stores
if they match the native format and the criteria set by the flags
parameter.
If sample data needs to be migrated but there is no format identical store from newfile
, then
a new duplicate IpatchSampleStoreSwap will be created and set as the new native sample.
If the IPATCH_SAMPLE_DATA_MIGRATE_REMOVE_NEW_IF_UNUSED flag is set in flags
, then unused IpatchSampleStore
objects referencing newfile
will be removed if unused.
The IPATCH_SAMPLE_DATA_MIGRATE_TO_NEWFILE flag can be used to migrate all native compatible samples to newfile
.
Default is to only migrate samples which reference oldfile
or swap.
The IPATCH_SAMPLE_DATA_MIGRATE_LEAVE_IN_SWAP flag can be used to not migrate samples out of swap. The default
is to migrate samples out of swap to newfile
if possible.
The IPATCH_SAMPLE_DATA_MIGRATE_REPLACE flag can be used to replace oldfile
with newfile
using
ipatch_file_replace()
. If oldfile
is not set, filename
can be used to replace a file, which should not
be referenced by any other IpatchFile object. If neither of these is set, then this flag is ignored.
NOTE - Not really thread safe. It is assumed that sample stores referencing oldfile
or newfile
will not be added or removed (respectively) by other threads during this function. The side
effect of this would potentially be added samples still referencing oldfile
or removed samples
being re-added.
oldfile |
Old file to migrate samples from (can be |
[nullable] |
newfile |
New file which has stores which may be used for migration
(can be |
[nullable] |
filename |
File name used for replace if |
[nullable] |
flags |
Flag options for migration. |
[type IpatchSampleDataMigrateFlags] |
err |
Location to store error info or |
Since: 1.1.0
IpatchSampleData *
ipatch_sample_data_new (void
);
Create a new sample data object.
New sample data with a reference count of 1 which the caller owns.
Use count should be incremented when added to an active instrument sample
using ipatch_sample_data_used()
which will add it to the pool of sample data objects.
void
ipatch_sample_data_used (IpatchSampleData *sampledata
);
Increment use count of a sample data object. Use references are not the same as object references and in contrast indicate if a sample data object should continue to be a part of the sample data pool - if it is a dependency of an active loaded instrument for example.
Since: 1.1.0
void
ipatch_sample_data_unused (IpatchSampleData *sampledata
);
Decrement use count of a sample data object. When the use count drops to 0 it will be removed from the pool of active sample data objects. Sample data object is only freed after it's reference count goes to 0 though.
Since: 1.1.0
void ipatch_sample_data_add (IpatchSampleData *sampledata
,IpatchSampleStore *store
);
Add a sample to a sample data object. If no samples have yet been added,
then the added sample becomes the native sample. All samples added to a
given sampledata
object must have the same frame count and should also
have the same sample rate. This is not enforced though and is left to the
caller to ensure.
void ipatch_sample_data_remove (IpatchSampleData *sampledata
,IpatchSampleStore *store
);
Remove a sample from a sample data object. The native sample should not
be removed from an active sample data object. Use
ipatch_sample_data_replace_native_sample()
if replacement is desired.
void ipatch_sample_data_replace_native_sample (IpatchSampleData *sampledata
,IpatchSampleStore *store
);
Replace the native sample of a sample data object. This function can be used
even if there are no samples yet, in which case it behaves just like
ipatch_sample_data_add()
.
The store
object can already be added to sampledata
, does nothing if already native sample
(libInstPatch version 1.1.0+).
IpatchList *
ipatch_sample_data_get_samples (IpatchSampleData *sampledata
);
Get an object list of samples in a sample data object. The first sample is the native sample.
Newly created list of IpatchSampleStore objects with a refcount of 1 which the caller owns.
[transfer full]
guint
ipatch_sample_data_get_size (IpatchSampleData *sampledata
);
Get the size in frames of the samples in the sampledata
object.
IpatchSampleStore *
ipatch_sample_data_get_native_sample (IpatchSampleData *sampledata
);
Get the native sample of a sample data object.
int
ipatch_sample_data_get_native_format (IpatchSampleData *sampledata
);
Convenience function to get the sample format of the native sample in a
sample data object. See ipatch_sample_get_format()
for more info.
gboolean ipatch_sample_data_open_native_sample (IpatchSampleData *sampledata
,IpatchSampleHandle *handle
,char mode
,int format
,guint32 channel_map
,GError **err
);
A convenience function to open a handle to a sampledata
object's native sample.
See ipatch_sample_handle_open()
for more details. This is identical to calling
ipatch_sample_data_get_native_sample()
and then ipatch_sample_handle_open()
on
the returned sample.
sampledata |
Sample data |
|
handle |
Caller supplied structure to initialize. |
[out] |
mode |
Access mode to sample, 'r' for reading and 'w' for writing |
|
format |
Sample format to convert to/from (0 for no conversion or to assign
a transform object with |
|
channel_map |
Channel mapping if |
|
err |
Location to store error information |
IpatchSampleStore * ipatch_sample_data_get_cache_sample (IpatchSampleData *sampledata
,int format
,guint32 channel_map
,GError **err
);
Get a cached version, in RAM, of a sample. If an existing cached sample already exists with the given format and channel map, it is used. Otherwise a new IpatchSampleStoreCache sample is created and the native sample is converted as necessary. If a matching cached sample is currently being created by another thread, this function will block until it is created and return it.
sampledata |
Sample data object |
|
format |
Sample format of cached sample to convert native sample to |
|
channel_map |
Channel mapping to use for new cached sample when converting
from native format, use IPATCH_SAMPLE_UNITY_CHANNEL_MAP for 1 to 1 channel
mapping (see |
|
err |
Location to store error information |
IpatchSampleStore * ipatch_sample_data_lookup_cache_sample (IpatchSampleData *sampledata
,int format
,guint32 channel_map
);
Like ipatch_sample_data_get_cache_sample()
but does not create a new cache
sample if it doesn't exist.
gboolean ipatch_sample_data_open_cache_sample (IpatchSampleData *sampledata
,IpatchSampleHandle *handle
,int format
,guint32 channel_map
,GError **err
);
Like ipatch_sample_data_get_cache_sample()
but opens the resulting cached
sample as a convenience.
guint64
ipatch_sample_cache_get_unused_size (void
);
Get the current unused sample cache data size.
Since: 1.1.0
void ipatch_sample_cache_clean (guint64 max_unused_size
,guint max_unused_age
);
IpatchSampleData *
ipatch_sample_data_get_blank (void
);
Get blank sample data object. Return's a sample data structure
with the minimum amount of data which is blank. Only creates it on
the first call, subsequent calls return the same sample data
object. Therefore it should not be modified. The blank sample data's
reference count has been incremented and should be removed by the
caller with g_object_unref()
when finished with it.
Remove unused IpatchSampleStore objects referencing newfile. |
||
Migrate all IpatchSampleData objects to newfile which have a IpatchSampleStore with the same format as the native format therein, default is to only migrate those with their native samples in oldfile or swap storage. |
||
Leave native samples in IpatchSampleData objects in swap, even if present in newfile, default is to migrate samples out of swap in preference for newfile. |
||
Replace oldfile with newfile (has no effect if newfile is |
Since: 1.1.0