## AgsSequencer

AgsSequencer — unique access to sequencers

## Stability Level

Stable, unless otherwise indicated

## Functions

void | ags_sequencer_set_device ()
gchar * | ags_sequencer_get_device ()
void | ags_sequencer_list_cards ()
gboolean | ags_sequencer_is_starting ()
gboolean | ags_sequencer_is_playing ()
gboolean | ags_sequencer_is_recording ()
void | ags_sequencer_play_init ()
void | ags_sequencer_play ()
void | ags_sequencer_record_init ()
void | ags_sequencer_record ()
void | ags_sequencer_stop ()
void | ags_sequencer_tic ()
void | ags_sequencer_offset_changed ()
void * | ags_sequencer_get_buffer ()
void * | ags_sequencer_get_next_buffer ()
void | ags_sequencer_lock_buffer ()
void | ags_sequencer_unlock_buffer ()
void | ags_sequencer_set_bpm ()
gdouble | ags_sequencer_get_bpm ()
void | ags_sequencer_set_delay_factor ()
gdouble | ags_sequencer_get_delay_factor ()
void | ags_sequencer_set_start_note_offset ()
guint | ags_sequencer_get_start_note_offset ()
void | ags_sequencer_set_note_offset ()
guint | ags_sequencer_get_note_offset ()
AgsSequencerMidiVersion | ags_sequencer_get_midi_version ()

## Signals

void | offset-changed | Run Last
void | tic | Run Last

## Types and Values

#define | AGS_SEQUENCER_MAX_MIDI_CHANNELS
#define | AGS_SEQUENCER_MAX_MIDI_KEYS
#define | AGS_SEQUENCER_DEFAULT_SAMPLERATE
#define | AGS_SEQUENCER_DEFAULT_BUFFER_SIZE
#define | AGS_SEQUENCER_DEFAULT_DEVICE
#define | AGS_SEQUENCER_DEFAULT_BPM
#define | AGS_SEQUENCER_DEFAULT_DELAY_FACTOR
#define | AGS_SEQUENCER_DEFAULT_JIFFIE
#define | AGS_SEQUENCER_DEFAULT_TACT
#define | AGS_SEQUENCER_DEFAULT_TACT_JIFFIE
#define | AGS_SEQUENCER_DEFAULT_TACTRATE
#define | AGS_SEQUENCER_DEFAULT_SCALE
#define | AGS_SEQUENCER_DEFAULT_DELAY
#define | AGS_SEQUENCER_DEFAULT_PERIOD
#define | AGS_SEQUENCER_DEFAULT_LATENCY
enum | AgsSequencerMidiVersion

## Object Hierarchy

        GInterface
        ╰── AgsSequencer

## Includes

    #include <ags/object/ags_sequencer.h>

## Description

The AgsSequencer interface gives you a unique access to MIDI devices.

## Functions

### ags_sequencer_set_device ()

    void
    ags_sequencer_set_device (AgsSequencer *sequencer,
                              gchar *card_id);

Set device.

#### Parameters

sequencer | the AgsSequencer |
card_id | the device to set |

Since: 3.0.0

### ags_sequencer_get_device ()

    gchar *
    ags_sequencer_get_device (AgsSequencer *sequencer);

Get device.

#### Parameters

sequencer | the AgsSequencer |

#### Returns

the device's identifier

Since: 3.0.0

### ags_sequencer_list_cards ()

    void
    ags_sequencer_list_cards (AgsSequencer *sequencer,
                              GList **card_id,
                              GList **card_name);

Retrieve `card_id` and `card_name` as a list of strings.

#### Parameters

sequencer | the AgsSequencer |
card_id | a list containing card ids. | [element-type utf8][out callee-allocates][array zero-terminated=1][transfer full]
card_name | a list containing card names. | [element-type utf8][out callee-allocates][array zero-terminated=1][transfer full]

Since: 3.0.0

### ags_sequencer_is_starting ()

    gboolean
    ags_sequencer_is_starting (AgsSequencer *sequencer);

Get starting.

#### Parameters

sequencer | the AgsSequencer |

#### Returns

`TRUE` if starting, else `FALSE`

Since: 3.0.0

### ags_sequencer_is_playing ()

    gboolean
    ags_sequencer_is_playing (AgsSequencer *sequencer);

Get playing.

#### Parameters

sequencer | the AgsSequencer |

#### Returns

`TRUE` if playing, else `FALSE`

Since: 3.0.0

### ags_sequencer_is_recording ()

    gboolean
    ags_sequencer_is_recording (AgsSequencer *sequencer);

Get recording.

#### Parameters

sequencer | the AgsSequencer |

#### Returns

`TRUE` if recording, else `FALSE`

Since: 3.0.0

