## AgsRecycling

AgsRecycling — Recycling container of audio signals

## Stability Level

Stable, unless otherwise indicated

## Functions

#define | AGS_RECYCLING_GET_OBJ_MUTEX()
GRecMutex * | ags_recycling_get_obj_mutex ()
gboolean | ags_recycling_test_flags ()
void | ags_recycling_set_flags ()
void | ags_recycling_unset_flags ()
GObject * | ags_recycling_get_channel ()
void | ags_recycling_set_channel ()
AgsRecycling * | ags_recycling_next ()
AgsRecycling * | ags_recycling_prev ()
GObject * | ags_recycling_get_output_soundcard ()
void | ags_recycling_set_output_soundcard ()
GObject * | ags_recycling_get_input_soundcard ()
void | ags_recycling_set_input_soundcard ()
guint | ags_recycling_get_samplerate ()
void | ags_recycling_set_samplerate ()
guint | ags_recycling_get_buffer_size ()
void | ags_recycling_set_buffer_size ()
guint | ags_recycling_get_format ()
void | ags_recycling_set_format ()
GList * | ags_recycling_get_audio_signal ()
void | ags_recycling_set_audio_signal ()
void | ags_recycling_add_audio_signal ()
void | ags_recycling_remove_audio_signal ()
void | ags_recycling_data_request ()
gint | ags_recycling_position ()
AgsRecycling * | ags_recycling_find_next_channel ()
gboolean | ags_recycling_is_active ()
void | ags_recycling_create_audio_signal_with_defaults ()
void | ags_recycling_create_audio_signal_with_frame_count ()
AgsRecycling * | ags_recycling_new ()

## Properties

gpointer | audio-signal | Read / Write
guint | buffer-size | Read / Write
AgsChannel * | channel | Read / Write
guint | format | Read / Write
GObject * | input-soundcard | Read / Write
int | input-soundcard-channel | Read / Write
AgsRecycling * | next | Read / Write
GObject * | output-soundcard | Read / Write
int | output-soundcard-channel | Read / Write
AgsRecycling * | parent | Read / Write
AgsRecycling * | prev | Read / Write
guint | samplerate | Read / Write

## Signals

void | add-audio-signal | Run Last
void | data-request | Run Last
void | remove-audio-signal | Run Last

## Types and Values

enum | AgsRecyclingFlags

## Object Hierarchy

        GFlags
        ╰── AgsRecyclingFlags
        GObject
        ╰── AgsRecycling

## Includes

    #include <ags/audio/ags_recycling.h>

## Description

AgsRecycling forms the nested tree of AgsAudio and AgsChannel. The recycling tree is the actual audio processing tree, because it hosts AgsAudioSignal.

Every recycling node introduces a new AgsAudioSignal for specific AgsSoundScope specified by assigned AgsRecallID.

All audio processing happens on AgsAudioSignal and is added to AgsRecycling by `ags_recycling_add_audio_signal()`. While you call it, the function takes the audio signal with AGS_AUDIO_SIGNAL_TEMPLATE flag set and creates a copy AgsAudioSignal with the very same audio data of `stream` property.

The actual audio processing functionality is provided by AgsRecall implementations. Its entry point is AgsAudio or AgsChannel.

AgsRecall objectss except templates are assigned with a AgsRecallID with a relation to AgsRecyclingContext.

## Functions

### AGS_RECYCLING_GET_OBJ_MUTEX()

    #define AGS_RECYCLING_GET_OBJ_MUTEX(obj) (&(((AgsRecycling *) obj)->obj_mutex))

### ags_recycling_get_obj_mutex ()

    GRecMutex *
    ags_recycling_get_obj_mutex (AgsRecycling *recycling);

Get object mutex.

#### Parameters

recycling | the AgsRecycling |

#### Returns

the GRecMutex to lock `recycling`

Since: 3.1.0

### ags_recycling_test_flags ()

    gboolean
    ags_recycling_test_flags (AgsRecycling *recycling,
                              guint flags);

Test `flags` to be set on `recycling` .

#### Parameters

recycling | the AgsRecycling |
flags | the flags |

#### Returns

`TRUE` if flags are set, else `FALSE`

Since: 3.0.0

