(Metux) autogen.sh: not running ./configure anymore (breaks certain distro builders)
[mirror-ossqm-audiofile.git] / libaudiofile / units.c
blob3cf635c3f77f775048bfc8bb11aa73512ed9bff4
1 /*
2 Audio File Library
3 Copyright (C) 2000-2001, Silicon Graphics, Inc.
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Library General Public
7 License as published by the Free Software Foundation; either
8 version 2 of the License, or (at your option) any later version.
10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Library General Public License for more details.
15 You should have received a copy of the GNU Library General Public
16 License along with this library; if not, write to the
17 Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307 USA.
22 units.c
24 This file contains the file format units.
27 #ifdef HAVE_CONFIG_H
28 #include <config.h>
29 #endif
31 #include "audiofile.h"
32 #include "afinternal.h"
33 #include "units.h"
35 #include "raw.h"
36 #include "aiff.h"
37 #include "next.h"
38 #include "wave.h"
39 #include "ircam.h"
40 #include "avr.h"
41 #include "iff.h"
42 #include "nist.h"
44 #include "compression.h"
46 #include "modules/pcm.h"
47 #include "modules/g711.h"
48 #include "modules/ima.h"
49 #include "modules/msadpcm.h"
51 extern _InstParamInfo _af_aiff_inst_params[];
52 extern _InstParamInfo _af_wave_inst_params[];
54 extern int _af_raw_compression_types[];
55 extern int _af_aiffc_compression_types[];
56 extern int _af_next_compression_types[];
57 extern int _af_wave_compression_types[];
59 const _Unit _af_units[_AF_NUM_UNITS] =
62 AF_FILE_RAWDATA,
63 "Raw Data", "Raw Sound Data", "raw",
64 true, NULL, _af_raw_complete_setup,
65 {_af_raw_recognize, _af_raw_read_init},
66 {_af_raw_write_init, NULL, NULL},
67 AF_SAMPFMT_TWOSCOMP, 16,
68 _AF_RAW_NUM_COMPTYPES,
69 _af_raw_compression_types,
70 0, /* maximum marker count */
71 0, /* maximum instrument count */
72 0, /* maxium number of loops per instrument */
73 0, NULL,
76 AF_FILE_AIFFC,
77 "AIFF-C", "AIFF-C File Format", "aifc",
78 true, _af_aifc_get_version, _af_aiff_complete_setup,
79 {_af_aifc_recognize, _af_aiff_read_init},
80 {_af_aiff_write_init, _af_aiff_instparam_valid, _af_aiff_update},
81 AF_SAMPFMT_TWOSCOMP, 16,
82 _AF_AIFFC_NUM_COMPTYPES,
83 _af_aiffc_compression_types,
84 65535, /* maximum marker count */
85 1, /* maximum instrument count */
86 2, /* maximum number of loops per instrument */
87 _AF_AIFF_NUM_INSTPARAMS,
88 _af_aiff_inst_params
91 AF_FILE_AIFF,
92 "AIFF", "Audio Interchange File Format", "aiff",
93 true, NULL, _af_aiff_complete_setup,
94 {_af_aiff_recognize, _af_aiff_read_init},
95 {_af_aiff_write_init, _af_aiff_instparam_valid, _af_aiff_update},
96 AF_SAMPFMT_TWOSCOMP, 16,
97 0, /* supported compression types */
98 NULL,
99 65535, /* maximum marker count */
100 1, /* maximum instrument count */
101 2, /* maximum number of loops per instrument */
102 _AF_AIFF_NUM_INSTPARAMS,
103 _af_aiff_inst_params
106 AF_FILE_NEXTSND,
107 "NeXT .snd/Sun .au", "NeXT .snd/Sun .au Format", "next",
108 true, NULL, _af_next_complete_setup,
109 {_af_next_recognize, _af_next_read_init},
110 {_af_next_write_init, NULL, _af_next_update},
111 AF_SAMPFMT_TWOSCOMP, 16,
112 _AF_NEXT_NUM_COMPTYPES,
113 _af_next_compression_types,
114 0, /* maximum marker count */
115 0, /* maximum instrument count */
116 0, /* maximum number of loops per instrument */
117 0, NULL
120 AF_FILE_WAVE,
121 "MS RIFF WAVE", "Microsoft RIFF WAVE Format", "wave",
122 true, NULL, _af_wave_complete_setup,
123 {_af_wave_recognize, _af_wave_read_init},
124 {_af_wave_write_init, _af_wave_instparam_valid, _af_wave_update},
125 AF_SAMPFMT_TWOSCOMP, 16,
126 _AF_WAVE_NUM_COMPTYPES,
127 _af_wave_compression_types,
128 AF_NUM_UNLIMITED, /* maximum marker count */
129 1, /* maximum instrument count */
130 AF_NUM_UNLIMITED, /* maximum number of loops per instrument */
131 _AF_WAVE_NUM_INSTPARAMS,
132 _af_wave_inst_params
135 AF_FILE_IRCAM,
136 "BICSF", "Berkeley/IRCAM/CARL Sound Format", "bicsf",
137 true, NULL, _af_ircam_complete_setup,
138 {_af_ircam_recognize, _af_ircam_read_init},
139 {_af_ircam_write_init, NULL, _af_ircam_update},
140 AF_SAMPFMT_TWOSCOMP, 16,
141 0, /* number of compression types */
142 NULL, /* compression types */
143 0, /* maximum marker count */
144 0, /* maximum instrument count */
145 0, /* maximum number of loops per instrument */
146 0, /* number of instrument parameters */
147 NULL /* instrument parameters */
150 AF_FILE_MPEG1BITSTREAM,
151 "MPEG", "MPEG Audio Bitstream", "mpeg",
152 false
155 AF_FILE_SOUNDDESIGNER1,
156 "Sound Designer 1", "Sound Designer 1 File Format", "sd1",
157 false
160 AF_FILE_SOUNDDESIGNER2,
161 "Sound Designer 2", "Sound Designer 2 File Format", "sd2",
162 false
165 AF_FILE_AVR,
166 "AVR", "Audio Visual Research File Format", "avr",
167 true, NULL, _af_avr_complete_setup,
168 {_af_avr_recognize, _af_avr_read_init},
169 {_af_avr_write_init, NULL, _af_avr_update},
170 AF_SAMPFMT_TWOSCOMP, 16,
171 0, /* number of compression types */
172 NULL, /* compression types */
173 0, /* maximum marker count */
174 0, /* maximum instrument count */
175 0, /* maximum number of loops per instrument */
176 0, /* number of instrument parameters */
179 AF_FILE_IFF_8SVX,
180 "IFF/8SVX", "Amiga IFF/8SVX Sound File Format", "iff",
181 true, NULL, _af_iff_complete_setup,
182 {_af_iff_recognize, _af_iff_read_init},
183 {_af_iff_write_init, NULL, _af_iff_update},
184 AF_SAMPFMT_TWOSCOMP, 8,
185 0, /* number of compression types */
186 NULL, /* compression types */
187 0, /* maximum marker count */
188 0, /* maximum instrument count */
189 0, /* maximum number of loops per instrument */
190 0, /* number of instrument parameters */
193 AF_FILE_SAMPLEVISION,
194 "Sample Vision", "Sample Vision File Format", "smp",
195 false
198 AF_FILE_VOC,
199 "VOC", "Creative Voice File Format", "voc",
200 false
203 AF_FILE_NIST_SPHERE,
204 "NIST SPHERE", "NIST SPHERE File Format", "nist",
205 true, NULL, _af_nist_complete_setup,
206 {_af_nist_recognize, _af_nist_read_init},
207 {_af_nist_write_init, NULL, _af_nist_update},
208 AF_SAMPFMT_TWOSCOMP, 16,
209 0, /* number of compression types */
210 NULL, /* compression types */
211 0, /* maximum marker count */
212 0, /* maximum instrument count */
213 0, /* maximum number of loops per instrument */
214 0, /* number of instrument parameters */
215 NULL /* instrument parameters */
218 AF_FILE_SOUNDFONT2,
219 "SoundFont 2", "SoundFont 2 File Format", "sf2",
220 false
224 const _CompressionUnit _af_compression[_AF_NUM_COMPRESSION] =
227 AF_COMPRESSION_NONE,
228 true,
229 "none", /* label */
230 "none", /* short name */
231 "not compressed",
232 1.0,
233 AF_SAMPFMT_TWOSCOMP, 16,
234 false, /* needsRebuffer */
235 false, /* multiple_of */
236 _af_pcm_format_ok,
237 _AFpcminitcompress, _AFpcminitdecompress
240 AF_COMPRESSION_G711_ULAW,
241 true,
242 "ulaw", /* label */
243 "CCITT G.711 u-law", /* shortname */
244 "CCITT G.711 u-law",
245 2.0,
246 AF_SAMPFMT_TWOSCOMP, 16,
247 false, /* needsRebuffer */
248 false, /* multiple_of */
249 _af_g711_format_ok,
250 _AFg711initcompress, _AFg711initdecompress
253 AF_COMPRESSION_G711_ALAW,
254 true,
255 "alaw", /* label */
256 "CCITT G.711 A-law", /* short name */
257 "CCITT G.711 A-law",
258 2.0,
259 AF_SAMPFMT_TWOSCOMP, 16,
260 false, /* needsRebuffer */
261 false, /* multiple_of */
262 _af_g711_format_ok,
263 _AFg711initcompress, _AFg711initdecompress
266 AF_COMPRESSION_IMA,
267 true,
268 "ima4", /* label */
269 "IMA ADPCM", /* short name */
270 "IMA DVI ADPCM",
271 4.0,
272 AF_SAMPFMT_TWOSCOMP, 16,
273 true, /* needsRebuffer */
274 false, /* multiple_of */
275 _af_ima_adpcm_format_ok,
276 NULL, _af_ima_adpcm_init_decompress
279 AF_COMPRESSION_MS_ADPCM,
280 true,
281 "msadpcm", /* label */
282 "MS ADPCM", /* short name */
283 "Microsoft ADPCM",
284 4.0,
285 AF_SAMPFMT_TWOSCOMP, 16,
286 true, /* needsRebuffer */
287 false, /* multiple_of */
288 _af_ms_adpcm_format_ok,
289 NULL, _af_ms_adpcm_init_decompress