## BtWave

BtWave — one BtWavetable entry that keeps a list of BtWavelevels

## Synopsis

    #include <libbtcore/core.h>

                        BtWave;
    enum                BtWaveLoopMode;
    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);
    gboolean            bt_wave_add_wavelevel               (const BtWave * const self,
                                                             const BtWavelevel * const wavelevel);
    BtWavelevel *       bt_wave_get_level_by_index          (const BtWave * const self,
                                                             const gulong index);

## Object Hierarchy

      GObject
       +----BtWave

## Implemented Interfaces

BtWave implements

## Properties

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

## Signals

      "loading-done"                                   : Run Last / No Recursion / No Hooks

## Description

Represents one instrument. Contains one or more BtWavelevels.

## Details

### BtWave

    typedef struct _BtWave BtWave;

A single waveform.

### enum BtWaveLoopMode

    typedef enum {
      BT_WAVE_LOOP_MODE_OFF=0,
      BT_WAVE_LOOP_MODE_FORWARD,
      BT_WAVE_LOOP_MODE_PINGPONG
    } BtWaveLoopMode;

BtWave clips can be played using several loop modes.

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

### 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

`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

### 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()`.

`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()`. Unref the wavelevel, when done with it.

`self` : | the wave to search for the wavelevel
`index` : | the index of the wavelevel
Returns : | BtWaveLevel instance or `NULL` if not found

## Property Details

### The `"channels"` property

      "channels"                 guint                 : Read / Write / Construct

number of channels in the sample.

Allowed values: <= 2

Default value: 0

### The `"index"` property

      "index"                    gulong                : Read / Write / Construct

The index of the wave in the wavtable.

### The `"loop-mode"` property

      "loop-mode"                BtWaveLoopMode        : Read / Write / Construct

mode of loop playback.

Default value: off

### The `"name"` property

      "name"                     gchar*                : Read / Write / Construct

The name of the wave.

Default value: "unamed wave"

### The `"song"` property

      "song"                     BtSong*               : Read / Write / Construct Only

Set song object, the wave belongs to.

### The `"uri"` property

      "uri"                      gchar*                : Read / Write / Construct

The uri of the wave.

Default value: NULL

### The `"volume"` property

      "volume"                   gdouble               : Read / Write / Construct

The volume of the wave in the wavtable.

Allowed values: [0,1]

Default value: 1

### The `"wavelevels"` property

      "wavelevels"               gpointer              : Read

A copy of the list of wavelevels.

## Signal Details

### The `"loading-done"` signal

    void                user_function                      (BtWave  *self,
                                                            gboolean success,
                                                            gpointer user_data)      : Run Last / No Recursion / No Hooks

Loading the sample has finished with `result`.

`self` : | the setup object that emitted the signal
`success` : | the result
`user_data` : | user data set when the signal handler was connected.