AgsSequencer

AgsSequencer — unique access to sequencers

Functions

Signals

Types and Values

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_application_context ()

void
ags_sequencer_set_application_context (AgsSequencer *sequencer,
                                       AgsApplicationContext *application_context);

Set application context.

Parameters

sequencer

an AgsSequencer

 

application_context

the application context to set

 

Since: 1.0.0


ags_sequencer_get_application_context ()

AgsApplicationContext *
ags_sequencer_get_application_context (AgsSequencer *sequencer);

Get application context.

Parameters

sequencer

an AgsSequencer

 

Since: 1.0.0


ags_sequencer_set_application_mutex ()

void
ags_sequencer_set_application_mutex (AgsSequencer *sequencer,
                                     pthread_mutex_t *application_mutex);

Set application mutex.

Parameters

sequencer

an AgsSequencer

 

application_mutex

the application mutex to set

 

Since: 1.0.0


ags_sequencer_get_application_mutex ()

pthread_mutex_t *
ags_sequencer_get_application_mutex (AgsSequencer *sequencer);

Get application mutex.

Parameters

sequencer

an AgsSequencer

 

Returns

the application mutex

Since: 1.0.0


ags_sequencer_set_device ()

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

Set device.

Parameters

sequencer

an AgsSequencer

 

device_id

the device to set

 

Since: 1.0.0


ags_sequencer_get_device ()

gchar *
ags_sequencer_get_device (AgsSequencer *sequencer);

Get device.

Parameters

sequencer

an AgsSequencer

 

Returns

the device's identifier

Since: 1.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

an AgsSequencer

 

card_id

a list containing card ids

 

card_name

a list containing card names

 

Since: 1.0.0


ags_sequencer_is_starting ()

gboolean
ags_sequencer_is_starting (AgsSequencer *sequencer);

Get starting.

Parameters

sequencer

an AgsSequencer

 

Returns

TRUE if starting, else FALSE

Since: 1.0.0


ags_sequencer_is_playing ()

gboolean
ags_sequencer_is_playing (AgsSequencer *sequencer);

Get playing.

Parameters

sequencer

an AgsSequencer

 

Returns

TRUE if playing, else FALSE

Since: 1.0.0


ags_sequencer_is_recording ()

gboolean
ags_sequencer_is_recording (AgsSequencer *sequencer);

Get recording.

Parameters

sequencer

an AgsSequencer

 

Returns

TRUE if recording, else FALSE

Since: 1.0.0


ags_sequencer_play_init ()

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

ags_sequencer_play ()

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

Plays the current buffer of sequencer.

Parameters

sequencer

an AgsSequencer

 

error

an error that may occure

 

Since: 1.0.0


ags_sequencer_record_init ()

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

ags_sequencer_record ()

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

Records the current buffer of sequencer.

Parameters

sequencer

an AgsSequencer

 

error

an error that may occure

 

Since: 1.0.0


ags_sequencer_stop ()

void
ags_sequencer_stop (AgsSequencer *sequencer);

Stops the sequencer from playing to it.

Parameters

sequencer

an AgsSequencer

 

Since: 1.0.0


ags_sequencer_tic ()

void
ags_sequencer_tic (AgsSequencer *sequencer);

Callback when counter expires minor note offset.

Parameters

sequencer

an AgsSequencer

 

Since: 1.0.0


ags_sequencer_offset_changed ()

void
ags_sequencer_offset_changed (AgsSequencer *sequencer,
                              guint note_offset);

ags_sequencer_get_buffer ()

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

Get current playback buffer.

Parameters

sequencer

an AgsSequencer

 

buffer_length

the buffer's length

 

Returns

current playback buffer

Since: 1.0.0


ags_sequencer_get_next_buffer ()

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

Get future playback buffer.

Parameters

sequencer

an AgsSequencer

 

buffer_length

the buffer's length

 

Returns

next playback buffer

Since: 1.0.0


ags_sequencer_set_bpm ()

void
ags_sequencer_set_bpm (AgsSequencer *sequencer,
                       gdouble bpm);

Set current playback bpm.

Parameters

sequencer

an AgsSequencer

 

bpm

the bpm to set

 

Since: 1.0.0


ags_sequencer_get_bpm ()

gdouble
ags_sequencer_get_bpm (AgsSequencer *sequencer);

Get current playback bpm.

Parameters

sequencer

an AgsSequencer

 

Returns

bpm

Since: 1.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

an AgsSequencer

 

delay_factor

the delay factor to set

 

Since: 1.0.0


ags_sequencer_get_delay_factor ()

gdouble
ags_sequencer_get_delay_factor (AgsSequencer *sequencer);

Get current playback delay factor.

Parameters

sequencer

an AgsSequencer

 

Returns

delay factor

Since: 1.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

