## BtWavetable

BtWavetable — the list of BtWave items in a BtSong

## Synopsis

    #include <libbtcore/core.h>

    struct              BtWavetable;
    gboolean            bt_wavetable_add_wave               (const BtWavetable * const self,
                                                             const BtWave * const wave);
    BtWave *            bt_wavetable_get_wave_by_index      (const BtWavetable * const self,
                                                             const gulong index);
    BtWavetable *       bt_wavetable_new                    (const BtSong * const song);
    void                bt_wavetable_remember_missing_wave  (const BtWavetable * const self,
                                                             const gchar * const str);
    gboolean            bt_wavetable_remove_wave            (const BtWavetable * const self,
                                                             const BtWave * const wave);

## Object Hierarchy

      GObject
       +----BtWavetable

## Implemented Interfaces

BtWavetable implements

## Properties

      "missing-waves"            gpointer              : Read
      "song"                     BtSong*               : Read / Write / Construct Only
      "waves"                    gpointer              : Read

## Signals

      "wave-added"                                     : No Hooks
      "wave-removed"                                   : No Hooks

## Description

Each wave table entry can constist of multiple BtWaves, were each of the waves has a BtWavelevel with the data for a note range.

## Details

### struct BtWavetable

    struct BtWavetable;

A table of BtWave objects.

### bt_wavetable_add_wave ()

    gboolean            bt_wavetable_add_wave               (const BtWavetable * const self,
                                                             const BtWave * const wave);

Add the supplied wave to the wavetable. This is automatically done by #`bt_wave_new()`.

`self` : | the wavetable to add the wave to
`wave` : | the new wave instance
Returns : | `TRUE` for success, `FALSE` otheriwse

### bt_wavetable_get_wave_by_index ()

    BtWave *            bt_wavetable_get_wave_by_index      (const BtWavetable * const self,
                                                             const gulong index);

Search the wavetable for a wave by the supplied index. The wave must have been added previously to this wavetable with `bt_wavetable_add_wave()`. Unref the wave, when done with it.

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

### bt_wavetable_new ()

    BtWavetable *       bt_wavetable_new                    (const BtSong * const song);

Create a new instance

`song` : | the song the new instance belongs to
Returns : | the new instance or `NULL` in case of an error

### bt_wavetable_remember_missing_wave ()

    void                bt_wavetable_remember_missing_wave  (const BtWavetable * const self,
                                                             const gchar * const str);

Loaders can use this function to collect information about wavetable entries that failed to load. The front-end can access this later by reading BtWavetable::missing-waves property.

`self` : | the wavetable
`str` : | human readable description of the missing wave

### bt_wavetable_remove_wave ()

    gboolean            bt_wavetable_remove_wave            (const BtWavetable * const self,
                                                             const BtWave * const wave);

Remove the supplied wave from the wavetable.

`self` : | the wavetable to remove the wave from
`wave` : | the wave instance
Returns : | `TRUE` for success, `FALSE` otheriwse

## Property Details

### The `"missing-waves"` property

      "missing-waves"            gpointer              : Read

The list of missing waves, don't change.

### The `"song"` property

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

Set song object, the wavetable belongs to.

### The `"waves"` property

      "waves"                    gpointer              : Read

A copy of the list of waves.

## Signal Details

### The `"wave-added"` signal

    void                user_function                      (BtWavetable *self,
                                                            BtWave      *wave,
                                                            gpointer     user_data)      : No Hooks

A new wave item has been added to the wavetable

`self` : | the wavetable object that emitted the signal
`wave` : | the new wave
`user_data` : | user data set when the signal handler was connected.

### The `"wave-removed"` signal

    void                user_function                      (BtWavetable *self,
                                                            BtWave      *wave,
                                                            gpointer     user_data)      : No Hooks

A wave item has been removed from the wavetable

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