summaryrefslogtreecommitdiff
path: root/libs/appleutility
diff options
context:
space:
mode:
authorRobin Gareus <robin@gareus.org>2015-10-05 16:17:49 +0200
committerRobin Gareus <robin@gareus.org>2015-10-05 16:17:49 +0200
commit22b07e0233a29d9633ffa825a79503befaf2e16e (patch)
tree1d8b06056f8e12197158f5d906319767d3dedda5 /libs/appleutility
parente11ba7b79d68bc1070b170236c22123966d7bcc3 (diff)
NOOP, remove trailing tabs/whitespace.
Diffstat (limited to 'libs/appleutility')
-rw-r--r--libs/appleutility/AUOutputBL.cpp18
-rw-r--r--libs/appleutility/AUOutputBL.h18
-rw-r--r--libs/appleutility/AUParamInfo.cpp18
-rw-r--r--libs/appleutility/AUParamInfo.h24
-rw-r--r--libs/appleutility/CAAUParameter.cpp28
-rw-r--r--libs/appleutility/CAAUParameter.h36
-rw-r--r--libs/appleutility/CAAudioChannelLayout.cpp6
-rw-r--r--libs/appleutility/CAAudioChannelLayout.h30
-rw-r--r--libs/appleutility/CAAudioChannelLayoutObject.cpp18
-rw-r--r--libs/appleutility/CAAudioFile.cpp102
-rw-r--r--libs/appleutility/CAAudioFile.h68
-rw-r--r--libs/appleutility/CAAudioUnit.cpp132
-rw-r--r--libs/appleutility/CAAudioUnit.h82
-rw-r--r--libs/appleutility/CABufferList.cpp10
-rw-r--r--libs/appleutility/CABufferList.h48
-rw-r--r--libs/appleutility/CACFDictionary.cpp112
-rw-r--r--libs/appleutility/CACFDictionary.h22
-rw-r--r--libs/appleutility/CACFNumber.cpp4
-rw-r--r--libs/appleutility/CACFNumber.h2
-rw-r--r--libs/appleutility/CACFString.cpp4
-rw-r--r--libs/appleutility/CACFString.h6
-rw-r--r--libs/appleutility/CAComponent.cpp24
-rw-r--r--libs/appleutility/CAComponent.h32
-rw-r--r--libs/appleutility/CAComponentDescription.cpp12
-rw-r--r--libs/appleutility/CAComponentDescription.h34
-rw-r--r--libs/appleutility/CADebugMacros.h10
-rw-r--r--libs/appleutility/CAMath.h2
-rw-r--r--libs/appleutility/CAReferenceCounted.h6
-rw-r--r--libs/appleutility/CAStreamBasicDescription.cpp70
-rw-r--r--libs/appleutility/CAStreamBasicDescription.h36
-rw-r--r--libs/appleutility/CAXException.cpp2
-rw-r--r--libs/appleutility/CAXException.h18
32 files changed, 517 insertions, 517 deletions
diff --git a/libs/appleutility/AUOutputBL.cpp b/libs/appleutility/AUOutputBL.cpp
index 026989afc4..3e6444855a 100644
--- a/libs/appleutility/AUOutputBL.cpp
+++ b/libs/appleutility/AUOutputBL.cpp
@@ -37,7 +37,7 @@
*/
/*=============================================================================
AUOutputBL.h
-
+
=============================================================================*/
#include "AUOutputBL.h"
@@ -79,7 +79,7 @@ AUOutputBL::~AUOutputBL()
void AUOutputBL::Prepare (UInt32 inNumFrames, bool inWantNullBufferIfAllocated)
{
UInt32 channelsPerBuffer = mFormat.IsInterleaved() ? mFormat.NumberChannels() : 1;
-
+
if (mBufferMemory == NULL || inWantNullBufferIfAllocated)
{
mBufferList->mNumberBuffers = mNumberBuffers;
@@ -95,7 +95,7 @@ void AUOutputBL::Prepare (UInt32 inNumFrames, bool inWantNullBufferIfAllocated)
UInt32 nBytes = mFormat.FramesToBytes (inNumFrames);
if ((nBytes * mNumberBuffers) > AllocatedBytes())
throw OSStatus(-10874);//(kAudioUnitErr_TooManyFramesToProcess);
-
+
mBufferList->mNumberBuffers = mNumberBuffers;
AudioBuffer *buf = &mBufferList->mBuffers[0];
Byte* p = mBufferMemory;
@@ -114,25 +114,25 @@ void AUOutputBL::Allocate (UInt32 inNumFrames)
if (inNumFrames)
{
UInt32 nBytes = mFormat.FramesToBytes (inNumFrames);
-
+
if (nBytes <= AllocatedBytes())
return;
-
+
// align successive buffers for Altivec and to take alternating
// cache line hits by spacing them by odd multiples of 16
if (mNumberBuffers > 1)
nBytes = (nBytes + (0x10 - (nBytes & 0xF))) | 0x10;
-
+
mBufferSize = nBytes;
-
+
UInt32 memorySize = mBufferSize * mNumberBuffers;
Byte *newMemory = new Byte[memorySize];
memset(newMemory, 0, memorySize); // make buffer "hot"
-
+
Byte *oldMemory = mBufferMemory;
mBufferMemory = newMemory;
delete[] oldMemory;
-
+
mFrames = inNumFrames;
}
else
diff --git a/libs/appleutility/AUOutputBL.h b/libs/appleutility/AUOutputBL.h
index e76d1bfe28..39887b6a3f 100644
--- a/libs/appleutility/AUOutputBL.h
+++ b/libs/appleutility/AUOutputBL.h
@@ -37,7 +37,7 @@
*/
/*=============================================================================
AUOutputBL.h
-
+
=============================================================================*/
#ifndef __AUOutputBL_h__
@@ -61,10 +61,10 @@
class AUOutputBL {
public:
-
+
// you CANNOT use one of these - it will crash!
// AUOutputBL ();
-
+
// this is the constructor that you use
// it can't be reset once you've constructed it
AUOutputBL (const CAStreamBasicDescription &inDesc, UInt32 inDefaultNumFrames = 512);
@@ -74,29 +74,29 @@ public:
{
Prepare (mFrames);
}
-
+
// this version can throw if this is an allocted ABL and inNumFrames is > AllocatedFrames()
// you can set the bool to true if you want a NULL buffer list even if allocated
// inNumFrames must be a valid number (will throw if inNumFrames is 0)
void Prepare (UInt32 inNumFrames, bool inWantNullBufferIfAllocated = false);
-
+
AudioBufferList* ABL() { return mBufferList; }
-
+
// You only need to call this if you want to allocate a buffer list
// if you want an empty buffer list, just call Prepare()
// if you want to dispose previously allocted memory, pass in 0
// then you either have an empty buffer list, or you can re-allocate
// Memory is kept around if an Allocation request is less than what is currently allocated
void Allocate (UInt32 inNumberFrames);
-
+
UInt32 AllocatedFrames() const { return mFrames; }
-
+
const CAStreamBasicDescription& GetFormat() const { return mFormat; }
#if DEBUG
void Print();
#endif
-
+
private:
UInt32 AllocatedBytes () const { return (mBufferSize * mNumberBuffers); }
diff --git a/libs/appleutility/AUParamInfo.cpp b/libs/appleutility/AUParamInfo.cpp
index 15cee0fa34..6379e5642c 100644
--- a/libs/appleutility/AUParamInfo.cpp
+++ b/libs/appleutility/AUParamInfo.cpp
@@ -37,7 +37,7 @@
*/
/*=============================================================================
AUParamInfo.cpp
-
+
=============================================================================*/
#include "AUParamInfo.h"
#include "CAXException.h"
@@ -56,14 +56,14 @@ AUParamInfo::AUParamInfo (AudioUnit inAU,
UInt32 size;
OSStatus result = AudioUnitGetPropertyInfo(mAU, kAudioUnitProperty_ParameterList, inScope, mElement, &size, NULL);
if (size == 0 || result) return;
-
+
int nparams = size / sizeof(AudioUnitPropertyID);
mParamListID = new AudioUnitParameterID[nparams];
memset (mParamListID, 0xFF, size);
AudioUnitParameterID *paramList = new AudioUnitParameterID[nparams];
-
+
result = AudioUnitGetProperty(mAU, kAudioUnitProperty_ParameterList, mScope, mElement, paramList, &size);
if (result) {
delete [] mParamListID;
@@ -71,13 +71,13 @@ AUParamInfo::AUParamInfo (AudioUnit inAU,
mParamListID = NULL;
return;
}
-
+
ParameterMap params;
for (int i = 0; i < nparams; ++i)
{
CAAUParameter auvp (mAU, paramList[i], mScope, mElement); // took out only using global scope in CAAUParameter creation
const AudioUnitParameterInfo &paramInfo = auvp.ParamInfo();
-
+
// don't include if parameter can't be read or written
if (!(paramInfo.flags & kAudioUnitParameterFlag_IsWritable)
&& !(paramInfo.flags & kAudioUnitParameterFlag_IsReadable))
@@ -86,18 +86,18 @@ AUParamInfo::AUParamInfo (AudioUnit inAU,
// only include if expert params wanted
if (!inIncludeExpert && auvp.IsExpert())
continue;
-
+
// only include if read only params are wanted
if (!(paramInfo.flags & kAudioUnitParameterFlag_IsWritable)
&& (paramInfo.flags & kAudioUnitParameterFlag_IsReadable))
- {
+ {
if (!inIncludeReadOnly)
continue;
}
-
+
mParamListID[mNumParams] = paramList[i];
mNumParams++;
-
+
// ok - if we're here, then we have a parameter we are going to display.
UInt32 clump = 0;
auvp.GetClumpID (clump);
diff --git a/libs/appleutility/AUParamInfo.h b/libs/appleutility/AUParamInfo.h
index b5f7c26345..e20e14b259 100644
--- a/libs/appleutility/AUParamInfo.h
+++ b/libs/appleutility/AUParamInfo.h
@@ -37,7 +37,7 @@
*/
/*=============================================================================
AUParamInfo.h
-
+
=============================================================================*/
#include <map>
#include <vector>
@@ -48,7 +48,7 @@
The ParameterMap returned by the Map() method is a map where
- the key is the clumpID
- the value is a ParameterList (vector<CAAUParameter>)
-
+
If you have parameters on multiple scopes (or elements within a scope), then you should create one of these
for each scope-element pair
*/
@@ -66,40 +66,40 @@ public:
bool inIncludeReadOnly,
AudioUnitScope inScope = kAudioUnitScope_Global,
AudioUnitElement inElement = 0);
-
+
~AUParamInfo();
-
+
const ParameterMap& Map () const { return mParams; }
-
+
// some convenience methods
UInt32 NumParams () const { return mNumParams; }
-
+
AudioUnitParameterID ParamID (UInt32 inIndex) const
{
if (inIndex < mNumParams) return mParamListID[inIndex];
return 0xFFFFFFFF;
}
-
+
UInt32 NumClumps () const { return mParams.size(); }
UInt32 NumParamsForClump (UInt32 inClump) const;
-
+
// returns NULL if there's no info for the parameter
const CAAUParameter* GetParamInfo (AudioUnitParameterID inParamID) const;
-
+
AudioUnitScope GetScope () const { return mScope; }
AudioUnitElement GetElement () const { return mElement; }
-
+
private:
AudioUnit mAU;
UInt32 mNumParams;
AudioUnitParameterID * mParamListID;
-
+
ParameterMap mParams;
AudioUnitScope mScope;
AudioUnitElement mElement;
-
+
// disallow
AUParamInfo () {}
AUParamInfo (const AUParamInfo &) {}
diff --git a/libs/appleutility/CAAUParameter.cpp b/libs/appleutility/CAAUParameter.cpp
index 1050ecfe1b..4953a3cd23 100644
--- a/libs/appleutility/CAAUParameter.cpp
+++ b/libs/appleutility/CAAUParameter.cpp
@@ -37,7 +37,7 @@
*/
/*=============================================================================
CAAUParameter.cpp
-
+
=============================================================================*/
#include "CAAUParameter.h"
@@ -70,13 +70,13 @@ CAAUParameter & CAAUParameter::operator = (const CAAUParameter &a)
if (mParamName) CFRelease(mParamName);
if (mParamTag) CFRelease(mParamTag);
if (mNamedParams) CFRelease(mNamedParams);
-
+
memcpy(this, &a, sizeof(CAAUParameter));
if (mParamName) CFRetain(mParamName);
if (mParamTag) CFRetain(mParamTag);
if (mNamedParams) CFRetain(mNamedParams);
-
+
return *this;
}
@@ -93,7 +93,7 @@ void CAAUParameter::Init (AudioUnit au, AudioUnitParameterID param, AudioUnitSc
mParameterID = param;
mScope = scope;
mElement = element;
-
+
UInt32 propertySize = sizeof(mParamInfo);
OSStatus err = AudioUnitGetProperty(au, kAudioUnitProperty_ParameterInfo,
scope, param, &mParamInfo, &propertySize);
@@ -105,7 +105,7 @@ void CAAUParameter::Init (AudioUnit au, AudioUnitParameterID param, AudioUnitSc
CFRetain (mParamName);
} else
mParamName = CFStringCreateWithCString(NULL, mParamInfo.name, kCFStringEncodingUTF8);
-
+
char* str = 0;
switch (mParamInfo.unit)
{
@@ -204,7 +204,7 @@ void CAAUParameter::Init (AudioUnit au, AudioUnitParameterID param, AudioUnitSc
str = NULL;
break;
}
-
+
if (str)
mParamTag = CFStringCreateWithCString(NULL, str, kCFStringEncodingUTF8);
else
@@ -239,18 +239,18 @@ CFStringRef CAAUParameter::GetStringFromValueCopy(const Float32 *value) const
stringValue.inValue = value;
stringValue.outString = NULL;
UInt32 propertySize = sizeof(stringValue);
-
+
OSStatus err = AudioUnitGetProperty (mAudioUnit,
kAudioUnitProperty_ParameterStringFromValue,
mScope,
mParameterID,
&stringValue,
&propertySize);
-
+
if (err == noErr && stringValue.outString != NULL)
return stringValue.outString;
}
-
+
Float32 val = (value == NULL ? GetValue() : *value);
char valstr[32];
AUParameterFormatValue (val, this, valstr, 4);
@@ -265,19 +265,19 @@ Float32 CAAUParameter::GetValueFromString(CFStringRef str) const
valueString.inParamID = mParameterID;
valueString.inString = str;
UInt32 propertySize = sizeof(valueString);
-
+
OSStatus err = AudioUnitGetProperty (mAudioUnit,
kAudioUnitProperty_ParameterValueFromString,
mScope,
mParameterID,
&valueString,
&propertySize);
-
+
if (err == noErr) {
return valueString.outValue;
}
}
-
+
Float32 paramValue = mParamInfo.defaultValue;
char valstr[32];
CFStringGetCString(str, valstr, sizeof(valstr), kCFStringEncodingUTF8);
@@ -304,12 +304,12 @@ void CAAUParameter::Print() const
{
UInt32 clump = 0;
GetClumpID (clump);
-
+
UInt32 len = CFStringGetLength(mParamName);
char* chars = (char*)malloc (len * 2); // give us plenty of room for unichar chars
if (!CFStringGetCString (mParamName, chars, len * 2, kCFStringEncodingUTF8))
chars[0] = 0;
-
+
printf ("ID: %ld, Clump: %ld, Name: %s\n", mParameterID, clump, chars);
free (chars);
}
diff --git a/libs/appleutility/CAAUParameter.h b/libs/appleutility/CAAUParameter.h
index 143a798006..82d75e560b 100644
--- a/libs/appleutility/CAAUParameter.h
+++ b/libs/appleutility/CAAUParameter.h
@@ -37,7 +37,7 @@
*/
/*=============================================================================
CAAUParameter.h
-
+
=============================================================================*/
#ifndef __CAAUParameter_h__
@@ -61,7 +61,7 @@ public:
CAAUParameter(const CAAUParameter &a);
/*! @dtor ~CAAUParameter */
~CAAUParameter();
-
+
/*! @method operator <@ */
bool operator < (const CAAUParameter &a) const
{
@@ -73,23 +73,23 @@ public:
{
return !memcmp(this, &a, sizeof(AudioUnitParameter));
}
-
+
/*! @method operator =@ */
CAAUParameter & operator = (const CAAUParameter &a);
-
+
/*! @method GetValue */
Float32 GetValue() const;
/*! @method SetValue */
void SetValue( AUParameterListenerRef inListener,
void * inObject,
Float32 inValue) const;
-
+
/*! @method GetName */
CFStringRef GetName() const { return mParamName; }
// borrowed reference!
/*! @method GetStringFromValueCopy */
- CFStringRef GetStringFromValueCopy(const Float32 *value = NULL) const;
+ CFStringRef GetStringFromValueCopy(const Float32 *value = NULL) const;
// returns a copy of the name of the current parameter value
// or null if there is no name associated
// caller must release
@@ -98,13 +98,13 @@ public:
{
return (mParamInfo.flags & kAudioUnitParameterFlag_ValuesHaveStrings) != 0;
}
-
+
/*! @method GetValueFromString */
- Float32 GetValueFromString (CFStringRef str) const;
+ Float32 GetValueFromString (CFStringRef str) const;
// caller must release
/*! @method ParamInfo */
- const AudioUnitParameterInfo &
+ const AudioUnitParameterInfo &
ParamInfo() const { return mParamInfo; }
/*! @method GetParamTag */
@@ -120,16 +120,16 @@ public:
? (CFStringRef) CFArrayGetValueAtIndex(mNamedParams, inIndex)
: 0;
}
-
+
/*! @method GetNumIndexedParams */
int GetNumIndexedParams () const { return mNumIndexedParams; }
-
+
/*! @method IsIndexedParam */
bool IsIndexedParam () const { return mNumIndexedParams != 0; }
-
+
/*! @method HasNamedParams */
bool HasNamedParams () const { return IsIndexedParam() && mNamedParams; }
-
+
/*! @method GetClumpID */
bool GetClumpID (UInt32 &outClumpID) const
{
@@ -139,7 +139,7 @@ public:
}
return false;
}
-
+
/*! @method HasDisplayTransformation */
bool HasDisplayTransformation () const
{
@@ -154,14 +154,14 @@ public:
#if DEBUG
void Print () const;
#endif
-
+
// these methods are defined in CAPersistence.cpp
// they will persist and restore only the scope, element and param ID's of the AudioUnitParameter
// however, this is sufficient to be able to save/restore a CAAUParameter object
void Save (CFPropertyListRef &outData) const;
-
+
static void Save (const AudioUnitParameter &inParam, CFPropertyListRef &outData);
-
+
static OSStatus Restore (const CFPropertyListRef inData, AudioUnitParameter &outParam);
protected:
@@ -176,7 +176,7 @@ protected:
short mNumIndexedParams;
/*! @var mNamedParams */
CFArrayRef mNamedParams;
-
+
private:
void Init (AudioUnit au, AudioUnitParameterID param, AudioUnitScope scope, AudioUnitElement element);
diff --git a/libs/appleutility/CAAudioChannelLayout.cpp b/libs/appleutility/CAAudioChannelLayout.cpp
index 585ff44fb7..5ca0b76ca0 100644
--- a/libs/appleutility/CAAudioChannelLayout.cpp
+++ b/libs/appleutility/CAAudioChannelLayout.cpp
@@ -90,10 +90,10 @@ bool operator== (const AudioChannelLayout &x, const AudioChannelLayout &y)
// (this may be too strict a comparison if all you care about are matching layout tags)
UInt32 theSize1 = CAAudioChannelLayout::CalculateByteSize(x.mNumberChannelDescriptions);
UInt32 theSize2 = CAAudioChannelLayout::CalculateByteSize(y.mNumberChannelDescriptions);
-
+
if (theSize1 != theSize2)
return false;
-
+
return !memcmp (&x, &y, theSize1);
}
@@ -115,7 +115,7 @@ UInt32 CAAudioChannelLayout::NumberChannels (const AudioChannelLayout& inLayout)
{
if (inLayout.mChannelLayoutTag == kAudioChannelLayoutTag_UseChannelDescriptions)
return inLayout.mNumberChannelDescriptions;
-
+
if (inLayout.mChannelLayoutTag == kAudioChannelLayoutTag_UseChannelBitmap)
return CountOnes (inLayout.mChannelBitmap);
diff --git a/libs/appleutility/CAAudioChannelLayout.h b/libs/appleutility/CAAudioChannelLayout.h
index 7db75ad7e0..388f087ef9 100644
--- a/libs/appleutility/CAAudioChannelLayout.h
+++ b/libs/appleutility/CAAudioChannelLayout.h
@@ -81,9 +81,9 @@ public:
}
static void SetAllToUnknown(AudioChannelLayout& outChannelLayout, UInt32 inNumberChannelDescriptions);
static UInt32 NumberChannels(const AudioChannelLayout& inLayout);
-
+
#if !HAL_Build
-// object methods
+// object methods
public:
CAAudioChannelLayout ();
@@ -96,7 +96,7 @@ public:
CAAudioChannelLayout (const CAAudioChannelLayout &c);
CAAudioChannelLayout (const AudioChannelLayout* inChannelLayout);
~CAAudioChannelLayout();
-
+
CAAudioChannelLayout& operator= (const AudioChannelLayout* inChannelLayout);
CAAudioChannelLayout& operator= (const CAAudioChannelLayout& c);
bool operator== (const CAAudioChannelLayout &c) const;
@@ -105,19 +105,19 @@ public:
bool IsValid() const { return NumberChannels() > 0; }
UInt32 Size() const { return mLayoutHolder ? mLayoutHolder->Size() : 0; }
-
+
UInt32 NumberChannels() const { return NumberChannels(Layout()); }
-
+
AudioChannelLayoutTag Tag() const { return Layout().mChannelLayoutTag; }
const AudioChannelLayout& Layout() const { return mLayoutHolder->Layout(); }
operator const AudioChannelLayout *() const { return &Layout(); }
-
+
void Print () const { Print (stdout); }
void Print (FILE* file) const;
OSStatus Save (CFPropertyListRef *outData) const;
OSStatus Restore (CFPropertyListRef &inData);
-
+
private:
class ACLRefCounter : public CAReferenceCounted {
public:
@@ -125,35 +125,35 @@ private:
{
if (inDataSize < offsetof(AudioChannelLayout, mChannelDescriptions))
inDataSize = offsetof(AudioChannelLayout, mChannelDescriptions);
-
+
mLayout = static_cast<AudioChannelLayout*>(malloc (inDataSize));
memset (mLayout, 0, inDataSize);
mByteSize = inDataSize;
}
-
+
const AudioChannelLayout & Layout() const { return *mLayout; }
-
+
UInt32 Size () const { return mByteSize; }
-
+
private:
AudioChannelLayout *mLayout;
UInt32 mByteSize;
-
+
// only the constructors can change the actual state of the layout
friend CAAudioChannelLayout::CAAudioChannelLayout (UInt32 inNumberChannels, bool inChooseSurround);
friend OSStatus CAAudioChannelLayout::Restore (CFPropertyListRef &inData);
friend CAAudioChannelLayout& CAAudioChannelLayout::operator= (const AudioChannelLayout* inChannelLayout);
friend void CAAudioChannelLayout::SetWithTag(AudioChannelLayoutTag inTag);
-
+
AudioChannelLayout * GetLayout() { return mLayout; }
~ACLRefCounter() { if (mLayout) { free(mLayout); mLayout = NULL; } }
-
+
private:
ACLRefCounter () : mLayout(NULL) { }
ACLRefCounter(const ACLRefCounter& other) : CAReferenceCounted (other), mLayout(NULL) { }
ACLRefCounter& operator=(const ACLRefCounter&) { return *this; }
};
-
+
ACLRefCounter *mLayoutHolder;
#endif // HAL_Build
diff --git a/libs/appleutility/CAAudioChannelLayoutObject.cpp b/libs/appleutility/CAAudioChannelLayoutObject.cpp
index 64a452d6b6..9e3cf586e9 100644
--- a/libs/appleutility/CAAudioChannelLayoutObject.cpp
+++ b/libs/appleutility/CAAudioChannelLayoutObject.cpp
@@ -59,16 +59,16 @@ CAAudioChannelLayout::CAAudioChannelLayout ()
// CAAudioChannelLayout::CAAudioChannelLayout
//=============================================================================
CAAudioChannelLayout::CAAudioChannelLayout (UInt32 inNumberChannels, bool inChooseSurround)
-{
+{
// this chooses default layouts based on the number of channels...
UInt32 theSize = CalculateByteSize (inNumberChannels);
-
+
mLayoutHolder = new ACLRefCounter (theSize);
-
+
AudioChannelLayout* layout = mLayoutHolder->GetLayout();
layout->mNumberChannelDescriptions = inNumberChannels;
-
+
switch (inNumberChannels)
{
case 1:
@@ -148,11 +148,11 @@ CAAudioChannelLayout& CAAudioChannelLayout::operator= (const CAAudioChannelLayou
if (mLayoutHolder != c.mLayoutHolder) {
if (mLayoutHolder)
mLayoutHolder->release();
-
+
if ((mLayoutHolder = c.mLayoutHolder) != NULL)
mLayoutHolder->retain();
}
-
+
return *this;
}
@@ -162,9 +162,9 @@ CAAudioChannelLayout& CAAudioChannelLayout::operator= (const AudioChannelLayout*
mLayoutHolder->release();
UInt32 theSize = CalculateByteSize (inChannelLayout->mNumberChannelDescriptions);
-
+
mLayoutHolder = new ACLRefCounter (theSize);
-
+
memcpy(mLayoutHolder->mLayout, inChannelLayout, theSize);
return *this;
}
@@ -173,7 +173,7 @@ void CAAudioChannelLayout::SetWithTag(AudioChannelLayoutTag inTag)
{
if (mLayoutHolder)
mLayoutHolder->release();
-
+
mLayoutHolder = new ACLRefCounter(offsetof(AudioChannelLayout, mChannelDescriptions[0]));
AudioChannelLayout* layout = mLayoutHolder->GetLayout();
layout->mChannelLayoutTag = inTag;
diff --git a/libs/appleutility/CAAudioFile.cpp b/libs/appleutility/CAAudioFile.cpp
index 1e97de6211..148565e7fb 100644
--- a/libs/appleutility/CAAudioFile.cpp
+++ b/libs/appleutility/CAAudioFile.cpp
@@ -37,7 +37,7 @@
*/
/*=============================================================================
CAAudioFile.cpp
-
+
=============================================================================*/
#include "CAAudioFile.h"
@@ -88,13 +88,13 @@
if (sIndent == 0)
printf("\n");
}
-
+
static void Indent() {
for (int i = sIndent; --i >= 0; ) {
putchar(' '); putchar(' ');
}
}
-
+
const char *mName;
static int sIndent;
};
@@ -126,7 +126,7 @@ CAAudioFile::CAAudioFile() :
mMode(kClosed),
mFileDataOffset(-1),
mFramesToSkipFollowingSeek(0),
-
+
mClientOwnsIOBuffer(false),
mPacketDescs(NULL),
mNumPacketDescs(0),
@@ -229,7 +229,7 @@ void CAAudioFile::CreateNew(const FSRef &parentDir, CFStringRef filename, AudioF
{
LOG_FUNCTION("CAAudioFile::CreateNew", "%p", this);
XThrowIf(mMode != kClosed, kExtAudioFileError_InvalidOperationOrder, "file already open");
-
+
mFileDataFormat = dataFormat;
if (layout) {
mFileChannelLayout = layout;
@@ -249,15 +249,15 @@ void CAAudioFile::FileFormatChanged(const FSRef *parentDir, CFStringRef filename
{
LOG_FUNCTION("CAAudioFile::FileFormatChanged", "%p", this);
XThrowIf(mMode != kPreparingToCreate && mMode != kPreparingToWrite, kExtAudioFileError_InvalidOperationOrder, "new file not prepared");
-
+
UInt32 propertySize;
OSStatus err;
AudioStreamBasicDescription saveFileDataFormat = mFileDataFormat;
-
+
#if VERBOSE_CONVERTER
mFileDataFormat.PrintFormat(stdout, "", "Specified file data format");
#endif
-
+
// Find out the actual format the converter will produce. This is necessary in
// case the bitrate has forced a lower sample rate, which needs to be set correctly
// in the stream description passed to AudioFileCreate.
@@ -286,7 +286,7 @@ void CAAudioFile::FileFormatChanged(const FSRef *parentDir, CFStringRef filename
free(layout);
}
}
-
+
// create the output file
if (mMode == kPreparingToCreate) {
CAStreamBasicDescription newFileDataFormat = mFileDataFormat;
@@ -314,12 +314,12 @@ void CAAudioFile::FileFormatChanged(const FSRef *parentDir, CFStringRef filename
if (mConverter != NULL) {
// encoder
- // get the magic cookie, if any, from the converter
+ // get the magic cookie, if any, from the converter
delete[] mMagicCookie; mMagicCookie = NULL;
mMagicCookieSize = 0;
err = AudioConverterGetPropertyInfo(mConverter, kAudioConverterCompressionMagicCookie, &propertySize, NULL);
-
+
// we can get a noErr result and also a propertySize == 0
// -- if the file format does support magic cookies, but this file doesn't have one.
if (err == noErr && propertySize > 0) {
@@ -338,7 +338,7 @@ void CAAudioFile::FileFormatChanged(const FSRef *parentDir, CFStringRef filename
XThrowIfError(AudioFileSetProperty(mAudioFile, kAudioFilePropertyMagicCookieData, mMagicCookieSize, mMagicCookie), "set audio file's magic cookie");
}
}
-
+
// get maximum packet size
propertySize = sizeof(UInt32);
XThrowIfError(AudioConverterGetProperty(mConverter, kAudioConverterPropertyMaximumOutputPacketSize, &propertySize, &mFileMaxPacketSize), "get audio converter's maximum output packet size");
@@ -347,7 +347,7 @@ void CAAudioFile::FileFormatChanged(const FSRef *parentDir, CFStringRef filename
} else {
InitFileMaxPacketSize();
}
-
+
if (mFileChannelLayout.IsValid() && mFileChannelLayout.NumberChannels() > 2) {
// don't bother tagging mono/stereo files
UInt32 isWritable;
@@ -366,7 +366,7 @@ void CAAudioFile::FileFormatChanged(const FSRef *parentDir, CFStringRef filename
#endif
}
}
-
+
UpdateClientMaxPacketSize(); // also sets mFrame0Offset
mPacketMark = 0;
mFrameMark = 0;
@@ -429,11 +429,11 @@ void CAAudioFile::GetExistingFileInfo()
LOG_FUNCTION("CAAudioFile::GetExistingFileInfo", "%p", this);
UInt32 propertySize;
OSStatus err;
-
+
// get mFileDataFormat
propertySize = sizeof(AudioStreamBasicDescription);
XThrowIfError(AudioFileGetProperty(mAudioFile, kAudioFilePropertyDataFormat, &propertySize, &mFileDataFormat), "get audio file's data format");
-
+
// get mFileChannelLayout
err = AudioFileGetPropertyInfo(mAudioFile, kAudioFilePropertyChannelLayout, &propertySize, NULL);
if (err == noErr && propertySize > 0) {
@@ -450,7 +450,7 @@ void CAAudioFile::GetExistingFileInfo()
}
if (mMode != kReading)
return;
-
+
#if 0
// get mNumberPackets
propertySize = sizeof(mNumberPackets);
@@ -459,7 +459,7 @@ void CAAudioFile::GetExistingFileInfo()
printf("CAAudioFile::GetExistingFileInfo: %qd packets\n", mNumberPackets);
#endif
#endif
-
+
// get mMagicCookie
err = AudioFileGetPropertyInfo(mAudioFile, kAudioFilePropertyMagicCookieData, &propertySize, NULL);
if (err == noErr && propertySize > 0) {
@@ -470,7 +470,7 @@ void CAAudioFile::GetExistingFileInfo()
InitFileMaxPacketSize();
mPacketMark = 0;
mFrameMark = 0;
-
+
UpdateClientMaxPacketSize();
}
@@ -495,9 +495,9 @@ void CAAudioFile::SetClientFormat(const CAStreamBasicDescription &dataFormat, co
{
LOG_FUNCTION("CAAudioFile::SetClientFormat", "%p", this);
XThrowIf(!dataFormat.IsPCM(), kExtAudioFileError_NonPCMClientFormat, "non-PCM client format on audio file");
-
+
bool dataFormatChanging = (mClientDataFormat.mFormatID == 0 || mClientDataFormat != dataFormat);
-
+
if (dataFormatChanging) {
CloseConverter();
if (mWriteBufferList) {
@@ -506,12 +506,12 @@ void CAAudioFile::SetClientFormat(const CAStreamBasicDescription &dataFormat, co
}
mClientDataFormat = dataFormat;
}
-
+
if (layout && layout->IsValid()) {
XThrowIf(layout->NumberChannels() != mClientDataFormat.NumberChannels(), kExtAudioFileError_InvalidChannelMap, "inappropriate channel map");
mClientChannelLayout = *layout;
}
-
+
bool differentLayouts;
if (mClientChannelLayout.IsValid()) {
if (mFileChannelLayout.IsValid()) {
@@ -534,7 +534,7 @@ void CAAudioFile::SetClientFormat(const CAStreamBasicDescription &dataFormat, co
printf("two invalid layouts\n");
#endif
}
-
+
if (mClientDataFormat != mFileDataFormat || differentLayouts) {
// We need an AudioConverter.
if (mMode == kReading) {
@@ -545,7 +545,7 @@ void CAAudioFile::SetClientFormat(const CAStreamBasicDescription &dataFormat, co
if (mConverter == NULL)
XThrowIfError(AudioConverterNew(&mFileDataFormat, &mClientDataFormat, &mConverter),
"create audio converter");
-
+
#if VERBOSE_CONVERTER
printf("CAAudioFile %p -- created converter\n", this);
CAShow(mConverter);
@@ -558,7 +558,7 @@ void CAAudioFile::SetClientFormat(const CAStreamBasicDescription &dataFormat, co
SetConverterChannelLayout(false, mFileChannelLayout);
SetConverterChannelLayout(true, mClientChannelLayout);
-
+
// propagate leading/trailing frame counts
if (mFileDataFormat.mBitsPerChannel == 0) {
UInt32 propertySize;
@@ -592,7 +592,7 @@ void CAAudioFile::SetClientFormat(const CAStreamBasicDescription &dataFormat, co
// _______________________________________________________________________________________
//
-OSStatus CAAudioFile::SetConverterProperty(
+OSStatus CAAudioFile::SetConverterProperty(
AudioConverterPropertyID inPropertyID,
UInt32 inPropertyDataSize,
const void* inPropertyData,
@@ -620,7 +620,7 @@ void CAAudioFile::SetConverterChannelLayout(bool output, const CAAudioChannelLay
{
LOG_FUNCTION("CAAudioFile::SetConverterChannelLayout", "%p", this);
OSStatus err;
-
+
if (layout.IsValid()) {
#if VERBOSE_CHANNELMAP
printf("Setting converter's %s channel layout: %s\n", output ? "output" : "input",
@@ -660,11 +660,11 @@ void CAAudioFile::UpdateClientMaxPacketSize()
AudioConverterPropertyID property = (mMode == kReading) ?
kAudioConverterPropertyMaximumOutputPacketSize :
kAudioConverterPropertyMaximumInputPacketSize;
-
+
UInt32 propertySize = sizeof(UInt32);
XThrowIfError(AudioConverterGetProperty(mConverter, property, &propertySize, &mClientMaxPacketSize),
"get audio converter's maximum packet size");
-
+
if (mFileDataFormat.mBitsPerChannel == 0) {
AudioConverterPrimeInfo primeInfo;
propertySize = sizeof(primeInfo);
@@ -693,7 +693,7 @@ void CAAudioFile::AllocateBuffers(bool okToFail)
}
UInt32 bufferSizeBytes = mIOBufferSizeBytes = std::max(mIOBufferSizeBytes, mFileMaxPacketSize);
// must be big enough for at least one maximum size packet
-
+
if (mIOBufferList.mBuffers[0].mDataByteSize != bufferSizeBytes) {
mIOBufferList.mNumberBuffers = 1;
mIOBufferList.mBuffers[0].mNumberChannels = mFileDataFormat.mChannelsPerFrame;
@@ -705,7 +705,7 @@ void CAAudioFile::AllocateBuffers(bool okToFail)
mIOBufferList.mBuffers[0].mDataByteSize = bufferSizeBytes;
mIOBufferSizePackets = bufferSizeBytes / mFileMaxPacketSize;
}
-
+
UInt32 propertySize = sizeof(UInt32);
UInt32 externallyFramed;
XThrowIfError(AudioFormatGetProperty(kAudioFormatProperty_FormatIsExternallyFramed,
@@ -766,7 +766,7 @@ SInt64 CAAudioFile::PacketToFrame(SInt64 packet) const
{
AudioFramePacketTranslation trans;
UInt32 propertySize;
-
+
switch (mFileDataFormat.mFramesPerPacket) {
case 1:
return packet;
@@ -784,7 +784,7 @@ SInt64 CAAudioFile::FrameToPacket(SInt64 inFrame) const
{
AudioFramePacketTranslation trans;
UInt32 propertySize;
-
+
switch (mFileDataFormat.mFramesPerPacket) {
case 1:
return inFrame;
@@ -815,7 +815,7 @@ void CAAudioFile::SeekToPacket(SInt64 packetNumber)
if (mPacketMark == packetNumber)
return; // already there! don't reset converter
mPacketMark = packetNumber;
-
+
mFrameMark = PacketToFrame(packetNumber) - mFrame0Offset;
mFramesToSkipFollowingSeek = 0;
if (mConverter)
@@ -825,7 +825,7 @@ void CAAudioFile::SeekToPacket(SInt64 packetNumber)
/*
Example: AAC, 1024 frames/packet, 2112 frame offset
-
+
2112
|
Absolute frames: 0 1024 2048 | 3072
@@ -838,7 +838,7 @@ void CAAudioFile::SeekToPacket(SInt64 packetNumber)
* Offset between absolute and client frames is mFrame0Offset.
*** mFrameMark is in client frames ***
-
+
Examples:
clientFrame 0 960 1000 1024
absoluteFrame 2112 3072 3112 3136
@@ -857,7 +857,7 @@ void CAAudioFile::Seek(SInt64 clientFrame)
#if VERBOSE_IO
SInt64 prevFrameMark = mFrameMark;
#endif
-
+
SInt64 packet;
packet = FrameToPacket(clientFrame);
if (packet < 0)
@@ -866,7 +866,7 @@ void CAAudioFile::Seek(SInt64 clientFrame)
// this will have backed up mFrameMark to match the beginning of the packet
mFramesToSkipFollowingSeek = std::max(UInt32(clientFrame - mFrameMark), UInt32(0));
mFrameMark = clientFrame;
-
+
#if VERBOSE_IO
printf("CAAudioFile::SeekToFrame: frame %qd (from %qd), packet %qd, skip %ld frames\n", mFrameMark, prevFrameMark, packet, mFramesToSkipFollowingSeek);
#endif
@@ -889,12 +889,12 @@ void CAAudioFile::Read(UInt32 &ioNumPackets, AudioBufferList *ioData)
AllocateBuffers();
}
UInt32 bufferSizeBytes = ioData->mBuffers[0].mDataByteSize;
- UInt32 maxNumPackets = bufferSizeBytes / mClientMaxPacketSize;
+ UInt32 maxNumPackets = bufferSizeBytes / mClientMaxPacketSize;
// older versions of AudioConverterFillComplexBuffer don't do this, so do our own sanity check
UInt32 nPackets = std::min(ioNumPackets, maxNumPackets);
-
+
mMaxPacketsToRead = ~0UL;
-
+
if (mClientDataFormat.mFramesPerPacket == 1) { // PCM or equivalent
while (mFramesToSkipFollowingSeek > 0) {
UInt32 skipFrames = std::min(mFramesToSkipFollowingSeek, maxNumPackets);
@@ -931,7 +931,7 @@ void CAAudioFile::Read(UInt32 &ioNumPackets, AudioBufferList *ioData)
ioData->mBuffers[i].mDataByteSize = bufferSizeBytes;
}
}
-
+
if (mFileDataFormat.mFramesPerPacket > 0)
// don't read more packets than we are being asked to produce
mMaxPacketsToRead = nPackets / mFileDataFormat.mFramesPerPacket + 1;
@@ -950,7 +950,7 @@ void CAAudioFile::Read(UInt32 &ioNumPackets, AudioBufferList *ioData)
}
if (mClientDataFormat.mFramesPerPacket == 1)
mFrameMark += nPackets;
-
+
ioNumPackets = nPackets;
}
@@ -977,7 +977,7 @@ OSStatus CAAudioFile::ReadInputProc( AudioConverterRef inAudioConverter,
return noErr; // not eofErr; EOF is signified by 0 packets/0 bytes
}
#endif
-
+
// determine how much to read
AudioBufferList *readBuffer;
UInt32 readPackets;
@@ -1003,11 +1003,11 @@ OSStatus CAAudioFile::ReadInputProc( AudioConverterRef inAudioConverter,
#endif
readPackets = This->mMaxPacketsToRead;
}
-
+
// read
UInt32 bytesRead;
OSStatus err;
-
+
StartTiming(This, read);
StartTiming(This, readinconv);
err = AudioFileReadPackets(This->mAudioFile, This->mUseCache, &bytesRead, This->mPacketDescs, This->mPacketMark, &readPackets, readBuffer->mBuffers[0].mData);
@@ -1020,7 +1020,7 @@ OSStatus CAAudioFile::ReadInputProc( AudioConverterRef inAudioConverter,
DebugMessageN1("Error %ld from AudioFileReadPackets!!!\n", err);
return err;
}
-
+
#if VERBOSE_IO
printf("CAAudioFile::ReadInputProc: read %ld packets (%qd-%qd), %ld bytes, err %ld\n", readPackets, This->mPacketMark, This->mPacketMark + readPackets, bytesRead, err);
#if VERBOSE_IO >= 2
@@ -1108,7 +1108,7 @@ void CAAudioFile::FlushEncoder()
OSStatus err;
AudioConverterPrimeInfo primeInfo;
propertySize = sizeof(primeInfo);
-
+
err = AudioConverterGetProperty(mConverter, kAudioConverterPrimeInfo, &propertySize, &primeInfo);
if (err == noErr) {
AudioFilePacketTableInfo pti;
@@ -1165,9 +1165,9 @@ static void hexdump(const void *addr, long len)
{
const Byte *p = (Byte *)addr;
UInt32 offset = 0;
-
+
if (len > 0x400) len = 0x400;
-
+
while (len > 0) {
int n = len > 16 ? 16 : len;
printf("%08lX: ", offset);
diff --git a/libs/appleutility/CAAudioFile.h b/libs/appleutility/CAAudioFile.h
index 594545a9d1..8dd1d8690b 100644
--- a/libs/appleutility/CAAudioFile.h
+++ b/libs/appleutility/CAAudioFile.h
@@ -37,7 +37,7 @@
*/
/*=============================================================================
CAAudioFile.h
-
+
=============================================================================*/
#ifndef __CAAudioFile_h__
@@ -122,7 +122,7 @@ public:
// open an existing file
XThrowIfError(ExtAudioFileOpen(&fsref, &mExtAF), "ExtAudioFileOpen failed");
}
-
+
void CreateNew(const FSRef &inParentDir, CFStringRef inFileName, AudioFileTypeID inFileType, const AudioStreamBasicDescription &inStreamDesc, const AudioChannelLayout *inChannelLayout=NULL) {
XThrowIfError(ExtAudioFileCreateNew(&inParentDir, inFileName, inFileType, &inStreamDesc, inChannelLayout, &mExtAF), "ExtAudioFileCreateNew failed");
}
@@ -131,7 +131,7 @@ public:
// use this to wrap an AudioFileID opened externally
XThrowIfError(ExtAudioFileWrapAudioFileID(fileID, forWriting, &mExtAF), "ExtAudioFileWrapAudioFileID failed");
}
-
+
void Close() {
std::cerr << "\tdisposeo of ext audio file @ " << mExtAF << std::endl;
XThrowIfError(ExtAudioFileDispose(mExtAF), "ExtAudioFileClose failed");
@@ -143,11 +143,11 @@ public:
XThrowIfError(ExtAudioFileGetProperty(mExtAF, kExtAudioFileProperty_FileDataFormat, &size, &mFileDataFormat), "Couldn't get file's data format");
return mFileDataFormat;
}
-
+
const CAAudioChannelLayout & GetFileChannelLayout() {
return FetchChannelLayout(mFileChannelLayout, kExtAudioFileProperty_FileChannelLayout);
}
-
+
void SetFileChannelLayout(const CAAudioChannelLayout &layout) {
XThrowIfError(ExtAudioFileSetProperty(mExtAF, kExtAudioFileProperty_FileChannelLayout, layout.Size(), &layout.Layout()), "Couldn't set file's channel layout");
mFileChannelLayout = layout;
@@ -158,21 +158,21 @@ public:
XThrowIfError(ExtAudioFileGetProperty(mExtAF, kExtAudioFileProperty_ClientDataFormat, &size, &mClientDataFormat), "Couldn't get client data format");
return mClientDataFormat;
}
-
+
const CAAudioChannelLayout & GetClientChannelLayout() {
return FetchChannelLayout(mClientChannelLayout, kExtAudioFileProperty_ClientChannelLayout);
}
-
+
void SetClientFormat(const CAStreamBasicDescription &dataFormat, const CAAudioChannelLayout *layout=NULL) {
XThrowIfError(ExtAudioFileSetProperty(mExtAF, kExtAudioFileProperty_ClientDataFormat, sizeof(dataFormat), &dataFormat), "Couldn't set client format");
if (layout)
SetClientChannelLayout(*layout);
}
-
+
void SetClientChannelLayout(const CAAudioChannelLayout &layout) {
XThrowIfError(ExtAudioFileSetProperty(mExtAF, kExtAudioFileProperty_ClientChannelLayout, layout.Size(), &layout.Layout()), "Couldn't set client channel layout");
}
-
+
AudioConverterRef GetConverter() const {
UInt32 size = sizeof(AudioConverterRef);
AudioConverterRef converter;
@@ -192,28 +192,28 @@ public:
}
return err;
}
-
+
SInt64 GetNumberFrames() {
SInt64 length;
UInt32 size = sizeof(SInt64);
XThrowIfError(ExtAudioFileGetProperty(mExtAF, kExtAudioFileProperty_FileLengthFrames, &size, &length), "Couldn't get file's length");
return length;
}
-
+
void SetNumberFrames(SInt64 length) {
XThrowIfError(ExtAudioFileSetProperty(mExtAF, kExtAudioFileProperty_FileLengthFrames, sizeof(SInt64), &length), "Couldn't set file's length");
}
-
+
void Seek(SInt64 pos) {
XThrowIfError(ExtAudioFileSeek(mExtAF, pos), "Couldn't seek in audio file");
}
-
+
SInt64 Tell() {
SInt64 pos;
XThrowIfError(ExtAudioFileTell(mExtAF, &pos), "Couldn't get file's mark");
return pos;
}
-
+
void Read(UInt32 &ioFrames, AudioBufferList *ioData) {
XThrowIfError(ExtAudioFileRead(mExtAF, &ioFrames, ioData), "Couldn't read audio file");
}
@@ -261,12 +261,12 @@ private:
// - Open
// - PrepareNew followed by Create
// - Wrap
-
+
void Open(const FSRef &fsref);
// open an existing file
void CreateNew(const FSRef &inParentDir, CFStringRef inFileName, AudioFileTypeID inFileType, const AudioStreamBasicDescription &inStreamDesc, const AudioChannelLayout *inChannelLayout=NULL);
-
+
void Wrap(AudioFileID fileID, bool forWriting);
// use this to wrap an AudioFileID opened externally
@@ -274,7 +274,7 @@ private:
void Close();
// In case you want to close the file before the destructor executes
-
+
// --- Data formats ---
// Allow specifying the file's channel layout. Must be called before SetClientFormat.
@@ -282,14 +282,14 @@ private:
// the channel layout). When reading, the specified layout overrides the one read from the file,
// if any.
void SetFileChannelLayout(const CAAudioChannelLayout &layout);
-
+
// This specifies the data format which the client will use for reading/writing the file,
// which may be different from the file's format. An AudioConverter is created if necessary.
// The client format must be linear PCM.
void SetClientFormat(const CAStreamBasicDescription &dataFormat, const CAAudioChannelLayout *layout=NULL);
void SetClientDataFormat(const CAStreamBasicDescription &dataFormat) { SetClientFormat(dataFormat, NULL); }
void SetClientChannelLayout(const CAAudioChannelLayout &layout) { SetClientFormat(mClientDataFormat, &layout); }
-
+
// Wrapping the underlying converter, if there is one
OSStatus SetConverterProperty(AudioConverterPropertyID inPropertyID,
UInt32 inPropertyDataSize,
@@ -298,7 +298,7 @@ private:
void SetConverterConfig(CFArrayRef config) {
SetConverterProperty(kAudioConverterPropertySettings, sizeof(config), &config); }
CFArrayRef GetConverterConfig();
-
+
// --- I/O ---
// All I/O is sequential, but you can seek to an arbitrary position when reading.
// SeekToPacket and TellPacket's packet numbers are in the file's data format, not the client's.
@@ -310,7 +310,7 @@ private:
// These can fail for files without a constant mFramesPerPacket
void Seek(SInt64 frameNumber);
SInt64 Tell() const; // frameNumber
-
+
// --- Accessors ---
// note: client parameters only valid if SetClientFormat has been called
AudioFileID GetAudioFileID() const { return mAudioFile; }
@@ -331,27 +331,27 @@ private:
SInt64 GetNumberFrames() const;
// will be 0 if the file's frames/packet is 0 (variable)
void SetNumberFrames(SInt64 length); // should only be set on a PCM file
-
+
// --- Tunable performance parameters ---
void SetUseCache(bool b) { mUseCache = b; }
void SetIOBufferSizeBytes(UInt32 bufferSizeBytes) { mIOBufferSizeBytes = bufferSizeBytes; }
UInt32 GetIOBufferSizeBytes() { return mIOBufferSizeBytes; }
void * GetIOBuffer() { return mIOBufferList.mBuffers[0].mData; }
void SetIOBuffer(void *buf);
-
+
// -- Profiling ---
#if CAAUDIOFILE_PROFILE
void EnableProfiling(bool b) { mProfiling = b; }
UInt64 TicksInConverter() const { return (mTicksInConverter > 0) ? (mTicksInConverter - mTicksInReadInConverter) : 0; }
UInt64 TicksInIO() const { return mTicksInIO; }
#endif
-
+
// _______________________________________________________________________________________
private:
SInt64 FileDataOffset();
void SeekToPacket(SInt64 packetNumber);
SInt64 TellPacket() const { return mPacketMark; } // will be imprecise if SeekToFrame was called
-
+
void SetConverterChannelLayout(bool output, const CAAudioChannelLayout &layout);
void WritePacketsFromCallback(
AudioConverterComplexInputDataProc inInputDataProc,
@@ -372,13 +372,13 @@ private:
UInt32* ioNumberDataPackets,
AudioBufferList* ioData,
AudioStreamPacketDescription** outDataPacketDescription,
- void* inUserData);
+ void* inUserData);
static OSStatus WriteInputProc( AudioConverterRef inAudioConverter,
UInt32* ioNumberDataPackets,
AudioBufferList* ioData,
AudioStreamPacketDescription** outDataPacketDescription,
- void* inUserData);
+ void* inUserData);
// _______________________________________________________________________________________
private:
@@ -389,7 +389,7 @@ private:
bool mUseCache;
bool mFinishingEncoding;
enum { kClosed, kReading, kPreparingToCreate, kPreparingToWrite, kWriting } mMode;
-
+
// SInt64 mNumberPackets; // in file's format
SInt64 mFileDataOffset;
SInt64 mPacketMark; // in file's format
@@ -398,7 +398,7 @@ private:
// lie at frame 2112 of a decoded AAC file
SInt32 mFrame0Offset;
UInt32 mFramesToSkipFollowingSeek;
-
+
// buffers
UInt32 mIOBufferSizeBytes;
UInt32 mIOBufferSizePackets;
@@ -406,7 +406,7 @@ private:
bool mClientOwnsIOBuffer;
AudioStreamPacketDescription *mPacketDescs;
UInt32 mNumPacketDescs;
-
+
// formats/conversion
AudioConverterRef mConverter;
CAStreamBasicDescription mFileDataFormat;
@@ -415,18 +415,18 @@ private:
CAAudioChannelLayout mClientChannelLayout;
UInt32 mFileMaxPacketSize;
UInt32 mClientMaxPacketSize;
-
+
// cookie
Byte * mMagicCookie;
UInt32 mMagicCookieSize;
-
+
// for ReadPackets
UInt32 mMaxPacketsToRead;
-
+
// for WritePackets
UInt32 mWritePackets;
CABufferList * mWriteBufferList;
-
+
#if CAAUDIOFILE_PROFILE
// performance
bool mProfiling;
diff --git a/libs/appleutility/CAAudioUnit.cpp b/libs/appleutility/CAAudioUnit.cpp
index 853cfc124c..f0b0890c51 100644
--- a/libs/appleutility/CAAudioUnit.cpp
+++ b/libs/appleutility/CAAudioUnit.cpp
@@ -55,7 +55,7 @@
struct StackAUChannelInfo {
StackAUChannelInfo (UInt32 inSize) : mChanInfo ((AUChannelInfo*)malloc (inSize)) {}
~StackAUChannelInfo() { free (mChanInfo); }
-
+
AUChannelInfo* mChanInfo;
};
@@ -77,9 +77,9 @@ public:
{
Init();
}
-
+
~AUState();
-
+
AudioUnit mUnit;
AUNode mNode;
@@ -89,7 +89,7 @@ public:
if (mGetParamProc != NULL) {
return reinterpret_cast<AudioUnitGetParameterProc>(mGetParamProc) (mConnInstanceStorage,
inID, scope, element, &outValue);
- }
+ }
return AudioUnitGetParameter(mUnit, inID, scope, element, &outValue);
}
@@ -99,10 +99,10 @@ public:
if (mSetParamProc != NULL) {
return reinterpret_cast<AudioUnitSetParameterProc>(mSetParamProc) (mConnInstanceStorage,
inID, scope, element, value, bufferOffsetFrames);
- }
+ }
return AudioUnitSetParameter(mUnit, inID, scope, element, value, bufferOffsetFrames);
}
-
+
OSStatus Render (AudioUnitRenderActionFlags * ioActionFlags,
const AudioTimeStamp * inTimeStamp,
UInt32 inOutputBusNumber,
@@ -112,10 +112,10 @@ public:
if (mRenderProc != NULL) {
return reinterpret_cast<AudioUnitRenderProc>(mRenderProc) (mConnInstanceStorage,
ioActionFlags, inTimeStamp, inOutputBusNumber, inNumberFrames, ioData);
- }
+ }
return AudioUnitRender(mUnit, ioActionFlags, inTimeStamp, inOutputBusNumber, inNumberFrames, ioData);
}
-
+
OSStatus MIDIEvent (UInt32 inStatus,
UInt32 inData1,
UInt32 inData2,
@@ -177,13 +177,13 @@ private:
kAudioUnitScope_Global, kMusicDeviceMIDIEventSelect,
&mMIDIEventProc, &size) != noErr)
mMIDIEventProc = NULL;
-
+
if (mRenderProc || mGetParamProc || mSetParamProc || mMIDIEventProc)
mConnInstanceStorage = GetComponentInstanceStorage(mUnit);
else
mConnInstanceStorage = NULL;
}
-
+
ProcPtr mRenderProc, mGetParamProc, mSetParamProc, mMIDIEventProc;
void * mConnInstanceStorage;
@@ -193,9 +193,9 @@ private:
AUState () {}
AUState (const AUState& other) : CAReferenceCounted (other) {}
AUState& operator= (const AUState&) { return *this; }
-};
-
-
+};
+
+
CAAudioUnit::AUState::~AUState ()
{
if (mUnit && (mNode == 0)) {
@@ -246,13 +246,13 @@ CAAudioUnit& CAAudioUnit::operator= (const CAAudioUnit &a)
if (mDataPtr != a.mDataPtr) {
if (mDataPtr)
mDataPtr->release();
-
+
if ((mDataPtr = a.mDataPtr) != NULL)
mDataPtr->retain();
-
+
mComp = a.mComp;
}
-
+
return *this;
}
@@ -270,13 +270,13 @@ bool CAAudioUnit::operator== (const AudioUnit& y) const
return mDataPtr->mUnit == y;
}
-#pragma mark __State Management
+#pragma mark __State Management
bool CAAudioUnit::IsValid () const
{
return mDataPtr ? mDataPtr->mUnit != 0 : false;
}
-
+
AudioUnit CAAudioUnit::AU() const
{
return mDataPtr ? mDataPtr->mUnit : 0;
@@ -288,10 +288,10 @@ AUNode CAAudioUnit::GetAUNode () const
}
#pragma mark __Format Handling
-
+
bool CAAudioUnit::CanDo ( int inChannelsIn,
int inChannelsOut) const
-{
+{
// this is the default assumption of an audio effect unit
Boolean* isWritable = 0;
UInt32 dataSize = 0;
@@ -300,7 +300,7 @@ bool CAAudioUnit::CanDo ( int inChannelsIn,
kAudioUnitProperty_SupportedNumChannels,
kAudioUnitScope_Global, 0,
&dataSize, isWritable); //don't care if this is writable
-
+
// if this property is NOT implemented an FX unit
// is expected to deal with same channel valance in and out
if (result)
@@ -317,14 +317,14 @@ bool CAAudioUnit::CanDo ( int inChannelsIn,
return false;
}
}
-
+
StackAUChannelInfo info (dataSize);
-
+
result = GetProperty (kAudioUnitProperty_SupportedNumChannels,
kAudioUnitScope_Global, 0,
info.mChanInfo, &dataSize);
if (result) { return false; }
-
+
return ValidateChannelPair (inChannelsIn, inChannelsOut, info.mChanInfo, (dataSize / sizeof (AUChannelInfo)));
}
@@ -338,10 +338,10 @@ int CAAudioUnit::GetChannelInfo (AUChannelInfo** chaninfo, UInt32& cnt)
kAudioUnitProperty_SupportedNumChannels,
kAudioUnitScope_Global, 0,
&dataSize, isWritable); //don't care if this is writable
-
+
// if this property is NOT implemented an FX unit
// is expected to deal with same channel valance in and out
-
+
if (result)
{
if (Comp().Desc().IsEffect())
@@ -452,7 +452,7 @@ bool CAAudioUnit::ValidateChannelPair (int inChannelsIn,
}
}
}
-
+
// special meaning on input, specific num on output
else if (info[i].inChannels < 0) {
if (info[i].outChannels == inChannelsOut)
@@ -471,7 +471,7 @@ bool CAAudioUnit::ValidateChannelPair (int inChannelsIn,
}
}
}
-
+
// special meaning on output, specific num on input
else if (info[i].outChannels < 0) {
if (info[i].inChannels == inChannelsIn)
@@ -495,7 +495,7 @@ bool CAAudioUnit::ValidateChannelPair (int inChannelsIn,
else if ((info[i].inChannels == inChannelsIn) && (info[i].outChannels == inChannelsOut)) {
return true;
}
-
+
// now check to see if a wild card on the args (inChannelsIn or inChannelsOut chans is zero) is found
// tells us to match just one side of the scopes
else if (inChannelsIn == 0) {
@@ -509,7 +509,7 @@ bool CAAudioUnit::ValidateChannelPair (int inChannelsIn,
}
}
}
-
+
return false;
}
@@ -553,14 +553,14 @@ bool CAAudioUnit::CanDo (const CAAUChanHelper &inputs,
// first check our state
// huh!
if (inputs.mNumEls == 0 && outputs.mNumEls == 0) return false;
-
+
UInt32 elCount;
if (GetElementCount (kAudioUnitScope_Input, elCount)) { return false; }
if (elCount != inputs.mNumEls) return false;
if (GetElementCount (kAudioUnitScope_Output, elCount)) { return false; }
if (elCount != outputs.mNumEls) return false;
-
+
// (1) special cases (effects and sources (generators and instruments) only)
UInt32 dataSize = 0;
if (GetPropertyInfo (kAudioUnitProperty_SupportedNumChannels,
@@ -574,7 +574,7 @@ bool CAAudioUnit::CanDo (const CAAUChanHelper &inputs,
if (numChan != outputs.mChans[out]) return false;
return true;
}
-
+
// in this case, all the channels have to match the current config
if (Comp().Desc().IsGenerator() || Comp().Desc().IsMusicDevice()) {
for (unsigned int in = 0; in < inputs.mNumEls; ++in) {
@@ -589,22 +589,22 @@ bool CAAudioUnit::CanDo (const CAAUChanHelper &inputs,
}
return true;
}
-
+
// if we get here we can't determine anything about channel capabilities
return false;
}
StackAUChannelInfo info (dataSize);
-
+
if (GetProperty (kAudioUnitProperty_SupportedNumChannels,
kAudioUnitScope_Global, 0,
info.mChanInfo, &dataSize) != noErr)
{
return false;
}
-
+
int numInfo = dataSize / sizeof(AUChannelInfo);
-
+
// (2) Test for dynamic capability (or no elements on that scope)
SInt32 dynInChans = 0;
if (ValidateDynamicScope (kAudioUnitScope_Input, dynInChans, info.mChanInfo, numInfo)) {
@@ -655,7 +655,7 @@ bool CAAudioUnit::CanDo (const CAAUChanHelper &inputs,
}
}
}
-
+
return true;
}
@@ -669,7 +669,7 @@ bool CAAudioUnit::SupportsNumChannels () const
kAudioUnitProperty_SupportedNumChannels,
kAudioUnitScope_Global, 0,
&dataSize, isWritable); //don't care if this is writable
-
+
// if this property is NOT implemented an FX unit
// is expected to deal with same channel valance in and out
if (result) {
@@ -702,7 +702,7 @@ bool CAAudioUnit::GetChannelLayouts (AudioUnitScope inScope,
}
if (result) return false;
-
+
bool canDo = false;
// OK lets get our channel layouts and see if the one we want is present
AudioChannelLayoutTag* info = (AudioChannelLayoutTag*)malloc (dataSize);
@@ -711,7 +711,7 @@ bool CAAudioUnit::GetChannelLayouts (AudioUnitScope inScope,
inScope, inEl,
info, &dataSize);
if (result) goto home;
-
+
outChannelVector.erase (outChannelVector.begin(), outChannelVector.end());
for (unsigned int i = 0; i < (dataSize / sizeof (AudioChannelLayoutTag)); ++i)
outChannelVector.push_back (info[i]);
@@ -739,14 +739,14 @@ OSStatus CAAudioUnit::GetChannelLayout (AudioUnitScope inScope,
OSStatus result = AudioUnitGetPropertyInfo (AU(), kAudioUnitProperty_AudioChannelLayout,
inScope, inEl, &size, NULL);
if (result) return result;
-
+
AudioChannelLayout *layout = (AudioChannelLayout*)malloc (size);
require_noerr (result = AudioUnitGetProperty (AU(), kAudioUnitProperty_AudioChannelLayout,
inScope, inEl, layout, &size), home);
outLayout = CAAudioChannelLayout (layout);
-
+
home:
free (layout);
return result;
@@ -827,7 +827,7 @@ OSStatus CAAudioUnit::SetSampleRate (AudioUnitScope inScope,
OSStatus CAAudioUnit::SetSampleRate (Float64 inSampleRate)
{
OSStatus result;
-
+
UInt32 elCount;
require_noerr (result = GetElementCount(kAudioUnitScope_Input, elCount), home);
if (elCount) {
@@ -842,7 +842,7 @@ OSStatus CAAudioUnit::SetSampleRate (Float64 inSampleRate)
require_noerr (result = SetSampleRate (kAudioUnitScope_Output, i, inSampleRate), home);
}
}
-
+
home:
return result;
}
@@ -879,7 +879,7 @@ OSStatus CAAudioUnit::IsElementCountWritable (AudioUnitScope inScope, bool &out
if (result)
return result;
outWritable = isWritable ? true : false;
- return noErr;
+ return noErr;
}
OSStatus CAAudioUnit::GetElementCount (AudioUnitScope inScope, UInt32 &outCount) const
@@ -902,12 +902,12 @@ bool CAAudioUnit::HasDynamicScope (AudioUnitScope inScope, SInt32 &outTotalNum
OSStatus result = GetPropertyInfo (kAudioUnitProperty_SupportedNumChannels,
kAudioUnitScope_Global, 0,
&dataSize, isWritable); //don't care if this is writable
-
+
// AU has to explicitly tell us about this.
if (result) return false;
StackAUChannelInfo info (dataSize);
-
+
result = GetProperty (kAudioUnitProperty_SupportedNumChannels,
kAudioUnitScope_Global, 0,
info.mChanInfo, &dataSize);
@@ -945,36 +945,36 @@ bool CAAudioUnit::ValidateDynamicScope (AudioUnitScope inScope,
outTotalNumChannels = -1;
return true;
}
-
+
// ok lets now test our special case....
if (inScope == kAudioUnitScope_Input) {
// isn't dynamic on this side at least
if (info[i].inChannels >= 0)
continue;
-
+
if (info[i].inChannels < -2) {
outTotalNumChannels = abs (info[i].inChannels);
return true;
}
}
-
+
else if (inScope == kAudioUnitScope_Output) {
// isn't dynamic on this side at least
if (info[i].outChannels >= 0)
continue;
-
+
if (info[i].outChannels < -2) {
outTotalNumChannels = abs (info[i].outChannels);
return true;
}
}
-
+
else {
break; // wrong scope was specified
}
}
-
- return false;
+
+ return false;
}
OSStatus CAAudioUnit::ConfigureDynamicScope (AudioUnitScope inScope,
@@ -986,7 +986,7 @@ OSStatus CAAudioUnit::ConfigureDynamicScope (AudioUnitScope inScope,
bool isDyamic = HasDynamicScope (inScope, numChannels);
if (isDyamic == false)
return kAudioUnitErr_InvalidProperty;
-
+
//lets to a sanity check...
// if numChannels == -1, then it can do "any"...
if (numChannels > 0) {
@@ -996,11 +996,11 @@ OSStatus CAAudioUnit::ConfigureDynamicScope (AudioUnitScope inScope,
if (count > numChannels)
return kAudioUnitErr_InvalidPropertyValue;
}
-
+
OSStatus result = SetElementCount (inScope, inNumElements);
if (result)
return result;
-
+
CAStreamBasicDescription desc;
desc.mSampleRate = inSampleRate;
for (unsigned int i = 0; i < inNumElements; ++i) {
@@ -1034,7 +1034,7 @@ bool CAAudioUnit::GetBypass () const
}
OSStatus CAAudioUnit::SetBypass (bool inBypass) const
-{
+{
UInt32 bypass = inBypass ? 1 : 0;
return AudioUnitSetProperty (AU(), kAudioUnitProperty_BypassEffect,
kAudioUnitScope_Global, 0,
@@ -1085,7 +1085,7 @@ OSStatus CAAudioUnit::GetPresentPreset (AUPreset &outData) const
}
return result;
}
-
+
OSStatus CAAudioUnit::SetPresentPreset (AUPreset &inData)
{
OSStatus result = AudioUnitSetProperty (AU(), kAudioUnitProperty_PresentPreset,
@@ -1184,18 +1184,18 @@ OSStatus CAAudioUnit::Preroll (UInt32 inFrameSize)
CAStreamBasicDescription desc;
OSStatus result = GetFormat (kAudioUnitScope_Input, 0, desc);
bool hasInput = false;
- //we have input
+ //we have input
if (result == noErr)
{
sRenderCallback.inputProc = PrerollRenderProc;
sRenderCallback.inputProcRefCon = 0;
-
+
result = SetProperty (kAudioUnitProperty_SetRenderCallback, kAudioUnitScope_Input,
0, &sRenderCallback, sizeof(sRenderCallback));
if (result) return result;
hasInput = true;
}
-
+
AudioUnitRenderActionFlags flags = 0;
AudioTimeStamp time;
memset (&time, 0, sizeof(time));
@@ -1206,7 +1206,7 @@ OSStatus CAAudioUnit::Preroll (UInt32 inFrameSize)
{
AUOutputBL list (outputFormat, inFrameSize);
list.Prepare ();
-
+
require_noerr (result = Render (&flags, &time, 0, inFrameSize, list.ABL()), home);
require_noerr (result = GlobalReset(), home);
}
@@ -1216,7 +1216,7 @@ home:
// remove our installed callback
sRenderCallback.inputProc = 0;
sRenderCallback.inputProcRefCon = 0;
-
+
SetProperty (kAudioUnitProperty_SetRenderCallback, kAudioUnitScope_Input,
0, &sRenderCallback, sizeof(sRenderCallback));
}
@@ -1262,7 +1262,7 @@ CAAUChanHelper& CAAUChanHelper::operator= (const CAAUChanHelper &c)
mChans = mStaticChans;
}
memcpy (mChans, c.mChans, c.mNumEls * sizeof(int));
-
+
return *this;
}
diff --git a/libs/appleutility/CAAudioUnit.h b/libs/appleutility/CAAudioUnit.h
index e5927af1fc..7be48464e7 100644
--- a/libs/appleutility/CAAudioUnit.h
+++ b/libs/appleutility/CAAudioUnit.h
@@ -94,26 +94,26 @@ public:
~CAAudioUnit ();
-
+
CAAudioUnit& operator= (const CAAudioUnit& y);
bool operator== (const CAAudioUnit& y) const;
bool operator== (const AudioUnit& y) const;
-#pragma mark __State Management
+#pragma mark __State Management
bool IsValid () const;
-
+
AudioUnit AU() const;
operator AudioUnit () const { return AU(); }
const CAComponent& Comp() const { return mComp; }
-
+
bool FromAUGraph () const { return GetAUNode() != 0 || GetAUNode() != -1; }
-
+
AUNode GetAUNode () const;
operator AUNode () const { return GetAUNode(); }
-
+
#pragma mark __API Wrapper
OSStatus Initialize() const { return AudioUnitInitialize(AU()); }
OSStatus Uninitialize() const { return AudioUnitUninitialize(AU()); }
@@ -134,7 +134,7 @@ public:
}
OSStatus SetParameter(AudioUnitParameterID inID, AudioUnitScope scope, AudioUnitElement element,
Float32 value, UInt32 bufferOffsetFrames=0);
-
+
OSStatus GetParameter(AudioUnitParameterID inID, AudioUnitScope scope, AudioUnitElement element,
Float32 &outValue) const;
@@ -143,7 +143,7 @@ public:
UInt32 inOutputBusNumber,
UInt32 inNumberFrames,
AudioBufferList * ioData);
-
+
OSStatus Reset (AudioUnitScope scope, AudioUnitElement element)
{
return AudioUnitReset (AU(), scope, element);
@@ -159,19 +159,19 @@ public:
{
return AudioUnitAddRenderNotify (AU(), inProc, inProcRefCon);
}
-
+
OSStatus RemoveRenderNotify (AURenderCallback inProc, void *inProcRefCon)
{
return AudioUnitRemoveRenderNotify (AU(), inProc, inProcRefCon);
}
-
-// Fast dispatch support for MIDI Effects or Music Devices
+
+// Fast dispatch support for MIDI Effects or Music Devices
OSStatus MIDIEvent (UInt32 inStatus,
UInt32 inData1,
UInt32 inData2,
UInt32 inOffsetSampleFrame);
-
+
// uses the default VoiceForGroup value - this is the normal case
OSStatus StartNote (MusicDeviceGroupID inGroupID,
NoteInstanceID * outNoteInstanceID,
@@ -203,29 +203,29 @@ public:
{
return CanDo (inChannelsInOut, inChannelsInOut);
}
-
+
bool CanDo ( int inChannelsIn,
int inChannelsOut) const;
-
+
// This version does a more thorough test for ANY AU with ANY ins/outs
// you pass in the channel helper (for the current element count on that scope)
-
+
bool CanDo ( const CAAUChanHelper &input,
const CAAUChanHelper &output) const;
-
+
bool SupportsNumChannels () const;
-
+
bool HasChannelLayouts (AudioUnitScope inScope,
AudioUnitElement inEl) const;
-
+
int GetChannelInfo (AUChannelInfo** chaninfo, UInt32& cnt);
bool GetChannelLayouts (AudioUnitScope inScope,
AudioUnitElement inEl,
ChannelTagVector &outChannelVector) const;
-
+
OSStatus GetChannelLayout (AudioUnitScope inScope,
AudioUnitElement inEl,
- CAAudioChannelLayout &outLayout) const;
+ CAAudioChannelLayout &outLayout) const;
OSStatus SetChannelLayout (AudioUnitScope inScope,
AudioUnitElement inEl,
@@ -235,10 +235,10 @@ public:
AudioUnitElement inEl,
AudioChannelLayout &inLayout,
UInt32 inSize);
-
+
OSStatus ClearChannelLayout (AudioUnitScope inScope,
AudioUnitElement inEl);
-
+
OSStatus GetFormat (AudioUnitScope inScope,
AudioUnitElement inEl,
AudioStreamBasicDescription &outFormat) const;
@@ -257,7 +257,7 @@ public:
// this sets the sample rate on all in/out buses of the AU
OSStatus SetSampleRate (Float64 inSampleRate);
-
+
OSStatus NumberChannels (AudioUnitScope inScope,
AudioUnitElement inEl,
UInt32 &outChans) const;
@@ -278,7 +278,7 @@ public:
OSStatus GetElementCount (AudioUnitScope inScope, UInt32 &outCount) const;
OSStatus SetElementCount (AudioUnitScope inScope, UInt32 inCount);
-
+
// value of -1 for outTotalNumChannels indicates no restriction on num channels
// for ex. the Matrix Mixer satisfies this (its in/out element count is writable, and can be set to
// any number of channels.
@@ -287,19 +287,19 @@ public:
{
return HasDynamicScope (kAudioUnitScope_Input, outTotalNumChannels);
}
-
+
bool HasDynamicOutputs (SInt32 &outTotalNumChannels) const
{
return HasDynamicScope (kAudioUnitScope_Output, outTotalNumChannels);
}
-
+
// here, if the in (or out) elements are dynamic, then you supply the number of elements
// you want on in (or out) scope, and the number of channels on each consecutive element
OSStatus ConfigureDynamicInput (UInt32 inNumElements, UInt32 *inChannelsPerElement, Float64 inSampleRate)
{
return ConfigureDynamicScope (kAudioUnitScope_Input, inNumElements, inChannelsPerElement, inSampleRate);
}
-
+
OSStatus ConfigureDynamicOutput (UInt32 inNumElements, UInt32 *inChannelsPerElement, Float64 inSampleRate)
{
return ConfigureDynamicScope (kAudioUnitScope_Output, inNumElements, inChannelsPerElement, inSampleRate);
@@ -310,31 +310,31 @@ public:
bool GetBypass () const;
OSStatus SetBypass (bool inBypass) const;
-
+
Float64 Latency () const;
-
+
// these calls just deal with the global preset state
// you could rescope them to deal with presets on the part scope
OSStatus GetAUPreset (CFPropertyListRef &outData) const;
OSStatus SetAUPreset (CFPropertyListRef &inData);
-
+
OSStatus GetPresentPreset (AUPreset &outData) const;
-
+
OSStatus SetPresentPreset (AUPreset &inData);
-
+
bool HasCustomView () const;
-
-#pragma mark __Print
+
+#pragma mark __Print
void Print () const { Print (stdout); }
void Print (FILE* file) const;
-
+
private:
CAComponent mComp;
-
+
class AUState;
AUState* mDataPtr;
-
+
// this can throw - so wrap this up in a static that returns a result code...
CAAudioUnit (const CAComponent& inComp);
@@ -347,7 +347,7 @@ private:
int inChannelsOut,
const AUChannelInfo * info,
UInt32 numChanInfo) const;
-
+
bool ValidateDynamicScope (AudioUnitScope inScope,
SInt32 &outTotalNumChannels,
const AUChannelInfo * info,
@@ -356,7 +356,7 @@ private:
bool checkOutput,
const AUChannelInfo *info,
UInt32 numInfo) const;
-
+
};
class CAAUChanHelper {
@@ -368,14 +368,14 @@ public:
}
CAAUChanHelper(const CAAudioUnit &inAU, AudioUnitScope inScope);
CAAUChanHelper (const CAAUChanHelper &c) :mChans(mStaticChans), mNumEls(0), mDidAllocate(false) { *this = c; }
-
+
~CAAUChanHelper();
CAAUChanHelper& operator= (const CAAUChanHelper &c);
UInt32 * mChans;
UInt32 mNumEls;
-
+
private:
UInt32 mStaticChans[8];
bool mDidAllocate;
diff --git a/libs/appleutility/CABufferList.cpp b/libs/appleutility/CABufferList.cpp
index 47fe524f6f..581f1adda7 100644
--- a/libs/appleutility/CABufferList.cpp
+++ b/libs/appleutility/CABufferList.cpp
@@ -37,7 +37,7 @@
*/
/*=============================================================================
CABufferList.cpp
-
+
=============================================================================*/
#include "CABufferList.h"
@@ -50,7 +50,7 @@
void CABufferList::AllocateBuffers(UInt32 nBytes)
{
if (nBytes <= GetNumBytes()) return;
-
+
if (mNumberBuffers > 1)
// align successive buffers for Altivec and to take alternating
// cache line hits by spacing them by odd multiples of 16
@@ -58,7 +58,7 @@ void CABufferList::AllocateBuffers(UInt32 nBytes)
UInt32 memorySize = nBytes * mNumberBuffers;
Byte *newMemory = new Byte[memorySize], *p = newMemory;
memset(newMemory, 0, memorySize); // get page faults now, not later
-
+
AudioBuffer *buf = mBuffers;
for (UInt32 i = mNumberBuffers; i--; ++buf) {
if (buf->mData != NULL && buf->mDataByteSize > 0)
@@ -83,7 +83,7 @@ void CABufferList::AllocateBuffersAndCopyFrom(UInt32 nBytes, CABufferList *inSr
}
inSetPtrList->VerifyNotTrashingOwnedBuffer();
UInt32 fromByteSize = inSrcList->GetNumBytes();
-
+
if (mNumberBuffers > 1)
// align successive buffers for Altivec and to take alternating
// cache line hits by spacing them by odd multiples of 16
@@ -91,7 +91,7 @@ void CABufferList::AllocateBuffersAndCopyFrom(UInt32 nBytes, CABufferList *inSr
UInt32 memorySize = nBytes * mNumberBuffers;
Byte *newMemory = new Byte[memorySize], *p = newMemory;
memset(newMemory, 0, memorySize); // make buffer "hot"
-
+
AudioBuffer *buf = mBuffers;
AudioBuffer *ptrBuf = inSetPtrList->mBuffers;
AudioBuffer *srcBuf = inSrcList->mBuffers;
diff --git a/libs/appleutility/CABufferList.h b/libs/appleutility/CABufferList.h
index 8f69de9413..fc94769458 100644
--- a/libs/appleutility/CABufferList.h
+++ b/libs/appleutility/CABufferList.h
@@ -37,7 +37,7 @@
*/
/*=============================================================================
CABufferList.h
-
+
=============================================================================*/
#ifndef __CABufferList_h__
@@ -59,7 +59,7 @@ extern "C" void CAShowAudioBufferList(const AudioBufferList *abl, int framesToPr
This class is designed for use in non-simplistic cases. For AudioUnits, AUBufferList
is preferred.
-
+
CABufferList can be used in one of two ways:
- as mutable pointers into non-owned memory
- as an immutable array of buffers (owns its own memory).
@@ -99,22 +99,22 @@ public:
if (mBufferMemory)
delete[] mBufferMemory;
}
-
+
const char * Name() { return mName; }
-
+
const AudioBufferList & GetBufferList() const { return *(AudioBufferList *)&mNumberBuffers; }
-
+
AudioBufferList & GetModifiableBufferList()
{
VerifyNotTrashingOwnedBuffer();
return _GetBufferList();
}
-
+
UInt32 GetNumBytes() const
{
return mBuffers[0].mDataByteSize;
}
-
+
void SetBytes(UInt32 nBytes, void *data)
{
VerifyNotTrashingOwnedBuffer();
@@ -122,7 +122,7 @@ public:
mBuffers[0].mDataByteSize = nBytes;
mBuffers[0].mData = data;
}
-
+
void CopyAllFrom(CABufferList *srcbl, CABufferList *ptrbl)
// copies bytes from srcbl
// make ptrbl reflect the length copied
@@ -144,7 +144,7 @@ public:
if (srcbl != ptrbl)
srcbl->BytesConsumed(nBytes);
}
-
+
void AppendFrom(CABufferList *blp, UInt32 nBytes)
{
VerifyNotTrashingOwnedBuffer();
@@ -156,7 +156,7 @@ public:
}
blp->BytesConsumed(nBytes);
}
-
+
void PadWithZeroes(UInt32 desiredBufferSize)
// for cases where an algorithm (e.g. SRC) requires some
// padding to create silence following end-of-file
@@ -169,7 +169,7 @@ public:
buf->mDataByteSize = desiredBufferSize;
}
}
-
+
void SetToZeroes(UInt32 nBytes)
{
VerifyNotTrashingOwnedBuffer();
@@ -179,23 +179,23 @@ public:
buf->mDataByteSize = nBytes;
}
}
-
+
void Reset()
{
DeallocateBuffers();
}
-
+
Boolean SameDataAs(const CABufferList* anotherBufferList)
{
// check to see if two buffer lists point to the same memory.
if (mNumberBuffers != anotherBufferList->mNumberBuffers) return false;
-
+
for (UInt32 i = 0; i < mNumberBuffers; ++i) {
if (mBuffers[i].mData != anotherBufferList->mBuffers[i].mData) return false;
}
return true;
}
-
+
void BytesConsumed(UInt32 nBytes)
// advance buffer pointers, decrease buffer sizes
{
@@ -207,18 +207,18 @@ public:
buf->mDataByteSize -= nBytes;
}
}
-
+
void SetFrom(const AudioBufferList *abl)
{
VerifyNotTrashingOwnedBuffer();
memcpy(&_GetBufferList(), abl, (char *)&abl->mBuffers[abl->mNumberBuffers] - (char *)abl);
}
-
+
void SetFrom(const CABufferList *blp)
{
SetFrom(&blp->GetBufferList());
}
-
+
void SetFrom(const AudioBufferList *abl, UInt32 nBytes)
{
VerifyNotTrashingOwnedBuffer();
@@ -230,23 +230,23 @@ public:
mybuf->mData = srcbuf->mData;
}
}
-
+
void SetFrom(const CABufferList *blp, UInt32 nBytes)
{
SetFrom(&blp->GetBufferList(), nBytes);
}
-
+
AudioBufferList * ToAudioBufferList(AudioBufferList *abl) const
{
memcpy(abl, &GetBufferList(), (char *)&abl->mBuffers[mNumberBuffers] - (char *)abl);
return abl;
}
-
+
void AllocateBuffers(UInt32 nBytes);
void AllocateBuffersAndCopyFrom(UInt32 nBytes, CABufferList *inCopyFromList, CABufferList *inSetPtrList);
-
+
void DeallocateBuffers();
-
+
void UseExternalBuffer(Byte *ptr, UInt32 nBytes);
void AdvanceBufferPointers(UInt32 nBytes)
@@ -261,7 +261,7 @@ public:
buf->mDataByteSize -= nBytes;
}
}
-
+
void SetNumBytes(UInt32 nBytes)
{
VerifyNotTrashingOwnedBuffer();
diff --git a/libs/appleutility/CACFDictionary.cpp b/libs/appleutility/CACFDictionary.cpp
index c209b5fc36..ed983a828f 100644
--- a/libs/appleutility/CACFDictionary.cpp
+++ b/libs/appleutility/CACFDictionary.cpp
@@ -74,7 +74,7 @@ void CACFDictionary::GetKeys (const void **keys) const
bool CACFDictionary::GetBool(const CFStringRef inKey, bool& outValue) const
{
bool theAnswer = false;
-
+
CFTypeRef theValue = NULL;
if(GetCFType(inKey, theValue))
{
@@ -91,14 +91,14 @@ bool CACFDictionary::GetBool(const CFStringRef inKey, bool& outValue) const
theAnswer = true;
}
}
-
+
return theAnswer;
}
bool CACFDictionary::GetSInt32(const CFStringRef inKey, SInt32& outValue) const
{
bool theAnswer = false;
-
+
CFTypeRef theValue = NULL;
if(GetCFType(inKey, theValue))
{
@@ -108,14 +108,14 @@ bool CACFDictionary::GetSInt32(const CFStringRef inKey, SInt32& outValue) const
theAnswer = true;
}
}
-
+
return theAnswer;
}
bool CACFDictionary::GetUInt32(const CFStringRef inKey, UInt32& outValue) const
{
bool theAnswer = false;
-
+
CFTypeRef theValue = NULL;
if(GetCFType(inKey, theValue))
{
@@ -125,14 +125,14 @@ bool CACFDictionary::GetUInt32(const CFStringRef inKey, UInt32& outValue) const
theAnswer = true;
}
}
-
+
return theAnswer;
}
bool CACFDictionary::GetSInt64(const CFStringRef inKey, SInt64& outValue) const
{
bool theAnswer = false;
-
+
CFTypeRef theValue = NULL;
if(GetCFType(inKey, theValue))
{
@@ -142,14 +142,14 @@ bool CACFDictionary::GetSInt64(const CFStringRef inKey, SInt64& outValue) const
theAnswer = true;
}
}
-
+
return theAnswer;
}
bool CACFDictionary::GetUInt64(const CFStringRef inKey, UInt64& outValue) const
{
bool theAnswer = false;
-
+
CFTypeRef theValue = NULL;
if(GetCFType(inKey, theValue))
{
@@ -159,14 +159,14 @@ bool CACFDictionary::GetUInt64(const CFStringRef inKey, UInt64& outValue) const
theAnswer = true;
}
}
-
+
return theAnswer;
}
bool CACFDictionary::GetFloat32(const CFStringRef inKey, Float32& outValue) const
{
bool theAnswer = false;
-
+
CFTypeRef theValue = NULL;
if(GetCFType(inKey, theValue))
{
@@ -176,14 +176,14 @@ bool CACFDictionary::GetFloat32(const CFStringRef inKey, Float32& outValue) cons
theAnswer = true;
}
}
-
+
return theAnswer;
}
bool CACFDictionary::GetFloat64(const CFStringRef inKey, Float64& outValue) const
{
bool theAnswer = false;
-
+
CFTypeRef theValue = NULL;
if(GetCFType(inKey, theValue))
{
@@ -193,14 +193,14 @@ bool CACFDictionary::GetFloat64(const CFStringRef inKey, Float64& outValue) cons
theAnswer = true;
}
}
-
+
return theAnswer;
}
bool CACFDictionary::GetString(const CFStringRef inKey, CFStringRef& outValue) const
{
bool theAnswer = false;
-
+
CFTypeRef theValue = NULL;
if(GetCFType(inKey, theValue))
{
@@ -210,14 +210,14 @@ bool CACFDictionary::GetString(const CFStringRef inKey, CFStringRef& outValue) c
theAnswer = true;
}
}
-
+
return theAnswer;
}
-
+
bool CACFDictionary::GetArray(const CFStringRef inKey, CFArrayRef& outValue) const
{
bool theAnswer = false;
-
+
CFTypeRef theValue = NULL;
if(GetCFType(inKey, theValue))
{
@@ -227,14 +227,14 @@ bool CACFDictionary::GetArray(const CFStringRef inKey, CFArrayRef& outValue) con
theAnswer = true;
}
}
-
+
return theAnswer;
}
-
+
bool CACFDictionary::GetDictionary(const CFStringRef inKey, CFDictionaryRef& outValue) const
{
bool theAnswer = false;
-
+
CFTypeRef theValue = NULL;
if(GetCFType(inKey, theValue))
{
@@ -244,14 +244,14 @@ bool CACFDictionary::GetDictionary(const CFStringRef inKey, CFDictionaryRef& out
theAnswer = true;
}
}
-
+
return theAnswer;
}
bool CACFDictionary::GetData(const CFStringRef inKey, CFDataRef& outValue) const
{
bool theAnswer = false;
-
+
CFTypeRef theValue = NULL;
if(GetCFType(inKey, theValue))
{
@@ -261,27 +261,27 @@ bool CACFDictionary::GetData(const CFStringRef inKey, CFDataRef& outValue) const
theAnswer = true;
}
}
-
+
return theAnswer;
}
bool CACFDictionary::GetCFType(const CFStringRef inKey, CFTypeRef& outValue) const
{
bool theAnswer = false;
-
+
if(mCFDictionary != NULL)
{
outValue = CFDictionaryGetValue(mCFDictionary, inKey);
theAnswer = (outValue != NULL);
}
-
+
return theAnswer;
}
bool CACFDictionary::GetCFTypeWithCStringKey(const char* inKey, CFTypeRef& outValue) const
{
bool theAnswer = false;
-
+
if(mCFDictionary != NULL)
{
CACFString theKey(inKey);
@@ -290,165 +290,165 @@ bool CACFDictionary::GetCFTypeWithCStringKey(const char* inKey, CFTypeRef& outVa
theAnswer = GetCFType(theKey.GetCFString(), outValue);
}
}
-
+
return theAnswer;
}
bool CACFDictionary::AddSInt32(const CFStringRef inKey, SInt32 inValue)
{
bool theAnswer = false;
-
+
if(mMutable && (mCFDictionary != NULL))
{
CACFNumber theValue(inValue);
theAnswer = AddCFType(inKey, theValue.GetCFNumber());
}
-
+
return theAnswer;
}
bool CACFDictionary::AddUInt32(const CFStringRef inKey, UInt32 inValue)
{
bool theAnswer = false;
-
+
if(mMutable && (mCFDictionary != NULL))
{
CACFNumber theValue(inValue);
theAnswer = AddCFType(inKey, theValue.GetCFNumber());
}
-
+
return theAnswer;
}
bool CACFDictionary::AddSInt64(const CFStringRef inKey, SInt64 inValue)
{
bool theAnswer = false;
-
+
if(mMutable && (mCFDictionary != NULL))
{
CACFNumber theValue(inValue);
theAnswer = AddCFType(inKey, theValue.GetCFNumber());
}
-
+
return theAnswer;
}
bool CACFDictionary::AddUInt64(const CFStringRef inKey, UInt64 inValue)
{
bool theAnswer = false;
-
+
if(mMutable && (mCFDictionary != NULL))
{
CACFNumber theValue(inValue);
theAnswer = AddCFType(inKey, theValue.GetCFNumber());
}
-
+
return theAnswer;
}
bool CACFDictionary::AddFloat32(const CFStringRef inKey, Float32 inValue)
{
bool theAnswer = false;
-
+
if(mMutable && (mCFDictionary != NULL))
{
CACFNumber theValue(inValue);
theAnswer = AddCFType(inKey, theValue.GetCFNumber());
}
-
+
return theAnswer;
}
bool CACFDictionary::AddFloat64(const CFStringRef inKey, Float64 inValue)
{
bool theAnswer = false;
-
+
if(mMutable && (mCFDictionary != NULL))
{
CACFNumber theValue(inValue);
theAnswer = AddCFType(inKey, theValue.GetCFNumber());
}
-
+
return theAnswer;
}
bool CACFDictionary::AddNumber(const CFStringRef inKey, const CFNumberRef inValue)
{
bool theAnswer = false;
-
+
if(mMutable && (mCFDictionary != NULL))
{
theAnswer = AddCFType(inKey, inValue);
}
-
+
return theAnswer;
}
bool CACFDictionary::AddString(const CFStringRef inKey, const CFStringRef inValue)
{
bool theAnswer = false;
-
+
if(mMutable && (mCFDictionary != NULL))
{
theAnswer = AddCFType(inKey, inValue);
}
-
+
return theAnswer;
}
bool CACFDictionary::AddArray(const CFStringRef inKey, const CFArrayRef inValue)
{
bool theAnswer = false;
-
+
if(mMutable && (mCFDictionary != NULL))
{
theAnswer = AddCFType(inKey, inValue);
}
-
+
return theAnswer;
}
bool CACFDictionary::AddDictionary(const CFStringRef inKey, const CFDictionaryRef inValue)
{
bool theAnswer = false;
-
+
if(mMutable && (mCFDictionary != NULL))
{
theAnswer = AddCFType(inKey, inValue);
}
-
+
return theAnswer;
}
bool CACFDictionary::AddData(const CFStringRef inKey, const CFDataRef inValue)
{
bool theAnswer = false;
-
+
if(mMutable && (mCFDictionary != NULL))
{
theAnswer = AddCFType(inKey, inValue);
}
-
+
return theAnswer;
}
bool CACFDictionary::AddCFType(const CFStringRef inKey, const CFTypeRef inValue)
{
bool theAnswer = false;
-
+
if(mMutable && (mCFDictionary != NULL))
{
CFDictionarySetValue(mCFDictionary, inKey, inValue);
theAnswer = true;
}
-
+
return theAnswer;
}
bool CACFDictionary::AddCFTypeWithCStringKey(const char* inKey, const CFTypeRef inValue)
{
bool theAnswer = false;
-
+
if(mMutable && (mCFDictionary != NULL))
{
CACFString theKey(inKey);
@@ -457,14 +457,14 @@ bool CACFDictionary::AddCFTypeWithCStringKey(const char* inKey, const CFTypeRef
theAnswer = AddCFType(theKey.GetCFString(), inValue);
}
}
-
+
return theAnswer;
}
bool CACFDictionary::AddCString(const CFStringRef inKey, const char* inValue)
{
bool theAnswer = false;
-
+
if(mMutable && (mCFDictionary != NULL))
{
CACFString theValue(inValue);
@@ -473,6 +473,6 @@ bool CACFDictionary::AddCString(const CFStringRef inKey, const char* inValue)
theAnswer = AddCFType(inKey, theValue.GetCFString());
}
}
-
+
return theAnswer;
}
diff --git a/libs/appleutility/CACFDictionary.h b/libs/appleutility/CACFDictionary.h
index ac82ebb87c..3221436a16 100644
--- a/libs/appleutility/CACFDictionary.h
+++ b/libs/appleutility/CACFDictionary.h
@@ -68,16 +68,16 @@ public:
CACFDictionary(const CACFDictionary& inDictionary) : mCFDictionary(inDictionary.mCFDictionary), mRelease(inDictionary.mRelease), mMutable(inDictionary.mMutable) { if(mRelease && (mCFDictionary != NULL)) { CFRetain(mCFDictionary); } }
CACFDictionary& operator=(const CACFDictionary& inDictionary) { mCFDictionary = inDictionary.mCFDictionary; mRelease = inDictionary.mRelease; mMutable = inDictionary.mMutable; if(mRelease && (mCFDictionary != NULL)) { CFRetain(mCFDictionary); } return *this; }
~CACFDictionary() { if(mRelease && (mCFDictionary != NULL)) { CFRelease(mCFDictionary); } }
-
+
// Attributes
public:
bool IsValid() const { return mCFDictionary != NULL; }
bool IsMutable() const { return mMutable;}
bool CanModify() const { return mMutable && (mCFDictionary != NULL); }
-
+
bool WillRelease() const { return mRelease; }
void ShouldRelease(bool inRelease) { mRelease = inRelease; }
-
+
CFDictionaryRef GetDict() const { return mCFDictionary; }
CFDictionaryRef GetCFDictionary() const { return mCFDictionary; }
CFDictionaryRef CopyCFDictionary() const { if(mCFDictionary != NULL) { CFRetain(mCFDictionary); } return mCFDictionary; }
@@ -95,7 +95,7 @@ public:
bool HasKey(const CFStringRef inKey) const;
UInt32 Size() const;
void GetKeys(const void** keys) const;
-
+
bool GetBool(const CFStringRef inKey, bool& outValue) const;
bool GetSInt32(const CFStringRef inKey, SInt32& outValue) const;
bool GetUInt32(const CFStringRef inKey, UInt32& outValue) const;
@@ -103,12 +103,12 @@ public:
bool GetUInt64(const CFStringRef inKey, UInt64& outValue) const;
bool GetFloat32(const CFStringRef inKey, Float32& outValue) const;
bool GetFloat64(const CFStringRef inKey, Float64& outValue) const;
- bool GetString(const CFStringRef inKey, CFStringRef& outValue) const;
- bool GetArray(const CFStringRef inKey, CFArrayRef& outValue) const;
- bool GetDictionary(const CFStringRef inKey, CFDictionaryRef& outValue) const;
+ bool GetString(const CFStringRef inKey, CFStringRef& outValue) const;
+ bool GetArray(const CFStringRef inKey, CFArrayRef& outValue) const;
+ bool GetDictionary(const CFStringRef inKey, CFDictionaryRef& outValue) const;
bool GetData(const CFStringRef inKey, CFDataRef& outValue) const;
bool GetCFType(const CFStringRef inKey, CFTypeRef& outValue) const;
-
+
bool GetCFTypeWithCStringKey(const char* inKey, CFTypeRef& outValue) const;
bool AddSInt32(const CFStringRef inKey, SInt32 inValue);
@@ -123,14 +123,14 @@ public:
bool AddDictionary(const CFStringRef inKey, const CFDictionaryRef inValue);
bool AddData(const CFStringRef inKey, const CFDataRef inValue);
bool AddCFType(const CFStringRef inKey, const CFTypeRef inValue);
-
+
bool AddCFTypeWithCStringKey(const char* inKey, const CFTypeRef inValue);
bool AddCString(const CFStringRef inKey, const char* inValue);
void Clear() { if(CanModify()) { CFDictionaryRemoveAllValues(mCFDictionary); } }
-
+
void Show() { CFShow(mCFDictionary); }
-
+
// Implementation
private:
CFMutableDictionaryRef mCFDictionary;
diff --git a/libs/appleutility/CACFNumber.cpp b/libs/appleutility/CACFNumber.cpp
index 3b6160c8bb..edbf3db2d9 100644
--- a/libs/appleutility/CACFNumber.cpp
+++ b/libs/appleutility/CACFNumber.cpp
@@ -53,13 +53,13 @@
Float32 CACFNumber::GetFixed32() const
{
SInt32 theFixedValue = GetSInt32();
-
+
// this is a 16.16 value so convert it to a float
Float32 theSign = theFixedValue < 0 ? -1.0 : 1.0;
theFixedValue *= (SInt32)theSign;
Float32 theWholePart = (theFixedValue & 0x7FFF0000) >> 16;
Float32 theFractPart = theFixedValue & 0x0000FFFF;
theFractPart /= 65536.0;
-
+
return theSign * (theWholePart + theFractPart);
}
diff --git a/libs/appleutility/CACFNumber.h b/libs/appleutility/CACFNumber.h
index 3991637bac..450a94dd47 100644
--- a/libs/appleutility/CACFNumber.h
+++ b/libs/appleutility/CACFNumber.h
@@ -77,7 +77,7 @@ public:
private:
void Retain() { if(mWillRelease && (mCFNumber != NULL)) { CFRetain(mCFNumber); } }
void Release() { if(mWillRelease && (mCFNumber != NULL)) { CFRelease(mCFNumber); } }
-
+
CFNumberRef mCFNumber;
bool mWillRelease;
diff --git a/libs/appleutility/CACFString.cpp b/libs/appleutility/CACFString.cpp
index ec3b18a8b6..5e00b11db6 100644
--- a/libs/appleutility/CACFString.cpp
+++ b/libs/appleutility/CACFString.cpp
@@ -53,13 +53,13 @@
UInt32 CACFString::GetStringByteLength(CFStringRef inCFString, CFStringEncoding inEncoding)
{
UInt32 theAnswer = 0;
-
+
if(inCFString != NULL)
{
CFRange theRange = { 0, CFStringGetLength(inCFString) };
CFStringGetBytes(inCFString, theRange, inEncoding, 0, false, NULL, 0x7FFFFFFF, (CFIndex*)&theAnswer);
}
-
+
return theAnswer;
}
diff --git a/libs/appleutility/CACFString.h b/libs/appleutility/CACFString.h
index 51fa64ebff..4adc460e70 100644
--- a/libs/appleutility/CACFString.h
+++ b/libs/appleutility/CACFString.h
@@ -74,7 +74,7 @@ public:
private:
void Retain() { if(mWillRelease && (mCFString != NULL)) { CFRetain(mCFString); } }
void Release() { if(mWillRelease && (mCFString != NULL)) { CFRelease(mCFString); } }
-
+
CFStringRef mCFString;
bool mWillRelease;
@@ -98,7 +98,7 @@ public:
static UInt32 GetStringByteLength(CFStringRef inCFString, CFStringEncoding inEncoding = kCFStringEncodingUTF8);
static void GetCString(CFStringRef inCFString, char* outString, UInt32& ioStringSize, CFStringEncoding inEncoding = kCFStringEncodingUTF8);
static void GetUnicodeString(CFStringRef inCFString, UInt16* outString, UInt32& ioStringSize);
-
+
};
inline bool operator<(const CACFString& x, const CACFString& y) { return CFStringCompare(x.GetCFString(), y.GetCFString(), 0) == kCFCompareLessThan; }
@@ -129,7 +129,7 @@ public:
private:
void Retain() { if(mWillRelease && (mCFMutableString != NULL)) { CFRetain(mCFMutableString); } }
void Release() { if(mWillRelease && (mCFMutableString != NULL)) { CFRelease(mCFMutableString); } }
-
+
CFMutableStringRef mCFMutableString;
bool mWillRelease;
diff --git a/libs/appleutility/CAComponent.cpp b/libs/appleutility/CAComponent.cpp
index 914e8f3c08..5c9686df36 100644
--- a/libs/appleutility/CAComponent.cpp
+++ b/libs/appleutility/CAComponent.cpp
@@ -94,15 +94,15 @@ OSStatus CAComponent::GetResourceVersion (UInt32 &outVersion) const
ResFileRefNum componentResFileID = kResFileNotOpened;
OSStatus result;
short thngResourceCount;
-
+
short curRes = CurResFile();
require_noerr (result = OpenAComponentResFile( mComp, &componentResFileID), home);
require_noerr (result = componentResFileID <= 0, home);
-
+
UseResFile(componentResFileID);
thngResourceCount = Count1Resources(kComponentResourceType);
-
+
require_noerr (result = ResError(), home);
// only go on if we successfully found at least 1 thng resource
require_noerr (thngResourceCount <= 0 ? -1 : 0, home);
@@ -135,12 +135,12 @@ OSStatus CAComponent::GetResourceVersion (UInt32 &outVersion) const
if (!versionFound)
result = resNotFound;
-
+
UseResFile(curRes); // revert
-
+
if ( componentResFileID != kResFileNotOpened )
CloseComponentResFile(componentResFileID);
-
+
home:
return result;
}
@@ -174,9 +174,9 @@ void CAComponent::SetCompNames () const
Handle h1 = NewHandle(4);
CAComponentDescription desc;
OSStatus err = GetComponentInfo (Comp(), &desc, h1, 0, 0);
-
+
if (err) { DisposeHandle(h1); return; }
-
+
HLock(h1);
char* ptr1 = *h1;
// Get the manufacturer's name... look for the ':' character convention
@@ -184,7 +184,7 @@ void CAComponent::SetCompNames () const
char* displayStr = 0;
const_cast<CAComponent*>(this)->mCompName = CFStringCreateWithPascalString(NULL, (const unsigned char*)*h1, kCFStringEncodingMacRoman);
-
+
for (int i = 0; i < len; ++i) {
if (ptr1[i] == ':') { // found the name
ptr1[i] = 0;
@@ -192,11 +192,11 @@ void CAComponent::SetCompNames () const
break;
}
}
-
+
if (displayStr)
{
const_cast<CAComponent*>(this)->mManuName = CFStringCreateWithCString(NULL, displayStr, kCFStringEncodingMacRoman);
-
+
//move displayStr ptr past the manu, to the name
// we move the characters down a index, because the handle doesn't have any room
// at the end for the \0
@@ -209,7 +209,7 @@ void CAComponent::SetCompNames () const
const_cast<CAComponent*>(this)->mAUName = CFStringCreateWithCString(NULL, displayStr, kCFStringEncodingMacRoman);
}
-
+
DisposeHandle (h1);
}
}
diff --git a/libs/appleutility/CAComponent.h b/libs/appleutility/CAComponent.h
index 2e721d8df9..4009bc42fe 100644
--- a/libs/appleutility/CAComponent.h
+++ b/libs/appleutility/CAComponent.h
@@ -57,59 +57,59 @@ class CAComponent
public:
CAComponent ()
: mComp (0), mDesc(), mManuName(0), mAUName(0), mCompName(0), mCompInfo (0) {}
-
+
// if next is specifed that is used to find the next component after that one
CAComponent (const ComponentDescription& inDesc, CAComponent* next = 0);
-
+
CAComponent (const CAComponent& y)
: mComp (0), mDesc(), mManuName(0), mAUName(0), mCompName(0), mCompInfo (0) { *this = y; }
CAComponent (const Component& comp);
-
+
CAComponent (const ComponentInstance& compInst);
CAComponent (OSType inType, OSType inSubtype = 0, OSType inManu = 0);
-
+
~CAComponent ();
-
+
CAComponent& operator= (const CAComponent& y);
-
+
// returns true if this object references a valid component
bool IsValid () const { return Comp() != 0; }
-
+
bool HasAUStrings() const { SetCompNames (); return mManuName != 0; }
// CFStringRef should be retained by caller if needed beyond lifetime of this object
-
+
// Can return NULL if component doesn't follow AU naming conventions
CFStringRef GetAUManu () const { SetCompNames (); return mManuName; }
CFStringRef GetAUName () const { SetCompNames (); return mAUName ? mAUName : mCompName; }
-
+
// Return value of NULL indicates a problem getting that information from the component
CFStringRef GetCompName () const { SetCompNames(); return mCompName; }
CFStringRef GetCompInfo () const { SetCompInfo(); return mCompInfo; }
-
+
const CAComponentDescription& Desc () const { return mDesc; }
-
+
OSStatus Open (ComponentInstance& outInst) const
{
return OpenAComponent (Comp(), &outInst);
}
OSStatus GetResourceVersion (UInt32 &outVersion) const;
-
+
const Component& Comp() const { return mComp; }
-
+
void Print(FILE* file = stdout) const;
OSStatus Save (CFPropertyListRef *outData) const;
-
+
OSStatus Restore (CFPropertyListRef &inData);
-
+
private:
Component mComp;
CAComponentDescription mDesc;
-
+
CFStringRef mManuName, mAUName, mCompName, mCompInfo;
void SetCompNames () const;
diff --git a/libs/appleutility/CAComponentDescription.cpp b/libs/appleutility/CAComponentDescription.cpp
index 7c3a449955..70e0285501 100644
--- a/libs/appleutility/CAComponentDescription.cpp
+++ b/libs/appleutility/CAComponentDescription.cpp
@@ -73,7 +73,7 @@ void CAComponentDescription::_CAShowComponentDescription(const ComponentDescrip
char str[24];
fprintf (file, "ComponentDescription: %s - ", StringForOSType(desc->componentType, str));
fprintf (file, "%s - ", StringForOSType(desc->componentSubType, str));
- fprintf (file, "%s", StringForOSType(desc->componentManufacturer, str));
+ fprintf (file, "%s", StringForOSType(desc->componentManufacturer, str));
fprintf (file, ", 0x%lX, 0x%lX\n", desc->componentFlags, desc->componentFlagsMask);
}
}
@@ -91,7 +91,7 @@ bool CAComponentDescription::IsAU () const
{
bool flag = IsEffect() || IsMusicDevice() || IsOffline();
if (flag) return true;
-
+
switch (componentType) {
case kAudioUnitType_Output:
case kAudioUnitType_FormatConverter:
@@ -109,15 +109,15 @@ inline bool _MatchTest (const OSType &inTypeA, const OSType &inTypeB)
bool CAComponentDescription::Matches (const ComponentDescription &desc) const
{
bool matches = false;
-
+
// see if the type matches
matches = _MatchTest (componentType, desc.componentType);
-
+
if (matches)
matches = _MatchTest (componentSubType, desc.componentSubType);
-
+
if (matches)
matches = _MatchTest (componentManufacturer, desc.componentManufacturer);
-
+
return matches;
}
diff --git a/libs/appleutility/CAComponentDescription.h b/libs/appleutility/CAComponentDescription.h
index a681902b91..a70d1eb2ec 100644
--- a/libs/appleutility/CAComponentDescription.h
+++ b/libs/appleutility/CAComponentDescription.h
@@ -37,7 +37,7 @@
*/
/*=============================================================================
CAComponentDescription.h
-
+
=============================================================================*/
#ifndef __CAComponentDescription_h__
@@ -73,53 +73,53 @@ void CAShowComponentDescription(const ComponentDescription *desc);
class CAComponentDescription : public ComponentDescription {
public:
CAComponentDescription() { memset (this, 0, sizeof (ComponentDescription)); }
-
+
CAComponentDescription (OSType inType, OSType inSubtype = 0, OSType inManu = 0);
CAComponentDescription(const ComponentDescription& desc) { memcpy (this, &desc, sizeof (ComponentDescription)); }
-
+
// _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
//
// interrogation
-
+
bool IsAU () const;
-
+
bool IsAUFX() const { return componentType == kAudioUnitType_Effect; }
bool IsAUFM() const { return componentType == kAudioUnitType_MusicEffect; }
-
+
bool IsEffect () const { return IsAUFX() || IsAUFM() || IsPanner(); }
-
+
bool IsOffline () const { return componentType == 'auol'; }
-
+
bool IsFConv () const { return componentType == kAudioUnitType_FormatConverter; }
-
+
bool IsPanner () const { return componentType == kAudioUnitType_Panner; }
-
+
bool IsMusicDevice () const { return componentType == kAudioUnitType_MusicDevice; }
-
+
#ifndef MAC_OS_X_VERSION_10_4
bool IsGenerator () const { return componentType =='augn'; }
#else
bool IsGenerator () const { return componentType ==kAudioUnitType_Generator; }
#endif
-
+
bool IsOutput () const { return componentType == kAudioUnitType_Output; }
-
+
bool IsSource () const { return IsMusicDevice() || IsGenerator(); }
-
+
OSType Type () const { return componentType; }
OSType SubType () const { return componentSubType; }
OSType Manu () const { return componentManufacturer; }
int Count() const { return CountComponents(const_cast<CAComponentDescription*>(this)); }
-
+
// does a semantic match where "wild card" values for type, subtype, manu will match
bool Matches (const ComponentDescription &desc) const;
-
+
// _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
//
// other
-
+
void Print(FILE* file = stdout) const { _CAShowComponentDescription (this, file); }
OSStatus Save (CFPropertyListRef *outData) const;
diff --git a/libs/appleutility/CADebugMacros.h b/libs/appleutility/CADebugMacros.h
index 1abae40187..58e5387862 100644
--- a/libs/appleutility/CADebugMacros.h
+++ b/libs/appleutility/CADebugMacros.h
@@ -56,10 +56,10 @@
#pragma mark Basic Definitions
#if DEBUG || CoreAudio_Debug
-
+
// can be used to break into debugger immediately, also see CADebugger
#define BusError() (*(long *)0 = 0)
-
+
// basic debugging print routines
#if TARGET_OS_MAC && !TARGET_API_MAC_CARBON
extern pascal void DebugStr(const unsigned char* debuggerMsg);
@@ -69,13 +69,13 @@
#define DebugMessageN3(msg, N1, N2, N3)
#else
#include "CADebugPrintf.h"
-
+
#if (CoreAudio_FlushDebugMessages && !CoreAudio_UseSysLog) || defined(CoreAudio_UseSideFile)
#define FlushRtn ;fflush(DebugPrintfFile)
#else
#define FlushRtn
#endif
-
+
#if CoreAudio_ThreadStampMessages
#include <pthread.h>
#include "CAHostTimeBase.h"
@@ -121,7 +121,7 @@
#else
#define vprint(msg)
#endif
-
+
#if CoreAudio_StopOnFailure
#include "CADebugger.h"
#define STOP CADebuggerStop()
diff --git a/libs/appleutility/CAMath.h b/libs/appleutility/CAMath.h
index 32b4e7f0b3..bc9ec51661 100644
--- a/libs/appleutility/CAMath.h
+++ b/libs/appleutility/CAMath.h
@@ -37,7 +37,7 @@
*/
/*=============================================================================
CAMath.h
-
+
=============================================================================*/
#ifndef __CAMath_h__
diff --git a/libs/appleutility/CAReferenceCounted.h b/libs/appleutility/CAReferenceCounted.h
index 5c9b1168bd..c17b5c38bd 100644
--- a/libs/appleutility/CAReferenceCounted.h
+++ b/libs/appleutility/CAReferenceCounted.h
@@ -37,7 +37,7 @@
*/
/*=============================================================================
CAReferenceCounted.h
-
+
=============================================================================*/
#ifndef __CAReferenceCounted_h__
@@ -57,9 +57,9 @@
class CAReferenceCounted {
public:
CAReferenceCounted() : mRefCount(1) {}
-
+
void retain() { IncrementAtomic(&mRefCount); }
-
+
void release()
{
// this returns the ORIGINAL value, not the new one.
diff --git a/libs/appleutility/CAStreamBasicDescription.cpp b/libs/appleutility/CAStreamBasicDescription.cpp
index e89b898666..bc48dd0f76 100644
--- a/libs/appleutility/CAStreamBasicDescription.cpp
+++ b/libs/appleutility/CAStreamBasicDescription.cpp
@@ -76,7 +76,7 @@ void CAStreamBasicDescription::PrintFormat(FILE *f, const char *indent, const ch
char formatID[5];
*(UInt32 *)formatID = CFSwapInt32HostToBig(mFormatID);
formatID[4] = '\0';
- fprintf(f, "%2ld ch, %6.0f Hz, '%-4.4s' (0x%08lX) ",
+ fprintf(f, "%2ld ch, %6.0f Hz, '%-4.4s' (0x%08lX) ",
NumberChannels(), mSampleRate, formatID,
mFormatFlags);
if (mFormatID == kAudioFormatLinearPCM) {
@@ -99,7 +99,7 @@ void CAStreamBasicDescription::PrintFormat(FILE *f, const char *indent, const ch
((mFormatFlags & kLinearPCMFormatFlagIsAlignedHigh) ? " high-aligned" : " low-aligned") : "";
const char *deinter = (mFormatFlags & kAudioFormatFlagIsNonInterleaved) ? ", deinterleaved" : "";
const char *commaSpace = (packed[0]!='\0') || (align[0]!='\0') ? ", " : "";
-
+
fprintf(f, "%ld-bit%s%s %s%s%s%s%s\n",
mBitsPerChannel, endian, sign, floatInt,
commaSpace, packed, align, deinter);
@@ -124,7 +124,7 @@ void CAStreamBasicDescription::PrintFormat(FILE *f, const char *indent, const ch
fprintf(f, "from %d-bit source, ", sourceBits);
else
fprintf(f, "from UNKNOWN source bit depth, ");
-
+
fprintf(f, "%ld frames/packet\n", mFramesPerPacket);
}
else
@@ -213,7 +213,7 @@ void CAStreamBasicDescription::GetSimpleName(const AudioStreamBasicDescription&
theEndianString = "Little Endian";
#endif
}
-
+
const char* theKindString = NULL;
if((inDescription.mFormatFlags & kAudioFormatFlagIsFloat) != 0)
{
@@ -227,7 +227,7 @@ void CAStreamBasicDescription::GetSimpleName(const AudioStreamBasicDescription&
{
theKindString = (inAbbreviate ? "UInt" : "Unsigned Integer");
}
-
+
const char* thePackingString = NULL;
if((inDescription.mFormatFlags & kAudioFormatFlagIsPacked) == 0)
{
@@ -240,7 +240,7 @@ void CAStreamBasicDescription::GetSimpleName(const AudioStreamBasicDescription&
thePackingString = "Low";
}
}
-
+
const char* theMixabilityString = NULL;
if((inDescription.mFormatFlags & kIsNonMixableFlag) == 0)
{
@@ -250,7 +250,7 @@ void CAStreamBasicDescription::GetSimpleName(const AudioStreamBasicDescription&
{
theMixabilityString = "Unmixable";
}
-
+
if(inAbbreviate)
{
if(theEndianString != NULL)
@@ -303,15 +303,15 @@ void CAStreamBasicDescription::GetSimpleName(const AudioStreamBasicDescription&
}
}
break;
-
+
case kAudioFormatAC3:
strcpy(outName, "AC-3");
break;
-
+
case kAudioFormat60958AC3:
strcpy(outName, "AC-3 for SPDIF");
break;
-
+
default:
{
char* the4CCString = (char*)&inDescription.mFormatID;
@@ -345,9 +345,9 @@ bool operator<(const AudioStreamBasicDescription& x, const AudioStreamBasicDescr
{
bool theAnswer = false;
bool isDone = false;
-
+
// note that if either side is 0, that field is skipped
-
+
// format ID is the first order sort
if((!isDone) && ((x.mFormatID != 0) && (y.mFormatID != 0)))
{
@@ -370,8 +370,8 @@ bool operator<(const AudioStreamBasicDescription& x, const AudioStreamBasicDescr
isDone = true;
}
}
-
-
+
+
// mixable is always better than non-mixable for linear PCM and should be the second order sort item
if((!isDone) && ((x.mFormatID == kAudioFormatLinearPCM) && (y.mFormatID == kAudioFormatLinearPCM)))
{
@@ -386,7 +386,7 @@ bool operator<(const AudioStreamBasicDescription& x, const AudioStreamBasicDescr
isDone = true;
}
}
-
+
// floating point vs integer for linear PCM only
if((!isDone) && ((x.mFormatID == kAudioFormatLinearPCM) && (y.mFormatID == kAudioFormatLinearPCM)))
{
@@ -397,7 +397,7 @@ bool operator<(const AudioStreamBasicDescription& x, const AudioStreamBasicDescr
isDone = true;
}
}
-
+
// bit depth
if((!isDone) && ((x.mBitsPerChannel != 0) && (y.mBitsPerChannel != 0)))
{
@@ -408,7 +408,7 @@ bool operator<(const AudioStreamBasicDescription& x, const AudioStreamBasicDescr
isDone = true;
}
}
-
+
// sample rate
if((!isDone) && fnonzero(x.mSampleRate) && fnonzero(y.mSampleRate))
{
@@ -419,7 +419,7 @@ bool operator<(const AudioStreamBasicDescription& x, const AudioStreamBasicDescr
isDone = true;
}
}
-
+
// number of channels
if((!isDone) && ((x.mChannelsPerFrame != 0) && (y.mChannelsPerFrame != 0)))
{
@@ -430,7 +430,7 @@ bool operator<(const AudioStreamBasicDescription& x, const AudioStreamBasicDescr
isDone = true;
}
}
-
+
return theAnswer;
}
@@ -438,29 +438,29 @@ static bool MatchFormatFlags(const AudioStreamBasicDescription& x, const AudioSt
{
UInt32 xFlags = x.mFormatFlags;
UInt32 yFlags = y.mFormatFlags;
-
+
// match wildcards
if (x.mFormatID == 0 || y.mFormatID == 0 || xFlags == 0 || yFlags == 0)
return true;
-
+
if (x.mFormatID == kAudioFormatLinearPCM)
- {
+ {
// knock off the all clear flag
xFlags = xFlags & ~kAudioFormatFlagsAreAllClear;
yFlags = yFlags & ~kAudioFormatFlagsAreAllClear;
-
+
// if both kAudioFormatFlagIsPacked bits are set, then we don't care about the kAudioFormatFlagIsAlignedHigh bit.
if (xFlags & yFlags & kAudioFormatFlagIsPacked) {
xFlags = xFlags & ~kAudioFormatFlagIsAlignedHigh;
yFlags = yFlags & ~kAudioFormatFlagIsAlignedHigh;
}
-
+
// if both kAudioFormatFlagIsFloat bits are set, then we don't care about the kAudioFormatFlagIsSignedInteger bit.
if (xFlags & yFlags & kAudioFormatFlagIsFloat) {
xFlags = xFlags & ~kAudioFormatFlagIsSignedInteger;
yFlags = yFlags & ~kAudioFormatFlagIsSignedInteger;
}
-
+
// if the bit depth is 8 bits or less and the format is packed, we don't care about endianness
if((x.mBitsPerChannel <= 8) && ((xFlags & kAudioFormatFlagIsPacked) == kAudioFormatFlagIsPacked))
{
@@ -470,7 +470,7 @@ static bool MatchFormatFlags(const AudioStreamBasicDescription& x, const AudioSt
{
yFlags = yFlags & ~kAudioFormatFlagIsBigEndian;
}
-
+
// if the number of channels is 0 or 1, we don't care about non-interleavedness
if (x.mChannelsPerFrame <= 1 && y.mChannelsPerFrame <= 1) {
xFlags &= ~kLinearPCMFormatFlagIsNonInterleaved;
@@ -485,31 +485,31 @@ bool operator==(const AudioStreamBasicDescription& x, const AudioStreamBasicDesc
// the semantics for equality are:
// 1) Values must match exactly
// 2) wildcard's are ignored in the comparison
-
+
#define MATCH(name) ((x.name) == 0 || (y.name) == 0 || (x.name) == (y.name))
-
+
return
// check the sample rate
(fiszero(x.mSampleRate) || fiszero(y.mSampleRate) || fequal(x.mSampleRate, y.mSampleRate))
-
+
// check the format ids
&& MATCH(mFormatID)
-
+
// check the format flags
&& MatchFormatFlags(x, y)
-
+
// check the bytes per packet
&& MATCH(mBytesPerPacket)
-
+
// check the frames per packet
&& MATCH(mFramesPerPacket)
-
+
// check the bytes per frame
&& MATCH(mBytesPerFrame)
-
+
// check the channels per frame
&& MATCH(mChannelsPerFrame)
-
+
// check the channels per frame
&& MATCH(mBitsPerChannel) ;
}
diff --git a/libs/appleutility/CAStreamBasicDescription.h b/libs/appleutility/CAStreamBasicDescription.h
index c9caed5aa0..db3faaea0d 100644
--- a/libs/appleutility/CAStreamBasicDescription.h
+++ b/libs/appleutility/CAStreamBasicDescription.h
@@ -37,7 +37,7 @@
*/
/*=============================================================================
CAStreamBasicDescription.h
-
+
=============================================================================*/
#ifndef __CAStreamBasicDescription_h__
@@ -82,12 +82,12 @@ public:
// Construction/Destruction
public:
CAStreamBasicDescription() { memset (this, 0, sizeof(AudioStreamBasicDescription)); }
-
+
CAStreamBasicDescription(const AudioStreamBasicDescription &desc)
{
SetFrom(desc);
}
-
+
CAStreamBasicDescription( double inSampleRate, UInt32 inFormatID,
UInt32 inBytesPerPacket, UInt32 inFramesPerPacket,
UInt32 inBytesPerFrame, UInt32 inChannelsPerFrame,
@@ -100,31 +100,31 @@ public:
{
memcpy(this, &desc, sizeof(AudioStreamBasicDescription));
}
-
+
// _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
//
// interrogation
-
+
bool IsPCM() const { return mFormatID == kAudioFormatLinearPCM; }
-
+
bool PackednessIsSignificant() const
{
Assert(IsPCM(), "PackednessIsSignificant only applies for PCM");
return (SampleWordSize() << 3) != mBitsPerChannel;
}
-
+
bool AlignmentIsSignificant() const
{
return PackednessIsSignificant() || (mBitsPerChannel & 7) != 0;
}
-
+
bool IsInterleaved() const
{
return !IsPCM() || !(mFormatFlags & kAudioFormatFlagIsNonInterleaved);
}
-
+
// for sanity with interleaved/deinterleaved possibilities, never access mChannelsPerFrame, use these:
- UInt32 NumberInterleavedChannels() const { return IsInterleaved() ? mChannelsPerFrame : 1; }
+ UInt32 NumberInterleavedChannels() const { return IsInterleaved() ? mChannelsPerFrame : 1; }
UInt32 NumberChannelStreams() const { return IsInterleaved() ? 1 : mChannelsPerFrame; }
UInt32 NumberChannels() const { return mChannelsPerFrame; }
UInt32 SampleWordSize() const { return (mBytesPerFrame > 0) ? mBytesPerFrame / NumberInterleavedChannels() : 0;}
@@ -134,16 +134,16 @@ public:
Assert(mBytesPerFrame > 0, "bytesPerFrame must be > 0 in BytesToFrames");
return nbytes / mBytesPerFrame;
}
-
+
bool SameChannelsAndInterleaving(const CAStreamBasicDescription &a) const
{
return this->NumberChannels() == a.NumberChannels() && this->IsInterleaved() == a.IsInterleaved();
}
-
+
// _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
//
// manipulation
-
+
void SetCanonical(UInt32 nChannels, bool interleaved)
// note: leaves sample rate untouched
{
@@ -159,7 +159,7 @@ public:
mFormatFlags |= kAudioFormatFlagIsNonInterleaved;
}
}
-
+
void ChangeNumberChannels(UInt32 nChannels, bool interleaved)
// alter an existing format
{
@@ -177,11 +177,11 @@ public:
mFormatFlags |= kAudioFormatFlagIsNonInterleaved;
}
}
-
+
// _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
//
// other
-
+
void Print() const
{
Print (stdout);
@@ -189,13 +189,13 @@ public:
void Print(FILE* file) const
{
- PrintFormat (file, "", "AudioStreamBasicDescription:");
+ PrintFormat (file, "", "AudioStreamBasicDescription:");
}
void PrintFormat(FILE *f, const char *indent, const char *name) const;
OSStatus Save(CFPropertyListRef *outData) const;
-
+
OSStatus Restore(CFPropertyListRef &inData);
// Operations
diff --git a/libs/appleutility/CAXException.cpp b/libs/appleutility/CAXException.cpp
index 088575f041..744a77ffa8 100644
--- a/libs/appleutility/CAXException.cpp
+++ b/libs/appleutility/CAXException.cpp
@@ -37,7 +37,7 @@
*/
/*=============================================================================
CAXException.cpp
-
+
=============================================================================*/
#include "CAXException.h"
diff --git a/libs/appleutility/CAXException.h b/libs/appleutility/CAXException.h
index 796119763d..b27f833805 100644
--- a/libs/appleutility/CAXException.h
+++ b/libs/appleutility/CAXException.h
@@ -37,7 +37,7 @@
*/
/*=============================================================================
CAXException.h
-
+
=============================================================================*/
#ifndef __CAXException_h__
@@ -68,24 +68,24 @@ public:
} else
strcpy(mOperation, operation);
}
-
+
char *FormatError(char *str) const
{
return FormatError(str, mError);
}
-
+
char mOperation[256];
const OSStatus mError;
-
+
// -------------------------------------------------
-
+
typedef void (*WarningHandler)(const char *msg, OSStatus err);
-
+
/*static void Throw(const char *operation, OSStatus err)
{
throw CAXException(operation, err);
}*/
-
+
static char *FormatError(char *str, OSStatus error)
{
// see if it appears to be a 4-char-code
@@ -98,13 +98,13 @@ public:
sprintf(str, "%ld", error);
return str;
}
-
+
static void Warning(const char *s, OSStatus error)
{
if (sWarningHandler)
(*sWarningHandler)(s, error);
}
-
+
static void SetWarningHandler(WarningHandler f) { sWarningHandler = f; }
private:
static WarningHandler sWarningHandler;