Top | ![]() |
![]() |
![]() |
![]() |
IpatchSampleStoreSwapIpatchSampleStoreSwap — Sample storage object for audio in memory or temporary swap file |
Swap sample stores are used for data which does not have a safe external source, for example if a sample was originally loaded from an external audio file or an instrument file that was closed.
Swap sample stores are stored in RAM up to the total size set by
ipatch_sample_store_swap_set_max_memory()
. Additional sample stores
are written to the swap file, whose file name is set by
ipatch_sample_store_set_file_name()
with a fallback to a temporary file
name if not set.
Currently there is a global lock on read or write accesses of sample stores in the swap file. This is contrary to most other sample store types.
When a sample store in the swap file is no longer used, it is added to a
recover list, which new sample stores may utilize. This cuts down on unused
space in the swap file (ipatch_sample_store_swap_get_unused_size()
), which
can be compacted with ipatch_sample_store_swap_compact()
.
void
ipatch_set_sample_store_swap_file_name
(const char *filename
);
Set name of sample swap storage file on disk. Can only be assigned once and should be done prior to any IpatchSampleStoreSwap objects being created.
Since: 1.1.0
char *
ipatch_get_sample_store_swap_file_name
(void
);
Get name of sample swap storage file on disk.
Since: 1.1.0
IpatchSample *
ipatch_sample_store_swap_new (void
);
Creates a new disk swap sample store.
New disk swap sample store, cast as an IpatchSample for convenience.
[type IpatchSampleStoreSwap]
void
ipatch_sample_store_swap_close (void
);
Close the swap sample store temporary file and delete it. Should only be called prior to exiting application when no more sample store accesses will occur.
Since: 1.1.0
int
ipatch_get_sample_store_swap_unused_size
(void
);
Get amount of unused space in the swap file.
Since: 1.1.0
void
ipatch_set_sample_store_swap_max_memory
(int size
);
Set maximum RAM memory size to use for samples in swap. Using RAM increases performance, at the expense of memory use. Once max RAM usage is exceeded samples will be allocated in sample swap file on disk.
Since: 1.1.0
int
ipatch_get_sample_store_swap_max_memory
(void
);
Get maximum RAM memory size to use for samples in swap.
Since: 1.1.0