## AgsAudioThread

AgsAudioThread — audio thread

## Stability Level

Stable, unless otherwise indicated

## Functions

gboolean | ags_audio_thread_test_nested_sync_flags ()
void | ags_audio_thread_set_nested_sync_flags ()
void | ags_audio_thread_unset_nested_sync_flags ()
gboolean | ags_audio_thread_get_processing ()
void | ags_audio_thread_set_processing ()
AgsTaskLauncher * | ags_audio_thread_get_task_launcher ()
void | ags_audio_thread_set_sound_scope ()
AgsAudioThreadScopeData * | ags_audio_thread_scope_data_alloc ()
void | ags_audio_thread_scope_data_free ()
gboolean | ags_audio_thread_get_do_fx_staging ()
void | ags_audio_thread_set_do_fx_staging ()
guint * | ags_audio_thread_get_staging_program ()
void | ags_audio_thread_set_staging_program ()
AgsAudioThread * | ags_audio_thread_new ()

## Properties

AgsAudio * | audio | Read / Write
GObject * | default-output-soundcard | Read / Write
gboolean | processing | Read / Write
AgsTaskLauncher * | task-launcher | Read

## Types and Values

#define | AGS_AUDIO_THREAD_DEFAULT_JIFFIE
enum | AgsAudioThreadNestedSyncFlags
struct | AgsAudioThreadScopeData

## Object Hierarchy

        GObject
        ╰── AgsThread
            ╰── AgsAudioThread

## Includes

    #include <ags/audio/thread/ags_audio_thread.h>

## Description

The AgsAudioThread acts as audio output thread to soundcard.

## Functions

### ags_audio_thread_test_nested_sync_flags ()

    gboolean
    ags_audio_thread_test_nested_sync_flags
                                   (AgsAudioThread *audio_thread,
                                    AgsAudioThreadNestedSyncFlags nested_sync_flags);

Test `nested_sync_flags` of `audio_thread` .

#### Parameters

audio_thread | the AgsAudioThread |
nested_sync_flags | status flags |

#### Returns

`TRUE` if status flags set, otherwise `FALSE`

Since: 6.0.0

### ags_audio_thread_set_nested_sync_flags ()

    void
    ags_audio_thread_set_nested_sync_flags
                                   (AgsAudioThread *audio_thread,
                                    AgsAudioThreadNestedSyncFlags nested_sync_flags);

Set status flags.

#### Parameters

audio_thread | the AgsAudioThread |
nested_sync_flags | status flags |

Since: 6.0.0

### ags_audio_thread_unset_nested_sync_flags ()

    void
    ags_audio_thread_unset_nested_sync_flags
                                   (AgsAudioThread *audio_thread,
                                    AgsAudioThreadNestedSyncFlags nested_sync_flags);

Unset status flags.

#### Parameters

audio_thread | the AgsAudioThread |
nested_sync_flags | status flags |

Since: 6.0.0

### ags_audio_thread_get_processing ()

    gboolean
    ags_audio_thread_get_processing (AgsAudioThread *audio_thread);

Get processing.

#### Parameters

audio_thread | the AgsAudioThread |

#### Returns

`TRUE` if do processing, otherwise `FALSE`

Since: 3.11.0

### ags_audio_thread_set_processing ()

    void
    ags_audio_thread_set_processing (AgsAudioThread *audio_thread,
                                     gboolean processing);

Set processing.

#### Parameters

audio_thread | the AgsAudioThread |
processing | `TRUE` enables and `FALSE` disables processing |

Since: 3.11.0

### ags_audio_thread_get_task_launcher ()

    AgsTaskLauncher *
    ags_audio_thread_get_task_launcher (AgsAudioThread *audio_thread);

Get task launcher.

#### Parameters

audio_thread | the AgsAudioThread |

#### Returns

the AgsTaskLauncher.

[transfer full]

Since: 3.11.0

### ags_audio_thread_set_sound_scope ()

    void
    ags_audio_thread_set_sound_scope (AgsAudioThread *audio_thread,
                                      gint sound_scope);

Set sound scope.

#### Parameters

audio_thread | the AgsAudioThread |
sound_scope | the sound scope |

