## BtWirePattern

BtWirePattern — class for an event pattern of a BtMachine instance

## Synopsis

    #include <libbtcore/core.h>

                        BtWirePattern;
    BtWirePattern *     bt_wire_pattern_new                 (const BtSong * const song,
                                                             const BtWire * const wire,
                                                             const BtPattern * const pattern);
    GValue *            bt_wire_pattern_get_event_data      (const BtWirePattern * const self,
                                                             const gulong tick,
                                                             const gulong param);
    gboolean            bt_wire_pattern_set_event           (const BtWirePattern * const self,
                                                             const gulong tick,
                                                             const gulong param,
                                                             const gchar * const value);
    gchar *             bt_wire_pattern_get_event           (const BtWirePattern * const self,
                                                             const gulong tick,
                                                             const gulong param);
    gboolean            bt_wire_pattern_test_event          (const BtWirePattern * const self,
                                                             const gulong tick,
                                                             const gulong param);
    gboolean            bt_wire_pattern_tick_has_data       (const BtWirePattern * const self,
                                                             const gulong tick);
    void                bt_wire_pattern_insert_row          (const BtWirePattern * const self,
                                                             const gulong tick,
                                                             const gulong param);
    void                bt_wire_pattern_insert_full_row     (const BtWirePattern * const self,
                                                             const gulong tick);
    void                bt_wire_pattern_delete_row          (const BtWirePattern * const self,
                                                             const gulong tick,
                                                             const gulong param);
    void                bt_wire_pattern_delete_full_row     (const BtWirePattern * const self,
                                                             const gulong tick);
    void                bt_wire_pattern_blend_column        (const BtWirePattern * const self,
                                                             const gulong start_tick,
                                                             const gulong end_tick,
                                                             const gulong param);
    void                bt_wire_pattern_blend_columns       (const BtWirePattern * const self,
                                                             const gulong start_tick,
                                                             const gulong end_tick);
    void                bt_wire_pattern_randomize_column    (const BtWirePattern * const self,
                                                             const gulong start_tick,
                                                             const gulong end_tick,
                                                             const gulong param);
    void                bt_wire_pattern_randomize_columns   (const BtWirePattern * const self,
                                                             const gulong start_tick,
                                                             const gulong end_tick);

## Object Hierarchy

      GObject
       +----BtWirePattern

## Implemented Interfaces

BtWirePattern implements

## Description

A pattern contains a grid of events. Events are parameter changes in BtMachine objects. The events are stored aas GValues.

The patterns are used in the BtSequence to form the score of a song.

## Details

### BtWirePattern

    typedef struct _BtWirePattern BtWirePattern;

Class that holds a sequence of automation events for a BtWire.

### bt_wire_pattern_new ()

    BtWirePattern *     bt_wire_pattern_new                 (const BtSong * const song,
                                                             const BtWire * const wire,
                                                             const BtPattern * const pattern);

Create a new instance.

`song` : | the song the new instance belongs to
`wire` : | the wire the pattern belongs to
`pattern` : | the pattern that gets extended
Returns : | the new instance or `NULL` in case of an error

### bt_wire_pattern_get_event_data ()

    GValue *            bt_wire_pattern_get_event_data      (const BtWirePattern * const self,
                                                             const gulong tick,
                                                             const gulong param);

Fetches a cell from the given location in the pattern. If there is no event there, then the `GValue` is uninitialized. Test with G_IS_VALUE(event).

`self` : | the pattern to search for the param
`tick` : | the tick (time) position starting with 0
`param` : | the number of the parameter starting with 0
Returns : | the GValue or `NULL` if out of the pattern range

### bt_wire_pattern_set_event ()

    gboolean            bt_wire_pattern_set_event           (const BtWirePattern * const self,
                                                             const gulong tick,
                                                             const gulong param,
                                                             const gchar * const value);

Stores the supplied value into the specified pattern cell.

`self` : | the pattern the cell belongs to
`tick` : | the tick (time) position starting with 0
`param` : | the number of the parameter starting with 0
`value` : | the string representation of the value to store
Returns : | `TRUE` for success