### ags_sequencer_play_init ()

    void
    ags_sequencer_play_init (AgsSequencer *sequencer,
                             GError **error);

Initializes the sequencer for playback.

#### Parameters

sequencer | the AgsSequencer |
error | an error that may occure |

Since: 3.0.0

### ags_sequencer_play ()

    void
    ags_sequencer_play (AgsSequencer *sequencer,
                        GError **error);

Plays the current buffer of sequencer.

#### Parameters

sequencer | the AgsSequencer |
error | an error that may occure |

Since: 3.0.0

### ags_sequencer_record_init ()

    void
    ags_sequencer_record_init (AgsSequencer *sequencer,
                               GError **error);

Initializes the sequencer for recording.

#### Parameters

sequencer | the AgsSequencer |
error | an error that may occure |

Since: 3.0.0

### ags_sequencer_record ()

    void
    ags_sequencer_record (AgsSequencer *sequencer,
                          GError **error);

Records the current buffer of sequencer.

#### Parameters

sequencer | the AgsSequencer |
error | an error that may occure |

Since: 3.0.0

### ags_sequencer_stop ()

    void
    ags_sequencer_stop (AgsSequencer *sequencer);

Stops the sequencer from playing to it.

#### Parameters

sequencer | the AgsSequencer |

Since: 3.0.0

### ags_sequencer_tic ()

    void
    ags_sequencer_tic (AgsSequencer *sequencer);

Every call to play may generate a tic.

#### Parameters

sequencer | the AgsSequencer |

Since: 3.0.0

### ags_sequencer_offset_changed ()

    void
    ags_sequencer_offset_changed (AgsSequencer *sequencer,
                                  guint note_offset);

Callback when counter expires minor note offset.

#### Parameters

sequencer | the AgsSequencer |
note_offset | the note offset |

Since: 3.0.0

### ags_sequencer_get_buffer ()

    void *
    ags_sequencer_get_buffer (AgsSequencer *sequencer,
                              guint *buffer_length);

Get current playback buffer.

#### Parameters

sequencer | the AgsSequencer |
buffer_length | the buffer's length |

#### Returns

current playback buffer

Since: 3.0.0

### ags_sequencer_get_next_buffer ()

    void *
    ags_sequencer_get_next_buffer (AgsSequencer *sequencer,
                                   guint *buffer_length);

Get future playback buffer.

#### Parameters

sequencer | the AgsSequencer |
buffer_length | the buffer's length |

#### Returns

next playback buffer

Since: 3.0.0

### ags_sequencer_lock_buffer ()

    void
    ags_sequencer_lock_buffer (AgsSequencer *sequencer,
                               void *buffer);

Lock `buffer` .

#### Parameters

sequencer | the AgsSequencer |
buffer | the buffer to lock |

Since: 3.0.0

### ags_sequencer_unlock_buffer ()

    void
    ags_sequencer_unlock_buffer (AgsSequencer *sequencer,
                                 void *buffer);

Unlock `buffer` .

#### Parameters

sequencer | the AgsSequencer |
buffer | the buffer to unlock |

Since: 3.0.0

### ags_sequencer_set_bpm ()

    void
    ags_sequencer_set_bpm (AgsSequencer *sequencer,
                           gdouble bpm);

Set current playback bpm.

#### Parameters

sequencer | the AgsSequencer |
bpm | the bpm to set |

Since: 3.0.0

### ags_sequencer_get_bpm ()

    gdouble
    ags_sequencer_get_bpm (AgsSequencer *sequencer);

Get current playback bpm.

#### Parameters

sequencer | the AgsSequencer |

#### Returns

bpm

Since: 3.0.0

### ags_sequencer_set_delay_factor ()

    void
    ags_sequencer_set_delay_factor (AgsSequencer *sequencer,
                                    gdouble delay_factor);

Set current playback delay factor.

#### Parameters

sequencer | the AgsSequencer |
delay_factor | the delay factor to set |

Since: 3.0.0

### ags_sequencer_get_delay_factor ()

    gdouble
    ags_sequencer_get_delay_factor (AgsSequencer *sequencer);

Get current playback delay factor.

#### Parameters

sequencer | the AgsSequencer |

#### Returns

delay factor

Since: 3.0.0

### ags_sequencer_set_start_note_offset ()

    void
    ags_sequencer_set_start_note_offset (AgsSequencer *sequencer,
                                         guint start_note_offset);

Set start playback note offset.

#### Parameters

sequencer | the AgsSequencer |
start_note_offset | the start note offset to set |

Since: 3.0.0

### ags_sequencer_get_start_note_offset ()

    guint
    ags_sequencer_get_start_note_offset (AgsSequencer *sequencer);

Get start playback note offset.

#### Parameters

sequencer | the AgsSequencer |

