/*************************************************************************** * Copyright (C) 1994 Charles P. Peterson * * 4007 Enchanted Sun, San Antonio, Texas 78244-1254 * * Email: Charles_P_Peterson@fcircus.sat.tx.us * * * * This is free software with NO WARRANTY. * * See gfft.c, or run program itself, for details. * * Support is available for a fee. * *************************************************************************** * * Program: gfft--General FFT analysis * File: format.h * Purpose: definitions for parsing formatted files * Author: Charles Peterson (CPP) * History: 17-October-1993 CPP; Created. * Comment: Whenever possible, I've borrowed from IFF-85 'cause its PD. * Some of the more recent C= iff codes ain't. * Thanks also to David Champion's OPLAY which helped me get * started on this. */ #ifndef FORMAT_H #define FORMAT_H #include "gfft.h" /* Must include now if not already included */ #define ID ULONG /* This macro rounds up to an even number. */ #define WordAlign(size) ((size+1)&~1) /* * As it may be machine dependent, * MakeID is defined in [amiga|unix|msdos]def.h */ struct ChunkHeader { ID ckID; ULONG ckSize; }; /* * 8SVX files */ #ifdef ID_FORM #undef ID_FORM #endif #define ID_FORM MakeID('F','O','R','M') /* required chunk */ #define ID_8SVX MakeID('8','S','V','X') /* required chunk */ #define ID_VHDR MakeID('V','H','D','R') /* required chunk */ #define ID_BODY MakeID('B','O','D','Y') /* required chunk */ struct VHDR { ULONG oneShotHiSamples; /* # samples in the high octave 1-shot part */ ULONG repeatHiSamples; /* # samples in the high octave repeat part */ ULONG samplesPerHiCycle; /* # samples/cycle in high octave, else 0 */ UWORD samplesPerSec; /* data sampling rate */ UBYTE ctOctave; /* # of octaves of waveforms */ UBYTE sCompression; /* data compression technique used */ long volume; /* playback nominal volume from 0 to Unity */ }; /* * AIFF and AIFC */ #define ID_AIFF MakeID('A','I','F','F') #define ID_AIFC MakeID('A','I','F','C') #define ID_COMM MakeID('C','O','M','M') #define ID_SSND MakeID('S','S','N','D') #define ID_COMT MakeID('C','O','M','T') #define ID_NONE MakeID('N','O','N','E') struct CommAiff { UWORD numChannels; ULONG numSampleFrames; UWORD sampleSize; UBYTE sampleRate[10]; /* typed as "Extended" */ }; struct CommAifc { UWORD numChannels; ULONG numSampleFrames; UWORD sampleSize; UBYTE sampleRate[10]; /* typed as "Extended" */ ID compressionType; /* A variable length string here, which we don't care about yet */ }; struct SoundDataChunkInfo { ULONG offset; ULONG blockSize; /* Actual data may begin here (check offset) */ }; /* * AVR (Audio Visual Research) */ #define ID_AVR MakeID('2','B','I','T') struct AVRH { /* Assumes ID_AVR has already been read */ char name[8]; /* null-padded sample name */ short mono; /* 0 = mono, 0xffff = stereo */ short rez; /* 8 = 8 bit, 16 = 16 bit */ short sign; /* 0 = unsigned, 0xffff = signed */ short loop; /* 0 = no loop, 0xffff = looping sample */ short midi; /* 0xffff = no MIDI note assigned, 0xffXX = single key note assignment 0xLLHH = key split, low/hi note */ long rate; /* sample frequency in hertz */ long size; /* sample length in bytes or words (see rez) */ long lbeg; /* offset to start of loop in bytes or words. set to zero if unused. */ long lend; /* offset to end of loop in bytes or words. set to sample length if unused. */ short res1; /* Reserved, MIDI keyboard split */ short res2; /* Reserved, sample compression */ short res3; /* Reserved */ char ext[20]; /* Additional filename space, used if (name[7] != 0) */ char user[64]; /* User defined. Typically ASCII message. */ }; /* * Other format ID's (not yet fully supported, but recognized) */ #define ID_RIFF MakeID('R','I','F','F') #define ID_VOCH MakeID('C','r','e','a') #endif /* ifndef FORMAT_H */