### bt_wire_pattern_get_event ()

    gchar *             bt_wire_pattern_get_event           (const BtWirePattern * const self,
                                                             const gulong tick,
                                                             const gulong param);

Returns the string representation of the specified cell. Free it when done.

`self` : | the pattern the cell belongs to
`tick` : | the tick (time) position starting with 0
`param` : | the number of the parameter starting with 0
Returns : | a newly allocated string with the data or `NULL` on error

### bt_wire_pattern_test_event ()

    gboolean            bt_wire_pattern_test_event          (const BtWirePattern * const self,
                                                             const gulong tick,
                                                             const gulong param);

Tests if there is an event in the specified cell.

`self` : | the pattern the cell belongs to
`tick` : | the tick (time) position starting with 0
`param` : | the number of the parameter starting with 0
Returns : | `TRUE` if there is an event

### bt_wire_pattern_tick_has_data ()

    gboolean            bt_wire_pattern_tick_has_data       (const BtWirePattern * const self,
                                                             const gulong tick);

Check if there are any event in the given pattern-row.

`self` : | the pattern to check
`tick` : | the tick index in the pattern
Returns : | `TRUE` is there are events, `FALSE` otherwise

### bt_wire_pattern_insert_row ()

    void                bt_wire_pattern_insert_row          (const BtWirePattern * const self,
                                                             const gulong tick,
                                                             const gulong param);

Insert one empty row for given `param`.

`self` : | the pattern
`tick` : | the postion to insert at
`param` : | the parameter

Since 0.3

### bt_wire_pattern_insert_full_row ()

    void                bt_wire_pattern_insert_full_row     (const BtWirePattern * const self,
                                                             const gulong tick);

Insert one empty row for all parameters.

`self` : | the pattern
`tick` : | the postion to insert at

Since 0.3

### bt_wire_pattern_delete_row ()

    void                bt_wire_pattern_delete_row          (const BtWirePattern * const self,
                                                             const gulong tick,
                                                             const gulong param);

Delete row for given `param`.

`self` : | the pattern
`tick` : | the postion to delete
`param` : | the parameter

Since 0.3

### bt_wire_pattern_delete_full_row ()

    void                bt_wire_pattern_delete_full_row     (const BtWirePattern * const self,
                                                             const gulong tick);

Delete row for all parameters.

`self` : | the pattern
`tick` : | the postion to delete

Since 0.3

### bt_wire_pattern_blend_column ()

    void                bt_wire_pattern_blend_column        (const BtWirePattern * const self,
                                                             const gulong start_tick,
                                                             const gulong end_tick,
                                                             const gulong param);

Fade values from `start_tick` to `end_tick` for `param`.

`self` : | the pattern
`start_tick` : | the start postion for the range
`end_tick` : | the end postion for the range
`param` : | the parameter

Since 0.3

### bt_wire_pattern_blend_columns ()

    void                bt_wire_pattern_blend_columns       (const BtWirePattern * const self,
                                                             const gulong start_tick,
                                                             const gulong end_tick);

Fade values from `start_tick` to `end_tick` for all params.

`self` : | the pattern
`start_tick` : | the start postion for the range
`end_tick` : | the end postion for the range

Since 0.3

### bt_wire_pattern_randomize_column ()

    void                bt_wire_pattern_randomize_column    (const BtWirePattern * const self,
                                                             const gulong start_tick,
                                                             const gulong end_tick,
                                                             const gulong param);

Randomize values from `start_tick` to `end_tick` for `param`.

`self` : | the pattern
`start_tick` : | the start postion for the range
`end_tick` : | the end postion for the range
`param` : | the parameter

Since 0.3

### bt_wire_pattern_randomize_columns ()

    void                bt_wire_pattern_randomize_columns   (const BtWirePattern * const self,
                                                             const gulong start_tick,
                                                             const gulong end_tick);

Randomize values from `start_tick` to `end_tick` for all params.

`self` : | the pattern
`start_tick` : | the start postion for the range
`end_tick` : | the end postion for the range

Since 0.3