File: chap4.xml

package info (click to toggle)
gsequencer 8.2.9-1
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 74,272 kB
  • sloc: ansic: 1,195,333; xml: 31,048; cpp: 9,749; sh: 5,798; makefile: 4,024; perl: 536; sed: 16; python: 11
file content (153 lines) | stat: -rw-r--r-- 4,615 bytes parent folder | download | duplicates (3)
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
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE chapter>

<!-- Copyright (C) 2005-2018 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>The soundcard and sequencer interface</title>
  <para>
    With AgsSoundcard and AgsSequencer interface you can obtain information about
    output or input devices. Getting the next buffer for playback something can be
    achieved, too. As well reading MIDI data from current buffer is supported.
    Note these operations are performed all delayed in order to avoid concurrent
    memory access.
  </para>

  <para>
    Latency is at most one buffer time. Operations on buffers might be performed
    non-blocking so the thread returns earlier than expected. This has the advantage
    of controlling timings and let the thread continue to do more synchronization
    runs. Real-time behaviour is indicated as all pending sync operations were fulfilled
    as the next buffer is needed.
  </para>
  
  <para>
    The Advanced Gtk+ Sequencer framework implements following
    soundcard objects. Note to register soundcards by a sound server make
    use of AgsSoundServer interface. This applies to JACK, Pulseaudio and CoreAudio
    backend.
  </para>
  
  <itemizedlist mark="bullet">
    <listitem>
      <para>
	AgsDevout ALSA and OSSv4 soundcard output.
      </para>
    </listitem>
    <listitem>
      <para>
	AgsDevin ALSA and OSSv4 soundcard input.
      </para>
    </listitem>
    <listitem>
      <para>
	AgsPulseDevout Pulseaudio output.
      </para>
    </listitem>
    <listitem>
      <para>
	AgsJackDevout JACK Audio Connection Kit output.
      </para>
    </listitem>
    <listitem>
      <para>
	AgsJackDevin JACK Audio Connection Kit input.
      </para>
    </listitem>
    <listitem>
      <para>
	AgsWasapiDevout Windows soundcard output.
      </para>
    </listitem>
    <listitem>
      <para>
	AgsWasapiDevin Windows soundcard input.
      </para>
    </listitem>
    <listitem>
      <para>
	AgsCoreAudioDevout macos soundcard output.
      </para>
    </listitem>
    <listitem>
      <para>
	AgsCoreAudioDevin macos soundcard input.
      </para>
    </listitem>
  </itemizedlist>
  
  <para>
    The Advanced Gtk+ Sequencer framework implements following
    sequencer objects.
  </para>
  
  <itemizedlist mark="bullet">
    <listitem>
      <para>
	AgsMidiin ALSA and OSSv4 MIDI input.
      </para>
    </listitem>
    <listitem>
      <para>
	AgsJackMidiin JACK Audio Connection Kit MIDI input.
      </para>
    </listitem>
    <listitem>
      <para>
	AgsCoreAudioMidiin macos MIDI input.
      </para>
    </listitem>
  </itemizedlist>
  
  <sect1>
    <title>Gathering PCM information of soundcard</title>
    <para>
      In this short example we just get some information out of AgsSoundcard by using
      <code language="C">void ags_soundcard_pcm_info(AgsSoundcard*, gchar*, guint*, guint*, guint*, guint*, guint*, guint*, GError*)</code>.
      It tells us the card identifier, minimum and maximum supported audio channels, samplerate and buffer size.
    </para>

    <example>
      <title>PCM information from AgsSoundcard</title>
      <programlisting language="C">
<xi:include href="../listings/pcm_info.c" parse="text" />
      </programlisting>
    </example>    
  </sect1>

  <sect1>
    <title>Obtain audio buffer</title>
    <para>
      Here we get audio buffer from AgsSoundcard and write some sine synth tone at
      440 Hz. First we get presets from soundcard, then we fill the AgsSynthUtil struct
      and finally compute the sine sound using utility function.
    </para>
    
    <example>
      <title>Get AgsSoundcard buffer</title>
      <programlisting language="C">
<xi:include href="../listings/soundcard_buffer.c" parse="text" />
      </programlisting>
    </example>
  </sect1>

  <sect1>
    <title>Read from MIDI device</title>
    <para>
    </para>
    
    <example>
      <title>Get AgsSequencer buffer</title>
      <programlisting language="C">
<xi:include href="../listings/sequencer_buffer.c" parse="text" />
      </programlisting>
    </example>
  </sect1>
</chapter>