an AgsSequencer

 

note_offset

the note offset to set

 

Since: 1.0.0


ags_sequencer_get_note_offset ()

guint
ags_sequencer_get_note_offset (AgsSequencer *sequencer);

Get current playback note offset.

Parameters

sequencer

an AgsSequencer

 

Returns

offset

Since: 1.0.0


ags_sequencer_set_audio ()

void
ags_sequencer_set_audio (AgsSequencer *sequencer,
                         GList *audio);

Set audio.

Parameters

sequencer

an AgsSequencer

 

audio

the audio to set

 

Since: 1.0.0


ags_sequencer_get_audio ()

GList *
ags_sequencer_get_audio (AgsSequencer *sequencer);

Get audio.

Parameters

sequencer

an AgsSequencer

 

Returns

a GList container AgsAudio

Since: 1.0.0


AGS_IS_SEQUENCER()

#define AGS_IS_SEQUENCER(obj)                 (G_TYPE_CHECK_INSTANCE_TYPE((obj), AGS_TYPE_SEQUENCER))

AGS_IS_SEQUENCER_INTERFACE()

#define AGS_IS_SEQUENCER_INTERFACE(vtable)    (G_TYPE_CHECK_CLASS_TYPE((vtable), AGS_TYPE_SEQUENCER))

AGS_SEQUENCER()

#define AGS_SEQUENCER(obj)                    (G_TYPE_CHECK_INSTANCE_CAST((obj), AGS_TYPE_SEQUENCER, AgsSequencer))

AGS_SEQUENCER_GET_INTERFACE()

#define AGS_SEQUENCER_GET_INTERFACE(obj)      (G_TYPE_INSTANCE_GET_INTERFACE((obj), AGS_TYPE_SEQUENCER, AgsSequencerInterface))

AGS_SEQUENCER_INTERFACE()

#define AGS_SEQUENCER_INTERFACE(vtable)       (G_TYPE_CHECK_CLASS_CAST((vtable), AGS_TYPE_SEQUENCER, AgsSequencerInterface))

ags_sequencer_get_type ()

GType
ags_sequencer_get_type ();

Types and Values

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)

AGS_TYPE_SEQUENCER

#define AGS_TYPE_SEQUENCER                    (ags_sequencer_get_type())

AgsSequencer

typedef struct _AgsSequencer AgsSequencer;

struct AgsSequencerInterface

struct AgsSequencerInterface {
  GTypeInterface ginterface;

  void (*set_application_context)(AgsSequencer *sequencer,
				  AgsApplicationContext *application_context);
  AgsApplicationContext* (*get_application_context)(AgsSequencer *sequencer);

  void (*set_application_mutex)(AgsSequencer *sequencer,
				pthread_mutex_t *application_mutex);
  pthread_mutex_t* (*get_application_mutex)(AgsSequencer *sequencer);

  void (*set_device)(AgsSequencer *sequencer,
		     gchar *card_id);
  gchar* (*get_device)(AgsSequencer *sequencer);

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

  gboolean (*is_starting)(AgsSequencer *sequencer);
  gboolean (*is_playing)(AgsSequencer *sequencer);
  gboolean (*is_recording)(AgsSequencer *sequencer);

  void (*play_init)(AgsSequencer *sequencer,
		    GError **error);
  void (*play)(AgsSequencer *sequencer,
	       GError **error);

  void (*record_init)(AgsSequencer *sequencer,
		      GError **error);
  void (*record)(AgsSequencer *sequencer,
		 GError **error);

  void (*stop)(AgsSequencer *sequencer);

  void (*tic)(AgsSequencer *sequencer);
  void (*offset_changed)(AgsSequencer *sequencer,
			 guint note_offset);

  void* (*get_buffer)(AgsSequencer *sequencer,
		      guint *buffer_length);
  void* (*get_next_buffer)(AgsSequencer *sequencer,
			   guint *buffer_length);

  void (*set_bpm)(AgsSequencer *sequencer,
		  gdouble bpm);
  gdouble (*get_bpm)(AgsSequencer *sequencer);

  void (*set_delay_factor)(AgsSequencer *sequencer,
			   gdouble delay_factor);
  gdouble (*get_delay_factor)(AgsSequencer *sequencer);

  void (*set_note_offset)(AgsSequencer *sequencer,
			  guint note_offset);
  guint (*get_note_offset)(AgsSequencer *sequencer);

  void (*set_audio)(AgsSequencer *sequencer,
		    GList *audio);
  GList* (*get_audio)(AgsSequencer *sequencer);
};

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 object

 

note_offset

new notation offset

 

user_data

user data set when the signal handler was connected.

 

Flags: Run Last

Since: 1.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 object

 

user_data

user data set when the signal handler was connected.

 

Flags: Run Last

Since: 1.0.0