### ags_recycling_set_flags ()

    void
    ags_recycling_set_flags (AgsRecycling *recycling,
                             guint flags);

Enable a feature of `recycling` .

#### Parameters

recycling | the AgsRecycling |
flags | see AgsRecyclingFlags |

Since: 3.0.0

### ags_recycling_unset_flags ()

    void
    ags_recycling_unset_flags (AgsRecycling *recycling,
                               guint flags);

Disable a feature of `recycling` .

#### Parameters

recycling | the AgsRecycling |
flags | see AgsRecyclingFlags |

Since: 3.0.0

### ags_recycling_get_channel ()

    GObject *
    ags_recycling_get_channel (AgsRecycling *recycling);

Get channel.

#### Parameters

recycling | the AgsRecycling |

#### Returns

the AgsChannel.

[transfer full]

Since: 3.1.0

### ags_recycling_set_channel ()

    void
    ags_recycling_set_channel (AgsRecycling *recycling,
                               GObject *channel);

Set channel.

#### Parameters

recycling | the AgsRecycling |
channel | the AgsChannel |

Since: 3.1.0

### ags_recycling_next ()

    AgsRecycling *
    ags_recycling_next (AgsRecycling *recycling);

Iterate `recycling` .

#### Parameters

recycling | the AgsRecycling |

#### Returns

the next of AgsRecycling if available, otherwise `NULL`.

[transfer full]

Since: 3.0.0

### ags_recycling_prev ()

    AgsRecycling *
    ags_recycling_prev (AgsRecycling *recycling);

Iterate `recycling` .

#### Parameters

recycling | the AgsRecycling |

#### Returns

the prev of AgsRecycling if available, otherwise `NULL`.

[transfer full]

Since: 3.0.0

### ags_recycling_get_output_soundcard ()

    GObject *
    ags_recycling_get_output_soundcard (AgsRecycling *recycling);

Get the output soundcard object of `recycling` .

#### Parameters

recycling | the AgsRecycling |

#### Returns

the output soundcard.

[transfer full]

Since: 3.1.0

### ags_recycling_set_output_soundcard ()

    void
    ags_recycling_set_output_soundcard (AgsRecycling *recycling,
                                        GObject *output_soundcard);

Set the output soundcard object of `recycling` .

#### Parameters

recycling | the AgsRecycling |
output_soundcard | the GObject implementing AgsSoundcard |

Since: 3.0.0

### ags_recycling_get_input_soundcard ()

    GObject *
    ags_recycling_get_input_soundcard (AgsRecycling *recycling);

Get the input soundcard object of `recycling` .

#### Parameters

recycling | the AgsRecycling |

#### Returns

the input soundcard.

[transfer full]

Since: 3.1.0

### ags_recycling_set_input_soundcard ()

    void
    ags_recycling_set_input_soundcard (AgsRecycling *recycling,
                                       GObject *input_soundcard);

Set the input soundcard object of `recycling` .

#### Parameters

recycling | an AgsRecycling |
input_soundcard | the GObject implementing AgsSoundcard |

Since: 3.0.0

### ags_recycling_get_samplerate ()

    guint
    ags_recycling_get_samplerate (AgsRecycling *recycling);

Gets samplerate.

#### Parameters

recycling | the AgsRecycling |

#### Returns

the samplerate

Since: 3.1.0

### ags_recycling_set_samplerate ()

    void
    ags_recycling_set_samplerate (AgsRecycling *recycling,
                                  guint samplerate);

Sets samplerate.

#### Parameters

recycling | the AgsRecycling |
samplerate | the samplerate |

Since: 3.0.0

### ags_recycling_get_buffer_size ()

    guint
    ags_recycling_get_buffer_size (AgsRecycling *recycling);

Gets buffer size.

#### Parameters

recycling | the AgsRecycling |

#### Returns

the buffer size

Since: 3.1.0

### ags_recycling_set_buffer_size ()

    void
    ags_recycling_set_buffer_size (AgsRecycling *recycling,
                                   guint buffer_size);

Set buffer size.

#### Parameters

recycling | the AgsRecycling |
buffer_size | the buffer size |

Since: 3.0.0

### ags_recycling_get_format ()

    guint
    ags_recycling_get_format (AgsRecycling *recycling);

