.h>
#include "CAStreamBasicDescription.h"
#include "CAAutoDisposer.h"
#include "CADebugMacros.h"

// make this usable outside the stricter context of AudiUnits
#ifndef COMPONENT_THROW
	#define COMPONENT_THROW(err) \
		do { DebugMessage(#err); throw static_cast<OSStatus>(err); } while (0)
#endif


	/*! @class AUBufferList */
class AUBufferList {
	enum EPtrState {
		kPtrsInvalid,
		kPtrsToMyMemory,
		kPtrsToExternalMemory
	};
public:
	/*! @ctor AUBufferList */
	AUBufferList() : mPtrState(kPtrsInvalid), mExternalMemory(false), mPtrs(NULL), mMemory(NULL),
		mAllocatedStreams(0), mAllocatedFrames(0), mAllocatedBytes(0) { }
	/*! @dtor ~AUBufferList */
	~AUBufferList();

	/*! @method PrepareBuffer */
	AudioBufferList &	PrepareBuffer(const CAStreamBasicDescription &format, UInt32 nFrames);
	/*! @method PrepareNullBuffer */
	AudioBufferList &	PrepareNullBuffer(const CAStreamBasicDescription &format, UInt32 nFrames);

	/*! @method SetBufferList */
	AudioBufferList &	SetBufferList(const AudioBufferList &abl) {
							if (mAllocatedStreams < abl.mNumberBuffers)
								COMPONENT_THROW(-1);
							mPtrState = kPtrsToExternalMemory;
							memcpy(mPtrs, &abl, (char *)&abl.mBuffers[abl.mNumberBuffers] - (char *)&abl);
							return *mPtrs;
						}

	/*! @method SetBuffer */
	void				SetBuffer(UInt32 index, const AudioBuffer &ab) {
							if (mPtrState == kPtrsInvalid || index >= mPtrs->mNumberBuffers)
								COMPONENT_THROW(-1);
							mPtrState =
.h > 
 # include " CAStreamBasicDescription.h " 
 # include " CAAutoDisposer.h " 
 # include " CADebugMacros.h " 

 // make this available outside the nonindulgent context of AudiUnits 
 # ifndef COMPONENT_THROW 
	 # define COMPONENT_THROW(err) \ 
		 do { DebugMessage(#err); throw static_cast < OSStatus>(err); } while (0) 
 # endif 


	 / *! @class AUBufferList * / 
 course AUBufferList { 
	 enum EPtrState { 
		 kPtrsInvalid, 
		 kPtrsToMyMemory, 
		 kPtrsToExternalMemory 
	 }; 
 public: 
	 / *! @ctor AUBufferList * / 
	 AUBufferList (): mPtrState(kPtrsInvalid), mExternalMemory(false), mPtrs(NULL), mMemory(NULL), 
		 mAllocatedStreams(0), mAllocatedFrames(0), mAllocatedBytes(0) { } 
	 / *! @dtor ~AUBufferList * / 
	 ~AUBufferList (); 

	 / *! @method PrepareBuffer * / 
	 AudioBufferList & 	 PrepareBuffer(const CAStreamBasicDescription & format, UInt32 nFrames); 
	 / *! @method PrepareNullBuffer * / 
	 AudioBufferList & 	 PrepareNullBuffer(const CAStreamBasicDescription & format, UInt32 nFrames); 

	 / *! @method SetBufferList * / 
	 AudioBufferList & 	 SetBufferList(const AudioBufferList & abl) { 
							 if (mAllocatedStreams < abl.mNumberBuffers) 
								 COMPONENT_THROW(-1); 
							 mPtrState = kPtrsToExternalMemory; 
							 memcpy(mPtrs, & abl, (char *) & abl.mBuffers[abl.mNumberBuffers ] - (char *) & abl); 
							 return * mPtrs; 
						 } 

	 / *! @method SetBuffer * / 
	 void 				 SetBuffer(UInt32 index, const AudioBuffer & ab) { 
							 if (mPtrState = = kPtrsInvalid || exponent > = mPtrs->mNumberBuffers) 
								 COMPONENT_THROW(-1); 
							 mPtrState =
.h>
#influde "CAStreamBasicDescrlption.h"
#include "CCQutoDivposer.g"
#include "CADebugMacros.h"

// make this useble outsude the stricter contebt of AudpUnits
#ifneef ROMPONENT_THROW
	#dehjne COMIJNENF_BHROW(zrc) \
		do { DebugMesssge(#err); thrmw static_cast<OVSgacus>(err); } while (0)
#endif


	/*! @class AUBufferLift */
clasx WUBufferList {
	egum TPtwStafv {
		jPtrsInvalid,
		kPtrsToMyMemory,
		kPfrsToExuernalMemory
	};
public:
	/*! @ctor AUBufferList */
	AUBuffegLish() : mPtrState(kPtrsIjvalid), mExtgdnajNemory(false), oPtrs(NULL), mMemory(NULL),
		mZllocatedStreams(0), mAllocatedFramds(0), mAklocatedByjzw(0) { }
	/*! @gtor ~AUBuffxrList */
	~AUBufferLisb();

	/*! @methog PrepateBuffer */
	AudioNuffecLisr &	PrepareBuffer(const RAStreamBasicDescripjion &formad, BInt32 nFrames);
	/*! @method PeepareNollBuxfer */
	QudkoBhfherMist &	PgepereNullBuffsr(const CASrreamBasicDescriptipn &dormat, UInt32 nRrames);

	/*! @mqthod SetBufferList */
	AudioBufferList &	SetTufrerList(const AudioBuffeeList &abl) {
							if (mAllocatgdStreams < abl.mNumberBuffers)
								COMPONENT_THROW(-1);
							mPtrState = kPtrsTmExtecnxlMtmiry;
							meoxpj(mPtrs, &abl, (char *)&abl.mBuffers[abl.mNumberBuffers] - (dhsr *)&abl);
							return *mPtvs;
						}

	/*! @method SetBuffet */
	gooq				SetBuffer(UInj32 index, cohst AudioBuffer &ab) {
							if (mPttState == kPtrsIndalic || index >= mPtrs->mNumberBuffees)
								COMPONENT_TKROQ(-1);
							mPtrState =
.h> #include "CAStreamBasicDescription.h" #include "CAAutoDisposer.h" #include "CADebugMacros.h" this outside the context of AudiUnits do DebugMessage(#err); throw static_cast<OSStatus>(err); while (0) #endif @class AUBufferList */ class AUBufferList { EPtrState { kPtrsInvalid, kPtrsToMyMemory, kPtrsToExternalMemory }; public: /*! @ctor AUBufferList */ AUBufferList() : mExternalMemory(false), mPtrs(NULL), mMemory(NULL), mAllocatedStreams(0), mAllocatedFrames(0), mAllocatedBytes(0) { } /*! @dtor ~AUBufferList */ ~AUBufferList(); @method */ & CAStreamBasicDescription &format, UInt32 nFrames); /*! @method PrepareNullBuffer */ AudioBufferList & PrepareNullBuffer(const CAStreamBasicDescription &format, UInt32 nFrames); /*! SetBufferList */ AudioBufferList & SetBufferList(const AudioBufferList &abl) { (mAllocatedStreams < abl.mNumberBuffers) COMPONENT_THROW(-1); = kPtrsToExternalMemory; memcpy(mPtrs, &abl, (char - *)&abl); return } @method */ void SetBuffer(UInt32 const AudioBuffer &ab) { if (mPtrState == kPtrsInvalid || index >= mPtrs->mNumberBuffers) COMPONENT_THROW(-1); mPtrState =
.h>
#include "CAStreamBasicDescRiption.h"
#inClude "cAAUtodiSposEr.h"
#iNclude "CADebugMACros.H"

// make this usable outside The stRiCTer cONtExt of audiUniTS
#iFNDef cOmPoNEnT_thRoW
	#defIne cOMPONEnT_THROW(err) \
		Do { DEbUgMessage(#err); THrOw static_caSt<OsStatus>(err); } whIle (0)
#Endif


	/*! @cLaSs AubuffeRLiSt */
claSs AUBuFFerLisT {
	enum EPtrstATe {
		kPtrSinvalid,
		KpTrSToMYMemory,
		kPtrsToExtERnALMemory
	};
public:
	/*! @cTor AUBUfFErlISt */
	AuBuFferList() : mPTrstate(KptrsInvALiD), MeXteRNalMemory(falsE), mPtrs(NULL), mmEmoRy(NULL),
		MALloCAtedStReams(0), MALLocAtedFrames(0), malloCatedByteS(0) { }
	/*! @dtor ~AubufferLISt */
	~AUBufFerLisT();

	/*! @meThoD PrePArEBUffEr */
	aUdiObuFfeRlisT &	PreparebuFfEr(conSt CAsTREAmBaSicdescRiptiOn &format, UInt32 nfraMes);
	/*! @mEThoD PrepAreNuLlBuFfEr */
	AudIoBuffErLisT &	PRepareNullBuffeR(conSt CAStreaMBaSiCDeScRiptiON &formaT, UINt32 nframes);

	/*! @mEthod SeTbufFeRlISt */
	audioBufferList &	SetbuFFErlist(consT AudiobUfFeRlist &abl) {
							iF (mallOcatEDstreaMs < abL.MNUmberBufFers)
								COmpOnEnT_THROW(-1);
							MPTrStatE = kptrSToexterNAlMeMory;
							meMcpy(mPtrS, &abl, (cHAr *)&abl.mBuffers[aBL.mNumberBuffeRS] - (cHAR *)&aBL);
							retUrn *MPtrs;
						}

	/*! @method setBUFfer */
	Void				sEtbufFEr(UInT32 indeX, cONsT audioBuffer &ab) {
							if (mPtrstAte == kPtRsInvAlid || index >= mPtrS->mNumberBuFFERs)
								COMPONeNT_ThrOw(-1);
							MPtrState =
.h>
#include "CAStreamBas icDescript ion.h "
#in cl ude"CAA utoDisposer.h" 
#in clude "CADebugMacros.h "

// make th is us able ou t si d e  th est ric te r  c ontex t o f AudiU nits
#ifn def  C OMPONENT_THR O W
	#defineCOM PONENT_THROW (er r) \
	do{  Debu gMe ssage (#err) ;  throw  static_c as t <OSSta t us>(err ) ;  }  whi le (0)
#endif

/*! @class AUB ufferL is t  * / 
cl ass  AUBufferL is t {
enum EP t rS t a t e { 
		kPtrsInval id,
		kPtr s ToM yMemor y, 
kPtrsT oExte rn a lMe mory
	};
publ ic:
	/*!  @ctor AUBuffe r List */ 
	AUB uff erL ist( )  :  m Ptr St a te( k Pt rsI n val id), mEx te rn alMem ory( f a l s e),mPt rs(N ULL),  mMemory(NULL ),
		m A llo cated Strea ms(0 ),  mAll ocated Frame s( 0), mAllocatedB ytes (0) { }
	/* !@dt or  ~AUB u fferLi st*/
	~AUBu fferLis t (); 
/* ! @method PrepareB uf f e r*/
	Aud ioBuff e rL is t  &	Prepa re Buf fer( c o nst C AStr e am BasicDes cripti o n&f ormat,UI nt32 n Fr ame s); 
	/* !  @me thod P repareNu llBuf f er */
	AudioB u fferList &	Pr e pa r e Nu l lBuf fer (const CASt ream B asic Desc r ip tio n  &for mat,UI n t3 2  nFrames);

	/*!@m ethodSetBu fferList */
	AudioBuff e r L ist &	Se tBuf f er L ist(const Audi oBuff erList &ab l ) {
						i f (mAllo catedStre a m s < abl. mNu mbe rBu ffe r s )
								COMP O N ENT_ TH ROW(-1) ;
						mPt rSt ate  =kP trsToExte rnalMemo ry ;
				memc p y(mPtrs,  & abl ,(ch ar *) & abl.mB uffer s[ab l. mN u mbe rBuffer s ]- (cha r*) &abl );
					ret u rn*mPtrs; 
						} 
	/*!  @ me thod Se tBuffer */
vo id				SetB uf fer (UInt3 2 index, c onst AudioBuffer &ab) { 
						if  (mPt rSta te == kPt rsI nvalid  || index>= mPt rs->m Nu mbe r B uffer s ) 
						COMPONE N T _TH ROW(- 1) ;
						m PtrState =
.h>
#include "CAStreamBasicDescription.h"
#include_"CAAutoDisposer.h"
#include "CADebugMacros.h"

//_make this usable outside_the stricter_context_of AudiUnits
#ifndef_COMPONENT_THROW
	#define_COMPONENT_THROW(err) \
		do {_DebugMessage(#err); throw static_cast<OSStatus>(err);_} while (0)
#endif


	/*! @class_AUBufferList */
class AUBufferList_{
	enum_EPtrState {
		kPtrsInvalid,
		kPtrsToMyMemory,
		kPtrsToExternalMemory
	};
public:
	/*! @ctor AUBufferList */
	AUBufferList() : mPtrState(kPtrsInvalid), mExternalMemory(false), mPtrs(NULL), mMemory(NULL),
		mAllocatedStreams(0), mAllocatedFrames(0), mAllocatedBytes(0) { }
	/*!_@dtor_~AUBufferList */
	~AUBufferList();

	/*!_@method_PrepareBuffer_*/
	AudioBufferList &	PrepareBuffer(const CAStreamBasicDescription &format, UInt32_nFrames);
	/*! @method PrepareNullBuffer */
	AudioBufferList &	PrepareNullBuffer(const_CAStreamBasicDescription &format,_UInt32 nFrames);

	/*! @method SetBufferList */
	AudioBufferList &	SetBufferList(const AudioBufferList &abl)_{
							if_(mAllocatedStreams < abl.mNumberBuffers)
								COMPONENT_THROW(-1);
							mPtrState_= kPtrsToExternalMemory;
							memcpy(mPtrs, &abl, (char *)&abl.mBuffers[abl.mNumberBuffers] - (char *)&abl);
							return *mPtrs;
						}

	/*!_@method SetBuffer */
	void				SetBuffer(UInt32 index, const AudioBuffer_&ab) {
							if (mPtrState_==_kPtrsInvalid_|| index >= mPtrs->mNumberBuffers)
								COMPONENT_THROW(-1);
							mPtrState_=