Chapter 6. Your tree linked with AgsChannel
Prev |  | Next

# Chapter 6. Your tree linked with AgsChannel

AgsChannel forms your audio processing tree and contains recalls, too. You might want to iterate the channels of your audio object or just call one of these functions:

- `AgsChannel* ags_channel_first(AgsChannel*)`
- `AgsChannel* ags_channel_last(AgsChannel*)`
- `AgsChannel* ags_channel_nth(AgsChannel*, guint)`
- `AgsChannel* ags_channel_pad_first(AgsChannel*)`
- `AgsChannel* ags_channel_pad_last(AgsChannel*)`
- `AgsChannel* ags_channel_pad_nth(AgsChannel*, guint)`

As you see there is a grained access to channels. You can lookup channels from with the same audio channel with the functions containing pad in its name. An other exciting feature is finding channels having an assigned recycling. These functions operate on the very same audio channel.

- `AgsChannel* ags_channel_first_with_recycling(AgsChannel*)`
- `AgsChannel* ags_channel_last_with_recycling(AgsChannel*)`
- `AgsChannel* ags_channel_prev_with_recycling(AgsChannel*)`
- `AgsChannel* ags_channel_next_with_recycling(AgsChannel*)`

Following object fields are changed during linking. Further a new AgsRecycling might be instantiated to be provided as `first_recycling` and `last_recycling` of specified AgsInput eg. if it is NULL. So this input has got its very own recycling as specified by `AGS_AUDIO_INPUT_HAS_RECYCLING`:

- `AgsChannel:link` `recursive AgsChannel:first-recycling and AgsChannel:last-recycling as needed` `AgsRecycling:parent` `AgsRecycling:prev or AgsRecycling:next`

## The pattern

There can AgsPattern being added to a channel by `void ags_channel_add_pattern(AgsChannel*, GObject*)`. Later if not used anymore likewise call `void ags_channel_remove_pattern(AgsChannel*, GObject*)`.

Example 6.1. Adding AgsPattern

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

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

    AgsChannel *channel;
    AgsPattern *pattern;

    guint n_bank_0, n_bank_1;
    guint length;

    /* create channel */
    channel = ags_channel_new(NULL);

    /* create pattern, set dimension and add it to channel */
    n_bank_0 = 4;
    n_bank_1 = 12;

    length = 64;

    pattern = ags_pattern_new();
    ags_pattern_set_dim(pattern,
                        n_bank_0,
                        n_bank_1,
                        length);
    ags_channel_add_pattern(channel,
                            pattern);

Prev |  | Next
Open audio files | Home | Linking overview