File: units.cpp

package info (click to toggle)
audiofile 0.3.4-2
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 4,192 kB
  • sloc: cpp: 31,691; sh: 11,006; ansic: 3,773; makefile: 271
file content (319 lines) | stat: -rw-r--r-- 7,841 bytes parent folder | download
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
/*
	Audio File Library
	Copyright (C) 2000-2001, Silicon Graphics, Inc.

	This library is free software; you can redistribute it and/or
	modify it under the terms of the GNU Library General Public
	License as published by the Free Software Foundation; either
	version 2 of the License, or (at your option) any later version.

	This library is distributed in the hope that it will be useful,
	but WITHOUT ANY WARRANTY; without even the implied warranty of
	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
	Library General Public License for more details.

	You should have received a copy of the GNU Library General Public
	License along with this library; if not, write to the
	Free Software Foundation, Inc., 59 Temple Place - Suite 330,
	Boston, MA  02111-1307  USA.
*/

/*
	units.cpp

	This file contains the file format units.
*/

#include "config.h"

#include "audiofile.h"
#include "afinternal.h"
#include "units.h"

#include "AIFF.h"
#include "AVR.h"
#include "CAF.h"
#include "IFF.h"
#include "IRCAM.h"
#include "NeXT.h"
#include "NIST.h"
#include "Raw.h"
#include "SampleVision.h"
#include "VOC.h"
#include "WAVE.h"

#include "compression.h"

#include "modules/PCM.h"
#include "modules/G711.h"
#include "modules/IMA.h"
#include "modules/MSADPCM.h"

const _Unit _af_units[_AF_NUM_UNITS] =
{
	{
		AF_FILE_RAWDATA,
		"Raw Data", "Raw Sound Data", "raw",
		true,
		&RawFile::completeSetup,
		&RawFile::recognize,
		AF_SAMPFMT_TWOSCOMP, 16,
		_AF_RAW_NUM_COMPTYPES,
		_af_raw_compression_types,
		0,	/* maximum marker count */
		0,	/* maximum instrument count */
		0,	/* maxium number of loops per instrument */
		0, NULL,
	},
	{
		AF_FILE_AIFFC,
		"AIFF-C", "AIFF-C File Format", "aifc",
		true,
		AIFFFile::completeSetup,
		AIFFFile::recognizeAIFFC,
		AF_SAMPFMT_TWOSCOMP, 16,
		_AF_AIFFC_NUM_COMPTYPES,
		_af_aiffc_compression_types,
		65535,	/* maximum marker count */
		1,	/* maximum instrument count */
		2,	/* maximum number of loops per instrument */
		_AF_AIFF_NUM_INSTPARAMS,
		_af_aiff_inst_params
	},
	{
		AF_FILE_AIFF,
		"AIFF", "Audio Interchange File Format", "aiff",
		true,
		AIFFFile::completeSetup,
		AIFFFile::recognizeAIFF,
		AF_SAMPFMT_TWOSCOMP, 16,
		0,	/* supported compression types */
		NULL,
		65535,	/* maximum marker count */
		1,	/* maximum instrument count */
		2,	/* maximum number of loops per instrument */
		_AF_AIFF_NUM_INSTPARAMS,
		_af_aiff_inst_params
	},
	{
		AF_FILE_NEXTSND,
		"NeXT .snd/Sun .au", "NeXT .snd/Sun .au Format", "next",
		true,
		NeXTFile::completeSetup,
		NeXTFile::recognize,
		AF_SAMPFMT_TWOSCOMP, 16,
		_AF_NEXT_NUM_COMPTYPES,
		_af_next_compression_types,
		0,	/* maximum marker count */
		0,	/* maximum instrument count */
		0,	/* maximum number of loops per instrument */
		0, NULL
	},
	{
		AF_FILE_WAVE,
		"MS RIFF WAVE", "Microsoft RIFF WAVE Format", "wave",
		true,
		WAVEFile::completeSetup,
		WAVEFile::recognize,
		AF_SAMPFMT_TWOSCOMP, 16,
		_AF_WAVE_NUM_COMPTYPES,
		_af_wave_compression_types,
		AF_NUM_UNLIMITED,	/* maximum marker count */
		1,			/* maximum instrument count */
		AF_NUM_UNLIMITED,	/* maximum number of loops per instrument */
		_AF_WAVE_NUM_INSTPARAMS,
		_af_wave_inst_params
	},
	{
		AF_FILE_IRCAM,
		"BICSF", "Berkeley/IRCAM/CARL Sound Format", "bicsf",
		true,
		IRCAMFile::completeSetup,
		IRCAMFile::recognize,
		AF_SAMPFMT_TWOSCOMP, 16,
		_AF_IRCAM_NUM_COMPTYPES,
		_af_ircam_compression_types,
		0,		// maximum marker count
		0,		// maximum instrument count
		0,		// maximum number of loops per instrument
		0,		// number of instrument parameters
		NULL	// instrument parameters
	},
	{
		AF_FILE_MPEG1BITSTREAM,
		"MPEG", "MPEG Audio Bitstream", "mpeg",
		false
	},
	{
		AF_FILE_SOUNDDESIGNER1,
		"Sound Designer 1", "Sound Designer 1 File Format", "sd1",
		false
	},
	{
		AF_FILE_SOUNDDESIGNER2,
		"Sound Designer 2", "Sound Designer 2 File Format", "sd2",
		false
	},
	{
		AF_FILE_AVR,
		"AVR", "Audio Visual Research File Format", "avr",
		true,
		AVRFile::completeSetup,
		AVRFile::recognize,
		AF_SAMPFMT_TWOSCOMP, 16,
		0,	/* number of compression types */
		NULL,	/* compression types */
		0,	/* maximum marker count */
		0,	/* maximum instrument count */
		0,	/* maximum number of loops per instrument */
		0,	/* number of instrument parameters */
	},
	{
		AF_FILE_IFF_8SVX,
		"IFF/8SVX", "Amiga IFF/8SVX Sound File Format", "iff",
		true,
		IFFFile::completeSetup,
		IFFFile::recognize,
		AF_SAMPFMT_TWOSCOMP, 8,
		0,	/* number of compression types */
		NULL,	/* compression types */
		0,	/* maximum marker count */
		0,	/* maximum instrument count */
		0,	/* maximum number of loops per instrument */
		0,	/* number of instrument parameters */
	},
	{
		AF_FILE_SAMPLEVISION,
		"Sample Vision", "Sample Vision File Format", "smp",
		true,
		SampleVisionFile::completeSetup,
		SampleVisionFile::recognize,
		AF_SAMPFMT_TWOSCOMP, 16,
		0,		// number of compression types
		NULL,	// compression types
		0,		// maximum marker count
		0,		// maximum instrument count
		0,		// maximum number of loops per instrument
		0,		// number of instrument parameters
		NULL	// instrument parameters
	},
	{
		AF_FILE_VOC,
		"VOC", "Creative Voice File Format", "voc",
		true,
		VOCFile::completeSetup,
		VOCFile::recognize,
		AF_SAMPFMT_TWOSCOMP, 16,
		_AF_VOC_NUM_COMPTYPES,
		_af_voc_compression_types,
		0,		// maximum marker count
		0,		// maximum instrument count
		0,		// maximum number of loops per instrument
		0,		// number of instrument parameters
		NULL	// instrument parameters
	},
	{
		AF_FILE_NIST_SPHERE,
		"NIST SPHERE", "NIST SPHERE File Format", "nist",
		true,
		NISTFile::completeSetup,
		NISTFile::recognize,
		AF_SAMPFMT_TWOSCOMP, 16,
		0,	/* number of compression types */
		NULL,	/* compression types */
		0,	/* maximum marker count */
		0,	/* maximum instrument count */
		0,	/* maximum number of loops per instrument */
		0,	/* number of instrument parameters */
		NULL	/* instrument parameters */
	},
	{
		AF_FILE_SOUNDFONT2,
		"SoundFont 2", "SoundFont 2 File Format", "sf2",
		false
	},
	{
		AF_FILE_CAF,
		"CAF", "Core Audio Format", "caf",
		true,
		CAFFile::completeSetup,
		CAFFile::recognize,
		AF_SAMPFMT_TWOSCOMP, 16,
		_AF_CAF_NUM_COMPTYPES,
		_af_caf_compression_types,
		0,		// maximum marker count
		0,		// maximum instrument count
		0,		// maximum number of loops per instrument
		0,		// number of instrument parameters
		NULL	// instrument parameters
	}
};

