Parlatype.Waveloader¶
- Subclasses:
None
Methods¶
- Inherited:
- Structs:
class |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Virtual Methods¶
- Inherited:
Properties¶
Name |
Type |
Flags |
Short Description |
---|---|---|---|
r/w/c |
Signals¶
- Inherited:
Name |
Short Description |
---|---|
The size of the array with waveform data has changed. |
|
While loading a waveform a progress signal is emitted, starting with a value greater than 0.0. |
Fields¶
- Inherited:
Name |
Type |
Access |
Description |
---|---|---|---|
parent_instance |
r |
Class Details¶
- class Parlatype.Waveloader(**kwargs)¶
- Bases:
- Abstract:
No
- Structure:
- classmethod new(uri)¶
- Parameters:
- Returns:
a new
Parlatype.Waveloader
- Return type:
Returns a new
Parlatype.Waveloader
. The uri is not checked on construction, but callingParlatype.Waveloader.load_async
() will fail with an error message.After use
GObject.Object.unref
() it.New in version 1.4.
- get_data()¶
- Returns:
a
GLib.Array
with wave data- Return type:
[
float
]
This returns the pointer to a
GLib.Array
that is holding all the wave form data. It consists of a minimum value in the range of -1 to 0 and a maximum value in the range of 0 to 1, repeating this until the end. Each min/max pair can be drawn by the application as one vertical line in the wave form.Don’t modify the data.
New in version 2.0.
- get_duration()¶
- Returns:
duration in nanoseconds as used by GStreamer
- Return type:
Returns the duration of stream. As the whole stream is scanned, this is supposed to be an exact duration, not an estimate.
New in version 1.4.
- load_async(pps, cancellable, callback, *user_data)¶
- Parameters:
pps (
int
) – pixels per secondcancellable (
Gio.Cancellable
orNone
) – aGio.Cancellable
orNone
callback (
Gio.AsyncReadyCallback
orNone
) – aGio.AsyncReadyCallback
to call when the operation is complete
Saves sample data to private memory. To keep the memory footprint low, the raw data is downsampled to 8000 samples per second (16 bit per sample). This requires approx. 1 MB of memory per minute.
Parlatype.Waveloader
:uri
must be set. If it is not valid, an error will be returned. If there is another load operation going on, an error will be returned.While saving data
Parlatype.Waveloader
::progress
is emitted every 30 ms.In your callback call
Parlatype.Waveloader.load_finish
to get the result of the operation.You can get a pointer to the
GLib.Array
holding the data withParlatype.Waveloader.get_data
either before loading it or afterwards.New in version 2.0.
- load_finish(result)¶
- Parameters:
result (
Gio.AsyncResult
) – theGio.AsyncResult
passed to yourGio.AsyncReadyCallback
- Raises:
- Returns:
- Return type:
Gives the result of the async load operation. A cancelled operation results in an error, too.
New in version 1.4.
- resize(pps)¶
- Parameters:
pps (
int
) – the requested pixel per second ratio- Raises:
- Returns:
- Return type:
Sync version of
Parlatype.Waveloader.resize_async
.New in version 2.0.
- resize_async(pps, cancellable, callback, *user_data)¶
- Parameters:
pps (
int
) – the requested pixel per second ratiocancellable (
Gio.Cancellable
orNone
) – aGio.Cancellable
orNone
callback (
Gio.AsyncReadyCallback
orNone
) – aGio.AsyncReadyCallback
to call when the operation is complete
Resizes wave form data at the requested resolution pps. If the array’s size has to be changed,
Parlatype.Waveloader
::array-size-changed
is emitted. Any data in the array will be overwritten.The resolution is given as pixel per seconds, e.g. 100 means one second is represented by 100 samples, is 100 pixels wide. pps must be >= 25 and <= 200.
You should have loaded a file with
Parlatype.Waveloader.load_async
before resizing it. There are no concurrent operations allowed. An error is returned, if the file was not loaded before, if it is still loading or if there is another #pt_waveloader_get_data_async operation going on.Cancelling the operation returns an error and lets the array in an inconsistent state. Its size will be according to the requested new resolution, but the data will be partly old, partly new.
In your callback call #pt_waveloader_get_data_finish to get the result of the operation.
New in version 2.0.
- resize_finish(result)¶
- Parameters:
result (
Gio.AsyncResult
) – theGio.AsyncResult
passed to yourGio.AsyncReadyCallback
- Raises:
- Returns:
- Return type:
Gives the result of the async resize operation. A cancelled operation results in an error, too.
New in version 2.0.
Signal Details¶
- Parlatype.Waveloader.signals.array_size_changed(waveloader)¶
- Signal Name:
array-size-changed
- Flags:
- Parameters:
waveloader (
Parlatype.Waveloader
) – The object which received the signal
The size of the array with waveform data has changed.
- Parlatype.Waveloader.signals.progress(waveloader, progress)¶
- Signal Name:
progress
- Flags:
- Parameters:
waveloader (
Parlatype.Waveloader
) – The object which received the signalprogress (
float
) – the new progress state, ranging from 0.0 to 1.0
While loading a waveform a progress signal is emitted, starting with a value greater than 0.0. At the end of the operation, 1.0 is emitted in case of success, otherwise 0.0.