/usr/share/doc/libags-audio-doc/html/ch06s04.html is in libags-audio-doc 1.4.24-1ubuntu2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 | <html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>Hands-On</title><meta name="generator" content="DocBook XSL Stylesheets V1.79.1"><link rel="home" href="index.html" title="Advanced Gtk+ Sequencer"><link rel="up" href="ch06.html" title="Chapter 6. Your tree linked with AgsChannel"><link rel="prev" href="ch06s03.html" title="Limitations"><link rel="next" href="ch07.html" title="Chapter 7. The recycling tree"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="idp71"></a>Hands-On</h2></div></div></div>
<p>
There may be two ways how you can link AgsChannel objects.
</p>
<div class="example"><a name="idp33"></a><p class="title"><b>Example 6.2. Prerequisites</b></p><div class="example-contents">
<pre class="programlisting">
#include <glib.h>
#include <glib-object.h>
#include <ags/libags.h>
#include <ags/libags-audio.h>
AgsAudio *master_audio, *slave_audio;
AgsLinkChannel *linkChannel;
GObject *soundcard;
GError *error;
/* instantiate AgsDevout */
soundcard = ags_devout_new(NULL);
/* create AgsAudio objects */
master_audio = (AgsAudio *) g_object_new(AGS_TYPE_AUDIO,
"soundcard\0", soundcard,
NULL);
slave_audio = (AgsAudio *) g_object_new(AGS_TYPE_AUDIO,
"soundcard\0", soundcard,
NULL);
/* assign AgsAudioSignal objects to master_audio and slave_audio */
ags_audio_set_flags(master_audio,
AGS_AUDIO_OUTPUT_HAS_RECYCLING);
ags_audio_set_flags(slave_audio,
(AGS_AUDIO_ASYNC | AGS_AUDIO_OUTPUT_HAS_RECYCLING | AGS_AUDIO_INPUT_HAS_RECYCLING));
/* create AgsChannel objects within master_audio and slave_audio */
ags_audio_set_audio_channels(master_audio, 2);
ags_audio_set_pads(master_audio, AGS_TYPE_OUTPUT, 1);
ags_audio_set_pads(master_audio, AGS_TYPE_INPUT, 1);
ags_audio_set_audio_channels(slave_audio, 2);
ags_audio_set_pads(slave_audio, AGS_TYPE_OUTPUT, 1);
ags_audio_set_pads(slave_audio, AGS_TYPE_INPUT, 8);
</pre>
</div></div><br class="example-break">
<p>
Assumed you know really what you do, you may be interested in following code.
</p>
<div class="example"><a name="idp34"></a><p class="title"><b>Example 6.3. Thread-Unsafe way</b></p><div class="example-contents">
<pre class="programlisting">
#include <glib.h>
#include <glib-object.h>
#include <ags/libags.h>
#include <ags/libags-audio.h>
AgsAudio *master_audio, *slave_audio;
AgsLinkChannel *linkChannel;
GObject *soundcard;
GError *error;
/* instantiate AgsDevout */
soundcard = ags_devout_new(NULL);
/* create AgsAudio objects */
master_audio = (AgsAudio *) g_object_new(AGS_TYPE_AUDIO,
"soundcard\0", soundcard,
NULL);
slave_audio = (AgsAudio *) g_object_new(AGS_TYPE_AUDIO,
"soundcard\0", soundcard,
NULL);
/* link master_audio's input with slave_audio's output */
ags_channel_set_link(ags_channel_nth(master_audio->input, 0),
ags_channel_nth(slave_audio->output, 0),
&error);
ags_channel_set_link(ags_channel_nth(master_audio->input, 1),
ags_channel_nth(slave_audio->output, 1),
&error);
</pre>
</div></div><br class="example-break">
<p>
But generally you wish to create an AgsTask object and let it to link the
AgsChannel for you.
</p>
<div class="example"><a name="idp35"></a><p class="title"><b>Example 6.4. Multithread-Safe way</b></p><div class="example-contents">
<pre class="programlisting">
#include <glib.h>
#include <glib-object.h>
#include <ags/libags.h>
#include <ags/libags-audio.h>
AgsApplicationContext *application_context;
AgsTaskThread *task_thread;
application_context = ags_application_context_get_instance();
task_thread = application_context->task_thread;
/* creating AgsLink task and add it to AgsDevout */
link_channel = ags_link_channel_new(ags_channel_nth(master_audio->input, 0),
ags_channel_nth(slave_audio->output, 0));
ags_task_thread_append_task(task_thread,
link_channel);
link_channel = ags_link_channel_new(ags_channel_nth(master_audio->input, 1),
ags_channel_nth(slave_audio->output, 1));
ags_task_thread_append_task(task_thread,
link_channel);
</pre>
</div></div><br class="example-break">
</div></body></html>
|