IpatchSampleStoreSwap

IpatchSampleStoreSwap — Sample storage object for audio in memory or temporary swap file

Stability Level

Stable, unless otherwise indicated

Functions

Types and Values

Object Hierarchy

    GObject
    ╰── IpatchItem
        ╰── IpatchSampleStore
            ╰── IpatchSampleStoreSwap

Description

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().

Functions

ipatch_set_sample_store_swap_file_name ()

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.

Parameters

filename

File name to use for sample swap disk file

 

Since: 1.1.0


ipatch_get_sample_store_swap_file_name ()

char *
ipatch_get_sample_store_swap_file_name
                               (void);

Get name of sample swap storage file on disk.

Returns

Newly allocated sample store swap file name or NULL

Since: 1.1.0


ipatch_sample_store_swap_new ()

IpatchSample *
ipatch_sample_store_swap_new (void);

Creates a new disk swap sample store.

Returns

New disk swap sample store, cast as an IpatchSample for convenience.

[type IpatchSampleStoreSwap]


ipatch_sample_store_swap_close ()

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


ipatch_get_sample_store_swap_unused_size ()

int
ipatch_get_sample_store_swap_unused_size
                               (void);

Get amount of unused space in the swap file.

Returns

Amount of unused data in bytes

Since: 1.1.0


ipatch_set_sample_store_swap_max_memory ()

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.

Parameters

size

Maximum amount of RAM to use for swap sample stores (-1 for unlimited)

 

Since: 1.1.0


ipatch_get_sample_store_swap_max_memory ()

int
ipatch_get_sample_store_swap_max_memory
                               (void);

Get maximum RAM memory size to use for samples in swap.

Returns

Max sample store swap RAM memory size.

Since: 1.1.0


ipatch_compact_sample_store_swap ()

gboolean
ipatch_compact_sample_store_swap (GError **err);

Types and Values

IPATCH_SAMPLE_STORE_SWAP_UNUSED_FLAG_SHIFT

#define             IPATCH_SAMPLE_STORE_SWAP_UNUSED_FLAG_SHIFT