PtWavedata: Parlatype Reference Manual

## PtWavedata PtWavedata — A boxed type with wave data. |

## Stability Level

Unstable, unless otherwise indicated

## Functions

PtWavedata * | pt_wavedata_new ()
PtWavedata * | pt_wavedata_copy ()
void | pt_wavedata_free ()

## Types and Values

struct | PtWavedata

## Object Hierarchy

        GBoxed
        ╰── PtWavedata

## Includes

    #include <parlatype/pt-wavedata.h>

## Description

Contains all information needed to show a wave form. It's produced by PtPlayer or PtWaveloader. Pass it to PtWaveviewer to visualize the wave. PtWaveviewer copies the data, you can free it immediately with `pt_wavedata_free()`.

There is no need to access the struct members.

Assuming you have set up a PtPlayer *player, typical usage would be:

    1
    2
    3
    4
    5
    6
    ...
    PtWavedata *data;
    data = pt_player_get_data (player, 100);
    pt_waveviewer_set_wave (PT_WAVEVIEWER (waveviewer), data);
    pt_wavedata_free (data);
    ...

## Functions

### pt_wavedata_new ()

    PtWavedata *
    pt_wavedata_new (gfloat *array,
                     gint64 length,
                     guint channels,
                     guint px_per_sec);

Constructs a new PtWavedata.

[constructor]

#### Parameters

array | an array of floats. | [array length=length]
length | number of elements in array |
channels | number of channels |
px_per_sec | rate |

#### Returns

new data, free after use with `pt_wavedata_free()`.

[transfer full]

### pt_wavedata_copy ()

    PtWavedata *
    pt_wavedata_copy (PtWavedata *data);

Creates a copy of `data` .

[skip]

#### Parameters

data | the object to copy |

#### Returns

a new PtWavedata, free after use with `pt_wavedata_free()`

### pt_wavedata_free ()

    void
    pt_wavedata_free (PtWavedata *data);

Free's `data` .

[skip]

#### Parameters

data | the object to be freed |

## Types and Values

### struct PtWavedata

    struct PtWavedata {
    	gfloat *array;
    	gint64  length;
    	guint   channels;
    	guint   px_per_sec;
    };

Contains all information about the wave. Usually you don't have to access the struct's members.

#### Members

gfloat *`array`; | array of min/max values. One single sample is represented by a min value ranging from -1.0 to 0.0 and a max value ranging from 0.0 to 1.0. This is a simplified approach, as a sample is not a single point in time, but a min and a max value in a certain amount of time, e.g. 10 ms. | [array length=length]
gint64 `length`; | number of elements in array |
guint `channels`; | number of channels for future use, currently it's always 1. |
guint `px_per_sec`; | pixels/samples per second. For example 100 means one second in time is 100 pixels wide. |