PS04Counter

PS04Counter — Counts the song position

Synopsis


#include <PS04-counter.h>


            PS04Counter;
PS04Counter* ps04_counter_new               (void);
void        ps04_counter_add_ticks          (PS04Counter *self,
                                             gulong ticks);
guint       ps04_counter_get_beats_per_measure
                                            (const PS04Counter *self);
void        ps04_counter_get_measure_beat_tick
                                            (const PS04Counter *self,
                                             guint *measure,
                                             guint *beat,
                                             guint *tick);
gulong      ps04_counter_get_n_ticks        (const PS04Counter *self);
char*       ps04_counter_get_position_string
                                            (const PS04Counter *self);
void        ps04_counter_set_beats_per_measure
                                            (PS04Counter *self,
                                             guint beats);

Object Hierarchy


  GObject
   +----PS04Counter

Description

The PS04Counter class keeps track of where you are in a rhythm pattern or song. It accumulates ticks (1/48 of a quarter note) and calculates a measure-beat-tick position from the current total. Time signature changes, set by ps04_counter_set_beats_per_measure(), are supported at any point during the tick accumulation - although you'd normally want to reset it at measure boundaries only.

Details

PS04Counter

typedef struct _PS04Counter PS04Counter;


ps04_counter_new ()

PS04Counter* ps04_counter_new               (void);

Creates a new counter.

Returns : a new PS04Counter object.

ps04_counter_add_ticks ()

void        ps04_counter_add_ticks          (PS04Counter *self,
                                             gulong ticks);

Adds a number of ticks to the counter.

self : a PS04Counter.
ticks : the number of ticks to add.

ps04_counter_get_beats_per_measure ()

guint       ps04_counter_get_beats_per_measure
                                            (const PS04Counter *self);

self :
Returns :

ps04_counter_get_measure_beat_tick ()

void        ps04_counter_get_measure_beat_tick
                                            (const PS04Counter *self,
                                             guint *measure,
                                             guint *beat,
                                             guint *tick);

Gets the current counter position as a measure-beat-tick combo. Note that all values are 0-based, although you should make measure and beat values 1-based when shown to the user.

self : a PS04Counter.
measure : pointer to a guint to receive the current measure (0-based).
beat : pointer to a guint to receive the current beat (0-based).
tick : pointer to a guint to receive the current tick (0-based), or NULL if this is of no interest (song events are always on beat boundaries and thus get zero tick values).

ps04_counter_get_n_ticks ()

gulong      ps04_counter_get_n_ticks        (const PS04Counter *self);

Gets the current accumulated tick count.

self : a PS04Counter.
Returns : the tick count.

ps04_counter_get_position_string ()

char*       ps04_counter_get_position_string
                                            (const PS04Counter *self);

self :
Returns :

ps04_counter_set_beats_per_measure ()

void        ps04_counter_set_beats_per_measure
                                            (PS04Counter *self,
                                             guint beats);

Sets the number of beats per measure from the current position and onwards.

self : a PS04Counter.
beats : the number of beats per measure (1-8).