## BtWavetable BtWavetable — the list of BtWave items in a BtSong |

## Functions

gboolean | bt_wavetable_add_wave ()
BtWave * | bt_wavetable_get_wave_by_index ()
BtWavetable * | bt_wavetable_new ()
void | bt_wavetable_remember_missing_wave ()
gboolean | bt_wavetable_remove_wave ()

## Properties

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

## Signals

void | wave-added | No Hooks
void | wave-removed | No Hooks

## Types and Values

struct | BtWavetable

## Object Hierarchy

        GObject
        ╰── BtWavetable

## Implemented Interfaces

BtWavetable implements BtPersistence.

## Includes

    #include <libbtcore/core.h>

## Description

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

The first entry starts at index pos 1. Index 0 is used in a BtPattern to indicate that no (new) wave is referenced.

## Functions

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

#### Parameters

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

#### Parameters

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

#### Returns

BtWave instance or `NULL` if not found. Unref the wave, when done with it.

[transfer full]

### bt_wavetable_new ()

    BtWavetable *
    bt_wavetable_new (const BtSong * const song);

Create a new instance

#### Parameters

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.

#### Parameters

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.

#### Parameters

self | the wavetable to remove the wave from |
wave | the wave instance |

#### Returns

`TRUE` for success, `FALSE` otheriwse

## Types and Values

### struct BtWavetable

    struct BtWavetable;

A table of BtWave objects.

## Property Details

### The `“missing-waves”` property

      “missing-waves”            gpointer

The list of missing waves, don't change.

Flags: Read

### The `“song”` property

      “song”                     BtSong *

Set song object, the wavetable belongs to.

Flags: Read / Write / Construct Only

### The `“waves”` property

      “waves”                    gpointer

A copy of the list of waves.

Flags: Read

## Signal Details

### The `“wave-added”` signal

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

A new wave item has been added to the wavetable

#### Parameters

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

Flags: No Hooks

### The `“wave-removed”` signal

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

A wave item has been removed from the wavetable

#### Parameters

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

Flags: No Hooks