Chris@40
|
1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
Chris@40
|
2 <HTML>
|
Chris@40
|
3
|
Chris@40
|
4 <HEAD>
|
Chris@40
|
5 <TITLE>
|
Chris@40
|
6 libsndfile : the sf_command function.
|
Chris@40
|
7 </TITLE>
|
Chris@40
|
8 <META NAME="Author" CONTENT="Erik de Castro Lopo (erikd AT mega-nerd DOT com)">
|
Chris@40
|
9 <!-- Another version at the bottom of the page. -->
|
Chris@40
|
10 <META NAME="Description" CONTENT="The libsndfile API.">
|
Chris@40
|
11 <META NAME="Keywords" CONTENT="WAV AIFF AU libsndfile sound audio dsp Linux">
|
Chris@40
|
12 <LINK REL="stylesheet" HREF="libsndfile.css" TYPE="text/css" MEDIA="all">
|
Chris@40
|
13 <LINK REL="stylesheet" HREF="print.css" TYPE="text/css" MEDIA="print">
|
Chris@40
|
14 </HEAD>
|
Chris@40
|
15
|
Chris@40
|
16 <BODY>
|
Chris@40
|
17
|
Chris@40
|
18 <H1><B>sf_command</B></H1>
|
Chris@40
|
19 <PRE>
|
Chris@40
|
20
|
Chris@40
|
21 int sf_command (SNDFILE *sndfile, int cmd, void *data, int datasize) ;
|
Chris@40
|
22 </PRE>
|
Chris@40
|
23 <P>
|
Chris@40
|
24 This function allows the caller to retrieve information from or change aspects of the
|
Chris@40
|
25 library behaviour.
|
Chris@40
|
26 Examples include retrieving a string containing the library version or changing the
|
Chris@40
|
27 scaling applied to floating point sample data during read and write.
|
Chris@40
|
28 Most of these operations are performed on a per-file basis.
|
Chris@40
|
29 </P>
|
Chris@40
|
30 <P>
|
Chris@40
|
31 The cmd parameter is an integer identifier which is defined in <sndfile.h>.
|
Chris@40
|
32 All of the valid command identifiers have names beginning with "SFC_".
|
Chris@40
|
33 Data is passed to and returned from the library by use of a void pointer.
|
Chris@40
|
34 The library will not read or write more than datasize bytes from the void pointer.
|
Chris@40
|
35 For some calls no data is required in which case data should be NULL and datasize
|
Chris@40
|
36 may be used for some other purpose.
|
Chris@40
|
37 </P>
|
Chris@40
|
38 <P>
|
Chris@40
|
39 The available commands are as follows:
|
Chris@40
|
40 </P>
|
Chris@40
|
41
|
Chris@40
|
42 <CENTER>
|
Chris@40
|
43 <TABLE BORDER="0" WIDTH="90%" CELLPADDING="4">
|
Chris@40
|
44 <TR>
|
Chris@40
|
45 <TD><A HREF="#SFC_GET_LIB_VERSION">SFC_GET_LIB_VERSION</A></TD>
|
Chris@40
|
46 <TD>Retrieve the version of the library.</TD>
|
Chris@40
|
47 </TR>
|
Chris@40
|
48 <TR>
|
Chris@40
|
49 <TD><A HREF="#SFC_GET_LOG_INFO">SFC_GET_LOG_INFO</A></TD>
|
Chris@40
|
50 <TD>Retrieve the internal per-file operation log.</TD>
|
Chris@40
|
51 </TR>
|
Chris@40
|
52 <TR>
|
Chris@40
|
53 <TD><A HREF="#SFC_CALC_SIGNAL_MAX">SFC_CALC_SIGNAL_MAX</A></TD>
|
Chris@40
|
54 <TD>Calculate the measured maximum signal value.</TD>
|
Chris@40
|
55 </TR>
|
Chris@40
|
56 <TR>
|
Chris@40
|
57 <TD><A HREF="#SFC_CALC_NORM_SIGNAL_MAX">SFC_CALC_NORM_SIGNAL_MAX</A></TD>
|
Chris@40
|
58 <TD>Calculate the measured normalised maximum signal value.</TD>
|
Chris@40
|
59 </TR>
|
Chris@40
|
60 <TR>
|
Chris@40
|
61 <TD><A HREF="#SFC_CALC_MAX_ALL_CHANNELS">SFC_CALC_MAX_ALL_CHANNELS</A></TD>
|
Chris@40
|
62 <TD>Calculate the peak value for each channel.</TD>
|
Chris@40
|
63 </TR>
|
Chris@40
|
64 <TR>
|
Chris@40
|
65 <TD><A HREF="#SFC_CALC_NORM_MAX_ALL_CHANNELS">SFC_CALC_NORM_MAX_ALL_CHANNELS</A></TD>
|
Chris@40
|
66 <TD>Calculate the normalised peak for each channel.</TD>
|
Chris@40
|
67 </TR>
|
Chris@40
|
68
|
Chris@40
|
69 <TR>
|
Chris@40
|
70 <TD><A HREF="#SFC_GET_SIGNAL_MAX">SFC_GET_SIGNAL_MAX</A></TD>
|
Chris@40
|
71 <TD>Retrieve the peak value for the file (as stored in the file header).</TD>
|
Chris@40
|
72 </TR>
|
Chris@40
|
73 <TR>
|
Chris@40
|
74 <TD><A HREF="#SFC_GET_MAX_ALL_CHANNELS">SFC_GET_MAX_ALL_CHANNELS</A></TD>
|
Chris@40
|
75 <TD>Retrieve the peak value for each channel (as stored in the file header).</TD>
|
Chris@40
|
76 </TR>
|
Chris@40
|
77
|
Chris@40
|
78 <TR>
|
Chris@40
|
79 <TD><A HREF="#SFC_SET_NORM_FLOAT">SFC_SET_NORM_FLOAT</A></TD>
|
Chris@40
|
80 <TD>Modify the normalisation behaviour of the floating point reading and writing functions.</TD>
|
Chris@40
|
81 </TR>
|
Chris@40
|
82 <TR>
|
Chris@40
|
83 <TD><A HREF="#SFC_SET_NORM_DOUBLE">SFC_SET_NORM_DOUBLE</A></TD>
|
Chris@40
|
84 <TD>Modify the normalisation behaviour of the double precision floating point reading and writing functions.</TD>
|
Chris@40
|
85 </TR>
|
Chris@40
|
86 <TR>
|
Chris@40
|
87 <TD><A HREF="#SFC_GET_NORM_FLOAT">SFC_GET_NORM_FLOAT</A></TD>
|
Chris@40
|
88 <TD>Retrieve the current normalisation behaviour of the floating point reading and writing functions.</TD>
|
Chris@40
|
89 </TR>
|
Chris@40
|
90 <TR>
|
Chris@40
|
91 <TD><A HREF="#SFC_GET_NORM_DOUBLE">SFC_GET_NORM_DOUBLE</A></TD>
|
Chris@40
|
92 <TD>Retrieve the current normalisation behaviour of the double precision floating point reading and writing functions.</TD>
|
Chris@40
|
93 </TR>
|
Chris@40
|
94 <TR>
|
Chris@40
|
95 <TD><A HREF="#SFC_SET_SCALE_FLOAT_INT_READ">SFC_SET_SCALE_FLOAT_INT_READ</A></TD>
|
Chris@40
|
96 <TD>Set/clear the scale factor when integer (short/int) data is read from a file
|
Chris@40
|
97 containing floating point data.</TD>
|
Chris@40
|
98 </TR>
|
Chris@40
|
99
|
Chris@40
|
100 <TR>
|
Chris@40
|
101 <TD><A HREF="#SFC_SET_SCALE_INT_FLOAT_WRITE">SFC_SET_SCALE_INT_FLOAT_WRITE</A></TD>
|
Chris@40
|
102 <TD>Set/clear the scale factor when integer (short/int) data is written to a file
|
Chris@40
|
103 as floating point data.</TD>
|
Chris@40
|
104 </TR>
|
Chris@40
|
105
|
Chris@40
|
106 <TR>
|
Chris@40
|
107 <TD><A HREF="#SFC_GET_SIMPLE_FORMAT_COUNT">SFC_GET_SIMPLE_FORMAT_COUNT</A></TD>
|
Chris@40
|
108 <TD>Retrieve the number of simple formats supported by libsndfile.</TD>
|
Chris@40
|
109 </TR>
|
Chris@40
|
110 <TR>
|
Chris@40
|
111 <TD><A HREF="#SFC_GET_SIMPLE_FORMAT">SFC_GET_SIMPLE_FORMAT</A></TD>
|
Chris@40
|
112 <TD>Retrieve information about a simple format.</TD>
|
Chris@40
|
113 </TR>
|
Chris@40
|
114
|
Chris@40
|
115 <TR>
|
Chris@40
|
116 <TD><A HREF="#SFC_GET_FORMAT_INFO">SFC_GET_FORMAT_INFO</A></TD>
|
Chris@40
|
117 <TD>Retrieve information about a major or subtype format.</TD>
|
Chris@40
|
118 </TR>
|
Chris@40
|
119
|
Chris@40
|
120 <TR>
|
Chris@40
|
121 <TD><A HREF="#SFC_GET_FORMAT_MAJOR_COUNT">SFC_GET_FORMAT_MAJOR_COUNT</A></TD>
|
Chris@40
|
122 <TD>Retrieve the number of major formats.</TD>
|
Chris@40
|
123 </TR>
|
Chris@40
|
124 <TR>
|
Chris@40
|
125 <TD><A HREF="#SFC_GET_FORMAT_MAJOR">SFC_GET_FORMAT_MAJOR</A></TD>
|
Chris@40
|
126 <TD>Retrieve information about a major format type.</TD>
|
Chris@40
|
127 </TR>
|
Chris@40
|
128 <TR>
|
Chris@40
|
129 <TD><A HREF="#SFC_GET_FORMAT_SUBTYPE_COUNT">SFC_GET_FORMAT_SUBTYPE_COUNT</A></TD>
|
Chris@40
|
130 <TD>Retrieve the number of subformats.</TD>
|
Chris@40
|
131 </TR>
|
Chris@40
|
132 <TR>
|
Chris@40
|
133 <TD><A HREF="#SFC_GET_FORMAT_SUBTYPE">SFC_GET_FORMAT_SUBTYPE</A></TD>
|
Chris@40
|
134 <TD>Retrieve information about a subformat.</TD>
|
Chris@40
|
135 </TR>
|
Chris@40
|
136
|
Chris@40
|
137 <TR>
|
Chris@40
|
138 <TD><A HREF="#SFC_SET_ADD_PEAK_CHUNK">SFC_SET_ADD_PEAK_CHUNK</A></TD>
|
Chris@40
|
139 <TD>Switch the code for adding the PEAK chunk to WAV and AIFF files on or off.</TD>
|
Chris@40
|
140 </TR>
|
Chris@40
|
141
|
Chris@40
|
142 <TR>
|
Chris@40
|
143 <TD><A HREF="#SFC_UPDATE_HEADER_NOW">SFC_UPDATE_HEADER_NOW</A></TD>
|
Chris@40
|
144 <TD>Used when a file is open for write, this command will update the file
|
Chris@40
|
145 header to reflect the data written so far.</TD>
|
Chris@40
|
146 </TR>
|
Chris@40
|
147 <TR>
|
Chris@40
|
148 <TD><A HREF="#SFC_SET_UPDATE_HEADER_AUTO">SFC_SET_UPDATE_HEADER_AUTO</A></TD>
|
Chris@40
|
149 <TD>Used when a file is open for write, this command will cause the file header
|
Chris@40
|
150 to be updated after each write to the file.</TD>
|
Chris@40
|
151 </TR>
|
Chris@40
|
152
|
Chris@40
|
153 <TR>
|
Chris@40
|
154 <TD><A HREF="#SFC_FILE_TRUNCATE">SFC_FILE_TRUNCATE</A></TD>
|
Chris@40
|
155 <TD>Truncate a file open for write or for read/write.</TD>
|
Chris@40
|
156 </TR>
|
Chris@40
|
157
|
Chris@40
|
158 <TR>
|
Chris@40
|
159 <TD><A HREF="#SFC_SET_RAW_START_OFFSET">SFC_SET_RAW_START_OFFSET</A></TD>
|
Chris@40
|
160 <TD>Change the data start offset for files opened up as SF_FORMAT_RAW.</TD>
|
Chris@40
|
161 </TR>
|
Chris@40
|
162
|
Chris@40
|
163 <TR>
|
Chris@40
|
164 <TD><A HREF="#SFC_SET_CLIPPING">SFC_SET_CLIPPING</A></TD>
|
Chris@40
|
165 <TD>Turn on/off automatic clipping when doing floating point to integer
|
Chris@40
|
166 conversion.</TD>
|
Chris@40
|
167 </TR>
|
Chris@40
|
168
|
Chris@40
|
169 <TR>
|
Chris@40
|
170 <TD><A HREF="#SFC_GET_CLIPPING">SFC_GET_CLIPPING</A></TD>
|
Chris@40
|
171 <TD>Retrieve current clipping setting.</TD>
|
Chris@40
|
172 </TR>
|
Chris@40
|
173
|
Chris@40
|
174 <TR>
|
Chris@40
|
175 <TD><A HREF="#SFC_GET_EMBED_FILE_INFO">SFC_GET_EMBED_FILE_INFO</A></TD>
|
Chris@40
|
176 <TD>Retrieve information about audio files embedded inside other files.</TD>
|
Chris@40
|
177 </TR>
|
Chris@40
|
178
|
Chris@40
|
179 <TR>
|
Chris@40
|
180 <TD><A HREF="#SFC_WAVEX_GET_AMBISONIC">SFC_GET_AMBISONIC</A></TD>
|
Chris@40
|
181 <TD>Test a WAVEX file for Ambisonic format</TD>
|
Chris@40
|
182 </TR>
|
Chris@40
|
183
|
Chris@40
|
184 <TR>
|
Chris@40
|
185 <TD><A HREF="#SFC_WAVEX_SET_AMBISONIC">SFC_SET_AMBISONIC</A></TD>
|
Chris@40
|
186 <TD>Modify a WAVEX header for Ambisonic format</TD>
|
Chris@40
|
187 </TR>
|
Chris@40
|
188
|
Chris@40
|
189 <TR>
|
Chris@40
|
190 <TD><A HREF="#SFC_SET_VBR_ENCODING_QUALITY">SFC_SET_VBR_ENCODING_QUALITY</A></TD>
|
Chris@40
|
191 <TD>Set the Variable Bit Rate encoding quality</TD>
|
Chris@40
|
192 </TR>
|
Chris@40
|
193
|
Chris@40
|
194 <TR>
|
Chris@40
|
195 <TD><A HREF="#SFC_SET_COMPRESSION_LEVEL">SFC_SET_COMPRESSION_LEVEL</A></TD>
|
Chris@40
|
196 <TD>Set the compression level.</TD>
|
Chris@40
|
197 </TR>
|
Chris@40
|
198
|
Chris@40
|
199 <TR>
|
Chris@40
|
200 <TD><A HREF="#SFC_RAW_NEEDS_ENDSWAP">SFC_RAW_NEEDS_ENDSWAP</a></td>
|
Chris@40
|
201 <TD>Determine if raw data needs endswapping</TD>
|
Chris@40
|
202 </TR>
|
Chris@40
|
203
|
Chris@40
|
204 <TR>
|
Chris@40
|
205 <TD><A HREF="#SFC_GET_BROADCAST_INFO">SFC_GET_BROADCAST_INFO</A></TD>
|
Chris@40
|
206 <TD>Retrieve the Broadcast Chunk info</TD>
|
Chris@40
|
207 </TR>
|
Chris@40
|
208
|
Chris@40
|
209 <TR>
|
Chris@40
|
210 <TD><A HREF="#SFC_SET_BROADCAST_INFO">SFC_SET_BROADCAST_INFO</A></TD>
|
Chris@40
|
211 <TD>Set the Broadcast Chunk info</TD>
|
Chris@40
|
212 </TR>
|
Chris@40
|
213
|
Chris@40
|
214 <TR>
|
Chris@40
|
215 <TD><A HREF="#SFC_SET_CART_INFO">SFC_SET_CART_INFO</A></TD>
|
Chris@40
|
216 <TD>Set the Cart Chunk info</TD>
|
Chris@40
|
217 </TR>
|
Chris@40
|
218
|
Chris@40
|
219 <TR>
|
Chris@40
|
220 <TD><A HREF="#SFC_GET_CART_INFO">SFC_GET_CART_INFO</A></TD>
|
Chris@40
|
221 <TD>Retrieve the Cart Chunk info</TD>
|
Chris@40
|
222 </TR>
|
Chris@40
|
223
|
Chris@40
|
224 <TR>
|
Chris@40
|
225 <TD><A HREF="#SFC_GET_LOOP_INFO">SFC_GET_LOOP_INFO</A></TD>
|
Chris@40
|
226 <TD>Get loop info</TD>
|
Chris@40
|
227 </TR>
|
Chris@40
|
228
|
Chris@40
|
229 <TR>
|
Chris@40
|
230 <TD><A HREF="#SFC_GET_INSTRUMENT">SFC_GET_INSTRUMENT</A></TD>
|
Chris@40
|
231 <TD>Get instrument info</TD>
|
Chris@40
|
232 </TR>
|
Chris@40
|
233
|
Chris@40
|
234 <TR>
|
Chris@40
|
235 <TD><A HREF="#SFC_SET_INSTRUMENT">SFC_SET_INSTRUMENT</A></TD>
|
Chris@40
|
236 <TD>Set instrument info</TD>
|
Chris@40
|
237 </TR>
|
Chris@40
|
238
|
Chris@40
|
239 <TR>
|
Chris@40
|
240 <TD><A HREF="#SFC_GET_CUE_COUNT">SFC_GET_CUE_COUNT</A></TD>
|
Chris@40
|
241 <TD>Get the cue marker count</TD>
|
Chris@40
|
242 </TR>
|
Chris@40
|
243
|
Chris@40
|
244 <TR>
|
Chris@40
|
245 <TD><A HREF="#SFC_GET_CUE">SFC_GET_CUE</A></TD>
|
Chris@40
|
246 <TD>Get cue marker info</TD>
|
Chris@40
|
247 </TR>
|
Chris@40
|
248
|
Chris@40
|
249 <TR>
|
Chris@40
|
250 <TD><A HREF="#SFC_SET_CUE">SFC_SET_CUE</A></TD>
|
Chris@40
|
251 <TD>Set cue marker info</TD>
|
Chris@40
|
252 </TR>
|
Chris@40
|
253
|
Chris@40
|
254 <TR>
|
Chris@40
|
255 <TD><A HREF="#SFC_RF64_AUTO_DOWNGRADE">SFC_RF64_AUTO_DOWNGRADE</A></TD>
|
Chris@40
|
256 <TD>Enable auto downgrade from RF64 to WAV</TD>
|
Chris@40
|
257 </TR>
|
Chris@40
|
258
|
Chris@40
|
259 <!--
|
Chris@40
|
260 <TR>
|
Chris@40
|
261 <TD><A HREF="#add-dither">add dither</A></TD>
|
Chris@40
|
262 <TD>Add dither to output on write.</TD>
|
Chris@40
|
263 </TR>
|
Chris@40
|
264 -->
|
Chris@40
|
265 </TABLE>
|
Chris@40
|
266 </CENTER>
|
Chris@40
|
267
|
Chris@40
|
268 <BR><BR>
|
Chris@40
|
269
|
Chris@40
|
270 <HR>
|
Chris@40
|
271
|
Chris@40
|
272 <!-- ========================================================================= -->
|
Chris@40
|
273 <A NAME="SFC_GET_LIB_VERSION"></A>
|
Chris@40
|
274 <H2><BR><B>SFC_GET_LIB_VERSION</B></H2>
|
Chris@40
|
275 <P>
|
Chris@40
|
276 Retrieve the version of the library as a string.
|
Chris@40
|
277 </P>
|
Chris@40
|
278 <P>
|
Chris@40
|
279 Parameters:
|
Chris@40
|
280 <PRE>
|
Chris@40
|
281 sndfile : Not used
|
Chris@40
|
282 cmd : SFC_GET_LIB_VERSION
|
Chris@40
|
283 data : A pointer to a char buffer
|
Chris@40
|
284 datasize : The size of the buffer
|
Chris@40
|
285 </PRE>
|
Chris@40
|
286 <P>
|
Chris@40
|
287 Example:
|
Chris@40
|
288 </P>
|
Chris@40
|
289 <PRE>
|
Chris@40
|
290 char buffer [128] ;
|
Chris@40
|
291 sf_command (NULL, SFC_GET_LIB_VERSION, buffer, sizeof (buffer)) ;
|
Chris@40
|
292 </PRE>
|
Chris@40
|
293
|
Chris@40
|
294 <DL>
|
Chris@40
|
295 <DT>Return value:</DT>
|
Chris@40
|
296 <DD><DD>This call will return the length of the retrieved version string.
|
Chris@40
|
297 </DL>
|
Chris@40
|
298 <DL>
|
Chris@40
|
299 <DT>Notes:</DT>
|
Chris@40
|
300 <DD>
|
Chris@40
|
301 The string returned in the buffer passed to this function will not overflow
|
Chris@40
|
302 the buffer and will always be null terminated .
|
Chris@40
|
303 </DL>
|
Chris@40
|
304
|
Chris@40
|
305 <!-- ========================================================================= -->
|
Chris@40
|
306 <A NAME="SFC_GET_LOG_INFO"></A>
|
Chris@40
|
307 <H2><BR><B>SFC_GET_LOG_INFO</B></H2>
|
Chris@40
|
308 <P>
|
Chris@40
|
309 Retrieve the log buffer generated when opening a file as a string. This log
|
Chris@40
|
310 buffer can often contain a good reason for why libsndfile failed to open a
|
Chris@40
|
311 particular file.
|
Chris@40
|
312 </P>
|
Chris@40
|
313 <P>
|
Chris@40
|
314 Parameters:
|
Chris@40
|
315 <PRE>
|
Chris@40
|
316 sndfile : A valid SNDFILE* pointer
|
Chris@40
|
317 cmd : SFC_GET_LOG_INFO
|
Chris@40
|
318 data : A pointer to a char buffer
|
Chris@40
|
319 datasize : The size of the buffer
|
Chris@40
|
320 </PRE>
|
Chris@40
|
321 <P>
|
Chris@40
|
322 Example:
|
Chris@40
|
323 </P>
|
Chris@40
|
324 <PRE>
|
Chris@40
|
325 char buffer [2048] ;
|
Chris@40
|
326 sf_command (sndfile, SFC_GET_LOG_INFO, buffer, sizeof (buffer)) ;
|
Chris@40
|
327 </PRE>
|
Chris@40
|
328
|
Chris@40
|
329 <DL>
|
Chris@40
|
330 <DT>Return value:</DT>
|
Chris@40
|
331 <DD><DD>This call will return the length of the retrieved version string.
|
Chris@40
|
332 </DL>
|
Chris@40
|
333 <DL>
|
Chris@40
|
334 <DT>Notes:</DT>
|
Chris@40
|
335 <DD>
|
Chris@40
|
336 The string returned in the buffer passed to this function will not overflow
|
Chris@40
|
337 the buffer and will always be null terminated .
|
Chris@40
|
338 </DL>
|
Chris@40
|
339
|
Chris@40
|
340 <!-- ========================================================================= -->
|
Chris@40
|
341 <A NAME="SFC_CALC_SIGNAL_MAX"></A>
|
Chris@40
|
342 <H2><BR><B>SFC_CALC_SIGNAL_MAX</B></H2>
|
Chris@40
|
343 <P>
|
Chris@40
|
344 Retrieve the measured maximum signal value. This involves reading through
|
Chris@40
|
345 the whole file which can be slow on large files.
|
Chris@40
|
346 </P>
|
Chris@40
|
347 <P>
|
Chris@40
|
348 Parameters:
|
Chris@40
|
349 <PRE>
|
Chris@40
|
350 sndfile : A valid SNDFILE* pointer
|
Chris@40
|
351 cmd : SFC_CALC_SIGNAL_MAX
|
Chris@40
|
352 data : A pointer to a double
|
Chris@40
|
353 datasize : sizeof (double)
|
Chris@40
|
354 </PRE>
|
Chris@40
|
355 <P>
|
Chris@40
|
356 Example:
|
Chris@40
|
357 </P>
|
Chris@40
|
358 <PRE>
|
Chris@40
|
359 double max_val ;
|
Chris@40
|
360 sf_command (sndfile, SFC_CALC_SIGNAL_MAX, &max_val, sizeof (max_val)) ;
|
Chris@40
|
361 </PRE>
|
Chris@40
|
362
|
Chris@40
|
363 <DL>
|
Chris@40
|
364 <DT>Return value:</DT>
|
Chris@40
|
365 <DD><DD>Zero on success, non-zero otherwise.
|
Chris@40
|
366 </DL>
|
Chris@40
|
367
|
Chris@40
|
368 <!-- ========================================================================= -->
|
Chris@40
|
369 <A NAME="SFC_CALC_NORM_SIGNAL_MAX"></A>
|
Chris@40
|
370 <H2><BR><B>SFC_CALC_NORM_SIGNAL_MAX</B></H2>
|
Chris@40
|
371 <P>
|
Chris@40
|
372 Retrieve the measured normalised maximum signal value. This involves reading
|
Chris@40
|
373 through the whole file which can be slow on large files.
|
Chris@40
|
374 </P>
|
Chris@40
|
375 <P>
|
Chris@40
|
376 Parameters:
|
Chris@40
|
377 <PRE>
|
Chris@40
|
378 sndfile : A valid SNDFILE* pointer
|
Chris@40
|
379 cmd : SFC_CALC_NORM_SIGNAL_MAX
|
Chris@40
|
380 data : A pointer to a double
|
Chris@40
|
381 datasize : sizeof (double)
|
Chris@40
|
382 </PRE>
|
Chris@40
|
383 <P>
|
Chris@40
|
384 Example:
|
Chris@40
|
385 </P>
|
Chris@40
|
386 <PRE>
|
Chris@40
|
387 double max_val ;
|
Chris@40
|
388 sf_command (sndfile, SFC_CALC_NORM_SIGNAL_MAX, &max_val, sizeof (max_val)) ;
|
Chris@40
|
389 </PRE>
|
Chris@40
|
390
|
Chris@40
|
391 <DL>
|
Chris@40
|
392 <DT>Return value:</DT>
|
Chris@40
|
393 <DD><DD>Zero on success, non-zero otherwise.
|
Chris@40
|
394 </DL>
|
Chris@40
|
395
|
Chris@40
|
396 <!-- ========================================================================= -->
|
Chris@40
|
397 <A NAME="SFC_CALC_MAX_ALL_CHANNELS"></A>
|
Chris@40
|
398 <H2><BR><B>SFC_CALC_MAX_ALL_CHANNELS</B></H2>
|
Chris@40
|
399 <P>
|
Chris@40
|
400 Calculate the peak value (ie a single number) for each channel.
|
Chris@40
|
401 This involves reading through the whole file which can be slow on large files.
|
Chris@40
|
402 </P>
|
Chris@40
|
403 <P>
|
Chris@40
|
404 Parameters:
|
Chris@40
|
405 <PRE>
|
Chris@40
|
406 sndfile : A valid SNDFILE* pointer
|
Chris@40
|
407 cmd : SFC_CALC_MAX_ALL_CHANNELS
|
Chris@40
|
408 data : A pointer to a double
|
Chris@40
|
409 datasize : sizeof (double) * number_of_channels
|
Chris@40
|
410 </PRE>
|
Chris@40
|
411 <P>
|
Chris@40
|
412 Example:
|
Chris@40
|
413 </P>
|
Chris@40
|
414 <PRE>
|
Chris@40
|
415 double peaks [number_of_channels] ;
|
Chris@40
|
416 sf_command (sndfile, SFC_CALC_MAX_ALL_CHANNELS, peaks, sizeof (peaks)) ;
|
Chris@40
|
417 </PRE>
|
Chris@40
|
418 <DL>
|
Chris@40
|
419 <DT>Return value:</DT>
|
Chris@40
|
420 <DD>Zero if peaks have been calculated successfully and non-zero otherwise.
|
Chris@40
|
421 </DL>
|
Chris@40
|
422
|
Chris@40
|
423
|
Chris@40
|
424 <!-- ========================================================================= -->
|
Chris@40
|
425 <A NAME="SFC_CALC_NORM_MAX_ALL_CHANNELS"></A>
|
Chris@40
|
426 <H2><BR><B>SFC_CALC_NORM_MAX_ALL_CHANNELS</B></H2>
|
Chris@40
|
427 <P>
|
Chris@40
|
428 Calculate the normalised peak for each channel.
|
Chris@40
|
429 This involves reading through the whole file which can be slow on large files.
|
Chris@40
|
430 </P>
|
Chris@40
|
431 <P>
|
Chris@40
|
432 Parameters:
|
Chris@40
|
433 <PRE>
|
Chris@40
|
434 sndfile : A valid SNDFILE* pointer
|
Chris@40
|
435 cmd : SFC_CALC_NORM_MAX_ALL_CHANNELS
|
Chris@40
|
436 data : A pointer to a double
|
Chris@40
|
437 datasize : sizeof (double) * number_of_channels
|
Chris@40
|
438 </PRE>
|
Chris@40
|
439 <P>
|
Chris@40
|
440 Example:
|
Chris@40
|
441 </P>
|
Chris@40
|
442 <PRE>
|
Chris@40
|
443 double peaks [number_of_channels] ;
|
Chris@40
|
444 sf_command (sndfile, SFC_CALC_NORM_MAX_ALL_CHANNELS, peaks, sizeof (peaks)) ;
|
Chris@40
|
445 </PRE>
|
Chris@40
|
446 <DL>
|
Chris@40
|
447 <DT>Return value:</DT>
|
Chris@40
|
448 <DD>Zero if peaks have been calculated successfully and non-zero otherwise.
|
Chris@40
|
449 </DL>
|
Chris@40
|
450
|
Chris@40
|
451
|
Chris@40
|
452
|
Chris@40
|
453
|
Chris@40
|
454 <!-- ========================================================================= -->
|
Chris@40
|
455 <A NAME="SFC_GET_SIGNAL_MAX"></A>
|
Chris@40
|
456 <H2><BR><B>SFC_GET_SIGNAL_MAX</B></H2>
|
Chris@40
|
457 <P>
|
Chris@40
|
458 Retrieve the peak value for the file as stored in the file header.
|
Chris@40
|
459 </P>
|
Chris@40
|
460 <P>
|
Chris@40
|
461 Parameters:
|
Chris@40
|
462 <PRE>
|
Chris@40
|
463 sndfile : A valid SNDFILE* pointer
|
Chris@40
|
464 cmd : SFC_GET_SIGNAL_MAX
|
Chris@40
|
465 data : A pointer to a double
|
Chris@40
|
466 datasize : sizeof (double)
|
Chris@40
|
467 </PRE>
|
Chris@40
|
468 <P>
|
Chris@40
|
469 Example:
|
Chris@40
|
470 </P>
|
Chris@40
|
471 <PRE>
|
Chris@40
|
472 double max_peak ;
|
Chris@40
|
473 sf_command (sndfile, SFC_GET_SIGNAL_MAX, &max_peak, sizeof (max_peak)) ;
|
Chris@40
|
474 </PRE>
|
Chris@40
|
475 <DL>
|
Chris@40
|
476 <DT>Return value:</DT>
|
Chris@40
|
477 <DD>SF_TRUE if the file header contained the peak value. SF_FALSE otherwise.
|
Chris@40
|
478 </DL>
|
Chris@40
|
479
|
Chris@40
|
480 <!-- ========================================================================= -->
|
Chris@40
|
481 <A NAME="SFC_GET_MAX_ALL_CHANNELS"></A>
|
Chris@40
|
482 <H2><BR><B>SFC_GET_MAX_ALL_CHANNELS</B></H2>
|
Chris@40
|
483 <P>
|
Chris@40
|
484 Retrieve the peak value for the file as stored in the file header.
|
Chris@40
|
485 </P>
|
Chris@40
|
486 <P>
|
Chris@40
|
487 Parameters:
|
Chris@40
|
488 <PRE>
|
Chris@40
|
489 sndfile : A valid SNDFILE* pointer
|
Chris@40
|
490 cmd : SFC_GET_SIGNAL_MAX
|
Chris@40
|
491 data : A pointer to an array of doubles
|
Chris@40
|
492 datasize : sizeof (double) * number_of_channels
|
Chris@40
|
493 </PRE>
|
Chris@40
|
494 <P>
|
Chris@40
|
495 Example:
|
Chris@40
|
496 </P>
|
Chris@40
|
497 <PRE>
|
Chris@40
|
498 double peaks [number_of_channels] ;
|
Chris@40
|
499 sf_command (sndfile, SFC_GET_MAX_ALL_CHANNELS, peaks, sizeof (peaks)) ;
|
Chris@40
|
500 </PRE>
|
Chris@40
|
501 <DL>
|
Chris@40
|
502 <DT>Return value:</DT>
|
Chris@40
|
503 <DD>SF_TRUE if the file header contains per channel peak values for the file.
|
Chris@40
|
504 SF_FALSE otherwise.
|
Chris@40
|
505 </DL>
|
Chris@40
|
506
|
Chris@40
|
507
|
Chris@40
|
508 <!-- ========================================================================= -->
|
Chris@40
|
509 <A NAME="SFC_SET_NORM_FLOAT"></A>
|
Chris@40
|
510 <H2><BR><B>SFC_SET_NORM_FLOAT</B></H2>
|
Chris@40
|
511 <P>
|
Chris@40
|
512 This command only affects data read from or written to using the floating point functions:
|
Chris@40
|
513 </P>
|
Chris@40
|
514 <PRE>
|
Chris@40
|
515 size_t <A HREF="api.html#read">sf_read_float</A> (SNDFILE *sndfile, float *ptr, size_t items) ;
|
Chris@40
|
516 size_t <A HREF="api.html#readf">sf_readf_float</A> (SNDFILE *sndfile, float *ptr, size_t frames) ;
|
Chris@40
|
517
|
Chris@40
|
518 size_t <A HREF="api.html#write">sf_write_float</A> (SNDFILE *sndfile, float *ptr, size_t items) ;
|
Chris@40
|
519 size_t <A HREF="api.html#writef">sf_writef_float</A> (SNDFILE *sndfile, float *ptr, size_t frames) ;
|
Chris@40
|
520 </PRE>
|
Chris@40
|
521 <P>
|
Chris@40
|
522 Parameters:
|
Chris@40
|
523 </P>
|
Chris@40
|
524 <PRE>
|
Chris@40
|
525 sndfile : A valid SNDFILE* pointer
|
Chris@40
|
526 cmd : SFC_SET_NORM_FLOAT
|
Chris@40
|
527 data : NULL
|
Chris@40
|
528 datasize : SF_TRUE or SF_FALSE
|
Chris@40
|
529 </PRE>
|
Chris@40
|
530 <P>
|
Chris@40
|
531 For read operations setting normalisation to SF_TRUE means that the data from all
|
Chris@40
|
532 subsequent reads will be be normalised to the range [-1.0, 1.0].
|
Chris@40
|
533 </P>
|
Chris@40
|
534 <P>
|
Chris@40
|
535 For write operations, setting normalisation to SF_TRUE means than all data supplied
|
Chris@40
|
536 to the float write functions should be in the range [-1.0, 1.0] and will be scaled
|
Chris@40
|
537 for the file format as necessary.
|
Chris@40
|
538 </P>
|
Chris@40
|
539 <P>
|
Chris@40
|
540 For both cases, setting normalisation to SF_FALSE means that no scaling will take place.
|
Chris@40
|
541 </P>
|
Chris@40
|
542 <P>
|
Chris@40
|
543 Example:
|
Chris@40
|
544 </P>
|
Chris@40
|
545 <PRE>
|
Chris@40
|
546 sf_command (sndfile, SFC_SET_NORM_FLOAT, NULL, SF_TRUE) ;
|
Chris@40
|
547
|
Chris@40
|
548 sf_command (sndfile, SFC_SET_NORM_FLOAT, NULL, SF_FALSE) ;
|
Chris@40
|
549 </PRE>
|
Chris@40
|
550 <DL>
|
Chris@40
|
551 <DT>Return value: </DT>
|
Chris@40
|
552 <DD>Returns the previous float normalisation mode.
|
Chris@40
|
553 </DL>
|
Chris@40
|
554
|
Chris@40
|
555 <!-- ========================================================================= -->
|
Chris@40
|
556 <A NAME="SFC_SET_NORM_DOUBLE"></A>
|
Chris@40
|
557 <H2><BR><B>SFC_SET_NORM_DOUBLE</B></H2>
|
Chris@40
|
558 <P>
|
Chris@40
|
559 This command only affects data read from or written to using the double precision
|
Chris@40
|
560 floating point functions:
|
Chris@40
|
561 </P>
|
Chris@40
|
562 <PRE>
|
Chris@40
|
563 size_t <A HREF="api.html#read">sf_read_double</A> (SNDFILE *sndfile, double *ptr, size_t items) ;
|
Chris@40
|
564 size_t <A HREF="api.html#readf">sf_readf_double</A> (SNDFILE *sndfile, double *ptr, size_t frames) ;
|
Chris@40
|
565
|
Chris@40
|
566 size_t <A HREF="api.html#write">sf_write_double</A> (SNDFILE *sndfile, double *ptr, size_t items) ;
|
Chris@40
|
567 size_t <A HREF="api.html#writef">sf_writef_double</A> (SNDFILE *sndfile, double *ptr, size_t frames) ;
|
Chris@40
|
568 </PRE>
|
Chris@40
|
569 <P>
|
Chris@40
|
570 Parameters:
|
Chris@40
|
571 </P>
|
Chris@40
|
572 <PRE>
|
Chris@40
|
573 sndfile : A valid SNDFILE* pointer
|
Chris@40
|
574 cmd : SFC_SET_NORM_DOUBLE
|
Chris@40
|
575 data : NULL
|
Chris@40
|
576 datasize : SF_TRUE or SF_FALSE
|
Chris@40
|
577 </PRE>
|
Chris@40
|
578 <P>
|
Chris@40
|
579 For read operations setting normalisation to SF_TRUE means that the data
|
Chris@40
|
580 from all subsequent reads will be be normalised to the range [-1.0, 1.0].
|
Chris@40
|
581 </P>
|
Chris@40
|
582 <P>
|
Chris@40
|
583 For write operations, setting normalisation to SF_TRUE means than all data supplied
|
Chris@40
|
584 to the double write functions should be in the range [-1.0, 1.0] and will be scaled
|
Chris@40
|
585 for the file format as necessary.
|
Chris@40
|
586 </P>
|
Chris@40
|
587 <P>
|
Chris@40
|
588 For both cases, setting normalisation to SF_FALSE means that no scaling will take place.
|
Chris@40
|
589 </P>
|
Chris@40
|
590 <P>
|
Chris@40
|
591 Example:
|
Chris@40
|
592 </P>
|
Chris@40
|
593 <PRE>
|
Chris@40
|
594 sf_command (sndfile, SFC_SET_NORM_DOUBLE, NULL, SF_TRUE) ;
|
Chris@40
|
595
|
Chris@40
|
596 sf_command (sndfile, SFC_SET_NORM_DOUBLE, NULL, SF_FALSE) ;
|
Chris@40
|
597 </PRE>
|
Chris@40
|
598 <DL>
|
Chris@40
|
599 <DT>Return value: </DT>
|
Chris@40
|
600 <DD>Returns the previous double normalisation mode.
|
Chris@40
|
601 </DL>
|
Chris@40
|
602
|
Chris@40
|
603 <!-- ========================================================================= -->
|
Chris@40
|
604 <A NAME="SFC_GET_NORM_FLOAT"></A>
|
Chris@40
|
605 <H2><BR><B>SFC_GET_NORM_FLOAT</B></H2>
|
Chris@40
|
606 <P>
|
Chris@40
|
607 Retrieve the current float normalisation mode.
|
Chris@40
|
608 </P>
|
Chris@40
|
609 <P>
|
Chris@40
|
610 Parameters:
|
Chris@40
|
611 </P>
|
Chris@40
|
612 <PRE>
|
Chris@40
|
613 sndfile : A valid SNDFILE* pointer
|
Chris@40
|
614 cmd : SFC_GET_NORM_FLOAT
|
Chris@40
|
615 data : NULL
|
Chris@40
|
616 datasize : anything
|
Chris@40
|
617 </PRE>
|
Chris@40
|
618 <P>
|
Chris@40
|
619 Example:
|
Chris@40
|
620 </P>
|
Chris@40
|
621 <PRE>
|
Chris@40
|
622 normalisation = sf_command (sndfile, SFC_GET_NORM_FLOAT, NULL, 0) ;
|
Chris@40
|
623 </PRE>
|
Chris@40
|
624 <DL>
|
Chris@40
|
625 <DT>Return value: </DT>
|
Chris@40
|
626 <DD>Returns TRUE if normalisation is on and FALSE otherwise.
|
Chris@40
|
627 </DL>
|
Chris@40
|
628
|
Chris@40
|
629 <!-- ========================================================================= -->
|
Chris@40
|
630 <A NAME="SFC_GET_NORM_DOUBLE"></A>
|
Chris@40
|
631 <H2><BR><B>SFC_GET_NORM_DOUBLE</B></H2>
|
Chris@40
|
632 <P>
|
Chris@40
|
633 Retrieve the current float normalisation mode.
|
Chris@40
|
634 </P>
|
Chris@40
|
635 <P>
|
Chris@40
|
636 Parameters:
|
Chris@40
|
637 </P>
|
Chris@40
|
638 <PRE>
|
Chris@40
|
639 sndfile : A valid SNDFILE* pointer
|
Chris@40
|
640 cmd : SFC_GET_NORM_DOUBLE
|
Chris@40
|
641 data : NULL
|
Chris@40
|
642 datasize : anything
|
Chris@40
|
643 </PRE>
|
Chris@40
|
644 <P>
|
Chris@40
|
645 Example:
|
Chris@40
|
646 </P>
|
Chris@40
|
647 <PRE>
|
Chris@40
|
648 normalisation = sf_command (sndfile, SFC_GET_NORM_DOUBLE, NULL, 0) ;
|
Chris@40
|
649 </PRE>
|
Chris@40
|
650 <DL>
|
Chris@40
|
651 <DT>Return value: </DT>
|
Chris@40
|
652 <DD>Returns TRUE if normalisation is on and FALSE otherwise.
|
Chris@40
|
653 </DL>
|
Chris@40
|
654
|
Chris@40
|
655
|
Chris@40
|
656 <!-- ========================================================================= -->
|
Chris@40
|
657 <A NAME="SFC_SET_SCALE_FLOAT_INT_READ"></A>
|
Chris@40
|
658 <H2><BR><B>SFC_SET_SCALE_FLOAT_INT_READ</B></H2>
|
Chris@40
|
659 <P>
|
Chris@40
|
660 Set/clear the scale factor when integer (short/int) data is read from a file
|
Chris@40
|
661 containing floating point data.
|
Chris@40
|
662 </P>
|
Chris@40
|
663 <P>
|
Chris@40
|
664 Parameters:
|
Chris@40
|
665 </P>
|
Chris@40
|
666 <PRE>
|
Chris@40
|
667 sndfile : A valid SNDFILE* pointer
|
Chris@40
|
668 cmd : SFC_SET_SCALE_FLOAT_INT_READ
|
Chris@40
|
669 data : NULL
|
Chris@40
|
670 datasize : TRUE or FALSE
|
Chris@40
|
671 </PRE>
|
Chris@40
|
672 <P>
|
Chris@40
|
673 Example:
|
Chris@40
|
674 </P>
|
Chris@40
|
675 <PRE>
|
Chris@40
|
676 sf_command (sndfile, SFC_SET_SCALE_FLOAT_INT_READ, NULL, SF_TRUE) ;
|
Chris@40
|
677 </PRE>
|
Chris@40
|
678 <DL>
|
Chris@40
|
679 <DT>Return value: </DT>
|
Chris@40
|
680 <DD>Returns the previous SFC_SET_SCALE_FLOAT_INT_READ setting for this file.
|
Chris@40
|
681 </DL>
|
Chris@40
|
682
|
Chris@40
|
683
|
Chris@40
|
684 <!-- ========================================================================= -->
|
Chris@40
|
685 <A NAME="SFC_SET_SCALE_INT_FLOAT_WRITE"></A>
|
Chris@40
|
686 <H2><BR><B>SFC_SET_SCALE_INT_FLOAT_WRITE</B></H2>
|
Chris@40
|
687 <P>
|
Chris@40
|
688 Set/clear the scale factor when integer (short/int) data is written to a file
|
Chris@40
|
689 as floating point data.
|
Chris@40
|
690 </P>
|
Chris@40
|
691 <P>
|
Chris@40
|
692 Parameters:
|
Chris@40
|
693 </P>
|
Chris@40
|
694 <PRE>
|
Chris@40
|
695 sndfile : A valid SNDFILE* pointer
|
Chris@40
|
696 cmd : SFC_SET_SCALE_FLOAT_INT_READ
|
Chris@40
|
697 data : NULL
|
Chris@40
|
698 datasize : TRUE or FALSE
|
Chris@40
|
699 </PRE>
|
Chris@40
|
700 <P>
|
Chris@40
|
701 Example:
|
Chris@40
|
702 </P>
|
Chris@40
|
703 <PRE>
|
Chris@40
|
704 sf_command (sndfile, SFC_SET_SCALE_INT_FLOAT_WRITE, NULL, SF_TRUE) ;
|
Chris@40
|
705 </PRE>
|
Chris@40
|
706 <DL>
|
Chris@40
|
707 <DT>Return value: </DT>
|
Chris@40
|
708 <DD>Returns the previous SFC_SET_SCALE_INT_FLOAT_WRITE setting for this file.
|
Chris@40
|
709 </DL>
|
Chris@40
|
710
|
Chris@40
|
711 <!-- ========================================================================= -->
|
Chris@40
|
712 <A NAME="SFC_GET_SIMPLE_FORMAT_COUNT"></A>
|
Chris@40
|
713 <H2><BR><B>SFC_GET_SIMPLE_FORMAT_COUNT</B></H2>
|
Chris@40
|
714 <P>
|
Chris@40
|
715 Retrieve the number of simple formats supported by libsndfile.
|
Chris@40
|
716 </P>
|
Chris@40
|
717 <P>
|
Chris@40
|
718 Parameters:
|
Chris@40
|
719 </P>
|
Chris@40
|
720 <PRE>
|
Chris@40
|
721 sndfile : Not used.
|
Chris@40
|
722 cmd : SFC_GET_SIMPLE_FORMAT_COUNT
|
Chris@40
|
723 data : a pointer to an int
|
Chris@40
|
724 datasize : sizeof (int)
|
Chris@40
|
725 </PRE>
|
Chris@40
|
726 <P>
|
Chris@40
|
727 Example:
|
Chris@40
|
728 </P>
|
Chris@40
|
729 <PRE>
|
Chris@40
|
730 int count ;
|
Chris@40
|
731 sf_command (sndfile, SFC_GET_SIMPLE_FORMAT_COUNT, &count, sizeof (int)) ;
|
Chris@40
|
732 </PRE>
|
Chris@40
|
733 <DL>
|
Chris@40
|
734 <DT>Return value: </DT>
|
Chris@40
|
735 <DD>0
|
Chris@40
|
736 </DL>
|
Chris@40
|
737
|
Chris@40
|
738 <!-- ========================================================================= -->
|
Chris@40
|
739 <A NAME="SFC_GET_SIMPLE_FORMAT"></A>
|
Chris@40
|
740 <H2><BR><B>SFC_GET_SIMPLE_FORMAT</B></H2>
|
Chris@40
|
741 <P>
|
Chris@40
|
742 Retrieve information about a simple format.
|
Chris@40
|
743 </P>
|
Chris@40
|
744 <P>
|
Chris@40
|
745 Parameters:
|
Chris@40
|
746 </P>
|
Chris@40
|
747 <PRE>
|
Chris@40
|
748 sndfile : Not used.
|
Chris@40
|
749 cmd : SFC_GET_SIMPLE_FORMAT
|
Chris@40
|
750 data : a pointer to an SF_FORMAT_INFO struct
|
Chris@40
|
751 datasize : sizeof (SF_FORMAT_INFO)
|
Chris@40
|
752 </PRE>
|
Chris@40
|
753 <P>
|
Chris@40
|
754 The SF_FORMAT_INFO struct is defined in <sndfile.h> as:
|
Chris@40
|
755 </P>
|
Chris@40
|
756 <PRE>
|
Chris@40
|
757 typedef struct
|
Chris@40
|
758 { int format ;
|
Chris@40
|
759 const char *name ;
|
Chris@40
|
760 const char *extension ;
|
Chris@40
|
761 } SF_FORMAT_INFO ;
|
Chris@40
|
762 </PRE>
|
Chris@40
|
763 <P>
|
Chris@40
|
764 When sf_command() is called with SF_GET_SIMPLE_FORMAT, the value of the format
|
Chris@40
|
765 field should be the format number (ie 0 <= format <= count value obtained using
|
Chris@40
|
766 SF_GET_SIMPLE_FORMAT_COUNT).
|
Chris@40
|
767 </P>
|
Chris@40
|
768 <P>
|
Chris@40
|
769 Example:
|
Chris@40
|
770 </P>
|
Chris@40
|
771 <PRE>
|
Chris@40
|
772 SF_FORMAT_INFO format_info ;
|
Chris@40
|
773 int k, count ;
|
Chris@40
|
774
|
Chris@40
|
775 sf_command (sndfile, SFC_GET_SIMPLE_FORMAT_COUNT, &count, sizeof (int)) ;
|
Chris@40
|
776
|
Chris@40
|
777 for (k = 0 ; k < count ; k++)
|
Chris@40
|
778 { format_info.format = k ;
|
Chris@40
|
779 sf_command (sndfile, SFC_GET_SIMPLE_FORMAT, &format_info, sizeof (format_info)) ;
|
Chris@40
|
780 printf ("%08x %s %s\n", format_info.format, format_info.name, format_info.extension) ;
|
Chris@40
|
781 } ;
|
Chris@40
|
782 </PRE>
|
Chris@40
|
783 <DL>
|
Chris@40
|
784 <DT>Return value: </DT>
|
Chris@40
|
785 <DD>0 on success and non-zero otherwise.
|
Chris@40
|
786 <DD>The value of the format field of the SF_FORMAT_INFO struct will be a value which
|
Chris@40
|
787 can be placed in the format field of an SF_INFO struct when a file is to be opened
|
Chris@40
|
788 for write.
|
Chris@40
|
789 <DD>The name field will contain a char* pointer to the name of the string, eg. "WAV (Microsoft 16 bit PCM)".
|
Chris@40
|
790 <DD>The extension field will contain the most commonly used file extension for that file type.
|
Chris@40
|
791 </DL>
|
Chris@40
|
792
|
Chris@40
|
793 <!-- ========================================================================= -->
|
Chris@40
|
794 <A NAME="SFC_GET_FORMAT_INFO"></A>
|
Chris@40
|
795 <H2><BR><B>SFC_GET_FORMAT_INFO</B></H2>
|
Chris@40
|
796 <P>
|
Chris@40
|
797 Retrieve information about a major or subtype format.
|
Chris@40
|
798 </P>
|
Chris@40
|
799 <P>
|
Chris@40
|
800 Parameters:
|
Chris@40
|
801 </P>
|
Chris@40
|
802 <PRE>
|
Chris@40
|
803 sndfile : Not used.
|
Chris@40
|
804 cmd : SFC_GET_FORMAT_INFO
|
Chris@40
|
805 data : a pointer to an SF_FORMAT_INFO struct
|
Chris@40
|
806 datasize : sizeof (SF_FORMAT_INFO)
|
Chris@40
|
807 </PRE>
|
Chris@40
|
808 <P>
|
Chris@40
|
809 The SF_FORMAT_INFO struct is defined in <sndfile.h> as:
|
Chris@40
|
810 </P>
|
Chris@40
|
811 <PRE>
|
Chris@40
|
812 typedef struct
|
Chris@40
|
813 { int format ;
|
Chris@40
|
814 const char *name ;
|
Chris@40
|
815 const char *extension ;
|
Chris@40
|
816 } SF_FORMAT_INFO ;
|
Chris@40
|
817 </PRE>
|
Chris@40
|
818 <P>
|
Chris@40
|
819 When sf_command() is called with SF_GET_FORMAT_INFO, the format field is
|
Chris@40
|
820 examined and if (format & SF_FORMAT_TYPEMASK) is a valid format then the struct
|
Chris@40
|
821 is filled in with information about the given major type.
|
Chris@40
|
822 If (format & SF_FORMAT_TYPEMASK) is FALSE and (format & SF_FORMAT_SUBMASK) is a
|
Chris@40
|
823 valid subtype format then the struct is filled in with information about the given
|
Chris@40
|
824 subtype.
|
Chris@40
|
825 </P>
|
Chris@40
|
826 <P>
|
Chris@40
|
827 Example:
|
Chris@40
|
828 </P>
|
Chris@40
|
829 <PRE>
|
Chris@40
|
830 SF_FORMAT_INFO format_info ;
|
Chris@40
|
831
|
Chris@40
|
832 format_info.format = SF_FORMAT_WAV ;
|
Chris@40
|
833 sf_command (sndfile, SFC_GET_FORMAT_INFO, &format_info, sizeof (format_info)) ;
|
Chris@40
|
834 printf ("%08x %s %s\n", format_info.format, format_info.name, format_info.extension) ;
|
Chris@40
|
835
|
Chris@40
|
836 format_info.format = SF_FORMAT_ULAW ;
|
Chris@40
|
837 sf_command (sndfile, SFC_GET_FORMAT_INFO, &format_info, sizeof (format_info)) ;
|
Chris@40
|
838 printf ("%08x %s\n", format_info.format, format_info.name) ;
|
Chris@40
|
839 </PRE>
|
Chris@40
|
840 <DL>
|
Chris@40
|
841 <DT>Return value: </DT>
|
Chris@40
|
842 <DD>0 on success and non-zero otherwise.
|
Chris@40
|
843 </DL>
|
Chris@40
|
844 <!-- ========================================================================= -->
|
Chris@40
|
845 <A NAME="SFC_GET_FORMAT_MAJOR_COUNT"></A>
|
Chris@40
|
846 <H2><BR><B>SFC_GET_FORMAT_MAJOR_COUNT</B></H2>
|
Chris@40
|
847 <P>
|
Chris@40
|
848 Retrieve the number of major formats.
|
Chris@40
|
849 </P>
|
Chris@40
|
850 <P>
|
Chris@40
|
851 Parameters:
|
Chris@40
|
852 </P>
|
Chris@40
|
853 <PRE>
|
Chris@40
|
854 sndfile : Not used.
|
Chris@40
|
855 cmd : SFC_GET_FORMAT_MAJOR_COUNT
|
Chris@40
|
856 data : a pointer to an int
|
Chris@40
|
857 datasize : sizeof (int)
|
Chris@40
|
858 </PRE>
|
Chris@40
|
859 <P>
|
Chris@40
|
860 Example:
|
Chris@40
|
861 </P>
|
Chris@40
|
862 <PRE>
|
Chris@40
|
863 int count ;
|
Chris@40
|
864 sf_command (sndfile, SFC_GET_FORMAT_MAJOR_COUNT, &count, sizeof (int)) ;
|
Chris@40
|
865 </PRE>
|
Chris@40
|
866 <DL>
|
Chris@40
|
867 <DT>Return value: </DT>
|
Chris@40
|
868 <DD>0
|
Chris@40
|
869 </DL>
|
Chris@40
|
870
|
Chris@40
|
871 <!-- ========================================================================= -->
|
Chris@40
|
872 <A NAME="SFC_GET_FORMAT_MAJOR"></A>
|
Chris@40
|
873 <H2><BR><B>SFC_GET_FORMAT_MAJOR</B></H2>
|
Chris@40
|
874 <P>
|
Chris@40
|
875 Retrieve information about a major format type.
|
Chris@40
|
876 </P>
|
Chris@40
|
877 <P>
|
Chris@40
|
878 Parameters:
|
Chris@40
|
879 </P>
|
Chris@40
|
880 <PRE>
|
Chris@40
|
881 sndfile : Not used.
|
Chris@40
|
882 cmd : SFC_GET_FORMAT_MAJOR
|
Chris@40
|
883 data : a pointer to an SF_FORMAT_INFO struct
|
Chris@40
|
884 datasize : sizeof (SF_FORMAT_INFO)
|
Chris@40
|
885 </PRE>
|
Chris@40
|
886 <P>
|
Chris@40
|
887 Example:
|
Chris@40
|
888 </P>
|
Chris@40
|
889 <PRE>
|
Chris@40
|
890 SF_FORMAT_INFO format_info ;
|
Chris@40
|
891 int k, count ;
|
Chris@40
|
892
|
Chris@40
|
893 sf_command (sndfile, SFC_GET_FORMAT_MAJOR_COUNT, &count, sizeof (int)) ;
|
Chris@40
|
894
|
Chris@40
|
895 for (k = 0 ; k < count ; k++)
|
Chris@40
|
896 { format_info.format = k ;
|
Chris@40
|
897 sf_command (sndfile, SFC_GET_FORMAT_MAJOR, &format_info, sizeof (format_info)) ;
|
Chris@40
|
898 printf ("%08x %s %s\n", format_info.format, format_info.name, format_info.extension) ;
|
Chris@40
|
899 } ;
|
Chris@40
|
900 </PRE>
|
Chris@40
|
901 <P>
|
Chris@40
|
902 For a more comprehensive example, see the program list_formats.c in the examples/
|
Chris@40
|
903 directory of the libsndfile source code distribution.
|
Chris@40
|
904 </P>
|
Chris@40
|
905 <DL>
|
Chris@40
|
906 <DT>Return value: </DT>
|
Chris@40
|
907 <DD>0 on success and non-zero otherwise.
|
Chris@40
|
908 <DD>The value of the format field will be one of the major format identifiers such as
|
Chris@40
|
909 SF_FORMAT_WAV or SF_FORMAT_AIFF.
|
Chris@40
|
910 <DD>The name field will contain a char* pointer to the name of the string, eg. "WAV (Microsoft)".
|
Chris@40
|
911 <DD>The extension field will contain the most commonly used file extension for that file type.
|
Chris@40
|
912 </DL>
|
Chris@40
|
913
|
Chris@40
|
914 <!-- ========================================================================= -->
|
Chris@40
|
915 <A NAME="SFC_GET_FORMAT_SUBTYPE_COUNT"></A>
|
Chris@40
|
916 <H2><BR><B>SFC_GET_FORMAT_SUBTYPE_COUNT</B></H2>
|
Chris@40
|
917 <P>
|
Chris@40
|
918 Retrieve the number of subformats.
|
Chris@40
|
919 </P>
|
Chris@40
|
920 <P>
|
Chris@40
|
921 Parameters:
|
Chris@40
|
922 </P>
|
Chris@40
|
923 <PRE>
|
Chris@40
|
924 sndfile : Not used.
|
Chris@40
|
925 cmd : SFC_GET_FORMAT_SUBTYPE_COUNT
|
Chris@40
|
926 data : a pointer to an int
|
Chris@40
|
927 datasize : sizeof (int)
|
Chris@40
|
928 </PRE>
|
Chris@40
|
929 <P>
|
Chris@40
|
930 Example:
|
Chris@40
|
931 </P>
|
Chris@40
|
932 <PRE>
|
Chris@40
|
933 int count ;
|
Chris@40
|
934 sf_command (sndfile, SFC_GET_FORMAT_SUBTYPE_COUNT, &count, sizeof (int)) ;
|
Chris@40
|
935 </PRE>
|
Chris@40
|
936 <DL>
|
Chris@40
|
937 <DT>Return value: </DT>
|
Chris@40
|
938 <DD>0
|
Chris@40
|
939 </DL>
|
Chris@40
|
940
|
Chris@40
|
941 <!-- ========================================================================= -->
|
Chris@40
|
942 <A NAME="SFC_GET_FORMAT_SUBTYPE"></A>
|
Chris@40
|
943 <H2><BR><B>SFC_GET_FORMAT_SUBTYPE</B></H2>
|
Chris@40
|
944 <P>
|
Chris@40
|
945 Enumerate the subtypes (this function does not translate a subtype into
|
Chris@40
|
946 a string describing that subtype).
|
Chris@40
|
947 A typical use case might be retrieving a string description of all subtypes
|
Chris@40
|
948 so that a dialog box can be filled in.
|
Chris@40
|
949 </P>
|
Chris@40
|
950 <P>
|
Chris@40
|
951
|
Chris@40
|
952 </P>
|
Chris@40
|
953 <P>
|
Chris@40
|
954 Parameters:
|
Chris@40
|
955 </P>
|
Chris@40
|
956 <PRE>
|
Chris@40
|
957 sndfile : Not used.
|
Chris@40
|
958 cmd : SFC_GET_FORMAT_SUBTYPE
|
Chris@40
|
959 data : a pointer to an SF_FORMAT_INFO struct
|
Chris@40
|
960 datasize : sizeof (SF_FORMAT_INFO)
|
Chris@40
|
961 </PRE>
|
Chris@40
|
962 <P>
|
Chris@40
|
963 Example 1: Retrieve all sybtypes supported by the WAV format.
|
Chris@40
|
964 </P>
|
Chris@40
|
965 <PRE>
|
Chris@40
|
966 SF_FORMAT_INFO format_info ;
|
Chris@40
|
967 int k, count ;
|
Chris@40
|
968
|
Chris@40
|
969 sf_command (sndfile, SFC_GET_FORMAT_SUBTYPE_COUNT, &count, sizeof (int)) ;
|
Chris@40
|
970
|
Chris@40
|
971 for (k = 0 ; k < count ; k++)
|
Chris@40
|
972 { format_info.format = k ;
|
Chris@40
|
973 sf_command (sndfile, SFC_GET_FORMAT_SUBTYPE, &format_info, sizeof (format_info)) ;
|
Chris@40
|
974 if (! sf_format_check (format_info.format | SF_FORMAT_WAV))
|
Chris@40
|
975 continue ;
|
Chris@40
|
976 printf ("%08x %s\n", format_info.format, format_info.name) ;
|
Chris@40
|
977 } ;
|
Chris@40
|
978 </PRE>
|
Chris@40
|
979 <P>
|
Chris@40
|
980 Example 2: Print a string describing the SF_FORMAT_PCM_16 subtype.
|
Chris@40
|
981 </P>
|
Chris@40
|
982 <PRE>
|
Chris@40
|
983 SF_FORMAT_INFO format_info ;
|
Chris@40
|
984 int k, count ;
|
Chris@40
|
985
|
Chris@40
|
986 sf_command (sndfile, SFC_GET_FORMAT_SUBTYPE_COUNT, &count, sizeof (int)) ;
|
Chris@40
|
987
|
Chris@40
|
988 for (k = 0 ; k < count ; k++)
|
Chris@40
|
989 { format_info.format = k ;
|
Chris@40
|
990 sf_command (sndfile, SFC_GET_FORMAT_SUBTYPE, &format_info, sizeof (format_info)) ;
|
Chris@40
|
991 if (format_info.format == SF_FORMAT_PCM_16)
|
Chris@40
|
992 { printf ("%08x %s\n", format_info.format, format_info.name) ;
|
Chris@40
|
993 break ;
|
Chris@40
|
994 } ;
|
Chris@40
|
995 } ;
|
Chris@40
|
996 </PRE>
|
Chris@40
|
997 <P>
|
Chris@40
|
998 For a more comprehensive example, see the program list_formats.c in the examples/
|
Chris@40
|
999 directory of the libsndfile source code distribution.
|
Chris@40
|
1000 </P>
|
Chris@40
|
1001 <DL>
|
Chris@40
|
1002 <DT>Return value: </DT>
|
Chris@40
|
1003 <DD>0 on success and non-zero otherwise.
|
Chris@40
|
1004 <DD>The value of the format field will be one of the major format identifiers such as
|
Chris@40
|
1005 SF_FORMAT_WAV or SF_FORMAT_AIFF.
|
Chris@40
|
1006 <DD>The name field will contain a char* pointer to the name of the string; for instance
|
Chris@40
|
1007 "WAV (Microsoft)" or "AIFF (Apple/SGI)".
|
Chris@40
|
1008 <DD>The extension field will be a NULL pointer.
|
Chris@40
|
1009 </DL>
|
Chris@40
|
1010
|
Chris@40
|
1011 <!-- ========================================================================= -->
|
Chris@40
|
1012 <A NAME="SFC_SET_ADD_PEAK_CHUNK"></A>
|
Chris@40
|
1013 <H2><BR><B>SFC_SET_ADD_PEAK_CHUNK</B></H2>
|
Chris@40
|
1014 <P>
|
Chris@40
|
1015 By default, WAV and AIFF files which contain floating point data (subtype SF_FORMAT_FLOAT
|
Chris@40
|
1016 or SF_FORMAT_DOUBLE) have a PEAK chunk.
|
Chris@40
|
1017 By using this command, the addition of a PEAK chunk can be turned on or off.
|
Chris@40
|
1018 </P>
|
Chris@40
|
1019 <P>
|
Chris@40
|
1020 Note : This call must be made before any data is written to the file.
|
Chris@40
|
1021 </P>
|
Chris@40
|
1022 <P>
|
Chris@40
|
1023 Parameters:
|
Chris@40
|
1024 <PRE>
|
Chris@40
|
1025 sndfile : A valid SNDFILE* pointer
|
Chris@40
|
1026 cmd : SFC_SET_ADD_PEAK_CHUNK
|
Chris@40
|
1027 data : Not used (should be NULL)
|
Chris@40
|
1028 datasize : TRUE or FALSE.
|
Chris@40
|
1029 </PRE>
|
Chris@40
|
1030 <P>
|
Chris@40
|
1031 Example:
|
Chris@40
|
1032 </P>
|
Chris@40
|
1033 <PRE>
|
Chris@40
|
1034 /* Turn on the PEAK chunk. */
|
Chris@40
|
1035 sf_command (sndfile, SFC_SET_ADD_PEAK_CHUNK, NULL, SF_TRUE) ;
|
Chris@40
|
1036
|
Chris@40
|
1037 /* Turn off the PEAK chunk. */
|
Chris@40
|
1038 sf_command (sndfile, SFC_SET_ADD_PEAK_CHUNK, NULL, SF_FALSE) ;
|
Chris@40
|
1039 </PRE>
|
Chris@40
|
1040 <DL>
|
Chris@40
|
1041 <DT>Return value:</DT>
|
Chris@40
|
1042 <DD>Returns SF_TRUE if the peak chunk will be written after this call.
|
Chris@40
|
1043 <DD>Returns SF_FALSE if the peak chunk will not be written after this call.
|
Chris@40
|
1044 </DL>
|
Chris@40
|
1045
|
Chris@40
|
1046 <!-- ========================================================================= -->
|
Chris@40
|
1047 <A NAME="SFC_UPDATE_HEADER_NOW"></A>
|
Chris@40
|
1048 <H2><BR><B>SFC_UPDATE_HEADER_NOW</B></H2>
|
Chris@40
|
1049 <P>
|
Chris@40
|
1050 The header of an audio file is normally written by libsndfile when the file is
|
Chris@40
|
1051 closed using <B>sf_close()</B>.
|
Chris@40
|
1052 </P>
|
Chris@40
|
1053 <P>
|
Chris@40
|
1054 There are however situations where large files are being generated and it would
|
Chris@40
|
1055 be nice to have valid data in the header before the file is complete.
|
Chris@40
|
1056 Using this command will update the file header to reflect the amount of data written
|
Chris@40
|
1057 to the file so far.
|
Chris@40
|
1058 Other programs opening the file for read (before any more data is written) will
|
Chris@40
|
1059 then read a valid sound file header.
|
Chris@40
|
1060 </P>
|
Chris@40
|
1061 <P>
|
Chris@40
|
1062 Parameters:
|
Chris@40
|
1063 <PRE>
|
Chris@40
|
1064 sndfile : A valid SNDFILE* pointer
|
Chris@40
|
1065 cmd : SFC_UPDATE_HEADER_NOW
|
Chris@40
|
1066 data : Not used (should be NULL)
|
Chris@40
|
1067 datasize : Not used.
|
Chris@40
|
1068 </PRE>
|
Chris@40
|
1069 <P>
|
Chris@40
|
1070 Example:
|
Chris@40
|
1071 </P>
|
Chris@40
|
1072 <PRE>
|
Chris@40
|
1073 /* Update the header now. */
|
Chris@40
|
1074 sf_command (sndfile, SFC_UPDATE_HEADER_NOW, NULL, 0) ;
|
Chris@40
|
1075 </PRE>
|
Chris@40
|
1076 <DL>
|
Chris@40
|
1077 <DT>Return value:</DT>
|
Chris@40
|
1078 <DD>0
|
Chris@40
|
1079 </DL>
|
Chris@40
|
1080
|
Chris@40
|
1081 <!-- ========================================================================= -->
|
Chris@40
|
1082 <A NAME="SFC_SET_UPDATE_HEADER_AUTO"></A>
|
Chris@40
|
1083 <H2><BR><B>SFC_SET_UPDATE_HEADER_AUTO</B></H2>
|
Chris@40
|
1084 <P>
|
Chris@40
|
1085 Similar to SFC_UPDATE_HEADER_NOW but updates the header at the end of every call
|
Chris@40
|
1086 to the <B>sf_write*</B> functions.
|
Chris@40
|
1087 </P>
|
Chris@40
|
1088 <P>
|
Chris@40
|
1089 Parameters:
|
Chris@40
|
1090 <PRE>
|
Chris@40
|
1091 sndfile : A valid SNDFILE* pointer
|
Chris@40
|
1092 cmd : SFC_UPDATE_HEADER_NOW
|
Chris@40
|
1093 data : Not used (should be NULL)
|
Chris@40
|
1094 datasize : SF_TRUE or SF_FALSE
|
Chris@40
|
1095 </PRE>
|
Chris@40
|
1096 <P>
|
Chris@40
|
1097 Example:
|
Chris@40
|
1098 </P>
|
Chris@40
|
1099 <PRE>
|
Chris@40
|
1100 /* Turn on auto header update. */
|
Chris@40
|
1101 sf_command (sndfile, SFC_SET_UPDATE_HEADER_AUTO, NULL, SF_TRUE) ;
|
Chris@40
|
1102
|
Chris@40
|
1103 /* Turn off auto header update. */
|
Chris@40
|
1104 sf_command (sndfile, SFC_SET_UPDATE_HEADER_AUTO, NULL, SF_FALSE) ;
|
Chris@40
|
1105 </PRE>
|
Chris@40
|
1106 <DL>
|
Chris@40
|
1107 <DT>Return value:</DT>
|
Chris@40
|
1108 <DD>TRUE if auto update header is now on; FALSE otherwise.
|
Chris@40
|
1109 </DL>
|
Chris@40
|
1110
|
Chris@40
|
1111 <!-- ========================================================================= -->
|
Chris@40
|
1112 <A NAME="SFC_FILE_TRUNCATE"></A>
|
Chris@40
|
1113 <H2><BR><B>SFC_FILE_TRUNCATE</B></H2>
|
Chris@40
|
1114 <P>
|
Chris@40
|
1115 Truncate a file that was opened for write or read/write.
|
Chris@40
|
1116 </P>
|
Chris@40
|
1117 <P>
|
Chris@40
|
1118 Parameters:
|
Chris@40
|
1119 <PRE>
|
Chris@40
|
1120 sndfile : A valid SNDFILE* pointer
|
Chris@40
|
1121 cmd : SFC_FILE_TRUNCATE
|
Chris@40
|
1122 data : A pointer to an sf_count_t.
|
Chris@40
|
1123 datasize : sizeof (sf_count_t)
|
Chris@40
|
1124 </PRE>
|
Chris@40
|
1125
|
Chris@40
|
1126 <P>
|
Chris@40
|
1127 Truncate the file to the number of frames specified by the sf_count_t pointed
|
Chris@40
|
1128 to by data.
|
Chris@40
|
1129 After this command, both the read and the write pointer will be
|
Chris@40
|
1130 at the new end of the file.
|
Chris@40
|
1131 This command will fail (returning non-zero) if the requested truncate position
|
Chris@40
|
1132 is beyond the end of the file.
|
Chris@40
|
1133 </P>
|
Chris@40
|
1134 <P>
|
Chris@40
|
1135 Example:
|
Chris@40
|
1136 </P>
|
Chris@40
|
1137 <PRE>
|
Chris@40
|
1138 /* Truncate the file to a length of 20 frames. */
|
Chris@40
|
1139 sf_count_t frames = 20 ;
|
Chris@40
|
1140 sf_command (sndfile, SFC_FILE_TRUNCATE, &frames, sizeof (frames)) ;
|
Chris@40
|
1141 </PRE>
|
Chris@40
|
1142 <DL>
|
Chris@40
|
1143 <DT>Return value:</DT>
|
Chris@40
|
1144 <DD>Zero on sucess, non-zero otherwise.
|
Chris@40
|
1145 </DL>
|
Chris@40
|
1146
|
Chris@40
|
1147 <!-- ========================================================================= -->
|
Chris@40
|
1148 <A NAME="SFC_SET_RAW_START_OFFSET"></A>
|
Chris@40
|
1149 <H2><BR><B>SFC_SET_RAW_START_OFFSET</B></H2>
|
Chris@40
|
1150 <P>
|
Chris@40
|
1151 Change the data start offset for files opened up as SF_FORMAT_RAW.
|
Chris@40
|
1152 </P>
|
Chris@40
|
1153 <P>
|
Chris@40
|
1154 Parameters:
|
Chris@40
|
1155 <PRE>
|
Chris@40
|
1156 sndfile : A valid SNDFILE* pointer
|
Chris@40
|
1157 cmd : SFC_SET_RAW_START_OFFSET
|
Chris@40
|
1158 data : A pointer to an sf_count_t.
|
Chris@40
|
1159 datasize : sizeof (sf_count_t)
|
Chris@40
|
1160 </PRE>
|
Chris@40
|
1161
|
Chris@40
|
1162 <P>
|
Chris@40
|
1163 For a file opened as format SF_FORMAT_RAW, set the data offset to the value
|
Chris@40
|
1164 given by data.
|
Chris@40
|
1165 </P>
|
Chris@40
|
1166 <P>
|
Chris@40
|
1167 Example:
|
Chris@40
|
1168 </P>
|
Chris@40
|
1169 <PRE>
|
Chris@40
|
1170 /* Reset the data offset to 5 bytes from the start of the file. */
|
Chris@40
|
1171 sf_count_t offset = 5 ;
|
Chris@40
|
1172 sf_command (sndfile, SFC_SET_RAW_START_OFFSET, &offset, sizeof (offset)) ;
|
Chris@40
|
1173 </PRE>
|
Chris@40
|
1174 <DL>
|
Chris@40
|
1175 <DT>Return value:</DT>
|
Chris@40
|
1176 <DD>Zero on success, non-zero otherwise.
|
Chris@40
|
1177 </DL>
|
Chris@40
|
1178
|
Chris@40
|
1179 <!-- ========================================================================= -->
|
Chris@40
|
1180 <A NAME="SFC_SET_CLIPPING"></A>
|
Chris@40
|
1181 <H2><BR><B>SFC_SET_CLIPPING</B></H2>
|
Chris@40
|
1182 <P>
|
Chris@40
|
1183 Turn on/off automatic clipping when doing floating point to integer conversion.
|
Chris@40
|
1184 </P>
|
Chris@40
|
1185 <P>
|
Chris@40
|
1186 Parameters:
|
Chris@40
|
1187 <PRE>
|
Chris@40
|
1188 sndfile : A valid SNDFILE* pointer
|
Chris@40
|
1189 cmd : SFC_SET_CLIPPING
|
Chris@40
|
1190 data : NULL
|
Chris@40
|
1191 datasize : SF_TRUE or SF_FALSE.
|
Chris@40
|
1192 </PRE>
|
Chris@40
|
1193
|
Chris@40
|
1194 <P>
|
Chris@40
|
1195 Turn on (datasize == SF_TRUE) or off (datasize == SF_FALSE) clipping.
|
Chris@40
|
1196 </P>
|
Chris@40
|
1197 <P>
|
Chris@40
|
1198 Example:
|
Chris@40
|
1199 </P>
|
Chris@40
|
1200 <PRE>
|
Chris@40
|
1201 sf_command (sndfile, SFC_SET_CLIPPING, NULL, SF_TRUE) ;
|
Chris@40
|
1202 </PRE>
|
Chris@40
|
1203 <DL>
|
Chris@40
|
1204 <DT>Return value:</DT>
|
Chris@40
|
1205 <DD>Clipping mode (SF_TRUE or SF_FALSE).
|
Chris@40
|
1206 </DL>
|
Chris@40
|
1207
|
Chris@40
|
1208
|
Chris@40
|
1209 <!-- ========================================================================= -->
|
Chris@40
|
1210 <A NAME="SFC_GET_CLIPPING"></A>
|
Chris@40
|
1211 <H2><BR><B>SFC_GET_CLIPPING</B></H2>
|
Chris@40
|
1212 <P>
|
Chris@40
|
1213 Turn on/off automatic clipping when doing floating point to integer conversion.
|
Chris@40
|
1214 </P>
|
Chris@40
|
1215 <P>
|
Chris@40
|
1216 Parameters:
|
Chris@40
|
1217 <PRE>
|
Chris@40
|
1218 sndfile : A valid SNDFILE* pointer
|
Chris@40
|
1219 cmd : SFC_GET_CLIPPING
|
Chris@40
|
1220 data : NULL
|
Chris@40
|
1221 datasize : 0
|
Chris@40
|
1222 </PRE>
|
Chris@40
|
1223
|
Chris@40
|
1224 <P>
|
Chris@40
|
1225 Retrieve the current cliiping setting.
|
Chris@40
|
1226 </P>
|
Chris@40
|
1227 <P>
|
Chris@40
|
1228 Example:
|
Chris@40
|
1229 </P>
|
Chris@40
|
1230 <PRE>
|
Chris@40
|
1231 sf_command (sndfile, SFC_GET_CLIPPING, NULL, 0) ;
|
Chris@40
|
1232 </PRE>
|
Chris@40
|
1233 <DL>
|
Chris@40
|
1234 <DT>Return value:</DT>
|
Chris@40
|
1235 <DD>Clipping mode (SF_TRUE or SF_FALSE).
|
Chris@40
|
1236 </DL>
|
Chris@40
|
1237
|
Chris@40
|
1238 <!-- ========================================================================= -->
|
Chris@40
|
1239 <A NAME="SFC_GET_EMBED_FILE_INFO"></A>
|
Chris@40
|
1240 <H2><BR><B>SFC_GET_EMBED_FILE_INFO</B></H2>
|
Chris@40
|
1241 <P>
|
Chris@40
|
1242 Get the file offset and file length of a file enbedded within another
|
Chris@40
|
1243 larger file.
|
Chris@40
|
1244 </P>
|
Chris@40
|
1245 <P>
|
Chris@40
|
1246 Parameters:
|
Chris@40
|
1247 <PRE>
|
Chris@40
|
1248 sndfile : A valid SNDFILE* pointer
|
Chris@40
|
1249 cmd : SFC_GET_CLIPPING
|
Chris@40
|
1250 data : a pointer to an SF_EMBED_FILE_INFO struct
|
Chris@40
|
1251 datasize : sizeof (SF_EMBED_FILE_INFO)
|
Chris@40
|
1252 </PRE>
|
Chris@40
|
1253 <P>
|
Chris@40
|
1254 The SF_EMBED_FILE_INFO struct is defined in <sndfile.h> as:
|
Chris@40
|
1255 </P>
|
Chris@40
|
1256 <PRE>
|
Chris@40
|
1257 typedef struct
|
Chris@40
|
1258 { sf_count_t offset ;
|
Chris@40
|
1259 sf_count_t length ;
|
Chris@40
|
1260 } SF_EMBED_FILE_INFO ;
|
Chris@40
|
1261 </PRE>
|
Chris@40
|
1262 <DL>
|
Chris@40
|
1263 <DT>Return value: </DT>
|
Chris@40
|
1264 <DD>0 on success and non-zero otherwise.
|
Chris@40
|
1265 <DD>The value of the offset field of the SF_EMBED_FILE_INFO struct will be
|
Chris@40
|
1266 the offsets in bytes from the start of the outer file to the start of
|
Chris@40
|
1267 the audio file.
|
Chris@40
|
1268 <DD>The value of the offset field of the SF_EMBED_FILE_INFO struct will be
|
Chris@40
|
1269 the length in bytes of the embedded file.
|
Chris@40
|
1270 </DL>
|
Chris@40
|
1271
|
Chris@40
|
1272
|
Chris@40
|
1273
|
Chris@40
|
1274 <!-- ========================================================================= -->
|
Chris@40
|
1275 <A NAME="SFC_WAVEX_GET_AMBISONIC"></A>
|
Chris@40
|
1276 <H2><BR><B>SFC_WAVEX_GET_AMBISONIC</B></H2>
|
Chris@40
|
1277 <P>
|
Chris@40
|
1278 Test if the current file has the GUID of a WAVEX file for any of the Ambisonic
|
Chris@40
|
1279 formats.
|
Chris@40
|
1280 </P>
|
Chris@40
|
1281 <P>
|
Chris@40
|
1282 Parameters:
|
Chris@40
|
1283 <PRE>
|
Chris@40
|
1284 sndfile : A valid SNDFILE* pointer
|
Chris@40
|
1285 cmd : SFC_WAVEX_GET_AMBISONIC
|
Chris@40
|
1286 data : NULL
|
Chris@40
|
1287 datasize : 0
|
Chris@40
|
1288 </PRE>
|
Chris@40
|
1289 <P>
|
Chris@40
|
1290 The Ambisonic WAVEX formats are defined here :
|
Chris@40
|
1291 <A HREF="http://dream.cs.bath.ac.uk/researchdev/wave-ex/bformat.html">
|
Chris@40
|
1292 http://dream.cs.bath.ac.uk/researchdev/wave-ex/bformat.html</A>.
|
Chris@40
|
1293 </P>
|
Chris@40
|
1294 <DL>
|
Chris@40
|
1295 <DT>Return value: </DT>
|
Chris@40
|
1296 <DD>SF_AMBISONIC_NONE or SF_AMBISONIC_B_FORMAT or zero if the file format
|
Chris@40
|
1297 does not support ambisonic formats.
|
Chris@40
|
1298 </DL>
|
Chris@40
|
1299
|
Chris@40
|
1300 <!-- ========================================================================= -->
|
Chris@40
|
1301 <A NAME="SFC_WAVEX_SET_AMBISONIC"></A>
|
Chris@40
|
1302 <H2><BR><B>SFC_WAVEX_SET_AMBISONIC</B></H2>
|
Chris@40
|
1303 <P>
|
Chris@40
|
1304 Set the GUID of a new WAVEX file to indicate an Ambisonics format.
|
Chris@40
|
1305 </P>
|
Chris@40
|
1306 <P>
|
Chris@40
|
1307 Parameters:
|
Chris@40
|
1308 <PRE>
|
Chris@40
|
1309 sndfile : A valid SNDFILE* pointer
|
Chris@40
|
1310 cmd : SFC_WAVEX_SET_AMBISONIC
|
Chris@40
|
1311 data : NULL
|
Chris@40
|
1312 datasize : SF_AMBISONIC_NONE or SF_AMBISONIC_B_FORMAT
|
Chris@40
|
1313 </PRE>
|
Chris@40
|
1314 <P>
|
Chris@40
|
1315 Turn on (SF_AMBISONIC_B_FORMAT) or off (SF_AMBISONIC_NONE) encoding.
|
Chris@40
|
1316 This command is currently only supported for files with SF_FORMAT_WAVEX format.
|
Chris@40
|
1317 </P>
|
Chris@40
|
1318 <P>
|
Chris@40
|
1319 The Ambisonic WAVEX formats are defined here :
|
Chris@40
|
1320 <A HREF="http://dream.cs.bath.ac.uk/researchdev/wave-ex/bformat.html">
|
Chris@40
|
1321 http://dream.cs.bath.ac.uk/researchdev/wave-ex/bformat.html</A>.
|
Chris@40
|
1322 </P>
|
Chris@40
|
1323 <DL>
|
Chris@40
|
1324 <DT>Return value: </DT>
|
Chris@40
|
1325 <DD>Return the ambisonic value that has just been set or zero if the file
|
Chris@40
|
1326 format does not support ambisonic encoding.
|
Chris@40
|
1327 </DL>
|
Chris@40
|
1328
|
Chris@40
|
1329 <!-- ========================================================================= -->
|
Chris@40
|
1330 <A NAME="SFC_SET_VBR_ENCODING_QUALITY"></A>
|
Chris@40
|
1331 <H2><BR><B>SFC_SET_VBR_ENCODING_QUALITY</B></H2>
|
Chris@40
|
1332 <P>
|
Chris@40
|
1333 Set the Variable Bit Rate encoding quality.
|
Chris@40
|
1334 The encoding quality value should be between 0.0 (lowest quality) and 1.0
|
Chris@40
|
1335 (highest quality).
|
Chris@40
|
1336 Currenly this command is only implemented for FLAC and Ogg/Vorbis files.
|
Chris@40
|
1337 It has no effect on un-compressed file formats.
|
Chris@40
|
1338 </P>
|
Chris@40
|
1339 <P>
|
Chris@40
|
1340 Parameters:
|
Chris@40
|
1341 <PRE>
|
Chris@40
|
1342 sndfile : A valid SNDFILE* pointer
|
Chris@40
|
1343 cmd : SFC_SET_VBR_ENCODING_QUALITY
|
Chris@40
|
1344 data : A pointer to a double value
|
Chris@40
|
1345 datasize : sizeof (double)
|
Chris@40
|
1346 </PRE>
|
Chris@40
|
1347 <P>
|
Chris@40
|
1348 The command must be sent before any audio data is written to the file.
|
Chris@40
|
1349 </P>
|
Chris@40
|
1350 <P>
|
Chris@40
|
1351 </P>
|
Chris@40
|
1352 <DL>
|
Chris@40
|
1353 <DT>Return value:</DT>
|
Chris@40
|
1354 <dd>SF_TRUE if VBR encoding quality was set.
|
Chris@40
|
1355 SF_FALSE otherwise.
|
Chris@40
|
1356 </DL>
|
Chris@40
|
1357
|
Chris@40
|
1358 <!-- ========================================================================= -->
|
Chris@40
|
1359 <A NAME="SFC_SET_COMPRESSION_LEVEL"></A>
|
Chris@40
|
1360 <H2><BR><B>SFC_SET_COMPRESSION_LEVEL</B></H2>
|
Chris@40
|
1361 <P>
|
Chris@40
|
1362 Set the compression level.
|
Chris@40
|
1363 The compression level should be between 0.0 (minimum compression level) and 1.0
|
Chris@40
|
1364 (highest compression level).
|
Chris@40
|
1365 Currenly this command is only implemented for FLAC and Ogg/Vorbis files.
|
Chris@40
|
1366 It has no effect on un-compressed file formats.
|
Chris@40
|
1367 </P>
|
Chris@40
|
1368 <P>
|
Chris@40
|
1369 Parameters:
|
Chris@40
|
1370 <PRE>
|
Chris@40
|
1371 sndfile : A valid SNDFILE* pointer
|
Chris@40
|
1372 cmd : SFC_SET_COMPRESSION_LEVEL
|
Chris@40
|
1373 data : A pointer to a double value
|
Chris@40
|
1374 datasize : sizeof (double)
|
Chris@40
|
1375 </PRE>
|
Chris@40
|
1376 <P>
|
Chris@40
|
1377 The command must be sent before any audio data is written to the file.
|
Chris@40
|
1378 </P>
|
Chris@40
|
1379 <P>
|
Chris@40
|
1380 </P>
|
Chris@40
|
1381 <DL>
|
Chris@40
|
1382 <DT>Return value:</DT>
|
Chris@40
|
1383 <dd>SF_TRUE if compression level was set.
|
Chris@40
|
1384 SF_FALSE otherwise.
|
Chris@40
|
1385 </DL>
|
Chris@40
|
1386
|
Chris@40
|
1387 <!-- ========================================================================= -->
|
Chris@40
|
1388 <A NAME="SFC_RAW_NEEDS_ENDSWAP"></A>
|
Chris@40
|
1389 <H2><BR><B>SFC_RAW_NEEDS_ENDSWAP</B></H2>
|
Chris@40
|
1390 <P>
|
Chris@40
|
1391 Determine if raw data read using
|
Chris@40
|
1392 <a href="api.html#raw">
|
Chris@40
|
1393 sf_read_raw</a>
|
Chris@40
|
1394 needs to be end swapped on the host CPU.
|
Chris@40
|
1395 </P>
|
Chris@40
|
1396 <P>
|
Chris@40
|
1397 For instance, will return SF_TRUE on when reading WAV containing
|
Chris@40
|
1398 SF_FORMAT_PCM_16 data on a big endian machine and SF_FALSE on a little endian
|
Chris@40
|
1399 machine.
|
Chris@40
|
1400 </P>
|
Chris@40
|
1401 <P>
|
Chris@40
|
1402 Parameters:
|
Chris@40
|
1403 <PRE>
|
Chris@40
|
1404 sndfile : A valid SNDFILE* pointer
|
Chris@40
|
1405 cmd : SFC_RAW_NEEDS_ENDSWAP
|
Chris@40
|
1406 data : NULL
|
Chris@40
|
1407 datasize : 0
|
Chris@40
|
1408 </PRE>
|
Chris@40
|
1409
|
Chris@40
|
1410 <DL>
|
Chris@40
|
1411 <DT>Return value: </DT>
|
Chris@40
|
1412 <DD>SF_TRUE or SF_FALSE
|
Chris@40
|
1413 </DL>
|
Chris@40
|
1414
|
Chris@40
|
1415
|
Chris@40
|
1416 <!-- ========================================================================= -->
|
Chris@40
|
1417 <A NAME="SFC_GET_BROADCAST_INFO"></A>
|
Chris@40
|
1418 <H2><BR><B>SFC_GET_BROADCAST_INFO</B></H2>
|
Chris@40
|
1419 <P>
|
Chris@40
|
1420 Retrieve the Broadcast Extension Chunk from WAV (and related) files.
|
Chris@40
|
1421 </P>
|
Chris@40
|
1422 <p>
|
Chris@40
|
1423 Parameters:
|
Chris@40
|
1424 </p>
|
Chris@40
|
1425 <PRE>
|
Chris@40
|
1426 sndfile : A valid SNDFILE* pointer
|
Chris@40
|
1427 cmd : SFC_GET_BROADCAST_INFO
|
Chris@40
|
1428 data : a pointer to an SF_BROADCAST_INFO struct
|
Chris@40
|
1429 datasize : sizeof (SF_BROADCAST_INFO)
|
Chris@40
|
1430 </PRE>
|
Chris@40
|
1431 <P>
|
Chris@40
|
1432 The SF_BROADCAST_INFO struct is defined in <sndfile.h> as:
|
Chris@40
|
1433 </P>
|
Chris@40
|
1434 <PRE>
|
Chris@40
|
1435 typedef struct
|
Chris@40
|
1436 { char description [256] ;
|
Chris@40
|
1437 char originator [32] ;
|
Chris@40
|
1438 char originator_reference [32] ;
|
Chris@40
|
1439 char origination_date [10] ;
|
Chris@40
|
1440 char origination_time [8] ;
|
Chris@40
|
1441 unsigned int time_reference_low ;
|
Chris@40
|
1442 unsigned int time_reference_high ;
|
Chris@40
|
1443 short version ;
|
Chris@40
|
1444 char umid [64] ;
|
Chris@40
|
1445 char reserved [190] ;
|
Chris@40
|
1446 unsigned int coding_history_size ;
|
Chris@40
|
1447 char coding_history [256] ;
|
Chris@40
|
1448 } SF_BROADCAST_INFO ;
|
Chris@40
|
1449 </PRE>
|
Chris@40
|
1450
|
Chris@40
|
1451 <DL>
|
Chris@40
|
1452 <DT>Return value: </DT>
|
Chris@40
|
1453 <DD>SF_TRUE if the file contained a Broadcast Extension chunk or SF_FALSE
|
Chris@40
|
1454 otherwise.
|
Chris@40
|
1455 </DL>
|
Chris@40
|
1456
|
Chris@40
|
1457 <!-- ========================================================================= -->
|
Chris@40
|
1458 <A NAME="SFC_SET_BROADCAST_INFO"></A>
|
Chris@40
|
1459 <H2><BR><B>SFC_SET_BROADCAST_INFO</B></H2>
|
Chris@40
|
1460 <P>
|
Chris@40
|
1461 Set the Broadcast Extension Chunk for WAV (and related) files.
|
Chris@40
|
1462 </P>
|
Chris@40
|
1463 <p>
|
Chris@40
|
1464 Parameters:
|
Chris@40
|
1465 </p>
|
Chris@40
|
1466 <PRE>
|
Chris@40
|
1467 sndfile : A valid SNDFILE* pointer
|
Chris@40
|
1468 cmd : SFC_SET_BROADCAST_INFO
|
Chris@40
|
1469 data : a pointer to an SF_BROADCAST_INFO struct
|
Chris@40
|
1470 datasize : sizeof (SF_BROADCAST_INFO)
|
Chris@40
|
1471 </PRE>
|
Chris@40
|
1472
|
Chris@40
|
1473 <DL>
|
Chris@40
|
1474 <DT>Return value: </DT>
|
Chris@40
|
1475 <DD>SF_TRUE if setting the Broadcast Extension chunk was successful and SF_FALSE
|
Chris@40
|
1476 otherwise.
|
Chris@40
|
1477
|
Chris@40
|
1478 </DL>
|
Chris@40
|
1479
|
Chris@40
|
1480 <!-- ========================================================================= -->
|
Chris@40
|
1481 <A NAME="SFC_GET_CART_INFO"></A>
|
Chris@40
|
1482 <H2><BR><B>SFC_GET_CART_INFO</B></H2>
|
Chris@40
|
1483 <P>Retrieve the Cart Chunk from WAV (and related) files. Based on AES46 standard for CartChunk (see <a href="http://www.cartchunk.org/">CartChunk.org</a> for more information.
|
Chris@40
|
1484 </P>
|
Chris@40
|
1485 <p>
|
Chris@40
|
1486 Parameters:
|
Chris@40
|
1487 </p>
|
Chris@40
|
1488 <PRE>
|
Chris@40
|
1489 sndfile : A valid SNDFILE* pointer
|
Chris@40
|
1490 cmd : SFC_GET_CART_INFO
|
Chris@40
|
1491 data : a pointer to an SF_CART_INFO struct
|
Chris@40
|
1492 datasize : sizeof (SF_CART_INFO)
|
Chris@40
|
1493 </PRE>
|
Chris@40
|
1494 <P>
|
Chris@40
|
1495 The SF_CART_INFO struct is defined in <sndfile.h> as:
|
Chris@40
|
1496 </P>
|
Chris@40
|
1497 <PRE>
|
Chris@40
|
1498 #define SF_CART_INFO_VAR(p_tag_text_size) \
|
Chris@40
|
1499 struct
|
Chris@40
|
1500 { char version [4] ;
|
Chris@40
|
1501 char title [64] ;
|
Chris@40
|
1502 char artist [64] ;
|
Chris@40
|
1503 char cut_id [64] ;
|
Chris@40
|
1504 char client_id [64] ;
|
Chris@40
|
1505 char category [64] ;
|
Chris@40
|
1506 char classification [64] ;
|
Chris@40
|
1507 char out_cue [64] ;
|
Chris@40
|
1508 char start_date [10] ;
|
Chris@40
|
1509 char start_time [8] ;
|
Chris@40
|
1510 char end_date [10] ;
|
Chris@40
|
1511 char end_time [8] ;
|
Chris@40
|
1512 char producer_app_id [64] ;
|
Chris@40
|
1513 char producer_app_version [64] ;
|
Chris@40
|
1514 char user_def [64] ;
|
Chris@40
|
1515 long level_reference ;
|
Chris@40
|
1516 SF_CART_TIMER post_timers [8] ;
|
Chris@40
|
1517 char reserved [276] ;
|
Chris@40
|
1518 char url [1024] ;
|
Chris@40
|
1519 unsigned int tag_text_size ;
|
Chris@40
|
1520 char tag_text[p_tag_text_size] ;
|
Chris@40
|
1521 }
|
Chris@40
|
1522 </PRE>
|
Chris@40
|
1523
|
Chris@40
|
1524 <DL>
|
Chris@40
|
1525 <DT>Return value: </DT>
|
Chris@40
|
1526 <DD>SF_TRUE if the file contained a Cart chunk or SF_FALSE
|
Chris@40
|
1527 otherwise.
|
Chris@40
|
1528 </DL>
|
Chris@40
|
1529
|
Chris@40
|
1530 <!-- ========================================================================= -->
|
Chris@40
|
1531 <A NAME="SFC_SET_CART_INFO"></A>
|
Chris@40
|
1532 <H2><BR><B>SFC_SET_CART_INFO</B></H2>
|
Chris@40
|
1533 <P>
|
Chris@40
|
1534 Set the Cart Chunk for WAV (and related) files.
|
Chris@40
|
1535 </P>
|
Chris@40
|
1536 <p>
|
Chris@40
|
1537 Parameters:
|
Chris@40
|
1538 </p>
|
Chris@40
|
1539 <PRE>
|
Chris@40
|
1540 sndfile : A valid SNDFILE* pointer
|
Chris@40
|
1541 cmd : SFC_SET_CART_INFO
|
Chris@40
|
1542 data : a pointer to an SF_CART_INFO struct
|
Chris@40
|
1543 datasize : sizeof (SF_CART_INFO)
|
Chris@40
|
1544 </PRE>
|
Chris@40
|
1545
|
Chris@40
|
1546 <DL>
|
Chris@40
|
1547 <DT>Return value: </DT>
|
Chris@40
|
1548 <DD>SF_TRUE if setting the Cart chunk was successful and SF_FALSE
|
Chris@40
|
1549 otherwise.
|
Chris@40
|
1550 </DL>
|
Chris@40
|
1551 <!-- ========================================================================= -->
|
Chris@40
|
1552
|
Chris@40
|
1553 <A NAME="SFC_GET_LOOP_INFO"></A>
|
Chris@40
|
1554 <H2><BR><B>SFC_GET_LOOP_INFO</B></H2>
|
Chris@40
|
1555 <P>
|
Chris@40
|
1556 Retrieve loop information for file including time signature, length in
|
Chris@40
|
1557 beats and original MIDI base note
|
Chris@40
|
1558 </P>
|
Chris@40
|
1559 <p>
|
Chris@40
|
1560 Parameters:
|
Chris@40
|
1561 </p>
|
Chris@40
|
1562 <PRE>
|
Chris@40
|
1563 sndfile : A valid SNDFILE* pointer
|
Chris@40
|
1564 cmd : SFC_GET_LOOP_INFO
|
Chris@40
|
1565 data : a pointer to an SF_LOOP_INFO struct
|
Chris@40
|
1566 datasize : sizeof (SF_LOOP_INFO)
|
Chris@40
|
1567 </PRE>
|
Chris@40
|
1568 <P>
|
Chris@40
|
1569 The SF_BROADCAST_INFO struct is defined in <sndfile.h> as:
|
Chris@40
|
1570 </P>
|
Chris@40
|
1571 <PRE>
|
Chris@40
|
1572 typedef struct
|
Chris@40
|
1573 { short time_sig_num ; /* any positive integer > 0 */
|
Chris@40
|
1574 short time_sig_den ; /* any positive power of 2 > 0 */
|
Chris@40
|
1575 int loop_mode ; /* see SF_LOOP enum */
|
Chris@40
|
1576
|
Chris@40
|
1577 int num_beats ; /* this is NOT the amount of quarter notes !!!*/
|
Chris@40
|
1578 /* a full bar of 4/4 is 4 beats */
|
Chris@40
|
1579 /* a full bar of 7/8 is 7 beats */
|
Chris@40
|
1580
|
Chris@40
|
1581 float bpm ; /* suggestion, as it can be calculated using other fields:*/
|
Chris@40
|
1582 /* file's lenght, file's sampleRate and our time_sig_den*/
|
Chris@40
|
1583 /* -> bpms are always the amount of _quarter notes_ per minute */
|
Chris@40
|
1584
|
Chris@40
|
1585 int root_key ; /* MIDI note, or -1 for None */
|
Chris@40
|
1586 int future [6] ;
|
Chris@40
|
1587 } SF_LOOP_INFO ;
|
Chris@40
|
1588 </PRE>
|
Chris@40
|
1589 <P>
|
Chris@40
|
1590 Example:
|
Chris@40
|
1591 </P>
|
Chris@40
|
1592 <PRE>
|
Chris@40
|
1593 SF_LOOP_INFO loop;
|
Chris@40
|
1594 sf_command (sndfile, SFC_GET_LOOP_INFO, &loop, sizeof (loop)) ;
|
Chris@40
|
1595 </PRE>
|
Chris@40
|
1596 <DL>
|
Chris@40
|
1597 <DT>Return value:</DT>
|
Chris@40
|
1598 <DD>SF_TRUE if the file header contains loop information for the file.
|
Chris@40
|
1599 SF_FALSE otherwise.
|
Chris@40
|
1600 </DL>
|
Chris@40
|
1601
|
Chris@40
|
1602 <!-- ========================================================================= -->
|
Chris@40
|
1603
|
Chris@40
|
1604
|
Chris@40
|
1605 <A NAME="SFC_GET_INSTRUMENT"></A>
|
Chris@40
|
1606 <H2><BR><B>SFC_GET_INSTRUMENT</B></H2>
|
Chris@40
|
1607 <P>
|
Chris@40
|
1608 Retrieve instrument information from file including MIDI base note,
|
Chris@40
|
1609 keyboard mapping and looping informations(start/stop and mode).
|
Chris@40
|
1610 </P>
|
Chris@40
|
1611 <p>
|
Chris@40
|
1612 Parameters:
|
Chris@40
|
1613 </p>
|
Chris@40
|
1614 <PRE>
|
Chris@40
|
1615 sndfile : A valid SNDFILE* pointer
|
Chris@40
|
1616 cmd : SFC_GET_INSTRUMENT
|
Chris@40
|
1617 data : a pointer to an SF_INSTRUMENT struct
|
Chris@40
|
1618 datasize : sizeof (SF_INSTRUMENT)
|
Chris@40
|
1619 </PRE>
|
Chris@40
|
1620
|
Chris@40
|
1621 <P>
|
Chris@40
|
1622 The SF_INSTRUMENT struct is defined in <sndfile.h> as:
|
Chris@40
|
1623 </P>
|
Chris@40
|
1624 <PRE>
|
Chris@40
|
1625 enum
|
Chris@40
|
1626 { /*
|
Chris@40
|
1627 ** The loop mode field in SF_INSTRUMENT will be one of the following.
|
Chris@40
|
1628 */
|
Chris@40
|
1629 SF_LOOP_NONE = 800,
|
Chris@40
|
1630 SF_LOOP_FORWARD,
|
Chris@40
|
1631 SF_LOOP_BACKWARD,
|
Chris@40
|
1632 SF_LOOP_ALTERNATING
|
Chris@40
|
1633 } ;
|
Chris@40
|
1634
|
Chris@40
|
1635 typedef struct
|
Chris@40
|
1636 { int gain ;
|
Chris@40
|
1637 char basenote, detune ;
|
Chris@40
|
1638 char velocity_lo, velocity_hi ;
|
Chris@40
|
1639 char key_lo, key_hi ;
|
Chris@40
|
1640 int loop_count ;
|
Chris@40
|
1641
|
Chris@40
|
1642 struct
|
Chris@40
|
1643 { int mode ;
|
Chris@40
|
1644 unsigned int start ;
|
Chris@40
|
1645 unsigned int end ;
|
Chris@40
|
1646 unsigned int count ;
|
Chris@40
|
1647 } loops [16] ; /* make variable in a sensible way */
|
Chris@40
|
1648 } SF_INSTRUMENT ;
|
Chris@40
|
1649 </PRE>
|
Chris@40
|
1650
|
Chris@40
|
1651 <P>
|
Chris@40
|
1652 Example:
|
Chris@40
|
1653 </P>
|
Chris@40
|
1654 <PRE>
|
Chris@40
|
1655 SF_INSTRUMENT inst ;
|
Chris@40
|
1656 sf_command (sndfile, SFC_GET_INSTRUMENT, &inst, sizeof (inst)) ;
|
Chris@40
|
1657 </PRE>
|
Chris@40
|
1658 <DL>
|
Chris@40
|
1659 <DT>Return value:</DT>
|
Chris@40
|
1660 <dd>SF_TRUE if the file header contains instrument information for the
|
Chris@40
|
1661 file. SF_FALSE otherwise.
|
Chris@40
|
1662 </DL>
|
Chris@40
|
1663
|
Chris@40
|
1664 <!-- ========================================================================= -->
|
Chris@40
|
1665
|
Chris@40
|
1666
|
Chris@40
|
1667 <A NAME="SFC_SET_INSTRUMENT"></A>
|
Chris@40
|
1668 <H2><BR><B>SFC_SET_INSTRUMENT</B></H2>
|
Chris@40
|
1669 <P>
|
Chris@40
|
1670 Set the instrument information for the file.
|
Chris@40
|
1671 </P>
|
Chris@40
|
1672 <p>
|
Chris@40
|
1673 Parameters:
|
Chris@40
|
1674 </p>
|
Chris@40
|
1675 <PRE>
|
Chris@40
|
1676 sndfile : A valid SNDFILE* pointer
|
Chris@40
|
1677 cmd : SFC_SET_INSTRUMENT
|
Chris@40
|
1678 data : a pointer to an SF_INSTRUMENT struct
|
Chris@40
|
1679 datasize : sizeof (SF_INSTRUMENT)
|
Chris@40
|
1680 </PRE>
|
Chris@40
|
1681 <P>
|
Chris@40
|
1682 Example:
|
Chris@40
|
1683 </P>
|
Chris@40
|
1684 <PRE>
|
Chris@40
|
1685 SF_INSTRUMENT inst ;
|
Chris@40
|
1686 sf_command (sndfile, SFC_SET_INSTRUMENT, &inst, sizeof (inst)) ;
|
Chris@40
|
1687 </PRE>
|
Chris@40
|
1688 <DL>
|
Chris@40
|
1689 <DT>Return value:</DT>
|
Chris@40
|
1690 <dd>SF_TRUE if the file header contains instrument information for the
|
Chris@40
|
1691 file. SF_FALSE otherwise.
|
Chris@40
|
1692 </DL>
|
Chris@40
|
1693
|
Chris@40
|
1694
|
Chris@40
|
1695 <!-- ========================================================================= -->
|
Chris@40
|
1696
|
Chris@40
|
1697 <A NAME="SFC_GET_CUE"></A>
|
Chris@40
|
1698 <H2><BR><B>SFC_GET_CUE_COUNT</B></H2>
|
Chris@40
|
1699 <P>
|
Chris@40
|
1700 Retrieve the number of cue markers available for retrieval using the
|
Chris@40
|
1701 SFC_GET_CUE command.
|
Chris@40
|
1702 </P>
|
Chris@40
|
1703 <P>
|
Chris@40
|
1704 Parameters:
|
Chris@40
|
1705 </P>
|
Chris@40
|
1706 <PRE>
|
Chris@40
|
1707 sndfile : A valid SNDFILE* pointer
|
Chris@40
|
1708 cmd : SFC_GET_CUE
|
Chris@40
|
1709 data : a pointer to a uint32_t
|
Chris@40
|
1710 datasize : sizeof (uint32_t)
|
Chris@40
|
1711 </PRE>
|
Chris@40
|
1712
|
Chris@40
|
1713
|
Chris@40
|
1714 <P>
|
Chris@40
|
1715 Example:
|
Chris@40
|
1716 </P>
|
Chris@40
|
1717 <PRE>
|
Chris@40
|
1718 uint32_t cue_count ;
|
Chris@40
|
1719 sf_command (sndfile, SFC_GET_CUE_COUNT, &cue_count, sizeof (cue_count)) ;
|
Chris@40
|
1720 </PRE>
|
Chris@40
|
1721 <DL>
|
Chris@40
|
1722 <DT>Return value:</DT>
|
Chris@40
|
1723 <dd>SF_TRUE if the file header contains cue marker information for the
|
Chris@40
|
1724 file. SF_FALSE otherwise.
|
Chris@40
|
1725 </DL>
|
Chris@40
|
1726
|
Chris@40
|
1727 <!-- ========================================================================= -->
|
Chris@40
|
1728
|
Chris@40
|
1729 <A NAME="SFC_GET_CUE"></A>
|
Chris@40
|
1730 <H2><BR><B>SFC_GET_CUE</B></H2>
|
Chris@40
|
1731 <P>
|
Chris@40
|
1732 Retrieve cue marker information from file.
|
Chris@40
|
1733 </P>
|
Chris@40
|
1734 <P>
|
Chris@40
|
1735 Parameters:
|
Chris@40
|
1736 </P>
|
Chris@40
|
1737 <PRE>
|
Chris@40
|
1738 sndfile : A valid SNDFILE* pointer
|
Chris@40
|
1739 cmd : SFC_GET_CUE
|
Chris@40
|
1740 data : a pointer to an SF_CUES struct
|
Chris@40
|
1741 datasize : sizeof (SF_CUES)
|
Chris@40
|
1742 </PRE>
|
Chris@40
|
1743
|
Chris@40
|
1744 <P>
|
Chris@40
|
1745 The SF_CUES struct is defined in <sndfile.h> as:
|
Chris@40
|
1746 </P>
|
Chris@40
|
1747 <PRE>
|
Chris@40
|
1748 typedef struct
|
Chris@40
|
1749 { int cue_count ;
|
Chris@40
|
1750
|
Chris@40
|
1751 struct
|
Chris@40
|
1752 { int32_t indx ;
|
Chris@40
|
1753 uint32_t position ;
|
Chris@40
|
1754 int32_t fcc_chunk ;
|
Chris@40
|
1755 int32_t chunk_start ;
|
Chris@40
|
1756 int32_t block_start ;
|
Chris@40
|
1757 uint32_t sample_offset ;
|
Chris@40
|
1758 char name [256] ;
|
Chris@40
|
1759 } cue_points [100] ;
|
Chris@40
|
1760 } SF_CUES ;
|
Chris@40
|
1761 </PRE>
|
Chris@40
|
1762
|
Chris@40
|
1763 <P>
|
Chris@40
|
1764 There is also an SF_CUES_VAR #define that allows reading/writing more than 100
|
Chris@40
|
1765 cue markers.
|
Chris@40
|
1766 </P>
|
Chris@40
|
1767
|
Chris@40
|
1768 <P>
|
Chris@40
|
1769 Example:
|
Chris@40
|
1770 </P>
|
Chris@40
|
1771 <PRE>
|
Chris@40
|
1772 SF_CUES cues ;
|
Chris@40
|
1773 sf_command (sndfile, SFC_GET_CUE, &cues, sizeof (cues)) ;
|
Chris@40
|
1774 </PRE>
|
Chris@40
|
1775 <DL>
|
Chris@40
|
1776 <DT>Return value:</DT>
|
Chris@40
|
1777 <dd>SF_TRUE if the file header contains cue marker information for the
|
Chris@40
|
1778 file. SF_FALSE otherwise.
|
Chris@40
|
1779 </DL>
|
Chris@40
|
1780
|
Chris@40
|
1781
|
Chris@40
|
1782 <!-- ========================================================================= -->
|
Chris@40
|
1783
|
Chris@40
|
1784
|
Chris@40
|
1785 <A NAME="SFC_SET_CUE"></A>
|
Chris@40
|
1786 <H2><BR><B>SFC_SET_CUE</B></H2>
|
Chris@40
|
1787 <P>
|
Chris@40
|
1788 Set the cue marker information for the file.
|
Chris@40
|
1789 </P>
|
Chris@40
|
1790 <P>
|
Chris@40
|
1791 Parameters:
|
Chris@40
|
1792 </P>
|
Chris@40
|
1793 <PRE>
|
Chris@40
|
1794 sndfile : A valid SNDFILE* pointer
|
Chris@40
|
1795 cmd : SFC_SET_CUE
|
Chris@40
|
1796 data : a pointer to an SF_CUES struct
|
Chris@40
|
1797 datasize : sizeof (SF_CUES)
|
Chris@40
|
1798 </PRE>
|
Chris@40
|
1799 <P>
|
Chris@40
|
1800 Example:
|
Chris@40
|
1801 </P>
|
Chris@40
|
1802 <PRE>
|
Chris@40
|
1803 SF_CUES cues ;
|
Chris@40
|
1804 sf_command (sndfile, SFC_SET_CUE, &cues, sizeof (cues)) ;
|
Chris@40
|
1805 </PRE>
|
Chris@40
|
1806 <DL>
|
Chris@40
|
1807 <DT>Return value:</DT>
|
Chris@40
|
1808 <dd>SF_TRUE if the file header contains cue marker information for the
|
Chris@40
|
1809 file. SF_FALSE otherwise.
|
Chris@40
|
1810 </DL>
|
Chris@40
|
1811
|
Chris@40
|
1812
|
Chris@40
|
1813 <!-- ========================================================================= -->
|
Chris@40
|
1814
|
Chris@40
|
1815
|
Chris@40
|
1816 <A NAME="SFC_RF64_AUTO_DOWNGRADE"></A>
|
Chris@40
|
1817 <H2><BR><B>SFC_RF64_AUTO_DOWNGRADE</B></H2>
|
Chris@40
|
1818 <P>
|
Chris@40
|
1819 Enable auto downgrade from RF64 to WAV.
|
Chris@40
|
1820 </P>
|
Chris@40
|
1821 <P>
|
Chris@40
|
1822 The EBU recomendation is that when writing RF64 files and the resulting file is
|
Chris@40
|
1823 less than 4Gig in size, it should be downgraded to a WAV file (WAV files have a
|
Chris@40
|
1824 maximum size of 4Gig).
|
Chris@40
|
1825 libsndfile doesn't follow the EBU recommendations exactly, , mainly because the
|
Chris@40
|
1826 test suite needs to be able test reading/writing RF64 files without having to
|
Chris@40
|
1827 generate files larger than 4 gigabytes.
|
Chris@40
|
1828 </P>
|
Chris@40
|
1829 <p>
|
Chris@40
|
1830 Note: This command should be issued before the first bit of audio data has been
|
Chris@40
|
1831 written to the file.
|
Chris@40
|
1832 Calling this command after audio data has been written will return the current
|
Chris@40
|
1833 value of this setting, but will not allow it to be changed.
|
Chris@40
|
1834 </p>
|
Chris@40
|
1835 <p>
|
Chris@40
|
1836 Parameters:
|
Chris@40
|
1837 </p>
|
Chris@40
|
1838 <PRE>
|
Chris@40
|
1839 sndfile : A valid SNDFILE* pointer
|
Chris@40
|
1840 cmd : SFC_RF64_AUTO_DOWNGRADE
|
Chris@40
|
1841 data : NULL
|
Chris@40
|
1842 datasize : SF_TRUE or SF_FALSE
|
Chris@40
|
1843 </PRE>
|
Chris@40
|
1844 <P>
|
Chris@40
|
1845 Example:
|
Chris@40
|
1846 </P>
|
Chris@40
|
1847 <PRE>
|
Chris@40
|
1848 /* Enable auto downgrade on file close. */
|
Chris@40
|
1849 sf_command (sndfile, SFC_RF64_AUTO_DOWNGRADE, NULL, SF_TRUE) ;
|
Chris@40
|
1850 </PRE>
|
Chris@40
|
1851 <DL>
|
Chris@40
|
1852 <DT>Return value:</DT>
|
Chris@40
|
1853 <dd>Returns SF_TRUE if SFC_RF64_AUTO_DOWNGRADE is set and SF_FALSE
|
Chris@40
|
1854 otherwise.
|
Chris@40
|
1855 </DL>
|
Chris@40
|
1856
|
Chris@40
|
1857
|
Chris@40
|
1858
|
Chris@40
|
1859 <!-- ========================================================================= -->
|
Chris@40
|
1860
|
Chris@40
|
1861
|
Chris@40
|
1862 <HR>
|
Chris@40
|
1863 <P>
|
Chris@40
|
1864 The libsndfile home page is here :
|
Chris@40
|
1865 <A HREF="http://www.mega-nerd.com/libsndfile/">
|
Chris@40
|
1866 http://www.mega-nerd.com/libsndfile/</A>.
|
Chris@40
|
1867 <BR>
|
Chris@40
|
1868 Version : 1.0.25
|
Chris@40
|
1869 </P>
|
Chris@40
|
1870
|
Chris@40
|
1871 </BODY>
|
Chris@40
|
1872 </HTML>
|