Gets format.

#### Parameters

recycling | the AgsRecycling |

#### Returns

the format

Since: 3.1.0

### ags_recycling_set_format ()

    void
    ags_recycling_set_format (AgsRecycling *recycling,
                              guint format);

Set format.

#### Parameters

recycling | the AgsRecycling |
format | the format |

Since: 3.0.0

### ags_recycling_get_audio_signal ()

    GList *
    ags_recycling_get_audio_signal (AgsRecycling *recycling);

Get recall id.

#### Parameters

recycling | the AgsRecycling |

#### Returns

the GList containig AgsAudioSignal.

[element-type AgsAudio.AudioSignal][transfer full]

Since: 3.1.0

### ags_recycling_set_audio_signal ()

    void
    ags_recycling_set_audio_signal (AgsRecycling *recycling,
                                    GList *audio_signal);

Set recall id by replacing existing.

#### Parameters

recycling | the AgsRecycling |
audio_signal | the GList containing AgsAudioSignal. | [element-type AgsAudio.AudioSignal][transfer full]

Since: 3.1.0

### ags_recycling_add_audio_signal ()

    void
    ags_recycling_add_audio_signal (AgsRecycling *recycling,
                                    AgsAudioSignal *audio_signal);

Add `audio_signal` to `recycling` .

#### Parameters

recycling | the AgsRecycling |
audio_signal | the AgsAudioSignal to add |

Since: 3.0.0

### ags_recycling_remove_audio_signal ()

    void
    ags_recycling_remove_audio_signal (AgsRecycling *recycling,
                                       AgsAudioSignal *audio_signal);

Remove `audio_signal` of `recycling` .

#### Parameters

recycling | the AgsRecycling |
audio_signal | the AgsAudioSignal to remove |

Since: 3.0.0

### ags_recycling_data_request ()

    void
    ags_recycling_data_request (AgsRecycling *recycling,
                                AgsAudioSignal *audio_signal);

Request data of `audio_signal` .

#### Parameters

recycling | the AgsRecycling |
audio_signal | the AgsAudioSignal |

Since: 3.0.0

### ags_recycling_position ()

    gint
    ags_recycling_position (AgsRecycling *start_region,
                            AgsRecycling *end_region,
                            AgsRecycling *recycling);

Retrieve position of recycling.

#### Parameters

start_region | boundary start |
end_region | boundary end |
recycling | matching recycling |

#### Returns

position within boundary.

Since: 3.0.0

### ags_recycling_find_next_channel ()

    AgsRecycling *
    ags_recycling_find_next_channel (AgsRecycling *start_region,
                                     AgsRecycling *end_region,
                                     GObject *prev_channel);

Retrieve next recycling with different channel.

#### Parameters

start_region | boundary start |
end_region | boundary end |
prev_channel | previous channel |

#### Returns

Matching recycling.

[transfer full]

Since: 3.0.0

### ags_recycling_is_active ()

    gboolean
    ags_recycling_is_active (AgsRecycling *start_region,
                             AgsRecycling *end_region,
                             GObject *recall_id);

Check if is active.

#### Parameters

start_region | boundary start |
end_region | boundary end |
recall_id | the AgsRecallID |

#### Returns

`TRUE` if related audio signal to recall id is available, otherwise `FALSE`

Since: 3.0.0

### ags_recycling_create_audio_signal_with_defaults ()

    void
    ags_recycling_create_audio_signal_with_defaults
                                   (AgsRecycling *recycling,
                                    AgsAudioSignal *audio_signal,
                                    gdouble delay,
                                    guint attack);

Create audio signal with defaults.

#### Parameters

recycling | the AgsRecycling |
audio_signal | the AgsAudioSignal to apply defaults |
delay | the delay |
attack | the attack |

Since: 3.0.0

### ags_recycling_create_audio_signal_with_frame_count ()

    void
    ags_recycling_create_audio_signal_with_frame_count
                                   (AgsRecycling *recycling,
                                    AgsAudioSignal *audio_signal,
                                    guint frame_count,
                                    gdouble delay,
                                    guint attack);

Create audio signal with frame count.

#### Parameters

recycling | the AgsRecycling |
audio_signal | the AgsAudioSignal to apply defaults |
frame_count | the audio data size |
delay | the delay |
attack | the attack |

