-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathgroup__audio__driver.html
More file actions
336 lines (318 loc) · 25.9 KB
/
group__audio__driver.html
File metadata and controls
336 lines (318 loc) · 25.9 KB
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
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.9.1"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>libfluidsynth: Audio Driver</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
<link href="custom.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td id="projectalign" style="padding-left: 0.5em;">
<div id="projectname">libfluidsynth
 <span id="projectnumber">2.5.4</span>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.9.1 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */
var searchBox = new SearchBox("searchBox", "search",false,'Search','.html');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */
$(function() {
initMenu('',true,false,'search.php','Search');
$(document).ready(function() { init_search(); });
});
/* @license-end */</script>
<div id="main-nav"></div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
<div id="nav-tree">
<div id="nav-tree-contents">
<div id="nav-sync" class="sync"></div>
</div>
</div>
<div id="splitbar" style="-moz-user-select:none;"
class="ui-resizable-handle">
</div>
</div>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */
$(document).ready(function(){initNavTree('group__audio__driver.html',''); initResizable(); });
/* @license-end */
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>
<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0"
name="MSearchResults" id="MSearchResults">
</iframe>
</div>
<div class="header">
<div class="summary">
<a href="#typedef-members">Typedefs</a> |
<a href="#func-members">Functions</a> </div>
<div class="headertitle">
<div class="title">Audio Driver<div class="ingroups"><a class="el" href="group__audio__output.html">Audio Output</a></div></div> </div>
</div><!--header-->
<div class="contents">
<p>Functions for managing audio drivers.
<a href="#details">More...</a></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="typedef-members"></a>
Typedefs</h2></td></tr>
<tr class="memitem:ga4c108916c658973df5242ae77fefa3d0"><td class="memItemLeft" align="right" valign="top">typedef int(* </td><td class="memItemRight" valign="bottom"><a class="el" href="group__audio__driver.html#ga4c108916c658973df5242ae77fefa3d0">fluid_audio_func_t</a>) (void *data, int len, int nfx, float *fx[], int nout, float *out[])</td></tr>
<tr class="memdesc:ga4c108916c658973df5242ae77fefa3d0"><td class="mdescLeft"> </td><td class="mdescRight">Callback function type used with <a class="el" href="group__audio__driver.html#gad36d048b94952b23f7b3971bea39519f" title="Create a new audio driver.">new_fluid_audio_driver2()</a> to allow for custom user audio processing before the audio is sent to the driver. <a href="group__audio__driver.html#ga4c108916c658973df5242ae77fefa3d0">More...</a><br /></td></tr>
<tr class="separator:ga4c108916c658973df5242ae77fefa3d0"><td class="memSeparator" colspan="2"> </td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader">Lifecycle Functions for Audio Driver</h2></td></tr>
<tr><td class="ititle" colspan="2"><p><a class="anchor" id="amgrp0f732276fd3ec7807846d74100277f21"></a></p>
</td></tr>
<tr class="memitem:ga7c66ef86f0008807bdd955770fca6925"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group__Types.html#gac3706330ce49cac5b7dd079e90d376d8">fluid_audio_driver_t</a> * </td><td class="memItemRight" valign="bottom"><a class="el" href="group__audio__driver.html#ga7c66ef86f0008807bdd955770fca6925">new_fluid_audio_driver</a> (<a class="el" href="group__Types.html#gaa363402d3c77333b0f070ba531d034ba">fluid_settings_t</a> *settings, <a class="el" href="group__Types.html#gae265f10ae174a13afe010de50d87e1a4">fluid_synth_t</a> *synth)</td></tr>
<tr class="memdesc:ga7c66ef86f0008807bdd955770fca6925"><td class="mdescLeft"> </td><td class="mdescRight">Create a new audio driver. <a href="group__audio__driver.html#ga7c66ef86f0008807bdd955770fca6925">More...</a><br /></td></tr>
<tr class="separator:ga7c66ef86f0008807bdd955770fca6925"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:gad36d048b94952b23f7b3971bea39519f"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group__Types.html#gac3706330ce49cac5b7dd079e90d376d8">fluid_audio_driver_t</a> * </td><td class="memItemRight" valign="bottom"><a class="el" href="group__audio__driver.html#gad36d048b94952b23f7b3971bea39519f">new_fluid_audio_driver2</a> (<a class="el" href="group__Types.html#gaa363402d3c77333b0f070ba531d034ba">fluid_settings_t</a> *settings, <a class="el" href="group__audio__driver.html#ga4c108916c658973df5242ae77fefa3d0">fluid_audio_func_t</a> func, void *data)</td></tr>
<tr class="memdesc:gad36d048b94952b23f7b3971bea39519f"><td class="mdescLeft"> </td><td class="mdescRight">Create a new audio driver. <a href="group__audio__driver.html#gad36d048b94952b23f7b3971bea39519f">More...</a><br /></td></tr>
<tr class="separator:gad36d048b94952b23f7b3971bea39519f"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ga9c6f54ffa43a8ca482aca81582316f5a"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="group__audio__driver.html#ga9c6f54ffa43a8ca482aca81582316f5a">delete_fluid_audio_driver</a> (<a class="el" href="group__Types.html#gac3706330ce49cac5b7dd079e90d376d8">fluid_audio_driver_t</a> *driver)</td></tr>
<tr class="memdesc:ga9c6f54ffa43a8ca482aca81582316f5a"><td class="mdescLeft"> </td><td class="mdescRight">Deletes an audio driver instance. <a href="group__audio__driver.html#ga9c6f54ffa43a8ca482aca81582316f5a">More...</a><br /></td></tr>
<tr class="separator:ga9c6f54ffa43a8ca482aca81582316f5a"><td class="memSeparator" colspan="2"> </td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:gadb6794858c4a18bf3ebe51c60ccb8605"><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="group__audio__driver.html#gadb6794858c4a18bf3ebe51c60ccb8605">fluid_audio_driver_register</a> (const char **adrivers)</td></tr>
<tr class="memdesc:gadb6794858c4a18bf3ebe51c60ccb8605"><td class="mdescLeft"> </td><td class="mdescRight">Registers audio drivers to use. <a href="group__audio__driver.html#gadb6794858c4a18bf3ebe51c60ccb8605">More...</a><br /></td></tr>
<tr class="separator:gadb6794858c4a18bf3ebe51c60ccb8605"><td class="memSeparator" colspan="2"> </td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<p>Functions for managing audio drivers. </p>
<p>Defines functions for creating audio driver output. Use <a class="el" href="group__audio__driver.html#ga7c66ef86f0008807bdd955770fca6925" title="Create a new audio driver.">new_fluid_audio_driver()</a> to create a new audio driver for a given synth and configuration settings.</p>
<p>The function <a class="el" href="group__audio__driver.html#gad36d048b94952b23f7b3971bea39519f" title="Create a new audio driver.">new_fluid_audio_driver2()</a> can be used if custom audio processing is desired before the audio is sent to the audio driver (although it is not as efficient).</p>
<dl class="section see"><dt>See also</dt><dd><a class="el" href="CreatingAudioDriver.html">Creating the audio driver</a> </dd></dl>
<h2 class="groupheader">Typedef Documentation</h2>
<a id="ga4c108916c658973df5242ae77fefa3d0"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga4c108916c658973df5242ae77fefa3d0">◆ </a></span>fluid_audio_func_t</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">typedef int(* fluid_audio_func_t) (void *data, int len, int nfx, float *fx[], int nout, float *out[])</td>
</tr>
</table>
</div><div class="memdoc">
<p>Callback function type used with <a class="el" href="group__audio__driver.html#gad36d048b94952b23f7b3971bea39519f" title="Create a new audio driver.">new_fluid_audio_driver2()</a> to allow for custom user audio processing before the audio is sent to the driver. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">data</td><td>The user data parameter as passed to <a class="el" href="group__audio__driver.html#gad36d048b94952b23f7b3971bea39519f" title="Create a new audio driver.">new_fluid_audio_driver2()</a>. </td></tr>
<tr><td class="paramname">len</td><td>Count of audio frames to synthesize. </td></tr>
<tr><td class="paramname">nfx</td><td>Count of arrays in <code>fx</code>. </td></tr>
<tr><td class="paramname">fx</td><td>Array of buffers to store effects audio to. Buffers may alias with buffers of <code>out</code>. </td></tr>
<tr><td class="paramname">nout</td><td>Count of arrays in <code>out</code>. </td></tr>
<tr><td class="paramname">out</td><td>Array of buffers to store (dry) audio to. Buffers may alias with buffers of <code>fx</code>. </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>Should return <a class="el" href="group__misc.html#gae4efb1c3ce0d550c922504adfb0fb886" title="Value that indicates success, used by most libfluidsynth functions.">FLUID_OK</a> on success, <a class="el" href="group__misc.html#ga90e8bdbc5a507bbfa5c45bac85a63a61" title="Value that indicates failure, used by most libfluidsynth functions.">FLUID_FAILED</a> if an error occurred.</dd></dl>
<p>This function is responsible for rendering audio to the buffers. The buffers passed to this function are allocated and owned by the respective audio driver and are only valid during that specific call (do not cache them). The buffers have already been zeroed-out. For further details please refer to <a class="el" href="group__audio__rendering.html#gaf41e26b153a095dbc4248e9df4f3ad46" title="Synthesize floating point audio to stereo audio channels (implements the default interface fluid_audi...">fluid_synth_process()</a>.</p>
<dl class="section note"><dt>Note</dt><dd>Whereas <a class="el" href="group__audio__rendering.html#gaf41e26b153a095dbc4248e9df4f3ad46" title="Synthesize floating point audio to stereo audio channels (implements the default interface fluid_audi...">fluid_synth_process()</a> allows aliasing buffers, there is the guarantee that <code>out</code> and <code>fx</code> buffers provided by fluidsynth's audio drivers never alias. This prevents downstream applications from e.g. applying a custom effect accidentally to the same buffer multiple times. </dd></dl>
<dl class="section note"><dt>Note</dt><dd>Also note that the Jack driver is currently the only driver that has dedicated <code>fx</code> buffers (but only if <a class="el" href="settings_audio.html#settings_audio_jack_multi">audio.jack.multi</a> is true). All other drivers do not provide <code>fx</code> buffers. In this case, users are encouraged to mix the effects into the provided dry buffers when calling <a class="el" href="group__audio__rendering.html#gaf41e26b153a095dbc4248e9df4f3ad46" title="Synthesize floating point audio to stereo audio channels (implements the default interface fluid_audi...">fluid_synth_process()</a>. <div class="fragment"><div class="line"><span class="keywordtype">int</span> myCallback(<span class="keywordtype">void</span> *, <span class="keywordtype">int</span> len, <span class="keywordtype">int</span> nfx, <span class="keywordtype">float</span> *fx[], <span class="keywordtype">int</span> nout, <span class="keywordtype">float</span> *out[])</div>
<div class="line">{</div>
<div class="line"> <span class="keywordtype">int</span> ret;</div>
<div class="line"> <span class="keywordflow">if</span>(nfx == 0)</div>
<div class="line"> {</div>
<div class="line"> <span class="keywordtype">float</span> *fxb[4] = {out[0], out[1], out[0], out[1]};</div>
<div class="line"> ret = <a class="code" href="group__audio__rendering.html#gaf41e26b153a095dbc4248e9df4f3ad46">fluid_synth_process</a>(synth, len, <span class="keyword">sizeof</span>(fxb) / <span class="keyword">sizeof</span>(fxb[0]), fxb, nout, out);</div>
<div class="line"> }</div>
<div class="line"> <span class="keywordflow">else</span></div>
<div class="line"> {</div>
<div class="line"> ret = <a class="code" href="group__audio__rendering.html#gaf41e26b153a095dbc4248e9df4f3ad46">fluid_synth_process</a>(synth, len, nfx, fx, nout, out);</div>
<div class="line"> }</div>
<div class="line"> <span class="comment">// ... client-code ...</span></div>
<div class="line"> <span class="keywordflow">return</span> ret;</div>
<div class="line">}</div>
<div class="ttc" id="agroup__audio__rendering_html_gaf41e26b153a095dbc4248e9df4f3ad46"><div class="ttname"><a href="group__audio__rendering.html#gaf41e26b153a095dbc4248e9df4f3ad46">fluid_synth_process</a></div><div class="ttdeci">int fluid_synth_process(fluid_synth_t *synth, int len, int nfx, float *fx[], int nout, float *out[])</div><div class="ttdoc">Synthesize floating point audio to stereo audio channels (implements the default interface fluid_audi...</div><div class="ttdef"><b>Definition:</b> fluid_synth.c:4423</div></div>
</div><!-- fragment --> For other possible use-cases refer to <a class="el" href="fluidsynth_process_8c-example.html">fluidsynth_process.c</a> . </dd></dl>
</div>
</div>
<h2 class="groupheader">Function Documentation</h2>
<a id="ga9c6f54ffa43a8ca482aca81582316f5a"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga9c6f54ffa43a8ca482aca81582316f5a">◆ </a></span>delete_fluid_audio_driver()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void delete_fluid_audio_driver </td>
<td>(</td>
<td class="paramtype"><a class="el" href="group__Types.html#gac3706330ce49cac5b7dd079e90d376d8">fluid_audio_driver_t</a> * </td>
<td class="paramname"><em>driver</em></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Deletes an audio driver instance. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">driver</td><td>Audio driver instance to delete</td></tr>
</table>
</dd>
</dl>
<p>Shuts down an audio driver and deletes its instance. </p>
<dl class="section examples"><dt>Examples</dt><dd><a class="el" href="example_8c-example.html#a7">example.c</a>, <a class="el" href="fluidsynth_arpeggio_8c-example.html#a16">fluidsynth_arpeggio.c</a>, <a class="el" href="fluidsynth_fx_8c-example.html#a8">fluidsynth_fx.c</a>, <a class="el" href="fluidsynth_metronome_8c-example.html#a15">fluidsynth_metronome.c</a>, <a class="el" href="fluidsynth_register_adriver_8c-example.html#a6">fluidsynth_register_adriver.c</a>, and <a class="el" href="fluidsynth_simple_8c-example.html#a5">fluidsynth_simple.c</a>.</dd>
</dl>
</div>
</div>
<a id="gadb6794858c4a18bf3ebe51c60ccb8605"></a>
<h2 class="memtitle"><span class="permalink"><a href="#gadb6794858c4a18bf3ebe51c60ccb8605">◆ </a></span>fluid_audio_driver_register()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int fluid_audio_driver_register </td>
<td>(</td>
<td class="paramtype">const char ** </td>
<td class="paramname"><em>adrivers</em></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Registers audio drivers to use. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">adrivers</td><td>NULL-terminated array of audio drivers to register. Pass NULL to register all available drivers. </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd><a class="el" href="group__misc.html#gae4efb1c3ce0d550c922504adfb0fb886" title="Value that indicates success, used by most libfluidsynth functions.">FLUID_OK</a> if all the audio drivers requested by the user are supported by fluidsynth and have been successfully registered. Otherwise <a class="el" href="group__misc.html#ga90e8bdbc5a507bbfa5c45bac85a63a61" title="Value that indicates failure, used by most libfluidsynth functions.">FLUID_FAILED</a> is returned and this function has no effect.</dd></dl>
<p>When creating a settings instance with <a class="el" href="group__settings.html#ga7623af35fb3d1abace21ef7d5b4f4781" title="Create a new settings object.">new_fluid_settings()</a>, all audio drivers are initialized once. In the past this has caused segfaults and application crashes due to buggy soundcard drivers.</p>
<p>This function enables the user to only initialize specific audio drivers when settings instances are created. Therefore pass a NULL-terminated array of C-strings containing the <code>names</code> of audio drivers to register for the usage with fluidsynth. The <code>names</code> are the same as being used for the <code>audio.driver</code> setting.</p>
<p>By default all audio drivers fluidsynth has been compiled with are registered, so calling this function is optional.</p>
<dl class="section warning"><dt>Warning</dt><dd>This function may only be called if no thread is residing in fluidsynth's API and no instances of any kind are alive (e.g. as it would be the case right after fluidsynth's initial creation). Else the behaviour is undefined. Furthermore any attempt of using audio drivers that have not been registered is undefined behaviour!</dd></dl>
<dl class="section note"><dt>Note</dt><dd>This function is not thread safe and will never be!</dd></dl>
<dl class="section since"><dt>Since</dt><dd>1.1.9 </dd></dl>
<dl class="section examples"><dt>Examples</dt><dd><a class="el" href="fluidsynth_register_adriver_8c-example.html#a0">fluidsynth_register_adriver.c</a>.</dd>
</dl>
</div>
</div>
<a id="ga7c66ef86f0008807bdd955770fca6925"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga7c66ef86f0008807bdd955770fca6925">◆ </a></span>new_fluid_audio_driver()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="group__Types.html#gac3706330ce49cac5b7dd079e90d376d8">fluid_audio_driver_t</a>* new_fluid_audio_driver </td>
<td>(</td>
<td class="paramtype"><a class="el" href="group__Types.html#gaa363402d3c77333b0f070ba531d034ba">fluid_settings_t</a> * </td>
<td class="paramname"><em>settings</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="group__Types.html#gae265f10ae174a13afe010de50d87e1a4">fluid_synth_t</a> * </td>
<td class="paramname"><em>synth</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Create a new audio driver. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">settings</td><td>Configuration settings used to select and create the audio driver. </td></tr>
<tr><td class="paramname">synth</td><td>Synthesizer instance for which the audio driver is created for. </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>The new audio driver instance or NULL on error</dd></dl>
<p>Creates a new audio driver for a given <code>synth</code> instance with a defined set of configuration <code>settings</code>. The <code>settings</code> instance must be the same that you have passed to <a class="el" href="group__synth.html#ga2aab8e0b82dc9fd086849efacb3c1b1b" title="Create new FluidSynth instance.">new_fluid_synth()</a> when creating the <code>synth</code> instance. Otherwise the behaviour is undefined.</p>
<dl class="section note"><dt>Note</dt><dd>As soon as an audio driver is created, the <code>synth</code> starts rendering audio. This means that all necessary initialization and sound-setup should have been completed before calling this function. Thus, of all object types in use (synth, midi player, sequencer, etc.) the audio driver should always be the last one to be created and the first one to be deleted! Also refer to the order of object creation in the code examples. Deleting and re-creating the audio driver is supported. However, only settings marked as realtime can reconfigure an already created <code>synth</code>. </dd></dl>
<dl class="section examples"><dt>Examples</dt><dd><a class="el" href="example_8c-example.html#a4">example.c</a>, <a class="el" href="fluidsynth_arpeggio_8c-example.html#a14">fluidsynth_arpeggio.c</a>, <a class="el" href="fluidsynth_metronome_8c-example.html#a13">fluidsynth_metronome.c</a>, <a class="el" href="fluidsynth_register_adriver_8c-example.html#a5">fluidsynth_register_adriver.c</a>, and <a class="el" href="fluidsynth_simple_8c-example.html#a3">fluidsynth_simple.c</a>.</dd>
</dl>
</div>
</div>
<a id="gad36d048b94952b23f7b3971bea39519f"></a>
<h2 class="memtitle"><span class="permalink"><a href="#gad36d048b94952b23f7b3971bea39519f">◆ </a></span>new_fluid_audio_driver2()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="group__Types.html#gac3706330ce49cac5b7dd079e90d376d8">fluid_audio_driver_t</a>* new_fluid_audio_driver2 </td>
<td>(</td>
<td class="paramtype"><a class="el" href="group__Types.html#gaa363402d3c77333b0f070ba531d034ba">fluid_settings_t</a> * </td>
<td class="paramname"><em>settings</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="group__audio__driver.html#ga4c108916c658973df5242ae77fefa3d0">fluid_audio_func_t</a> </td>
<td class="paramname"><em>func</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">void * </td>
<td class="paramname"><em>data</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Create a new audio driver. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">settings</td><td>Configuration settings used to select and create the audio driver. </td></tr>
<tr><td class="paramname">func</td><td>Function called to fill audio buffers for audio playback </td></tr>
<tr><td class="paramname">data</td><td>User defined data pointer to pass to <code>func</code> </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>The new audio driver instance or NULL on error</dd></dl>
<p>Like <a class="el" href="group__audio__driver.html#ga7c66ef86f0008807bdd955770fca6925" title="Create a new audio driver.">new_fluid_audio_driver()</a> but allows for custom audio processing before audio is sent to audio driver. It is the responsibility of the callback <code>func</code> to render the audio into the buffers. If <code>func</code> uses a fluid_synth_t <code>synth</code>, the <code>settings</code> instance must be the same that you have passed to <a class="el" href="group__synth.html#ga2aab8e0b82dc9fd086849efacb3c1b1b" title="Create new FluidSynth instance.">new_fluid_synth()</a> when creating the <code>synth</code> instance. Otherwise the behaviour is undefined.</p>
<dl class="section note"><dt>Note</dt><dd>Not as efficient as <a class="el" href="group__audio__driver.html#ga7c66ef86f0008807bdd955770fca6925" title="Create a new audio driver.">new_fluid_audio_driver()</a>.</dd>
<dd>
As soon as an audio driver is created, a new thread is spawned starting to make callbacks to <code>func</code>. This means that all necessary sound-setup should be completed after this point, thus of all object types in use (synth, midi player, sequencer, etc.) the audio driver should always be the last one to be created and the first one to be deleted! Also refer to the order of object creation in the code examples. </dd></dl>
<dl class="section examples"><dt>Examples</dt><dd><a class="el" href="fluidsynth_fx_8c-example.html#a6">fluidsynth_fx.c</a>.</dd>
</dl>
</div>
</div>
</div><!-- contents -->
</div><!-- doc-content -->
</body>
</html>