Since: 3.0.0

### ags_audio_thread_scope_data_alloc ()

    AgsAudioThreadScopeData *
    ags_audio_thread_scope_data_alloc ();

Allocate the AgsAudioThreadScopeData.

#### Returns

the newly allocated struct.

[transfer full]

Since: 3.3.0

### ags_audio_thread_scope_data_free ()

    void
    ags_audio_thread_scope_data_free (AgsAudioThreadScopeData *scope_data);

Free `scope_data` .

#### Parameters

scope_data | the AgsAudioThreadScopeData. | [transfer full]

Since: 3.3.0

### ags_audio_thread_get_do_fx_staging ()

    gboolean
    ags_audio_thread_get_do_fx_staging (AgsAudioThread *audio_thread);

Get do fx staging.

#### Parameters

audio_thread | the AgsAudioThread |

#### Returns

`TRUE` if set, otherwise `FALSE`

Since: 3.3.0

### ags_audio_thread_set_do_fx_staging ()

    void
    ags_audio_thread_set_do_fx_staging (AgsAudioThread *audio_thread,
                                        gboolean do_fx_staging);

Set do fx staging.

#### Parameters

audio_thread | the AgsAudioThread |
do_fx_staging | `TRUE` if do fx staging, else `FALSE` |

Since: 3.3.0

### ags_audio_thread_get_staging_program ()

    guint *
    ags_audio_thread_get_staging_program (AgsAudioThread *audio_thread,
                                          guint *staging_program_count);

Get staging program.

#### Parameters

audio_thread | the AgsAudioThread |
staging_program_count | the staging program count. | [out]

#### Returns

the staging program.

[transfer full]

Since: 3.3.0

### ags_audio_thread_set_staging_program ()

    void
    ags_audio_thread_set_staging_program (AgsAudioThread *audio_thread,
                                          guint *staging_program,
                                          guint staging_program_count);

Set staging program.

#### Parameters

audio_thread | the AgsAudioThread |
staging_program | the staging program. | [transfer none]
staging_program_count | the staging program count |

Since: 3.3.0

### ags_audio_thread_new ()

    AgsAudioThread *
    ags_audio_thread_new (GObject *default_output_soundcard,
                          GObject *audio);

Create a new instance of AgsAudioThread.

#### Parameters

default_output_soundcard | the GObject |
audio | the AgsAudio |

#### Returns

the new AgsAudioThread

Since: 3.0.0

## Types and Values

### AGS_AUDIO_THREAD_DEFAULT_JIFFIE

    #define AGS_AUDIO_THREAD_DEFAULT_JIFFIE (ceil(AGS_SOUNDCARD_DEFAULT_SAMPLERATE / AGS_SOUNDCARD_DEFAULT_BUFFER_SIZE) + AGS_SOUNDCARD_DEFAULT_OVERCLOCK)

### enum AgsAudioThreadNestedSyncFlags

#### Members

AGS_AUDIO_THREAD_STATUS_DONE |  |
AGS_AUDIO_THREAD_STATUS_WAIT |  |
AGS_AUDIO_THREAD_STATUS_DONE_SYNC |  |
AGS_AUDIO_THREAD_STATUS_WAIT_SYNC |  |

### struct AgsAudioThreadScopeData

    struct AgsAudioThreadScopeData {
      _Atomic gboolean fx_done;
      _Atomic guint fx_wait;

      GMutex fx_mutex;
      GCond fx_cond;
    };

## Property Details

### The `“audio”` property

      “audio”                    AgsAudio *

The assigned AgsAudio.

Owner: AgsAudioThread

Flags: Read / Write

Since: 3.0.0

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

      “default-output-soundcard” GObject *

The assigned default soundcard.

Owner: AgsAudioThread

Flags: Read / Write

Since: 3.0.0

### The `“processing”` property

      “processing”               gboolean

The processing state.

Owner: AgsAudioThread

Flags: Read / Write

Default value: FALSE

Since: 3.11.0

### The `“task-launcher”` property

      “task-launcher”            AgsTaskLauncher *

The assigned AgsTaskLauncher.

Owner: AgsAudioThread

Flags: Read

Since: 3.11.0