#### Returns

the start note offset

Since: 3.0.0

### ags_sequencer_set_note_offset ()

    void
    ags_sequencer_set_note_offset (AgsSequencer *sequencer,
                                   guint note_offset);

Set current playback note offset.

#### Parameters

sequencer | the AgsSequencer |
note_offset | the note offset to set |

Since: 3.0.0

### ags_sequencer_get_note_offset ()

    guint
    ags_sequencer_get_note_offset (AgsSequencer *sequencer);

Get current playback note offset.

#### Parameters

sequencer | the AgsSequencer |

#### Returns

offset

Since: 3.0.0

### ags_sequencer_get_midi_version ()

    AgsSequencerMidiVersion
    ags_sequencer_get_midi_version (AgsSequencer *sequencer);

Get MIDI version.

#### Parameters

sequencer | the AgsSequencer |

#### Returns

the MIDI version

Since: 7.0.0

## Types and Values

### AGS_SEQUENCER_MAX_MIDI_CHANNELS

    #define AGS_SEQUENCER_MAX_MIDI_CHANNELS (16)

### AGS_SEQUENCER_MAX_MIDI_KEYS

    #define AGS_SEQUENCER_MAX_MIDI_KEYS (128)

### AGS_SEQUENCER_DEFAULT_SAMPLERATE

    #define AGS_SEQUENCER_DEFAULT_SAMPLERATE (44100.0)

### AGS_SEQUENCER_DEFAULT_BUFFER_SIZE

    #define AGS_SEQUENCER_DEFAULT_BUFFER_SIZE (944)

### AGS_SEQUENCER_DEFAULT_DEVICE

    #define AGS_SEQUENCER_DEFAULT_DEVICE "hw:0"

### AGS_SEQUENCER_DEFAULT_BPM

    #define AGS_SEQUENCER_DEFAULT_BPM (120.0)

### AGS_SEQUENCER_DEFAULT_DELAY_FACTOR

    #define AGS_SEQUENCER_DEFAULT_DELAY_FACTOR (1.0 / 4.0)

### AGS_SEQUENCER_DEFAULT_JIFFIE

    #define AGS_SEQUENCER_DEFAULT_JIFFIE ((double) AGS_SEQUENCER_DEFAULT_SAMPLERATE / (double) AGS_SEQUENCER_DEFAULT_BUFFER_SIZE)

### AGS_SEQUENCER_DEFAULT_TACT

    #define AGS_SEQUENCER_DEFAULT_TACT (1.0 / 1.0)

### AGS_SEQUENCER_DEFAULT_TACT_JIFFIE

    #define AGS_SEQUENCER_DEFAULT_TACT_JIFFIE (60.0 / AGS_SEQUENCER_DEFAULT_BPM * AGS_SEQUENCER_DEFAULT_TACT)

### AGS_SEQUENCER_DEFAULT_TACTRATE

    #define AGS_SEQUENCER_DEFAULT_TACTRATE (1.0 / AGS_SEQUENCER_DEFAULT_TACT_JIFFIE)

### AGS_SEQUENCER_DEFAULT_SCALE

    #define AGS_SEQUENCER_DEFAULT_SCALE (1.0)

### AGS_SEQUENCER_DEFAULT_DELAY

    #define AGS_SEQUENCER_DEFAULT_DELAY (AGS_SEQUENCER_DEFAULT_JIFFIE * (60.0 / AGS_SEQUENCER_DEFAULT_BPM))

### AGS_SEQUENCER_DEFAULT_PERIOD

    #define AGS_SEQUENCER_DEFAULT_PERIOD (64.0)

### AGS_SEQUENCER_DEFAULT_LATENCY

    #define AGS_SEQUENCER_DEFAULT_LATENCY (400)

### enum AgsSequencerMidiVersion

Enum values to tell about version.

#### Members

AGS_SEQUENCER_MIDI1 | MIDI version 1 |
AGS_SEQUENCER_MIDI2 | MIDI version 2 |

## Signal Details

### The `“offset-changed”` signal

    void
    user_function (AgsSequencer *sequencer,
                   guint         note_offset,
                   gpointer      user_data)

The ::offset-changed signal notifies about changed position within notation.

#### Parameters

sequencer | the AgsSequencer object |
note_offset | new notation offset |
user_data | user data set when the signal handler was connected. |

Flags: Run Last

Since: 3.0.0

### The `“tic”` signal

    void
    user_function (AgsSequencer *sequencer,
                   gpointer      user_data)

The ::tic signal is emitted every tic of the sequencer. This notifies about a newly played buffer.

#### Parameters

sequencer | the AgsSequencer object |
user_data | user data set when the signal handler was connected. |

Flags: Run Last

Since: 3.0.0