view dstep/coreservices/carboncore/AIFF.d @ 11:07194b026fa4

Added bindings to a couple of frameworks, new license + some other things
author Jacob Carlborg <doob@me.com>
date Sat, 01 Aug 2009 15:03:28 +0200
parents
children
line wrap: on
line source

/**
 * Copyright: Copyright (c) 2009 Jacob Carlborg.
 * Authors: Jacob Carlborg
 * Version: Initial created: Jul 21, 2009 
 * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0)
 */
module dstep.coreservices.carboncore.AIFF;

//import dstep.AvailabilityMacros;
import dstep.coreservices.carboncore.MacTypes;
import dstep.objc.bridge.TypeEncoding;

alias uint ID;
alias short MarkerIdType;
alias FormatVersionChunk* FormatVersionChunkPtr;
alias CommonChunk* CommonChunkPtr;
alias ExtCommonChunk* ExtCommonChunkPtr;
alias SoundDataChunk* SoundDataChunkPtr;
alias MarkerChunk* MarkerChunkPtr;
alias InstrumentChunk* InstrumentChunkPtr;
alias MIDIDataChunk* MIDIDataChunkPtr;
alias AudioRecordingChunk* AudioRecordingChunkPtr;
alias ApplicationSpecificChunk* ApplicationSpecificChunkPtr;
alias CommentsChunk*CommentsChunkPtr;
alias TextChunk* TextChunkPtr;

// This is needed otherwise the enums will fail compiling with gdc
version (GNU)
{
	private
	{
		const __AIFFID = getOSType!("AIFF");
		const __AIFCID = getOSType!("AIFC");
		const __FormatVersionID = getOSType!("FVER");
		const __CommonID = getOSType!("COMM");
		const __FORMID = getOSType!("FORM");
		const __SoundDataID = getOSType!("SSND");
		const __MarkerID = getOSType!("MARK");
		const __InstrumentID = getOSType!("INST");
		const __MIDIDataID = getOSType!("MIDI");
		const __AudioRecordingID = getOSType!("AESD");
		const __ApplicationSpecificID = getOSType!("APPL");
		const __CommentID = getOSType!("COMT");
		const __NameID = getOSType!("NAME");
		const __AuthorID = getOSType!("AUTH");
		const __CopyrightID = getOSType!("(c) ");
		const __AnnotationID = getOSType!("ANNO");

	}
}

// This is needed otherwise the enums will fail compiling with gdc
version (GNU)
{
	private
	{
		const __NoneType = getOSType!("NONE");
		const __ACE2Type = getOSType!("ACE2");
		const __ACE8Type = getOSType!("ACE8");
		const __MACE3Type = getOSType!("MAC3");
		const __MACE6Type = getOSType!("MAC6");

	}
}

enum
{
	AIFFID = getOSType!("AIFF"),
	AIFCID = getOSType!("AIFC"),
	FormatVersionID = getOSType!("FVER"),
	CommonID = getOSType!("COMM"),
	FORMID = getOSType!("FORM"),
	SoundDataID = getOSType!("SSND"),
	MarkerID = getOSType!("MARK"),
	InstrumentID = getOSType!("INST"),
	MIDIDataID = getOSType!("MIDI"),
	AudioRecordingID = getOSType!("AESD"),
	ApplicationSpecificID = getOSType!("APPL"),
	CommentID = getOSType!("COMT"),
	NameID = getOSType!("NAME"),
	AuthorID = getOSType!("AUTH"),
	CopyrightID = getOSType!("(c) "),
	AnnotationID = getOSType!("ANNO")
}

enum
{
	NoLooping = 0,
	ForwardLooping = 1,
	ForwardBackwardLooping = 2
}

enum
{
	AIFCVersion1 = cast(uint)0xA2805140
}

enum
{
	NoneType = getOSType!("NONE"),
	ACE2Type = getOSType!("ACE2"),
	ACE8Type = getOSType!("ACE8"),
	MACE3Type = getOSType!("MAC3"),
	MACE6Type = getOSType!("MAC6")
}

struct ChunkHeader
{
	uint ckID;
	int ckSize;
}


struct ContainerChunk
{
	uint ckID;
	int ckSize;
	uint formType;
}


struct FormatVersionChunk
{
	uint ckID;
	int ckSize;
	uint timestamp;
}


struct CommonChunk
{
	uint ckID;
	int ckSize;
	short numChannels;
	uint numSampleFrames;
	short sampleSize;
	extended80 sampleRate;
}


struct ExtCommonChunk
{
	uint ckID;
	int ckSize;
	short numChannels;
	uint numSampleFrames;
	short sampleSize;
	extended80 sampleRate;
	uint compressionType;
	char* compressionName;
}


struct SoundDataChunk
{
	uint ckID;
	int ckSize;
	uint offset;
	uint blockSize;
}


struct Marker
{
	short id;
	uint position;
	ubyte[256] markerName;
}


struct MarkerChunk
{
	uint ckID;
	int ckSize;
	ushort numMarkers;
	Marker* Markers;
}


struct AIFFLoop
{
	short playMode;
	short beginLoop;
	short endLoop;
}


struct InstrumentChunk
{
	uint ckID;
	int ckSize;
	ubyte baseFrequency;
	ubyte detune;
	ubyte lowFrequency;
	ubyte highFrequency;
	ubyte lowVelocity;
	ubyte highVelocity;
	short gain;
	AIFFLoop sustainLoop;
	AIFFLoop releaseLoop;
}


struct MIDIDataChunk
{
	uint ckID;
	int ckSize;
	char* MIDIdata;
}


struct AudioRecordingChunk
{
	uint ckID;
	int ckSize;
	char* AESChannelStatus;
}


struct ApplicationSpecificChunk
{
	uint ckID;
	int ckSize;
	uint applicationSignature;
	char* data;
}


struct Comment
{
	uint timeStamp;
	short marker;
	ushort count;
	char* text;
}


struct CommentsChunk
{
	uint ckID;
	int ckSize;
	ushort numComments;
	Comment* comments;
}


struct TextChunk
{
	uint ckID;
	int ckSize;
	char* text;
}