Chapter 11. Thread-safe audio ports

Table of Contents

Get and set values

The AgsPort object provides you a well defined API to safe read or write data to the AgsPort. Its access is protected by mutices. All actions on ports shall happen through ::safe-read, ::safe-write, ::safe-get-property or ::safe-set-property.

AgsPort can contain various data types. But of only one type at the time. Automation happens by adjusting ports and perhaps even applying an AgsConversion. Further it contains some meta-information about plugin name and port specifier.

Get and set values

You can achieve this by using GValue like:

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

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

AgsPort *port;
GValue value = {0,};

/* create port */
port = ags_port_new();

/* initialize and set value */
g_value_init(&value,
	     G_TYPE_FLOAT);
g_value_set_float(&value,
		  0.0);

/* perform thread-safe operation */
ags_port_safe_write(port,
		    &value);