Since: 3.0.0

### ags_recycling_new ()

    AgsRecycling *
    ags_recycling_new (GObject *output_soundcard);

Creates a AgsRecycling, with defaults of `soundcard` .

#### Parameters

output_soundcard | the GObject implementing AgsSoundcard |

#### Returns

a new AgsRecycling

Since: 3.0.0

## Types and Values

### enum AgsRecyclingFlags

Enum values to control the behavior or indicate internal state of AgsRecycling by enable/disable as flags.

#### Members

AGS_RECYCLING_MUTED | recycling is muted |

## Property Details

### The `“audio-signal”` property

      “audio-signal”             gpointer

The containing AgsAudioSignal.

[transfer full]

Owner: AgsRecycling

Flags: Read / Write

Since: 3.0.0

### The `“buffer-size”` property

      “buffer-size”              guint

The buffer size.

Owner: AgsRecycling

Flags: Read / Write

Default value: 0

Since: 3.0.0

### The `“channel”` property

      “channel”                  AgsChannel *

The assigned AgsChannel.

Owner: AgsRecycling

Flags: Read / Write

Since: 3.0.0

### The `“format”` property

      “format”                   guint

The format.

Owner: AgsRecycling

Flags: Read / Write

Default value: 0

Since: 3.0.0

### The `“input-soundcard”` property

      “input-soundcard”          GObject *

The assigned input soundcard.

Owner: AgsRecycling

Flags: Read / Write

Since: 3.0.0

### The `“input-soundcard-channel”` property

      “input-soundcard-channel”  int

The input soundcard channel.

Owner: AgsRecycling

Flags: Read / Write

Allowed values: >= -1

Default value: 0

Since: 3.0.0

### The `“next”` property

      “next”                     AgsRecycling *

The assigned next AgsRecycling.

Owner: AgsRecycling

Flags: Read / Write

Since: 3.0.0

### The `“output-soundcard”` property

      “output-soundcard”         GObject *

The assigned output soundcard acting as default sink.

Owner: AgsRecycling

Flags: Read / Write

Since: 3.0.0

### The `“output-soundcard-channel”` property

      “output-soundcard-channel” int

The output soundcard channel.

Owner: AgsRecycling

Flags: Read / Write

Allowed values: >= -1

Default value: 0

Since: 3.0.0

### The `“parent”` property

      “parent”                   AgsRecycling *

The assigned parent AgsRecycling.

Owner: AgsRecycling

Flags: Read / Write

Since: 3.0.0

### The `“prev”` property

      “prev”                     AgsRecycling *

The assigned prev AgsRecycling.

Owner: AgsRecycling

Flags: Read / Write

Since: 3.0.0

### The `“samplerate”` property

      “samplerate”               guint

The samplerate.

Owner: AgsRecycling

Flags: Read / Write

Default value: 0

Since: 3.0.0

## Signal Details

### The `“add-audio-signal”` signal

    void
    user_function (AgsRecycling *recycling,
                   GObject      *audio_signal,
                   gpointer      user_data)

The ::add-audio-signal signal is emited as adding AgsAudioSignal.

#### Parameters

recycling | an AgsRecycling |
audio_signal | the AgsAudioSignal to add |
user_data | user data set when the signal handler was connected. |

Flags: Run Last

Since: 3.0.0

### The `“data-request”` signal

    void
    user_function (AgsRecycling *recycling,
                   GObject      *audio_signal,
                   gpointer      user_data)

The ::data-request signal is emited as requesting data for `audio_signal` .

#### Parameters

recycling | an AgsRecycling |
audio_signal | the AgsAudioSignal to request |
user_data | user data set when the signal handler was connected. |

Flags: Run Last

Since: 3.0.0

### The `“remove-audio-signal”` signal

    void
    user_function (AgsRecycling *recycling,
                   GObject      *audio_signal,
                   gpointer      user_data)

The ::remove-audio-signal signal is emited as removing AgsAudioSignal.

#### Parameters

recycling | an AgsRecycling |
audio_signal | the AgsAudioSignal to remove |
user_data | user data set when the signal handler was connected. |

Flags: Run Last

Since: 3.0.0