![]() |
![]() |
![]() |
Buzztard Bt-Core Reference Manual | ![]() |
---|---|---|---|---|
Top | Description | Object Hierarchy | Implemented Interfaces | Properties | Signals |
BtPatternBtPattern — class for an event pattern of a BtMachine instance |
#include <libbtcore/core.h> struct BtPattern; enum BtPatternCmd; void bt_pattern_blend_column (const BtPattern * const self
,const gulong start_tick
,const gulong end_tick
,const gulong param
); void bt_pattern_blend_columns (const BtPattern * const self
,const gulong start_tick
,const gulong end_tick
); BtPattern * bt_pattern_copy (const BtPattern * const self
); void bt_pattern_delete_column (const BtPattern * const self
,const gulong start_tick
,const gulong end_tick
,const gulong param
); void bt_pattern_delete_columns (const BtPattern * const self
,const gulong start_tick
,const gulong end_tick
); void bt_pattern_delete_full_row (const BtPattern * const self
,const gulong tick
); void bt_pattern_delete_row (const BtPattern * const self
,const gulong tick
,const gulong param
); gboolean bt_pattern_deserialize_column (const BtPattern * const self
,const gulong start_tick
,const gulong end_tick
,const gulong param
,const gchar *data
); void bt_pattern_flip_column (const BtPattern * const self
,const gulong start_tick
,const gulong end_tick
,const gulong param
); void bt_pattern_flip_columns (const BtPattern * const self
,const gulong start_tick
,const gulong end_tick
); BtPatternCmd bt_pattern_get_cmd (const BtPattern * const self
,const gulong tick
); gchar * bt_pattern_get_global_event (const BtPattern * const self
,const gulong tick
,const gulong param
); GValue * bt_pattern_get_global_event_data (const BtPattern * const self
,const gulong tick
,const gulong param
); gulong bt_pattern_get_global_param_index (const BtPattern * const self
,const gchar * const name
,GError **error
); gchar * bt_pattern_get_voice_event (const BtPattern * const self
,const gulong tick
,const gulong voice
,const gulong param
); GValue * bt_pattern_get_voice_event_data (const BtPattern * const self
,const gulong tick
,const gulong voice
,const gulong param
); gulong bt_pattern_get_voice_param_index (const BtPattern * const self
,const gchar * const name
,GError **error
); void bt_pattern_insert_full_row (const BtPattern * const self
,const gulong tick
); void bt_pattern_insert_row (const BtPattern * const self
,const gulong tick
,const gulong param
); BtPattern * bt_pattern_new (const BtSong * const song
,const gchar * const id
,const gchar * const name
,const gulong length
,const BtMachine * const machine
); BtPattern * bt_pattern_new_with_event (const BtSong * const song
,const BtMachine * const machine
,const BtPatternCmd cmd
); void bt_pattern_randomize_column (const BtPattern * const self
,const gulong start_tick
,const gulong end_tick
,const gulong param
); void bt_pattern_randomize_columns (const BtPattern * const self
,const gulong start_tick
,const gulong end_tick
); void bt_pattern_serialize_column (const BtPattern * const self
,const gulong start_tick
,const gulong end_tick
,const gulong param
,GString *data
); void bt_pattern_serialize_columns (const BtPattern * const self
,const gulong start_tick
,const gulong end_tick
,GString *data
); gboolean bt_pattern_set_global_event (const BtPattern * const self
,const gulong tick
,const gulong param
,const gchar * const value
); gboolean bt_pattern_set_voice_event (const BtPattern * const self
,const gulong tick
,const gulong voice
,const gulong param
,const gchar * const value
); gboolean bt_pattern_test_global_event (const BtPattern * const self
,const gulong tick
,const gulong param
); gboolean bt_pattern_test_voice_event (const BtPattern * const self
,const gulong tick
,const gulong voice
,const gulong param
); gboolean bt_pattern_tick_has_data (const BtPattern * const self
,const gulong tick
);
"id" gchar* : Read / Write / Construct "is-internal" gboolean : Read / Write / Construct Only "length" gulong : Read / Write / Construct "machine" BtMachine* : Read / Write / Construct Only "name" gchar* : Read / Write / Construct "song" BtSong* : Read / Write / Construct Only "voices" gulong : Read
"global-param-changed" :No Hooks
"pattern-changed" :No Hooks
"voice-param-changed" :No Hooks
A pattern contains a grid of events. Events are parameter changes in
BtMachine objects. The events are stored as GValues. Cells contaning NULL
have no event for the parameter at the time.
Patterns can have individual length. The length is meassured in ticks. How much that is in e.g. milliseconds is determined by "bpm" and "tpm".
The number of voices (tracks) is the same in all patterns of a machine. If the voices are changed on the machine patterns resize themself.
The patterns are used in the BtSequence to form the score of a song.
typedef enum { BT_PATTERN_CMD_NORMAL=0, BT_PATTERN_CMD_BREAK, BT_PATTERN_CMD_MUTE, BT_PATTERN_CMD_SOLO, BT_PATTERN_CMD_BYPASS } BtPatternCmd;
A pattern has a command field for every tick. The commands are only used in static internal patterns.
void bt_pattern_blend_column (const BtPattern * const self
,const gulong start_tick
,const gulong end_tick
,const gulong param
);
Fade values from start_tick
to end_tick
for param
.
|
the pattern |
|
the start postion for the range |
|
the end postion for the range |
|
the parameter |
Since 0.3
void bt_pattern_blend_columns (const BtPattern * const self
,const gulong start_tick
,const gulong end_tick
);
Fade values from start_tick
to end_tick
for all params.
|
the pattern |
|
the start postion for the range |
|
the end postion for the range |
Since 0.3
BtPattern * bt_pattern_copy (const BtPattern * const self
);
Create a new instance as a copy of the given instance.
|
the pattern to create a copy from |
Returns : |
the new instance or NULL in case of an error |
void bt_pattern_delete_column (const BtPattern * const self
,const gulong start_tick
,const gulong end_tick
,const gulong param
);
Randomize values from start_tick
to end_tick
for param
.
|
the pattern |
|
the start postion for the range |
|
the end postion for the range |
|
the parameter |
Since 0.6
void bt_pattern_delete_columns (const BtPattern * const self
,const gulong start_tick
,const gulong end_tick
);
Clear values from start_tick
to end_tick
for all params.
|
the pattern |
|
the start postion for the range |
|
the end postion for the range |
Since 0.6
void bt_pattern_delete_full_row (const BtPattern * const self
,const gulong tick
);
Delete row for all parameters.
|
the pattern |
|
the postion to delete |
Since 0.3
void bt_pattern_delete_row (const BtPattern * const self
,const gulong tick
,const gulong param
);
Delete row for given param
.
|
the pattern |
|
the postion to delete |
|
the parameter |
Since 0.3
gboolean bt_pattern_deserialize_column (const BtPattern * const self
,const gulong start_tick
,const gulong end_tick
,const gulong param
,const gchar *data
);
Deserializes values to start_tick
to end_tick
for param
from data
.
|
the pattern |
|
the start postion for the range |
|
the end postion for the range |
|
the parameter |
|
the source data |
Returns : |
TRUE for success, FALSE e.g. to indicate incompative GType values
for the column specified by param and the data . |
Since 0.6
void bt_pattern_flip_column (const BtPattern * const self
,const gulong start_tick
,const gulong end_tick
,const gulong param
);
Flips values from start_tick
to end_tick
for param
up-side down.
|
the pattern |
|
the start postion for the range |
|
the end postion for the range |
|
the parameter |
Since 0.6
void bt_pattern_flip_columns (const BtPattern * const self
,const gulong start_tick
,const gulong end_tick
);
Flips values from start_tick
to end_tick
for all params up-side down.
|
the pattern |
|
the start postion for the range |
|
the end postion for the range |
Since 0.5
BtPatternCmd bt_pattern_get_cmd (const BtPattern * const self
,const gulong tick
);
Returns the command id in the specified tick row.
|
the pattern to query the command from |
|
the tick (time) position starting with 0 |
Returns : |
the command id |
gchar * bt_pattern_get_global_event (const BtPattern * const self
,const gulong tick
,const gulong param
);
Returns the string representation of the specified cell. Free it when done.
|
the pattern the cell belongs to |
|
the tick (time) position starting with 0 |
|
the number of the global parameter starting with 0 |
Returns : |
a newly allocated string with the data or NULL on error |
GValue * bt_pattern_get_global_event_data (const BtPattern * 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 BT_IS_GVALUE(event).
|
the pattern to search for the global param |
|
the tick (time) position starting with 0 |
|
the number of the global parameter starting with 0 |
Returns : |
the GValue or NULL if out of the pattern range |
gulong bt_pattern_get_global_param_index (const BtPattern * const self
,const gchar * const name
,GError **error
);
Searches the list of registered dparam of the machine the pattern belongs to for a global dparam of the given name and returns the index if found.
|
the pattern to search for the global dparam |
|
the name of the global dparam |
|
pointer to an error variable |
Returns : |
the index. If an error occurs the function returns 0 and sets the error variable. You should always check for error if you use this function. |
gchar * bt_pattern_get_voice_event (const BtPattern * const self
,const gulong tick
,const gulong voice
,const gulong param
);
Returns the string representation of the specified cell. Free it when done.
|
the pattern the cell belongs to |
|
the tick (time) position starting with 0 |
|
the voice number starting with 0 |
|
the number of the global parameter starting with 0 |
Returns : |
a newly allocated string with the data or NULL on error |
GValue * bt_pattern_get_voice_event_data (const BtPattern * const self
,const gulong tick
,const gulong voice
,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 BT_IS_GVALUE(event).
|
the pattern to search for the voice param |
|
the tick (time) position starting with 0 |
|
the voice number starting with 0 |
|
the number of the voice parameter starting with 0 |
Returns : |
the GValue or NULL if out of the pattern range |
gulong bt_pattern_get_voice_param_index (const BtPattern * const self
,const gchar * const name
,GError **error
);
Searches the list of registered dparam of the machine the pattern belongs to for a voice dparam of the given name and returns the index if found.
|
the pattern to search for the voice dparam |
|
the name of the voice dparam |
|
pointer to an error variable |
Returns : |
the index. If an error occurs the function returns 0 and sets the error variable. You should always check for error if you use this function. |
void bt_pattern_insert_full_row (const BtPattern * const self
,const gulong tick
);
Insert one empty row for all parameters.
|
the pattern |
|
the postion to insert at |
Since 0.3
void bt_pattern_insert_row (const BtPattern * const self
,const gulong tick
,const gulong param
);
Insert one empty row for given param
.
|
the pattern |
|
the postion to insert at |
|
the parameter |
Since 0.3
BtPattern * bt_pattern_new (const BtSong * const song
,const gchar * const id
,const gchar * const name
,const gulong length
,const BtMachine * const machine
);
Create a new instance. It will be automatically added to the machines pattern list.
|
the song the new instance belongs to |
|
the id, we can use to lookup the pattern |
|
the display name of the pattern |
|
the number of ticks |
|
the machine the pattern belongs to |
Returns : |
the new instance or NULL in case of an error |
BtPattern * bt_pattern_new_with_event (const BtSong * const song
,const BtMachine * const machine
,const BtPatternCmd cmd
);
Create a new default pattern instance containg the given cmd
event.
It will be automatically added to the machines pattern list.
If cmd
is BT_PATTERN_CMD_NORMAL
use bt_pattern_new()
instead.
Don't call this from applications.
|
the song the new instance belongs to |
|
the machine the pattern belongs to |
|
a BtPatternCmd |
Returns : |
the new instance or NULL in case of an error |
void bt_pattern_randomize_column (const BtPattern * const self
,const gulong start_tick
,const gulong end_tick
,const gulong param
);
Randomize values from start_tick
to end_tick
for param
.
|
the pattern |
|
the start postion for the range |
|
the end postion for the range |
|
the parameter |
Since 0.3
void bt_pattern_randomize_columns (const BtPattern * const self
,const gulong start_tick
,const gulong end_tick
);
Randomize values from start_tick
to end_tick
for all params.
|
the pattern |
|
the start postion for the range |
|
the end postion for the range |
Since 0.3
void bt_pattern_serialize_column (const BtPattern * const self
,const gulong start_tick
,const gulong end_tick
,const gulong param
,GString *data
);
Serializes values from start_tick
to end_tick
for param
into data
.
|
the pattern |
|
the start postion for the range |
|
the end postion for the range |
|
the parameter |
|
the target |
Since 0.6
void bt_pattern_serialize_columns (const BtPattern * const self
,const gulong start_tick
,const gulong end_tick
,GString *data
);
Serializes values from start_tick
to end_tick
for all params into data
.
|
the pattern |
|
the start postion for the range |
|
the end postion for the range |
|
the target |
Since 0.6
gboolean bt_pattern_set_global_event (const BtPattern * const self
,const gulong tick
,const gulong param
,const gchar * const value
);
Stores the supplied value into the specified pattern cell.
|
the pattern the cell belongs to |
|
the tick (time) position starting with 0 |
|
the number of the global parameter starting with 0 |
|
the string representation of the value to store |
Returns : |
TRUE for success |
gboolean bt_pattern_set_voice_event (const BtPattern * const self
,const gulong tick
,const gulong voice
,const gulong param
,const gchar * const value
);
Stores the supplied value into the specified pattern cell.
|
the pattern the cell belongs to |
|
the tick (time) position starting with 0 |
|
the voice number starting with 0 |
|
the number of the global parameter starting with 0 |
|
the string representation of the value to store |
Returns : |
TRUE for success |
gboolean bt_pattern_test_global_event (const BtPattern * const self
,const gulong tick
,const gulong param
);
Tests if there is an event in the specified cell.
|
the pattern the cell belongs to |
|
the tick (time) position starting with 0 |
|
the number of the global parameter starting with 0 |
Returns : |
TRUE if there is an event |
gboolean bt_pattern_test_voice_event (const BtPattern * const self
,const gulong tick
,const gulong voice
,const gulong param
);
Tests if there is an event in the specified cell.
|
the pattern the cell belongs to |
|
the tick (time) position starting with 0 |
|
the voice number starting with 0 |
|
the number of the global parameter starting with 0 |
Returns : |
TRUE if there is an event |
gboolean bt_pattern_tick_has_data (const BtPattern * const self
,const gulong tick
);
Check if there are any event in the given pattern-row.
|
the pattern to check |
|
the tick index in the pattern |
Returns : |
TRUE is there are events, FALSE otherwise |
"id"
property "id" gchar* : Read / Write / Construct
pattern identifier (unique per song).
Default value: "unamed pattern"
"is-internal"
property "is-internal" gboolean : Read / Write / Construct Only
internal (cmd-pattern) indicator.
Default value: FALSE
"length"
property "length" gulong : Read / Write / Construct
length of the pattern in ticks.
Allowed values: >= 1
"machine"
property"machine" BtMachine* : Read / Write / Construct Only
Machine object, the pattern belongs to.
"name"
property "name" gchar* : Read / Write / Construct
the display-name of the pattern.
Default value: "unamed"
"song"
property"song" BtSong* : Read / Write / Construct Only
Song object, the pattern belongs to.
"global-param-changed"
signalvoid user_function (BtPattern *self,
gulong tick,
gulong param,
gpointer user_data) : No Hooks
signals that a global param of this pattern has been changed
|
the pattern object that emitted the signal |
|
the tick position inside the pattern |
|
the global parameter index |
|
user data set when the signal handler was connected. |
"pattern-changed"
signalvoid user_function (BtPattern *self,
gboolean intermediate,
gpointer user_data) : No Hooks
Signals that this pattern has been changed (more than in one place).
When doing e.g. lin inserts, one will receive two updtes, one before and one
after. The first will have intermediate
=TRUE. Applications can use that to
defer change-consolidation.
|
the pattern object that emitted the signal |
|
boolean flag that is TRUE to signal that more change are comming |
|
user data set when the signal handler was connected. |
"voice-param-changed"
signalvoid user_function (BtPattern *self,
gulong tick,
gulong voice,
gulong param,
gpointer user_data) : No Hooks
signals that a voice param of this pattern has been changed
|
the pattern object that emitted the signal |
|
the tick position inside the pattern |
|
the voice number |
|
the voice parameter index |
|
user data set when the signal handler was connected. |