PS04AudioTrack

PS04AudioTrack — an audio track

Synopsis


#include <PS04-audio-track.h>


            PS04AudioTrack;
void        (*PS04AudioSampleFunc)          (PS04AudioSample sample,
                                             gpointer data);
PS04AudioTrack* ps04_audio_track_new        (void);
void        ps04_audio_track_clear          (PS04AudioTrack *self);
PS04AudioSample* ps04_audio_track_get_data  (PS04AudioTrack *self,
                                             GError **error);
void        ps04_audio_track_set_data       (PS04AudioTrack *self,
                                             const PS04AudioSample *data,
                                             unsigned n_frames ,
                                             GError **error);
gsize       ps04_audio_track_get_n_frames   (const PS04AudioTrack *self);
void        ps04_audio_track_set_n_frames   (PS04AudioTrack *self,
                                             gulong n_frames);
gboolean    ps04_audio_track_is_empty       (const PS04AudioTrack *self);

PS04AudioTrack* ps04_null_audio_track_get   (void);

Object Hierarchy


  GObject
   +----PS04Stream
         +----PS04File
               +----PS04AudioTrack

Signals


"changed"   void        user_function      (PS04AudioTrack *track,
                                            gpointer        user_data)      : Run first

Description

The PS04AudioTrack class represents an audio track within a project's PS04AudioTrackMatrix. It is a PS04File, so you can open, read and close it, but you can also get at the data directly by calling ps04_audio_track_get_data(), in which case it's automatically loaded from disk, decoded and cached.

Details

PS04AudioTrack

typedef struct _PS04AudioTrack PS04AudioTrack;


PS04AudioSampleFunc ()

void        (*PS04AudioSampleFunc)          (PS04AudioSample sample,
                                             gpointer data);

This type defines a callback function called for each sample by ps04_audio_track_read_samples().

sample : The sample.
data : User-defined data, given as the user_data argument to ps04_audio_track_read_samples().

ps04_audio_track_new ()

PS04AudioTrack* ps04_audio_track_new        (void);

Creates a new audio track.

Returns : a new PS04AudioTrack.

ps04_audio_track_clear ()

void        ps04_audio_track_clear          (PS04AudioTrack *self);

self :

ps04_audio_track_get_data ()

PS04AudioSample* ps04_audio_track_get_data  (PS04AudioTrack *self,
                                             GError **error);

Gets the raw audio data of the track as an array of PS04AudioSample. This data is read once from file and then cached; thus the first call may be a lengthy operation.

self : A PS04AudioTrack.
error :
Returns : an array of PS04AudioSample, or NULL if the track is empty.

ps04_audio_track_set_data ()

void        ps04_audio_track_set_data       (PS04AudioTrack *self,
                                             const PS04AudioSample *data,
                                             unsigned n_frames ,
                                             GError **error);

self :
data :
Param3 :
error :

ps04_audio_track_get_n_frames ()

gsize       ps04_audio_track_get_n_frames   (const PS04AudioTrack *self);

Gets the number of frames (samples) in the track.

self : An PS04AudioTrack.
Returns : a frame count, or 0 if unknown or empty.

ps04_audio_track_set_n_frames ()

void        ps04_audio_track_set_n_frames   (PS04AudioTrack *self,
                                             gulong n_frames);

Sets the number of frames (samples) to n_frames. When the length is bigger than before, the data is padded with silence up to the new length (which is useful for making a number of tracks the same length). Otherwise nothing happens (the track is never shortened).

self : A PS04AudioTrack.
n_frames : The new frame count.

ps04_audio_track_is_empty ()

gboolean    ps04_audio_track_is_empty       (const PS04AudioTrack *self);

self :
Returns :

ps04_null_audio_track_get ()

PS04AudioTrack* ps04_null_audio_track_get   (void);

Gets a null audio track.

Returns : an PS04AudioTrack representing the null condition.

Signal Details

The "changed" signal

void        user_function                  (PS04AudioTrack *track,
                                            gpointer        user_data)      : Run first

The changed signal is emitted when the audio track has in some way been modified.

track : the object on which the signal is emitted.
user_data : user data set when the signal handler was connected.

See Also

PS04AudioTrackMatrix