home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Fresh Fish 8
/
FreshFishVol8-CD2.bin
/
bbs
/
util
/
macsnd_dt-1.7.lha
/
MacSND_dt
/
Source
/
Data.h
< prev
next >
Wrap
C/C++ Source or Header
|
1994-09-03
|
4KB
|
142 lines
/*
** MacSND DataType
**
** Written by Olaf `Olsen' Barthel <olsen@sourcery.han.de>
** Public domain
**
** :ts=4
*/
// Our custom library structure
struct ClassBase
{
struct Library LibNode; // Exec link
struct ExecBase *SysBase; // Exec library
struct DosLibrary *DOSBase; // Dos library
struct Library *IntuitionBase, // Intuition library
*UtilityBase, // Utility library
*IFFParseBase, // IFFParse library
*DataTypesBase, // DataTypes library
*SuperClassBase; // Sound datatype
struct SignalSemaphore LockSemaphore; // Shared access semaphore
Class *SoundClass; // The class this library implemnts
BPTR Segment; // Library segment pointer
};
// Redirect references to global data into the library base
#define SysBase ClassBase -> SysBase
#define DOSBase ClassBase -> DOSBase
#define IntuitionBase ClassBase -> IntuitionBase
#define UtilityBase ClassBase -> UtilityBase
#define IFFParseBase ClassBase -> IFFParseBase
#define DataTypesBase ClassBase -> DataTypesBase
#define SuperClassBase ClassBase -> SuperClassBase
#define LockSemaphore ClassBase -> LockSemaphore
#define SoundClass ClassBase -> SoundClass
#define Segment ClassBase -> Segment
// Resource fork header
struct ResourceHeader
{
LONG ResourceDataOffset, // Offset to data
ResourceMapOffset, // Offset to map
ResourceDataSize, // Size of resource data
ResourceMapSize; // Size of resource map
BYTE SystemReserved[112], // Reserved for system use
ApplicationReserved[128]; // Reserved for application use
};
// Resource map header
struct ResourceMapHeader
{
LONG ResourceDataOffset, // Offset to data
ResourceMapOffset, // Offset to map
ResourceDataSize, // Size of resource data
ResourceMapSize; // Size of resource map
BYTE Reserved[6];
WORD ResourceAttributes, // Offset to resource attribute list
ResourceTypeListOffset, // Offset to resource type list
ResourceNameListOffset; // Offset to resource name list
};
// Resource type list entry
struct ResourceTypeEntry
{
TEXT ResourceType[4]; // Resource type
WORD ResourceCount, // Number of resources in this list
ResourceReferenceOffset;
};
// Resource type header
struct ResourceTypeHeader
{
WORD ResourceEntryCount; // Number of entries in list
};
// Resource reference
struct ResourceReference
{
WORD ResourceID, // Resource ID number
ResourceNameOffset; // Offset to resource name
LONG ResourceInfo; // Top 8 eight bits = attributes,
// lower 24 bits = offset to data
BYTE Reserved[4];
};
// bufferCmd data packet, aka SoundDataHeader
struct SoundDataHeader
{
LONG DataOffset, // Offset to data area
SampleSize; // Number of bytes in sample
WORD SampleRate, // Sample rate (integer part)
SampleRate1; // Sample rate (mantissa)
LONG LoopStart, // Start of loop segment
LoopEnd; // End of loop segment
UBYTE Encoding; // Sound encoding, 0xFE means compressed
BYTE BaseFrequency; // Recording base frequency
};
#define stdSH 0x00
// MacBinary file header
typedef struct
{
BYTE zero1;
BYTE nlen;
TEXT name[63]; // File name, Pascal format string
TEXT type[4]; // File type
TEXT creator[4]; // Creator signature
UBYTE flags1, // Attributes
flags2;
UBYTE location[6]; // Icon position
UBYTE locked1, // Locked?
locked2;
UBYTE dflen[4]; // Data fork length
UBYTE rflen[4]; // Resource fork length
UBYTE cdate[4]; // Creation date
UBYTE mdate[4]; // Modification date
BYTE pad[29]; // Pad to 128 byte boundary
} MacBinaryHeader;