1 {
2      File:       CarbonCore/AIFF.h
3 
4      Contains:   Definition of AIFF file format components.
5                  The contents of this header file are deprecated.
6 
7      Copyright:  � 1989-2011 by Apple Inc. All rights reserved.
8 }
9 {
10     Modified for use with Free Pascal
11     Version 308
12     Please report any bugs to <gpc@microbizz.nl>
13 }
14 
15 {$ifc not defined MACOSALLINCLUDE or not MACOSALLINCLUDE}
16 {$mode macpas}
17 {$modeswitch cblocks}
18 {$packenum 1}
19 {$macro on}
20 {$inline on}
21 {$calling mwpascal}
22 
23 unit AIFF;
24 interface
25 {$setc UNIVERSAL_INTERFACES_VERSION := $0400}
26 {$setc GAP_INTERFACES_VERSION := $0308}
27 
28 {$ifc not defined USE_CFSTR_CONSTANT_MACROS}
29     {$setc USE_CFSTR_CONSTANT_MACROS := TRUE}
30 {$endc}
31 
32 {$ifc defined CPUPOWERPC and defined CPUI386}
33 	{$error Conflicting initial definitions for CPUPOWERPC and CPUI386}
34 {$endc}
35 {$ifc defined FPC_BIG_ENDIAN and defined FPC_LITTLE_ENDIAN}
36 	{$error Conflicting initial definitions for FPC_BIG_ENDIAN and FPC_LITTLE_ENDIAN}
37 {$endc}
38 
39 {$ifc not defined __ppc__ and defined CPUPOWERPC32}
40 	{$setc __ppc__ := 1}
41 {$elsec}
42 	{$setc __ppc__ := 0}
43 {$endc}
44 {$ifc not defined __ppc64__ and defined CPUPOWERPC64}
45 	{$setc __ppc64__ := 1}
46 {$elsec}
47 	{$setc __ppc64__ := 0}
48 {$endc}
49 {$ifc not defined __i386__ and defined CPUI386}
50 	{$setc __i386__ := 1}
51 {$elsec}
52 	{$setc __i386__ := 0}
53 {$endc}
54 {$ifc not defined __x86_64__ and defined CPUX86_64}
55 	{$setc __x86_64__ := 1}
56 {$elsec}
57 	{$setc __x86_64__ := 0}
58 {$endc}
59 {$ifc not defined __arm__ and defined CPUARM}
60 	{$setc __arm__ := 1}
61 {$elsec}
62 	{$setc __arm__ := 0}
63 {$endc}
64 {$ifc not defined __arm64__ and defined CPUAARCH64}
65   {$setc __arm64__ := 1}
66 {$elsec}
67   {$setc __arm64__ := 0}
68 {$endc}
69 
70 {$ifc defined cpu64}
71   {$setc __LP64__ := 1}
72 {$elsec}
73   {$setc __LP64__ := 0}
74 {$endc}
75 
76 
77 {$ifc defined __ppc__ and __ppc__ and defined __i386__ and __i386__}
78 	{$error Conflicting definitions for __ppc__ and __i386__}
79 {$endc}
80 
81 {$ifc defined __ppc__ and __ppc__}
82 	{$setc TARGET_CPU_PPC := TRUE}
83 	{$setc TARGET_CPU_PPC64 := FALSE}
84 	{$setc TARGET_CPU_X86 := FALSE}
85 	{$setc TARGET_CPU_X86_64 := FALSE}
86 	{$setc TARGET_CPU_ARM := FALSE}
87 	{$setc TARGET_CPU_ARM64 := FALSE}
88 	{$setc TARGET_OS_MAC := TRUE}
89 	{$setc TARGET_OS_IPHONE := FALSE}
90 	{$setc TARGET_IPHONE_SIMULATOR := FALSE}
91 	{$setc TARGET_OS_EMBEDDED := FALSE}
92 {$elifc defined __ppc64__ and __ppc64__}
93 	{$setc TARGET_CPU_PPC := FALSE}
94 	{$setc TARGET_CPU_PPC64 := TRUE}
95 	{$setc TARGET_CPU_X86 := FALSE}
96 	{$setc TARGET_CPU_X86_64 := FALSE}
97 	{$setc TARGET_CPU_ARM := FALSE}
98 	{$setc TARGET_CPU_ARM64 := FALSE}
99 	{$setc TARGET_OS_MAC := TRUE}
100 	{$setc TARGET_OS_IPHONE := FALSE}
101 	{$setc TARGET_IPHONE_SIMULATOR := FALSE}
102 	{$setc TARGET_OS_EMBEDDED := FALSE}
103 {$elifc defined __i386__ and __i386__}
104 	{$setc TARGET_CPU_PPC := FALSE}
105 	{$setc TARGET_CPU_PPC64 := FALSE}
106 	{$setc TARGET_CPU_X86 := TRUE}
107 	{$setc TARGET_CPU_X86_64 := FALSE}
108 	{$setc TARGET_CPU_ARM := FALSE}
109 	{$setc TARGET_CPU_ARM64 := FALSE}
110 {$ifc defined iphonesim}
111  	{$setc TARGET_OS_MAC := FALSE}
112 	{$setc TARGET_OS_IPHONE := TRUE}
113 	{$setc TARGET_IPHONE_SIMULATOR := TRUE}
114 {$elsec}
115 	{$setc TARGET_OS_MAC := TRUE}
116 	{$setc TARGET_OS_IPHONE := FALSE}
117 	{$setc TARGET_IPHONE_SIMULATOR := FALSE}
118 {$endc}
119 	{$setc TARGET_OS_EMBEDDED := FALSE}
120 {$elifc defined __x86_64__ and __x86_64__}
121 	{$setc TARGET_CPU_PPC := FALSE}
122 	{$setc TARGET_CPU_PPC64 := FALSE}
123 	{$setc TARGET_CPU_X86 := FALSE}
124 	{$setc TARGET_CPU_X86_64 := TRUE}
125 	{$setc TARGET_CPU_ARM := FALSE}
126 	{$setc TARGET_CPU_ARM64 := FALSE}
127 {$ifc defined iphonesim}
128  	{$setc TARGET_OS_MAC := FALSE}
129 	{$setc TARGET_OS_IPHONE := TRUE}
130 	{$setc TARGET_IPHONE_SIMULATOR := TRUE}
131 {$elsec}
132 	{$setc TARGET_OS_MAC := TRUE}
133 	{$setc TARGET_OS_IPHONE := FALSE}
134 	{$setc TARGET_IPHONE_SIMULATOR := FALSE}
135 {$endc}
136 	{$setc TARGET_OS_EMBEDDED := FALSE}
137 {$elifc defined __arm__ and __arm__}
138 	{$setc TARGET_CPU_PPC := FALSE}
139 	{$setc TARGET_CPU_PPC64 := FALSE}
140 	{$setc TARGET_CPU_X86 := FALSE}
141 	{$setc TARGET_CPU_X86_64 := FALSE}
142 	{$setc TARGET_CPU_ARM := TRUE}
143 	{$setc TARGET_CPU_ARM64 := FALSE}
144 	{$setc TARGET_OS_MAC := FALSE}
145 	{$setc TARGET_OS_IPHONE := TRUE}
146 	{$setc TARGET_IPHONE_SIMULATOR := FALSE}
147 	{$setc TARGET_OS_EMBEDDED := TRUE}
148 {$elifc defined __arm64__ and __arm64__}
149 	{$setc TARGET_CPU_PPC := FALSE}
150 	{$setc TARGET_CPU_PPC64 := FALSE}
151 	{$setc TARGET_CPU_X86 := FALSE}
152 	{$setc TARGET_CPU_X86_64 := FALSE}
153 	{$setc TARGET_CPU_ARM := FALSE}
154 	{$setc TARGET_CPU_ARM64 := TRUE}
155 {$ifc defined ios}
156 	{$setc TARGET_OS_MAC := FALSE}
157 	{$setc TARGET_OS_IPHONE := TRUE}
158 	{$setc TARGET_OS_EMBEDDED := TRUE}
159 {$elsec}
160 	{$setc TARGET_OS_MAC := TRUE}
161 	{$setc TARGET_OS_IPHONE := FALSE}
162 	{$setc TARGET_OS_EMBEDDED := FALSE}
163 {$endc}
164 	{$setc TARGET_IPHONE_SIMULATOR := FALSE}
165 {$elsec}
166 	{$error __ppc__ nor __ppc64__ nor __i386__ nor __x86_64__ nor __arm__ nor __arm64__ is defined.}
167 {$endc}
168 
169 {$ifc defined __LP64__ and __LP64__ }
170   {$setc TARGET_CPU_64 := TRUE}
171 {$elsec}
172   {$setc TARGET_CPU_64 := FALSE}
173 {$endc}
174 
175 {$ifc defined FPC_BIG_ENDIAN}
176 	{$setc TARGET_RT_BIG_ENDIAN := TRUE}
177 	{$setc TARGET_RT_LITTLE_ENDIAN := FALSE}
178 {$elifc defined FPC_LITTLE_ENDIAN}
179 	{$setc TARGET_RT_BIG_ENDIAN := FALSE}
180 	{$setc TARGET_RT_LITTLE_ENDIAN := TRUE}
181 {$elsec}
182 	{$error Neither FPC_BIG_ENDIAN nor FPC_LITTLE_ENDIAN are defined.}
183 {$endc}
184 {$setc ACCESSOR_CALLS_ARE_FUNCTIONS := TRUE}
185 {$setc CALL_NOT_IN_CARBON := FALSE}
186 {$setc OLDROUTINENAMES := FALSE}
187 {$setc OPAQUE_TOOLBOX_STRUCTS := TRUE}
188 {$setc OPAQUE_UPP_TYPES := TRUE}
189 {$setc OTCARBONAPPLICATION := TRUE}
190 {$setc OTKERNEL := FALSE}
191 {$setc PM_USE_SESSION_APIS := TRUE}
192 {$setc TARGET_API_MAC_CARBON := TRUE}
193 {$setc TARGET_API_MAC_OS8 := FALSE}
194 {$setc TARGET_API_MAC_OSX := TRUE}
195 {$setc TARGET_CARBON := TRUE}
196 {$setc TARGET_CPU_68K := FALSE}
197 {$setc TARGET_CPU_MIPS := FALSE}
198 {$setc TARGET_CPU_SPARC := FALSE}
199 {$setc TARGET_OS_UNIX := FALSE}
200 {$setc TARGET_OS_WIN32 := FALSE}
201 {$setc TARGET_RT_MAC_68881 := FALSE}
202 {$setc TARGET_RT_MAC_CFM := FALSE}
203 {$setc TARGET_RT_MAC_MACHO := TRUE}
204 {$setc TYPED_FUNCTION_POINTERS := TRUE}
205 {$setc TYPE_BOOL := FALSE}
206 {$setc TYPE_EXTENDED := FALSE}
207 {$setc TYPE_LONGLONG := TRUE}
208 uses MacTypes;
209 {$endc} {not MACOSALLINCLUDE}
210 
211 
212 
213 {$ALIGN MAC68K}
214 
215 const
216 	AIFFID = FourCharCode('AIFF');
217 	AIFCID = FourCharCode('AIFC');
218 	FormatVersionID = FourCharCode('FVER');
219 	CommonID = FourCharCode('COMM');
220 	FORMID = FourCharCode('FORM');
221 	SoundDataID = FourCharCode('SSND');
222 	MarkerID = FourCharCode('MARK');
223 	InstrumentID = FourCharCode('INST');
224 	MIDIDataID = FourCharCode('MIDI');
225 	AudioRecordingID = FourCharCode('AESD');
226 	ApplicationSpecificID = FourCharCode('APPL');
227 	CommentID = FourCharCode('COMT');
228 	NameID = FourCharCode('NAME');
229 	AuthorID = FourCharCode('AUTH');
230 	CopyrightID = FourCharCode('(c) ');
231 	AnnotationID = FourCharCode('ANNO');
232 
233 const
234 	NoLooping = 0;
235 	ForwardLooping = 1;
236 	ForwardBackwardLooping = 2;
237 
238 
239 const
240 { AIFF-C Versions }
241 	AIFCVersion1 = $A2805140;
242 
243 { Compression Names }
244 const
245 	NoneName = 'not compressed';
246 const
247 	ACE2to1Name = 'ACE 2-to-1';
248 const
249 	ACE8to3Name = 'ACE 8-to-3';
250 const
251 	MACE3to1Name = 'MACE 3-to-1';
252 const
253 	MACE6to1Name = 'MACE 6-to-1';
254 const
255 { Compression Types }
256 	NoneType = FourCharCode('NONE');
257 	ACE2Type = FourCharCode('ACE2');
258 	ACE8Type = FourCharCode('ACE8');
259 	MACE3Type = FourCharCode('MAC3');
260 	MACE6Type = FourCharCode('MAC6');
261 
262 {
263     AIFF.h use to define a type, ID, which causes conflicts with other headers and application which want to use
264     this pretty common name as their own type.  If you were previously relying on this being defined here, you
265     should either define it yourself or change your references to it into a UInt32.
266 
267     typedef UInt32 ID;
268 }
269 type
270 	MarkerIdType = SInt16;
271 	ChunkHeaderPtr = ^ChunkHeader;
272 	ChunkHeader = record
273 		ckID: UInt32;
274 		ckSize: SInt32;
275 	end;
276 type
277 	ContainerChunkPtr = ^ContainerChunk;
278 	ContainerChunk = record
279 		ckID: UInt32;
280 		ckSize: SInt32;
281 		formType: UInt32;
282 	end;
283 type
284 	FormatVersionChunk = record
285 		ckID: UInt32;
286 		ckSize: SInt32;
287 		timestamp: UInt32;
288 	end;
289 	FormatVersionChunkPtr = ^FormatVersionChunk;
290 type
291 	CommonChunk = record
292 		ckID: UInt32;
293 		ckSize: SInt32;
294 		numChannels: SInt16;
295 		numSampleFrames: UInt32;
296 		sampleSize: SInt16;
297 		sampleRate: extended80;
298 	end;
299 	CommonChunkPtr = ^CommonChunk;
300 type
301 	ExtCommonChunk = record
302 		ckID: UInt32;
303 		ckSize: SInt32;
304 		numChannels: SInt16;
305 		numSampleFrames: UInt32;
306 		sampleSize: SInt16;
307 		sampleRate: extended80;
308 		compressionType: UInt32;
309 		compressionName: SInt8;     { variable length array, Pascal string }
310 	end;
311 	ExtCommonChunkPtr = ^ExtCommonChunk;
312 type
313 	SoundDataChunk = record
314 		ckID: UInt32;
315 		ckSize: SInt32;
316 		offset: UInt32;
317 		blockSize: UInt32;
318 	end;
319 	SoundDataChunkPtr = ^SoundDataChunk;
320 type
321 	MarkerPtr = ^Marker;
322 	Marker = record
323 		id: MarkerIdType;
324 		position: UInt32;
325 		markerName: Str255;
326 	end;
327 type
328 	MarkerChunk = record
329 		ckID: UInt32;
330 		ckSize: SInt32;
331 		numMarkers: UInt16;
332 		Markers: array [0..0] of Marker;             { variable length array }
333 	end;
334 	MarkerChunkPtr = ^MarkerChunk;
335 type
336 	AIFFLoopPtr = ^AIFFLoop;
337 	AIFFLoop = record
338 		playMode: SInt16;
339 		beginLoop: MarkerIdType;
340 		endLoop: MarkerIdType;
341 	end;
342 type
343 	InstrumentChunk = record
344 		ckID: UInt32;
345 		ckSize: SInt32;
346 		baseFrequency: UInt8;
347 		detune: UInt8;
348 		lowFrequency: UInt8;
349 		highFrequency: UInt8;
350 		lowVelocity: UInt8;
351 		highVelocity: UInt8;
352 		gain: SInt16;
353 		sustainLoop: AIFFLoop;
354 		releaseLoop: AIFFLoop;
355 	end;
356 	InstrumentChunkPtr = ^InstrumentChunk;
357 type
358 	MIDIDataChunk = record
359 		ckID: UInt32;
360 		ckSize: SInt32;
361 		MIDIdata: SInt8;            { variable length array }
362 	end;
363 	MIDIDataChunkPtr = ^MIDIDataChunk;
364 type
365 	AudioRecordingChunk = record
366 		ckID: UInt32;
367 		ckSize: SInt32;
368 		AESChannelStatus:		packed array [0..23] of UInt8;
369 	end;
370 	AudioRecordingChunkPtr = ^AudioRecordingChunk;
371 type
372 	ApplicationSpecificChunk = record
373 		ckID: UInt32;
374 		ckSize: SInt32;
375 		applicationSignature: OSType;
376 		data: UInt8;                { variable length array }
377 	end;
378 	ApplicationSpecificChunkPtr = ^ApplicationSpecificChunk;
379 type
380 	CommentPtr = ^Comment;
381 	Comment = record
382 		timeStamp: UInt32;
383 		marker: MarkerIdType;
384 		count: UInt16;
385 		text: SInt8;                { variable length array, Pascal string }
386 	end;
387 	Comment_fix = Comment;
388 type
389 	CommentsChunk = record
390 		ckID: UInt32;
391 		ckSize: SInt32;
392 		numComments: UInt16;
393 		Comment: array [0..0] of Comment_fix;            { variable length array }
394 	end;
395 	CommentsChunkPtr = ^CommentsChunk;
396 type
397 	TextChunk = record
398 		ckID: UInt32;
399 		ckSize: SInt32;
400 		text: SInt8;                { variable length array, Pascal string }
401 	end;
402 	TextChunkPtr = ^TextChunk;
403 
404 {$ifc not defined MACOSALLINCLUDE or not MACOSALLINCLUDE}
405 
406 end.
407 {$endc} {not MACOSALLINCLUDE}
408