After you got an overview of the basic lifecycle of an effect it's time to create an effect. In this guide we will cover instatiating an effect by using the echo effect. In the following chapter we'll take a look inside the echo effect.
AgsRecallContainer isn't a recall itself but you can use it to retrieve a different context.
Example 9.1. Creating AgsRecallContainer
#include <glib.h> #include <glib-object.h> #include <ags/libags.h> #include <ags/libags-audio.h> AgsAudio *audio; AgsChannel *channel; AgsRecallContainer *echo_container; GObject *soundcard; soundcard = ags_alsa_devout_new(); audio = ags_audio_new(devout); /* create the container */ recall_container = (AgsRecallContainer *) g_object_new(AGS_TYPE_RECALL_CONTAINER, NULL); ags_audio_add_recall_container(audio, (GObject *) recall_container);
This is a context you want to use for fields applicable to the entire AgsAudio object.
Example 9.2. Creating AgsEchoAudio
#include <glib.h> #include <glib-object.h> #include <ags/libags.h> #include <ags/libags-audio.h> AgsEchoAudio *echo_audio; echo_audio = (AgsEchoAudio *) g_object_new(AGS_TYPE_ECHO_AUDIO, "soundcard", soundcard, "audio", audio, "recall-container", echo_container, NULL); ags_recall_set_flags(echo_audio, AGS_RECALL_TEMPLATE);
This context you can use for fields applicable to the AgsChannel you want to modify.
Example 9.3. Creating AgsEchoChannel
#include <glib.h> #include <glib-object.h> #include <ags/libags.h> #include <ags/libags-audio.h> AgsEchoChannel *echo_channel; echo_channel = (AgsEchoChannel *) g_object_new(AGS_TYPE_ECHO_CHANNEL, "soundcard", soundcard, "channel", channel, "recall-container", echo_container, "delay", (devout->frequency * (60 / devout->bpm) / 4), "repeat", 3, "fade", -0.25, "dry", 0.5, NULL); ags_recall_set_flags(echo_channel, AGS_RECALL_TEMPLATE);
The AgsRecallAudioRun class will be duplicated for a parental running AgsChannel. There may be several AgsChannel objects as parental owning a run.
Example 9.4. Creating AgsEchoAudioRun
#include <glib.h> #include <glib-object.h> #include <ags/libags.h> #include <ags/libags-audio.h> echo_audio_run = (AgsEchoAudioRun *) g_object_new(AGS_TYPE_ECHO_AUDIO_RUN, "soundcard", soundcard, "audio", audio, "recall-audio", echo_audio, "recall-container", echo_container, NULL); ags_recall_set_flags(echo_audio_run, AGS_RECALL_TEMPLATE);
The AgsRecallChannelRun behaves like an AgsRecallAudioRun but is designated to an AgsChannel object.
Example 9.5. Creating AgsEchoChannelRun
#include <glib.h> #include <glib-object.h> #include <ags/libags.h> #include <ags/libags-audio.h> AgsEchoChannelRun *echo_channel_run; echo_channel_run = (AgsEchoChannelRun *) g_object_new(AGS_TYPE_ECHO_CHANNEL_RUN, "soundcard", soundcard, "channel", channel "recall-channel", echo_channel, "recall-container", echo_container, NULL); ags_recall_set_flags(echo_channel_run, AGS_RECALL_TEMPLATE);