const _CompressionUnit _af_compression[_AF_NUM_COMPRESSION] =
{
	{
		AF_COMPRESSION_NONE,
		true,
		"none",	/* label */
		"none",	/* short name */
		"not compressed",
		1.0,
		AF_SAMPFMT_TWOSCOMP, 16,
		false,	/* needsRebuffer */
		false,	/* multiple_of */
		_af_pcm_format_ok,
		_AFpcminitcompress, _AFpcminitdecompress
	},
	{
		AF_COMPRESSION_G711_ULAW,
		true,
		"ulaw",	/* label */
		"CCITT G.711 u-law",	/* shortname */
		"CCITT G.711 u-law",
		2.0,
		AF_SAMPFMT_TWOSCOMP, 16,
		false,	/* needsRebuffer */
		false,	/* multiple_of */
		_af_g711_format_ok,
		_AFg711initcompress, _AFg711initdecompress
	},
	{
		AF_COMPRESSION_G711_ALAW,
		true,
		"alaw",	/* label */
		"CCITT G.711 A-law",	/* short name */
		"CCITT G.711 A-law",
		2.0,
		AF_SAMPFMT_TWOSCOMP, 16,
		false,	/* needsRebuffer */
		false,	/* multiple_of */
		_af_g711_format_ok,
		_AFg711initcompress, _AFg711initdecompress
	},
	{
		AF_COMPRESSION_IMA,
		true,
		"ima4",	/* label */
		"IMA ADPCM",	/* short name */
		"IMA DVI ADPCM",
		4.0,
		AF_SAMPFMT_TWOSCOMP, 16,
		true,	/* needsRebuffer */
		false,	/* multiple_of */
		_af_ima_adpcm_format_ok,
		NULL, _af_ima_adpcm_init_decompress
	},
	{
		AF_COMPRESSION_MS_ADPCM,
		true,
		"msadpcm",	/* label */
		"MS ADPCM",	/* short name */
		"Microsoft ADPCM",
		4.0,
		AF_SAMPFMT_TWOSCOMP, 16,
		true,	/* needsRebuffer */
		false,	/* multiple_of */
		_af_ms_adpcm_format_ok,
		NULL, _af_ms_adpcm_init_decompress
	}
};