## BtWave BtWave — one BtWavetable entry that keeps a list of BtWavelevels |

## Functions

gboolean | bt_wave_add_wavelevel ()
BtWavelevel * | bt_wave_get_level_by_index ()
BtWave * | bt_wave_new ()

## Properties

guint | channels | Read / Write / Construct
gulong | index | Read / Write / Construct
BtWaveLoopMode | loop-mode | Read / Write / Construct
gchar * | name | Read / Write / Construct
BtSong * | song | Read / Write / Construct Only
gchar * | uri | Read / Write / Construct
gdouble | volume | Read / Write / Construct
gpointer | wavelevels | Read

## Types and Values

struct | BtWave
enum | BtWaveLoopMode

## Object Hierarchy

        GEnum
        ╰── BtWaveLoopMode
        GObject
        ╰── BtWave

## Implemented Interfaces

BtWave implements BtPersistence.

## Includes

    #include <libbtcore/core.h>

## Description

Represents one instrument. Contains one or more BtWavelevels.

## Functions

### bt_wave_add_wavelevel ()

    gboolean
    bt_wave_add_wavelevel (const BtWave * const self,
                           const BtWavelevel * const wavelevel);

Add the supplied wavelevel to the wave. This is automatically done by `bt_wavelevel_new()`.

#### Parameters

self | the wavetable to add the new wavelevel to |
wavelevel | the new wavelevel instance |

#### Returns

`TRUE` for success, `FALSE` otheriwse

### bt_wave_get_level_by_index ()

    BtWavelevel *
    bt_wave_get_level_by_index (const BtWave * const self,
                                const gulong index);

Search the wave for a wavelevel by the supplied index. The wavelevel must have been added previously to this wave with `bt_wave_add_wavelevel()`.

#### Parameters

self | the wave to search for the wavelevel |
index | the index of the wavelevel |

#### Returns

BtWavelevel instance or `NULL` if not found. Unref the wavelevel, when done with it.

[transfer full]

### bt_wave_new ()

    BtWave *
    bt_wave_new (const BtSong * const song,
                 const gchar * const name,
                 const gchar * const uri,
                 const gulong index,
                 const gdouble volume,
                 const BtWaveLoopMode loop_mode,
                 const guint channels);

Create a new instance

#### Parameters

song | the song the new instance belongs to |
name | the display name for the new wave |
uri | the location of the sample data |
index | the list slot for the new wave |
volume | the volume of the wave |
loop_mode | loop playback mode |
channels | number of audio channels |

#### Returns

the new instance or `NULL` in case of an error

## Types and Values

### struct BtWave

    struct BtWave;

A single waveform.

### enum BtWaveLoopMode

BtWave clips can be played using several loop modes.

#### Members

BT_WAVE_LOOP_MODE_OFF | no loop |
BT_WAVE_LOOP_MODE_FORWARD | forward looping |
BT_WAVE_LOOP_MODE_PINGPONG | forward/backward looping |

## Property Details

### The `“channels”` property

      “channels”                 guint

number of channels in the sample.

Flags: Read / Write / Construct

Allowed values: <= 2

Default value: 0

### The `“index”` property

      “index”                    gulong

The index of the wave in the wavtable.

Flags: Read / Write / Construct

Allowed values: >= 1

### The `“loop-mode”` property

      “loop-mode”                BtWaveLoopMode

mode of loop playback.

Flags: Read / Write / Construct

Default value: off

### The `“name”` property

      “name”                     gchar *

The name of the wave.

Flags: Read / Write / Construct

Default value: "unamed wave"

### The `“song”` property

      “song”                     BtSong *

Set song object, the wave belongs to.

Flags: Read / Write / Construct Only

### The `“uri”` property

      “uri”                      gchar *

The uri of the wave.

Flags: Read / Write / Construct

Default value: NULL

### The `“volume”` property

      “volume”                   gdouble

The volume of the wave in the wavtable.

Flags: Read / Write / Construct

Allowed values: [0,1]

Default value: 1

### The `“wavelevels”` property

      “wavelevels”               gpointer

A copy of the list of wavelevels.

Flags: Read