Top | ![]() |
![]() |
![]() |
![]() |
An object to load waveform data from an audio file. The raw data can be used by a widget to visually represent a waveform.
PtWaveloader *
pt_waveloader_new (gchar *uri
);
Returns a new PtWaveloader. The uri
is not checked on construction, but
calling pt_waveloader_load_async()
will fail with an error message.
After use g_object_unref()
it.
gboolean pt_waveloader_load_finish (PtWaveloader *wl
,GAsyncResult *result
,GError **error
);
Gives the result of the async load operation. A cancelled operation results in an error, too.
wl |
||
result |
the GAsyncResult passed to your GAsyncReadyCallback |
|
error |
a pointer to a NULL GError, or NULL. |
[allow-none] |
void pt_waveloader_load_async (PtWaveloader *wl
,GCancellable *cancellable
,GAsyncReadyCallback callback
,gpointer user_data
);
Writes the raw sample data to a temporary file and also gets the number of channels, the bit rate and the exact duration. Load only once and on success the data can be retrieved as a PtWavedata. It's a programmer's error trying to retrieve the data without prior loading.
Emits a progress signal while saving the temporary file.
In your callback call pt_waveloader_load_finish to get the result of the operation.
wl |
||
cancellable |
a GCancellable or NULL. |
[allow-none] |
callback |
a GAsyncReadyCallback to call when the operation is complete. |
[scope async] |
user_data |
user_data for callback. |
[closure] |
gint64
pt_waveloader_get_duration (PtWaveloader *wl
);
Returns the duration of stream. As the whole stream is scanned, this is supposed to be an exact duration, not an estimate.
PtWavedata * pt_waveloader_get_data (PtWaveloader *wl
,gint pps
);
Returns wave data needed for visual representation as raw data. The requested resolution is given as pixel per seconds, e.g. 100 means one second is represented by 100 samples, is 100 pixels wide. The returned resolution doesn't have to be necessarily exactly the requested resolution, it might be a bit differnt, depending on the bit rate.
struct PtWaveloader;
The PtWaveloader contains only private fields and should not be directly accessed.
“uri”
property“uri” gchar *
URI of the audio file.
Flags: Read / Write / Construct
Default value: ""
“progress”
signalvoid user_function (PtWaveloader *wl, gdouble progress, gpointer user_data)
Indicates progress on a scale from 0.0 to 1.0, however it does not emit the value 0.0 nor 1.0. Wait for a successful operation until any gui element showing progress is dismissed.
wl |
the waveloader emitting the signal |
|
progress |
the new progress state, ranging from 0.0 to 1.0 |
|
user_data |
user data set when the signal handler was connected. |
Flags: Run First