Chapter 5. AgsAudio a container of AgsChannel

Table of Contents

AgsNotation and AgsNote
AgsAutomation and AgsAcceleration
AgsRecallID and AgsRecyclingContext
Dealing with recalls
Open audio files

AgsAudio contains a pointer to your notation and automation data. It has its own recall context, AgsRecallAudio. It organizes your recycling contices and thus having an associated AgsRecallID for running contices. Further AgsAudio is your topmost nesting level of AgsAudioSignal. You might traverse the layers in following order:

  1. AgsAudio
  2. AgsChannel
  3. AgsRecycling
  4. AgsAudioSignal

AgsAudioSignal keeps your audio data as a GList of buffers. AgsRecycling is your nested tree to AgsChannel, giving you the opportunity to emit ::add_audio_signal or ::remove_audio_signal by producer and havig many consumers. AgsChannel is your opposite to an audio channel representing a single line. AgsAudio keeps track of all of them. You might want to add your audio object to an AgsSoundcard.

You may resize the count of pads or audio channels with ags_audio_set_pads() and ags_audio_set_audio_channels(). Like in the following example the channels are adjusted and notation is added.

Example 5.1. Using AgsAudio

#include <glib.h>
#include <glib-object.h>

#include <ags/libags.h>
#include <ags/libags-audio.h>

AgsApplicationContext *application_context;
GList *soundcard;
AgsAudio *audio;
AgsNotation *notation;

guint audio_channels;
guint i;

/* get application context and soundcard */
application_context = ags_application_context_get_instance();
soundcard = ags_sound_provider_get_soundcard(AGS_SOUND_PROVIDER(application_context));

/* creat audio and resize channels */
audio_channels = 2;

audio = ags_audio_new(soundcard->data);
ags_audio_set_audio_channels(audio,
                             audio_channels);
ags_audio_set_pads(audio,
                   AGS_TYPE_OUTPUT,
                   1);
ags_audio_set_pads(audio,
                   AGS_TYPE_INPUT,
                   1);

/* add notation */
for(i = 0; i < audio_channels; i++){
  notation = ags_notation_new(audio,
                              i);
  ags_audio_add_notation(audio,
                         notation);
}

    

AgsNotation and AgsNote

The notation object stores your notes as a GList. You can add or remove a note by calling appropriate function:

  • ags_notation_add_note()
  • ags_notation_remove_note_at_position()

The notation object supports selection of notes. There are functions available to select a single point or a region of the notation. You may find specific notes by calling:

  • ags_notation_find_point()
  • ags_notation_find_region()