revert between 56095 -> 55830 in arch
[AROS.git] / workbench / classes / datatypes / sound / aiff.h
blob961d387b10b1706012a52ee387c16b8870d297b7
2 /*
3 ** aiff.h
4 ** stolen from Olaf Barthels' aiff.dt
5 */
7 #ifndef AIFF_H
8 #define AIFF_H
10 #ifndef EXEC_TYPES_H
11 #include <exec/types.h>
12 #endif
14 typedef struct {
15 UWORD exponent; // Exponent, bit #15 is sign bit for mantissa
16 ULONG mantissa[2]; // 64 bit mantissa
17 } extended;
19 // Audio Interchange Format chunk data
21 #define ID_AIFF MAKE_ID('A', 'I', 'F', 'F')
23 #define ID_COMM MAKE_ID('C', 'O', 'M', 'M')
24 #define ID_SSND MAKE_ID('S', 'S', 'N', 'D')
26 // "COMM" chunk header
28 typedef struct {
29 WORD numChannels; // Number of channels
30 ULONG numSampleFrames; // Number of sample frames
31 WORD sampleSize; // Number of bits per sample point
32 extended sampleRate; // Replay rate in samples per second
33 } CommonChunk;
35 // "SSND" chunk header
37 typedef struct {
38 ULONG offset, // Offset to sound data, for block alignment
39 blockSize; // Size of block data is aligned to
40 } SampledSoundHeader;
42 static void ulong2extended( ULONG value, extended *ex )
44 ex->exponent = 31 + 16383;
46 while( ( value & 0x80000000 ) == 0 )
48 value <<= 1;
50 ex->exponent--;
53 ex->mantissa[0] = value;
54 ex->mantissa[1] = 0;
57 #endif