![]() |
![]() |
![]() |
GPS04 Reference Manual | ![]() |
---|---|---|---|---|
#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);
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.
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() .
|
PS04AudioTrack* ps04_audio_track_new (void);
Creates a new audio track.
Returns : | a new PS04AudioTrack. |
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.
|
void ps04_audio_track_set_data (PS04AudioTrack *self, const PS04AudioSample *data, unsigned n_frames , GError **error);
self : |
|
data : |
|
Param3 : |
|
error : |
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. |
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. |
gboolean ps04_audio_track_is_empty (const PS04AudioTrack *self);
self : |
|
Returns : |
PS04AudioTrack* ps04_null_audio_track_get (void);
Gets a null audio track.
Returns : | an PS04AudioTrack representing the null condition. |
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. |