File: chap12.xml

package info (click to toggle)
gsequencer 7.7.5-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 71,040 kB
  • sloc: ansic: 1,145,949; xml: 31,016; cpp: 9,487; sh: 5,798; makefile: 3,845; perl: 155; sed: 16; python: 11
file content (61 lines) | stat: -rw-r--r-- 2,644 bytes parent folder | download | duplicates (2)
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
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE chapter>

<!-- Copyright (C) 2005-2021 Jo\u00EBl Kr\u00E4hemann -->
<!-- Permission is granted to copy, distribute and/or modify this document -->
<!-- under the terms of the GNU Free Documentation License, Version 1.3 -->
<!-- or any later version published by the Free Software Foundation; -->
<!-- with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. -->
<!-- A copy of the license is included in the section entitled "GNU -->
<!-- Free Documentation License". -->

<chapter xmlns="http://docbook.org/ns/docbook"
	 xmlns:xi="http://www.w3.org/2001/XInclude" version="5.0">
  <title>Putting all together</title>
  <para>
    So far we have seen the most important objects involved doing an audio processing
    tree. Now we want to do complete example putting all together. In this example we
    instantiate AgsAudioThread and AgsChannelThread to play a simple pattern. The sound
    we use is generated using a sine wave.
  </para>
  
  <para>
    In order that the threads are used we provide an appropriate AgsConfig. Further we
    define an AgsPattern and add the needed recalls to do playback using the AgsFxFactory.
  </para>

  <para>
    The example creates 2 different AgsAudio objects. One called master which does the
    actual playback and a second called slave doing the sequencer work. Since the slave
    is linked to the master, we only have to start slave, which initializes the audio
    tree for playback.
  </para>

  <para>
    The slave owns the audio signal and has to provide audio processing threads for it.
    This is done by <code language="C">AGS_AUDIO_OUTPUT_HAS_RECYCLING</code> flag. We
    set the ags-fx staging flags and the staging program. We need to do this explicitely
    in view of reverse compatibility to the deprecated recall engine.
  </para>
  
  <para>
    Note, here thread-safety doesn't matter. If you need to do more complex work-flows,
    you have to care about it. In practice you wouldn't make direct use of any struct
    fields. Rather use the appropriate getter/setter functions and take care of owner
    ship. 
  </para>

  <para>
    Usually, you wouldn't call directly
    <code language="C">void ags_channel_set_link(AgsChannel*, AgsChannel*, GError**)</code>,
    but rather use the AgsLinkChannel task and add it to the AgsTaskLauncher. Else,
    everything is fine.
  </para>
  
  <example>
    <title>Simple pattern sequencer with master playback</title>
    <programlisting language="C">
<xi:include href="../listings/complete_example.c" parse="text" />
    </programlisting>
  </example>
</chapter>