IpatchSampleStoreSndFile

IpatchSampleStoreSndFile — Sample store object type which uses libsndfile to access audio in sound files

Stability Level

Stable, unless otherwise indicated

Functions

Properties

IpatchSndFileEndian endian Read / Write
IpatchSndFileFormat file-format Read / Write
char * file-name Read / Write
int fine-tune Read / Write
guint loop-end Read / Write
guint loop-start Read / Write
IpatchSampleLoopType loop-type Read / Write
int root-note Read / Write
IpatchSndFileSubFormat sub-format Read / Write

Types and Values

Object Hierarchy

    GObject
    ╰── IpatchItem
        ╰── IpatchSampleStore
            ╰── IpatchSampleStoreSndFile

Description

Functions

ipatch_sample_store_snd_file_new ()

IpatchSample *
ipatch_sample_store_snd_file_new (const char *filename);

Creates a new libsndfile sample store. ipatch_sample_store_snd_file_init_read() or ipatch_sample_store_snd_file_init_write() must be called, depending on audio file mode, prior to opening the sample.

Parameters

filename

File name to assign to the new libsndfile sample store

 

Returns

New libsndfile sample store, cast as a IpatchSample for convenience.

[type IpatchSampleStoreSndFile]


ipatch_sample_store_snd_file_init_read ()

gboolean
ipatch_sample_store_snd_file_init_read
                               (IpatchSampleStoreSndFile *store);

Initialize a libsndfile sample store for reading. Should be called prior to opening the sample store and after the filename has been assigned. Fills in the “file-format”, “sub-format”, “endian”, “sample-rate” and “sample-size” information properties. In addition the “sample-format” property is set to a value for optimal loading of the audio data (least amount of conversion necessary to yield uncompressed PCM audio), which will be the audio format of the sample store.

Parameters

store

libsndfile sample store

 

Returns

TRUE on success, FALSE otherwise


ipatch_sample_store_snd_file_init_write ()

gboolean
ipatch_sample_store_snd_file_init_write
                               (IpatchSampleStoreSndFile *store,
                                int file_format,
                                int sub_format,
                                int endian,
                                int channels,
                                int samplerate);

Initialize a libsndfile sample store for writing. Should be called prior to opening the sample store. The “file-format”, “sub-format”, “endian” and “sample-rate” properties will be assigned the provided values. In addition the “sample-format” property is set to a value for optimal writing of the audio data (including the channels value), which will be the audio format of the sample store.

Parameters

store

libsndfile sample store

 

file_format

libsndfile file format type (GEnum "IpatchSndFileFormat")

 

sub_format

libsndfile audio format type (GEnum "IpatchSndFileSubFormat")

 

endian

libsndfile endian selection (IpatchSampleStoreSndFileEndian)

 

channels

Number of channels (1-8, 1=mono, 2=stereo, etc)

 

samplerate

Audio sample rate

 

Returns

TRUE if format variables are valid, FALSE otherwise

Types and Values

IPATCH_SAMPLE_STORE_SND_FILE_UNUSED_FLAG_SHIFT

#define             IPATCH_SAMPLE_STORE_SND_FILE_UNUSED_FLAG_SHIFT

Property Details

The “endian” property

  “endian”                   IpatchSndFileEndian

Endian byte order of file.

Owner: IpatchSampleStoreSndFile

Flags: Read / Write

Default value: IPATCH_SND_FILE_ENDIAN_FILE


The “file-format” property

  “file-format”              IpatchSndFileFormat

File format.

Owner: IpatchSampleStoreSndFile

Flags: Read / Write

Default value: wav


The “file-name” property

  “file-name”                char *

File name.

Owner: IpatchSampleStoreSndFile

Flags: Read / Write

Default value: NULL


The “fine-tune” property

  “fine-tune”                int

Fine tuning in cents.

Owner: IpatchSampleStoreSndFile

Flags: Read / Write

Allowed values: [-99,99]

Default value: 0


The “loop-end” property

  “loop-end”                 guint

Loop end in frames (after loop).

Owner: IpatchSampleStoreSndFile

Flags: Read / Write

Default value: 0


The “loop-start” property

  “loop-start”               guint

Start of loop in frames.

Owner: IpatchSampleStoreSndFile

Flags: Read / Write

Default value: 0


The “loop-type” property

  “loop-type”                IpatchSampleLoopType

Loop method type.

Owner: IpatchSampleStoreSndFile

Flags: Read / Write

Default value: IPATCH_SAMPLE_LOOP_NONE


The “root-note” property

  “root-note”                int

Root MIDI note.

Owner: IpatchSampleStoreSndFile

Flags: Read / Write

Allowed values: [0,127]

Default value: 60


The “sub-format” property

  “sub-format”               IpatchSndFileSubFormat

File sub audio format.

Owner: IpatchSampleStoreSndFile

Flags: Read / Write

Default value: signed-16-bit-pcm