IpatchSampleStoreSndFile

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

Stability Level

Stable, unless otherwise indicated

Synopsis

                    IpatchSampleStoreSndFile;
#define             IPATCH_SAMPLE_STORE_SND_FILE_UNUSED_FLAG_SHIFT
IpatchSample *      ipatch_sample_store_snd_file_new    (const char *filename);
gboolean            ipatch_sample_store_snd_file_init_read
                                                        (IpatchSampleStoreSndFile *store);
gboolean            ipatch_sample_store_snd_file_init_write
                                                        (IpatchSampleStoreSndFile *store,
                                                         int file_format,
                                                         int sub_format,
                                                         int endian,
                                                         int channels,
                                                         int samplerate);

Object Hierarchy

  GObject
   +----IpatchItem
         +----IpatchSampleStore
               +----IpatchSampleStoreSndFile

Implemented Interfaces

IpatchSampleStoreSndFile implements IpatchSample.

Properties

  "endian"                   IpatchSndFileEndian   : Read / Write
  "file-format"              IpatchSndFileFormat   : Read / Write
  "file-name"                gchar*                : Read / Write
  "fine-tune"                gint                  : Read / Write
  "loop-end"                 guint                 : Read / Write
  "loop-start"               guint                 : Read / Write
  "loop-type"                IpatchSampleLoopType  : Read / Write
  "root-note"                gint                  : Read / Write
  "sub-format"               IpatchSndFileSubFormat  : Read / Write

Description

Details

IpatchSampleStoreSndFile

typedef struct _IpatchSampleStoreSndFile IpatchSampleStoreSndFile;

IPATCH_SAMPLE_STORE_SND_FILE_UNUSED_FLAG_SHIFT

#define             IPATCH_SAMPLE_STORE_SND_FILE_UNUSED_FLAG_SHIFT

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.

filename :

File name to assign to the new libsndfile sample store

Returns :

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

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.

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.

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

Property Details

The "endian" property

  "endian"                   IpatchSndFileEndian   : Read / Write

Endian byte order of file.

Default value: IPATCH_SND_FILE_ENDIAN_FILE


The "file-format" property

  "file-format"              IpatchSndFileFormat   : Read / Write

File format.

Default value: wav


The "file-name" property

  "file-name"                gchar*                : Read / Write

File name.

Default value: NULL


The "fine-tune" property

  "fine-tune"                gint                  : Read / Write

Fine tuning in cents.

Allowed values: [-99,99]

Default value: 0


The "loop-end" property

  "loop-end"                 guint                 : Read / Write

Loop end in frames (after loop).

Default value: 0


The "loop-start" property

  "loop-start"               guint                 : Read / Write

Start of loop in frames.

Default value: 0


The "loop-type" property

  "loop-type"                IpatchSampleLoopType  : Read / Write

Loop method type.

Default value: IPATCH_SAMPLE_LOOP_NONE


The "root-note" property

  "root-note"                gint                  : Read / Write

Root MIDI note.

Allowed values: [0,127]

Default value: 60


The "sub-format" property

  "sub-format"               IpatchSndFileSubFormat  : Read / Write

File sub audio format.

Default value: Signed 16 bit PCM