summaryrefslogtreecommitdiff
path: root/libs/appleutility/CoreAudio/PublicUtility
diff options
context:
space:
mode:
Diffstat (limited to 'libs/appleutility/CoreAudio/PublicUtility')
-rw-r--r--libs/appleutility/CoreAudio/PublicUtility/AUOutputBL.cpp40
-rw-r--r--libs/appleutility/CoreAudio/PublicUtility/AUOutputBL.h28
-rw-r--r--libs/appleutility/CoreAudio/PublicUtility/AUParamInfo.cpp42
-rw-r--r--libs/appleutility/CoreAudio/PublicUtility/AUParamInfo.h52
-rw-r--r--libs/appleutility/CoreAudio/PublicUtility/CAAUMIDIMap.cpp26
-rw-r--r--libs/appleutility/CoreAudio/PublicUtility/CAAUMIDIMap.h178
-rw-r--r--libs/appleutility/CoreAudio/PublicUtility/CAAUMIDIMapManager.cpp98
-rw-r--r--libs/appleutility/CoreAudio/PublicUtility/CAAUMIDIMapManager.h42
-rw-r--r--libs/appleutility/CoreAudio/PublicUtility/CAAUParameter.cpp112
-rw-r--r--libs/appleutility/CoreAudio/PublicUtility/CAAUParameter.h92
-rw-r--r--libs/appleutility/CoreAudio/PublicUtility/CAAUProcessor.cpp196
-rw-r--r--libs/appleutility/CoreAudio/PublicUtility/CAAUProcessor.h120
-rw-r--r--libs/appleutility/CoreAudio/PublicUtility/CAAtomic.h18
-rw-r--r--libs/appleutility/CoreAudio/PublicUtility/CAAtomicStack.h42
-rw-r--r--libs/appleutility/CoreAudio/PublicUtility/CAAudioBufferList.cpp36
-rw-r--r--libs/appleutility/CoreAudio/PublicUtility/CAAudioBufferList.h12
-rw-r--r--libs/appleutility/CoreAudio/PublicUtility/CAAudioChannelLayout.cpp20
-rw-r--r--libs/appleutility/CoreAudio/PublicUtility/CAAudioChannelLayout.h56
-rw-r--r--libs/appleutility/CoreAudio/PublicUtility/CAAudioChannelLayoutObject.cpp30
-rw-r--r--libs/appleutility/CoreAudio/PublicUtility/CAAudioFileFormats.cpp44
-rw-r--r--libs/appleutility/CoreAudio/PublicUtility/CAAudioFileFormats.h34
-rw-r--r--libs/appleutility/CoreAudio/PublicUtility/CAAudioTimeStamp.cpp28
-rw-r--r--libs/appleutility/CoreAudio/PublicUtility/CAAudioTimeStamp.h12
-rw-r--r--libs/appleutility/CoreAudio/PublicUtility/CAAudioUnit.cpp310
-rw-r--r--libs/appleutility/CoreAudio/PublicUtility/CAAudioUnit.h154
-rw-r--r--libs/appleutility/CoreAudio/PublicUtility/CAAudioUnitOutputCapturer.h24
-rw-r--r--libs/appleutility/CoreAudio/PublicUtility/CAAudioValueRange.cpp40
-rw-r--r--libs/appleutility/CoreAudio/PublicUtility/CAAudioValueRange.h14
-rw-r--r--libs/appleutility/CoreAudio/PublicUtility/CAAutoDisposer.h186
-rw-r--r--libs/appleutility/CoreAudio/PublicUtility/CABitOperations.h16
-rw-r--r--libs/appleutility/CoreAudio/PublicUtility/CABool.h18
-rw-r--r--libs/appleutility/CoreAudio/PublicUtility/CABufferList.cpp22
-rw-r--r--libs/appleutility/CoreAudio/PublicUtility/CABufferList.h70
-rw-r--r--libs/appleutility/CoreAudio/PublicUtility/CABundleLocker.cpp12
-rw-r--r--libs/appleutility/CoreAudio/PublicUtility/CABundleLocker.h14
-rw-r--r--libs/appleutility/CoreAudio/PublicUtility/CAByteOrder.h16
-rw-r--r--libs/appleutility/CoreAudio/PublicUtility/CACFArray.cpp164
-rw-r--r--libs/appleutility/CoreAudio/PublicUtility/CACFArray.h34
-rw-r--r--libs/appleutility/CoreAudio/PublicUtility/CACFData.h18
-rw-r--r--libs/appleutility/CoreAudio/PublicUtility/CACFDictionary.cpp108
-rw-r--r--libs/appleutility/CoreAudio/PublicUtility/CACFDictionary.h44
-rw-r--r--libs/appleutility/CoreAudio/PublicUtility/CACFDistributedNotification.cpp20
-rw-r--r--libs/appleutility/CoreAudio/PublicUtility/CACFDistributedNotification.h12
-rw-r--r--libs/appleutility/CoreAudio/PublicUtility/CACFMachPort.cpp20
-rw-r--r--libs/appleutility/CoreAudio/PublicUtility/CACFMachPort.h14
-rw-r--r--libs/appleutility/CoreAudio/PublicUtility/CACFMessagePort.cpp14
-rw-r--r--libs/appleutility/CoreAudio/PublicUtility/CACFMessagePort.h12
-rw-r--r--libs/appleutility/CoreAudio/PublicUtility/CACFNumber.cpp20
-rw-r--r--libs/appleutility/CoreAudio/PublicUtility/CACFNumber.h20
-rw-r--r--libs/appleutility/CoreAudio/PublicUtility/CACFObject.h14
-rw-r--r--libs/appleutility/CoreAudio/PublicUtility/CACFPlugIn.h16
-rw-r--r--libs/appleutility/CoreAudio/PublicUtility/CACFPreferences.cpp50
-rw-r--r--libs/appleutility/CoreAudio/PublicUtility/CACFPreferences.h14
-rw-r--r--libs/appleutility/CoreAudio/PublicUtility/CACFString.cpp16
-rw-r--r--libs/appleutility/CoreAudio/PublicUtility/CACFString.h18
-rw-r--r--libs/appleutility/CoreAudio/PublicUtility/CAComponent.cpp46
-rw-r--r--libs/appleutility/CoreAudio/PublicUtility/CAComponent.h50
-rw-r--r--libs/appleutility/CoreAudio/PublicUtility/CAComponentDescription.cpp30
-rw-r--r--libs/appleutility/CoreAudio/PublicUtility/CAComponentDescription.h48
-rw-r--r--libs/appleutility/CoreAudio/PublicUtility/CADebugMacros.cpp12
-rw-r--r--libs/appleutility/CoreAudio/PublicUtility/CADebugMacros.h20
-rw-r--r--libs/appleutility/CoreAudio/PublicUtility/CADebugPrintf.cpp14
-rw-r--r--libs/appleutility/CoreAudio/PublicUtility/CADebugPrintf.h22
-rw-r--r--libs/appleutility/CoreAudio/PublicUtility/CADebugger.cpp12
-rw-r--r--libs/appleutility/CoreAudio/PublicUtility/CADebugger.h12
-rw-r--r--libs/appleutility/CoreAudio/PublicUtility/CAException.h14
-rw-r--r--libs/appleutility/CoreAudio/PublicUtility/CAExtAudioFile.h58
-rw-r--r--libs/appleutility/CoreAudio/PublicUtility/CAFilePathUtils.cpp48
-rw-r--r--libs/appleutility/CoreAudio/PublicUtility/CAFilePathUtils.h12
-rw-r--r--libs/appleutility/CoreAudio/PublicUtility/CAGuard.cpp38
-rw-r--r--libs/appleutility/CoreAudio/PublicUtility/CAGuard.h26
-rw-r--r--libs/appleutility/CoreAudio/PublicUtility/CAHALAudioDevice.cpp26
-rw-r--r--libs/appleutility/CoreAudio/PublicUtility/CAHALAudioDevice.h32
-rw-r--r--libs/appleutility/CoreAudio/PublicUtility/CAHALAudioObject.cpp90
-rw-r--r--libs/appleutility/CoreAudio/PublicUtility/CAHALAudioObject.h22
-rw-r--r--libs/appleutility/CoreAudio/PublicUtility/CAHALAudioStream.cpp12
-rw-r--r--libs/appleutility/CoreAudio/PublicUtility/CAHALAudioStream.h12
-rw-r--r--libs/appleutility/CoreAudio/PublicUtility/CAHALAudioSystemObject.cpp18
-rw-r--r--libs/appleutility/CoreAudio/PublicUtility/CAHALAudioSystemObject.h14
-rw-r--r--libs/appleutility/CoreAudio/PublicUtility/CAHostTimeBase.cpp14
-rw-r--r--libs/appleutility/CoreAudio/PublicUtility/CAHostTimeBase.h32
-rw-r--r--libs/appleutility/CoreAudio/PublicUtility/CALogMacros.h54
-rw-r--r--libs/appleutility/CoreAudio/PublicUtility/CAMath.h12
-rw-r--r--libs/appleutility/CoreAudio/PublicUtility/CAMixMap.h54
-rw-r--r--libs/appleutility/CoreAudio/PublicUtility/CAMutex.cpp46
-rw-r--r--libs/appleutility/CoreAudio/PublicUtility/CAMutex.h36
-rw-r--r--libs/appleutility/CoreAudio/PublicUtility/CAPThread.cpp58
-rw-r--r--libs/appleutility/CoreAudio/PublicUtility/CAPThread.h20
-rw-r--r--libs/appleutility/CoreAudio/PublicUtility/CAPersistence.cpp146
-rw-r--r--libs/appleutility/CoreAudio/PublicUtility/CAProcess.cpp18
-rw-r--r--libs/appleutility/CoreAudio/PublicUtility/CAProcess.h12
-rw-r--r--libs/appleutility/CoreAudio/PublicUtility/CAPropertyAddress.h28
-rw-r--r--libs/appleutility/CoreAudio/PublicUtility/CAReferenceCounted.h30
-rw-r--r--libs/appleutility/CoreAudio/PublicUtility/CARingBuffer.cpp64
-rw-r--r--libs/appleutility/CoreAudio/PublicUtility/CARingBuffer.h36
-rw-r--r--libs/appleutility/CoreAudio/PublicUtility/CASettingsStorage.cpp158
-rw-r--r--libs/appleutility/CoreAudio/PublicUtility/CASettingsStorage.h26
-rw-r--r--libs/appleutility/CoreAudio/PublicUtility/CASharedLibrary.cpp16
-rw-r--r--libs/appleutility/CoreAudio/PublicUtility/CASharedLibrary.h12
-rw-r--r--libs/appleutility/CoreAudio/PublicUtility/CASpectralProcessor.cpp96
-rw-r--r--libs/appleutility/CoreAudio/PublicUtility/CASpectralProcessor.h46
-rw-r--r--libs/appleutility/CoreAudio/PublicUtility/CAStreamBasicDescription.cpp136
-rw-r--r--libs/appleutility/CoreAudio/PublicUtility/CAStreamBasicDescription.h84
-rw-r--r--libs/appleutility/CoreAudio/PublicUtility/CAStreamRangedDescription.cpp32
-rw-r--r--libs/appleutility/CoreAudio/PublicUtility/CAStreamRangedDescription.h20
-rw-r--r--libs/appleutility/CoreAudio/PublicUtility/CAThreadSafeList.h48
-rw-r--r--libs/appleutility/CoreAudio/PublicUtility/CATink.h22
-rw-r--r--libs/appleutility/CoreAudio/PublicUtility/CATokenMap.h32
-rw-r--r--libs/appleutility/CoreAudio/PublicUtility/CAVectorUnit.cpp38
-rw-r--r--libs/appleutility/CoreAudio/PublicUtility/CAVectorUnit.h12
-rw-r--r--libs/appleutility/CoreAudio/PublicUtility/CAVectorUnitTypes.h12
-rw-r--r--libs/appleutility/CoreAudio/PublicUtility/CAVolumeCurve.cpp138
-rw-r--r--libs/appleutility/CoreAudio/PublicUtility/CAVolumeCurve.h26
-rw-r--r--libs/appleutility/CoreAudio/PublicUtility/CAXException.cpp12
-rw-r--r--libs/appleutility/CoreAudio/PublicUtility/CAXException.h32
-rw-r--r--libs/appleutility/CoreAudio/PublicUtility/MatrixMixerVolumes.cpp36
-rw-r--r--libs/appleutility/CoreAudio/PublicUtility/MatrixMixerVolumes.h16
117 files changed, 2640 insertions, 2640 deletions
diff --git a/libs/appleutility/CoreAudio/PublicUtility/AUOutputBL.cpp b/libs/appleutility/CoreAudio/PublicUtility/AUOutputBL.cpp
index c2c8468bd9..8a76b8b5d0 100644
--- a/libs/appleutility/CoreAudio/PublicUtility/AUOutputBL.cpp
+++ b/libs/appleutility/CoreAudio/PublicUtility/AUOutputBL.cpp
@@ -2,14 +2,14 @@
File: AUOutputBL.cpp
Abstract: AUOutputBL.h
Version: 1.1
-
+
Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple
Inc. ("Apple") in consideration of your agreement to the following
terms, and your use, installation, modification or redistribution of
this Apple software constitutes acceptance of these terms. If you do
not agree with these terms, please do not use, install, modify or
redistribute this Apple software.
-
+
In consideration of your agreement to abide by the following terms, and
subject to these terms, Apple grants you a personal, non-exclusive
license, under Apple's copyrights in this original Apple software (the
@@ -25,13 +25,13 @@
implied, are granted by Apple herein, including but not limited to any
patent rights that may be infringed by your derivative works or by other
works in which the Apple Software may be incorporated.
-
+
The Apple Software is provided by Apple on an "AS IS" basis. APPLE
MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND
OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
-
+
IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
@@ -40,9 +40,9 @@
AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),
STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
-
+
Copyright (C) 2014 Apple Inc. All Rights Reserved.
-
+
*/
#include "AUOutputBL.h"
#if !defined(__COREAUDIO_USE_FLAT_INCLUDES__)
@@ -64,7 +64,7 @@ struct AudioBuffer
};
*/
-AUOutputBL::AUOutputBL (const CAStreamBasicDescription &inDesc, UInt32 inDefaultNumFrames)
+AUOutputBL::AUOutputBL (const CAStreamBasicDescription &inDesc, UInt32 inDefaultNumFrames)
: mFormat (inDesc),
mBufferMemory(NULL),
mBufferList (NULL),
@@ -85,10 +85,10 @@ AUOutputBL::~AUOutputBL()
delete [] (Byte *)mBufferList;
}
-void AUOutputBL::Prepare (UInt32 inNumFrames, bool inWantNullBufferIfAllocated)
+void AUOutputBL::Prepare (UInt32 inNumFrames, bool inWantNullBufferIfAllocated)
{
UInt32 channelsPerBuffer = mFormat.IsInterleaved() ? mFormat.NumberChannels() : 1;
-
+
if (mBufferMemory == NULL || inWantNullBufferIfAllocated)
{
mBufferList->mNumberBuffers = mNumberBuffers;
@@ -104,7 +104,7 @@ void AUOutputBL::Prepare (UInt32 inNumFrames, bool inWantNullBufferIfAllocated)
UInt32 nBytes = mFormat.FramesToBytes (inNumFrames);
if ((nBytes * mNumberBuffers) > AllocatedBytes())
throw OSStatus(kAudioUnitErr_TooManyFramesToProcess);
-
+
mBufferList->mNumberBuffers = mNumberBuffers;
AudioBuffer *buf = &mBufferList->mBuffers[0];
Byte* p = mBufferMemory;
@@ -120,31 +120,31 @@ void AUOutputBL::Prepare (UInt32 inNumFrames, bool inWantNullBufferIfAllocated)
void AUOutputBL::Allocate (UInt32 inNumFrames)
{
- if (inNumFrames)
+ if (inNumFrames)
{
UInt32 nBytes = mFormat.FramesToBytes (inNumFrames);
-
- if (nBytes <= AllocatedBytes())
+
+ 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
+ }
+ else
{
if (mBufferMemory) {
delete [] mBufferMemory;
diff --git a/libs/appleutility/CoreAudio/PublicUtility/AUOutputBL.h b/libs/appleutility/CoreAudio/PublicUtility/AUOutputBL.h
index 0baad3a579..da30891d27 100644
--- a/libs/appleutility/CoreAudio/PublicUtility/AUOutputBL.h
+++ b/libs/appleutility/CoreAudio/PublicUtility/AUOutputBL.h
@@ -2,14 +2,14 @@
File: AUOutputBL.h
Abstract: Part of CoreAudio Utility Classes
Version: 1.1
-
+
Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple
Inc. ("Apple") in consideration of your agreement to the following
terms, and your use, installation, modification or redistribution of
this Apple software constitutes acceptance of these terms. If you do
not agree with these terms, please do not use, install, modify or
redistribute this Apple software.
-
+
In consideration of your agreement to abide by the following terms, and
subject to these terms, Apple grants you a personal, non-exclusive
license, under Apple's copyrights in this original Apple software (the
@@ -25,13 +25,13 @@
implied, are granted by Apple herein, including but not limited to any
patent rights that may be infringed by your derivative works or by other
works in which the Apple Software may be incorporated.
-
+
The Apple Software is provided by Apple on an "AS IS" basis. APPLE
MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND
OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
-
+
IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
@@ -40,9 +40,9 @@
AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),
STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
-
+
Copyright (C) 2014 Apple Inc. All Rights Reserved.
-
+
*/
#ifndef __AUOutputBL_h__
#define __AUOutputBL_h__
@@ -63,10 +63,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);
@@ -76,29 +76,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/CoreAudio/PublicUtility/AUParamInfo.cpp b/libs/appleutility/CoreAudio/PublicUtility/AUParamInfo.cpp
index 87d7848790..677fcb4569 100644
--- a/libs/appleutility/CoreAudio/PublicUtility/AUParamInfo.cpp
+++ b/libs/appleutility/CoreAudio/PublicUtility/AUParamInfo.cpp
@@ -2,14 +2,14 @@
File: AUParamInfo.cpp
Abstract: AUParamInfo.h
Version: 1.1
-
+
Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple
Inc. ("Apple") in consideration of your agreement to the following
terms, and your use, installation, modification or redistribution of
this Apple software constitutes acceptance of these terms. If you do
not agree with these terms, please do not use, install, modify or
redistribute this Apple software.
-
+
In consideration of your agreement to abide by the following terms, and
subject to these terms, Apple grants you a personal, non-exclusive
license, under Apple's copyrights in this original Apple software (the
@@ -25,13 +25,13 @@
implied, are granted by Apple herein, including but not limited to any
patent rights that may be infringed by your derivative works or by other
works in which the Apple Software may be incorporated.
-
+
The Apple Software is provided by Apple on an "AS IS" basis. APPLE
MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND
OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
-
+
IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
@@ -40,15 +40,15 @@
AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),
STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
-
+
Copyright (C) 2014 Apple Inc. All Rights Reserved.
-
+
*/
#include "AUParamInfo.h"
#include "CAXException.h"
-AUParamInfo::AUParamInfo (AudioUnit inAU,
- bool inIncludeExpert,
+AUParamInfo::AUParamInfo (AudioUnit inAU,
+ bool inIncludeExpert,
bool inIncludeReadOnly,
AudioUnitScope inScope,
AudioUnitElement inElement)
@@ -61,14 +61,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;
@@ -76,33 +76,33 @@ AUParamInfo::AUParamInfo (AudioUnit inAU,
mParamListID = NULL;
return;
}
-
+
ParameterMap params;
- for (int i = 0; i < nparams; ++i)
+ 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)
+ if (!(paramInfo.flags & kAudioUnitParameterFlag_IsWritable)
&& !(paramInfo.flags & kAudioUnitParameterFlag_IsReadable))
continue;
// only include if expert params wanted
if (!inIncludeExpert && auvp.IsExpert())
continue;
-
+
// only include if read only params are wanted
- if (!(paramInfo.flags & kAudioUnitParameterFlag_IsWritable)
+ 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);
@@ -118,9 +118,9 @@ AUParamInfo::~AUParamInfo()
}
UInt32 AUParamInfo::NumParamsForClump (UInt32 inClump) const
-{
+{
ParameterMap::const_iterator it = mParams.find(inClump);
- if (it != mParams.end())
+ if (it != mParams.end())
return static_cast<UInt32>((*it).second.size());
return 0;
}
diff --git a/libs/appleutility/CoreAudio/PublicUtility/AUParamInfo.h b/libs/appleutility/CoreAudio/PublicUtility/AUParamInfo.h
index d15fbfeb2d..4d5b795b10 100644
--- a/libs/appleutility/CoreAudio/PublicUtility/AUParamInfo.h
+++ b/libs/appleutility/CoreAudio/PublicUtility/AUParamInfo.h
@@ -2,14 +2,14 @@
File: AUParamInfo.h
Abstract: Part of CoreAudio Utility Classes
Version: 1.1
-
+
Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple
Inc. ("Apple") in consideration of your agreement to the following
terms, and your use, installation, modification or redistribution of
this Apple software constitutes acceptance of these terms. If you do
not agree with these terms, please do not use, install, modify or
redistribute this Apple software.
-
+
In consideration of your agreement to abide by the following terms, and
subject to these terms, Apple grants you a personal, non-exclusive
license, under Apple's copyrights in this original Apple software (the
@@ -25,13 +25,13 @@
implied, are granted by Apple herein, including but not limited to any
patent rights that may be infringed by your derivative works or by other
works in which the Apple Software may be incorporated.
-
+
The Apple Software is provided by Apple on an "AS IS" basis. APPLE
MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND
OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
-
+
IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
@@ -40,9 +40,9 @@
AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),
STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
-
+
Copyright (C) 2014 Apple Inc. All Rights Reserved.
-
+
*/
#include <map>
#include <vector>
@@ -50,11 +50,11 @@
#include "CAAUParameter.h"
/*
- The ParameterMap returned by the Map() method is a map where
+ 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
+
+ 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,45 +66,45 @@ public:
- AUParamInfo (AudioUnit inAU,
- bool inIncludeExpert,
- bool inIncludeReadOnly,
+ AUParamInfo (AudioUnit inAU,
+ bool inIncludeExpert,
+ 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;
+
+ AudioUnitParameterID ParamID (UInt32 inIndex) const
+ {
+ if (inIndex < mNumParams) return mParamListID[inIndex];
+ return 0xFFFFFFFF;
}
-
+
UInt32 NumClumps () const { return static_cast<UInt32>(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 &c) {}
diff --git a/libs/appleutility/CoreAudio/PublicUtility/CAAUMIDIMap.cpp b/libs/appleutility/CoreAudio/PublicUtility/CAAUMIDIMap.cpp
index 4e72b22858..4f8bea692b 100644
--- a/libs/appleutility/CoreAudio/PublicUtility/CAAUMIDIMap.cpp
+++ b/libs/appleutility/CoreAudio/PublicUtility/CAAUMIDIMap.cpp
@@ -2,14 +2,14 @@
File: CAAUMIDIMap.cpp
Abstract: CAAUMIDIMap.h
Version: 1.1
-
+
Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple
Inc. ("Apple") in consideration of your agreement to the following
terms, and your use, installation, modification or redistribution of
this Apple software constitutes acceptance of these terms. If you do
not agree with these terms, please do not use, install, modify or
redistribute this Apple software.
-
+
In consideration of your agreement to abide by the following terms, and
subject to these terms, Apple grants you a personal, non-exclusive
license, under Apple's copyrights in this original Apple software (the
@@ -25,13 +25,13 @@
implied, are granted by Apple herein, including but not limited to any
patent rights that may be infringed by your derivative works or by other
works in which the Apple Software may be incorporated.
-
+
The Apple Software is provided by Apple on an "AS IS" basis. APPLE
MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND
OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
-
+
IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
@@ -40,16 +40,16 @@
AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),
STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
-
+
Copyright (C) 2014 Apple Inc. All Rights Reserved.
-
+
*/
#include "CAAUMIDIMap.h"
#include <pthread.h>
struct AllMidiTransformers
{
- MIDILinearTransformer linearTrans;
+ MIDILinearTransformer linearTrans;
MIDILogTransformer logTrans;
MIDIExpTransformer expTrans;
MIDISqrtTransformer sqrtTrans;
@@ -77,13 +77,13 @@ static void CheckInitAllMidiTransformers()
MIDIValueTransformer * CAAUMIDIMap::GetTransformer (UInt32 inFlags)
{
#if TARGET_OS_MAC
- if (gAllMidiTransformers == NULL)
+ if (gAllMidiTransformers == NULL)
CheckInitAllMidiTransformers();
#else
- if (gAllMidiTransformers == NULL)
+ if (gAllMidiTransformers == NULL)
gAllMidiTransformers = new AllMidiTransformers();
#endif
-
+
if (AudioUnitDisplayTypeIsLogarithmic(inFlags))
return &gAllMidiTransformers->logTrans;
else if (AudioUnitDisplayTypeIsExponential(inFlags))
@@ -176,13 +176,13 @@ bool CAAUMIDIMap::MIDI_Matches (UInt8 inChannel, UInt8 inData1, UInt8 inData2, F
}
return false;
}
- //printf("this in midi matches %X with ", this);
- outLinear = inData2 / 127.;
+ //printf("this in midi matches %X with ", this);
+ outLinear = inData2 / 127.;
return true;
}
return false;
}
-
+
// this just matches on the patch change value itself...
if (IsPatchChange()) {
if (mData1 == inData1) {
diff --git a/libs/appleutility/CoreAudio/PublicUtility/CAAUMIDIMap.h b/libs/appleutility/CoreAudio/PublicUtility/CAAUMIDIMap.h
index a53fdf70dc..33d0c2e266 100644
--- a/libs/appleutility/CoreAudio/PublicUtility/CAAUMIDIMap.h
+++ b/libs/appleutility/CoreAudio/PublicUtility/CAAUMIDIMap.h
@@ -2,14 +2,14 @@
File: CAAUMIDIMap.h
Abstract: Part of CoreAudio Utility Classes
Version: 1.1
-
+
Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple
Inc. ("Apple") in consideration of your agreement to the following
terms, and your use, installation, modification or redistribution of
this Apple software constitutes acceptance of these terms. If you do
not agree with these terms, please do not use, install, modify or
redistribute this Apple software.
-
+
In consideration of your agreement to abide by the following terms, and
subject to these terms, Apple grants you a personal, non-exclusive
license, under Apple's copyrights in this original Apple software (the
@@ -25,13 +25,13 @@
implied, are granted by Apple herein, including but not limited to any
patent rights that may be infringed by your derivative works or by other
works in which the Apple Software may be incorporated.
-
+
The Apple Software is provided by Apple on an "AS IS" basis. APPLE
MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND
OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
-
+
IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
@@ -40,9 +40,9 @@
AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),
STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
-
+
Copyright (C) 2014 Apple Inc. All Rights Reserved.
-
+
*/
#ifndef __CAAUMIDIMap_h_
#define __CAAUMIDIMap_h_
@@ -53,7 +53,7 @@
/*
enum {
kAUParameterMIDIMapping_AnyChannelFlag = (1L << 0),
- // If this flag is set and mStatus is a MIDI channel message, then the MIDI channel number
+ // If this flag is set and mStatus is a MIDI channel message, then the MIDI channel number
// in the status byte is ignored; the mapping is from the specified MIDI message on ANY channel.
kAUParameterMIDIMapping_AnyNoteFlag = (1L << 1),
@@ -68,7 +68,7 @@ enum {
// this is only useful for boolean typed parameters. When set, it means that the parameter's
// value should be toggled (if true, become false and vice versa) when the represented MIDI message
// is received
-
+
kAUParameterMIDIMapping_Bipolar = (1L << 4),
// this can be set to when mapping a MIDI Controller to indicate that the parameter (typically a boolean
// style parameter) will only have its value changed to either the on or off state of a MIDI controller message
@@ -118,41 +118,41 @@ Create a mapping between a parameter and a MIDI message through either:
* The AUParameterMIDIMapping Structure
- Command mStatus mData1
- Note Off 0x8n Note Num
- Note On 0x9n Note Num
- Key Pressure 0xAn Note Num
- Control Change 0xBn ControllerID
- Patch Change 0xCn Patch Num
- Channel Pressure DxDn 0 (Unused)
- Pitch Bend 0xEn 0 (Unused)
+ Command mStatus mData1
+ Note Off 0x8n Note Num
+ Note On 0x9n Note Num
+ Key Pressure 0xAn Note Num
+ Control Change 0xBn ControllerID
+ Patch Change 0xCn Patch Num
+ Channel Pressure DxDn 0 (Unused)
+ Pitch Bend 0xEn 0 (Unused)
(where n is 0-0xF to correspond to MIDI channels 1-16)
Details:
In general MIDI Commands can be mapped to either a specific channel as specified in the mStatus bit.
- If the kAUParameterMIDIMapping_AnyChannelFlag bit is set mStatus is a MIDI channel message, then the
+ If the kAUParameterMIDIMapping_AnyChannelFlag bit is set mStatus is a MIDI channel message, then the
MIDI channel number in the status byte is ignored; the mapping is from the specified MIDI message on ANY channel.
For note commands (note on, note off, key pressure), the MIDI message can trigger either with just a specific
note number, or any note number if the kAUParameterMIDIMapping_AnyNoteFlag bit is set. In these instances, the
- note number is used as the trigger value (for instance, a note message could be used to set the
+ note number is used as the trigger value (for instance, a note message could be used to set the
cut off frequency of a filter).
- The Properties:
+ The Properties:
kAudioUnitProperty_AllParameterMIDIMappings array of AUParameterMIDIMapping (read/write)
This property is used to both retreive and set the current mapping state between (some/many/all of) its parameters
and MIDI messages. When set, it should replace any previous mapped settings the AU had.
If this property is implemented by a non-MIDI capable AU (such as an 'aufx' type), then the property is
- read only, and recommends a suggested set of mappings for the host to perform. In this case, it is the
+ read only, and recommends a suggested set of mappings for the host to perform. In this case, it is the
host's responsibility to map MIDI message to the AU parameters. As described previously, there are a set
- of default mappings (see AudioToolbox/AUMIDIController.h) that the host can recommend to the user
+ of default mappings (see AudioToolbox/AUMIDIController.h) that the host can recommend to the user
in this circumstance.
- This property's size will be very dynamic, depending on the number of mappings currently in affect, so the
+ This property's size will be very dynamic, depending on the number of mappings currently in affect, so the
caller should always get the size of the property first before retrieving it. The AU should return an error
if the caller doesn't provide enough space to return all of the current mappings.
@@ -169,19 +169,19 @@ Create a mapping between a parameter and a MIDI message through either:
(1) If a mapping struct is provided, then that struct provides *all* of the information that the AU should
use to map the parameter, *except* for the MIDI message. The AU should then listen for the next MIDI message
and associate that MIDI message with the supplied AUParameter mapping. When this MIDI message is received and
- the mapping made, the AU should also issue a notification on this property
+ the mapping made, the AU should also issue a notification on this property
(kAudioUnitProperty_HotMapParameterMIDIMapping) to indicate to the host that the mapping has been made. The host
can then retrieve the mapping that was made by getting the value of this property.
- To avoid possible confusion, it is recommended that once the host has retrieved this mapping (if it is
+ To avoid possible confusion, it is recommended that once the host has retrieved this mapping (if it is
presenting a UI to describe the mappings for example), that it then clears the mapping state as described next.
Thus, the only time this property will return a valid value is when the AU has made a mapping. If the AU's mapping
- state has been cleared (or it has not been asked to make a mapping), then the AU should return
+ state has been cleared (or it has not been asked to make a mapping), then the AU should return
kAudioUnitErr_InvalidPropertyValue if the host tries to read this value.
(2) If the value passed in is NULL, then if the AU had a parameter that it was in the process of mapping, it
- should disregard that (stop listening to the MIDI messages to create a mapping) and discard the partially
+ should disregard that (stop listening to the MIDI messages to create a mapping) and discard the partially
mapped struct. If the value is NULL and the AU is not in the process of mapping, the AU can ignore the request.
At all times, the _AllMappings property will completely describe the current known state of the AU's mappings
@@ -242,25 +242,25 @@ struct MIDICubeTransformer : public MIDIValueTransformer {
class CAAUMIDIMap : public AUParameterMIDIMapping {
-
+
public:
-// variables for more efficient parsing of MIDI to Param value
+// variables for more efficient parsing of MIDI to Param value
Float32 mMinValue;
Float32 mMaxValue;
MIDIValueTransformer *mTransType;
-// methods
+// methods
static MIDIValueTransformer *GetTransformer (UInt32 inFlags);
-
+
CAAUMIDIMap() { memset(this, 0, sizeof(CAAUMIDIMap)); }
- CAAUMIDIMap (const AUParameterMIDIMapping& inMap)
+ CAAUMIDIMap (const AUParameterMIDIMapping& inMap)
{
memset(this, 0, sizeof(CAAUMIDIMap));
memcpy (this, &inMap, sizeof(inMap));
}
- CAAUMIDIMap (AudioUnitScope inScope, AudioUnitElement inElement, AudioUnitParameterID inParam)
- {
- memset(this, 0, sizeof(CAAUMIDIMap));
+ CAAUMIDIMap (AudioUnitScope inScope, AudioUnitElement inElement, AudioUnitParameterID inParam)
+ {
+ memset(this, 0, sizeof(CAAUMIDIMap));
mScope = inScope;
mElement = inElement;
mParameterID = inParam;
@@ -271,41 +271,41 @@ public:
// returns -1 if any channel bit is set
SInt32 Channel () const { return IsAnyChannel() ? -1 : (mStatus & 0xF); }
- bool IsAnyChannel () const {
- return mFlags & kAUParameterMIDIMapping_AnyChannelFlag;
+ bool IsAnyChannel () const {
+ return mFlags & kAUParameterMIDIMapping_AnyChannelFlag;
}
// preserves the existing channel info in the status byte
// preserves any previously set mFlags value
- void SetAnyChannel (bool inFlag)
- {
- if (inFlag)
- mFlags |= kAUParameterMIDIMapping_AnyChannelFlag;
+ void SetAnyChannel (bool inFlag)
+ {
+ if (inFlag)
+ mFlags |= kAUParameterMIDIMapping_AnyChannelFlag;
else
mFlags &= ~kAUParameterMIDIMapping_AnyChannelFlag;
}
- bool IsAnyNote () const {
+ bool IsAnyNote () const {
return (mFlags & kAUParameterMIDIMapping_AnyNoteFlag) != 0;
}
// preserves the existing key num in the mData1 byte
// preserves any previously set mFlags value
void SetAnyNote (bool inFlag)
- {
- if (inFlag)
- mFlags |= kAUParameterMIDIMapping_AnyNoteFlag;
+ {
+ if (inFlag)
+ mFlags |= kAUParameterMIDIMapping_AnyNoteFlag;
else
mFlags &= ~kAUParameterMIDIMapping_AnyNoteFlag;
}
-
+
bool IsToggle() const { return (mFlags & kAUParameterMIDIMapping_Toggle) != 0; }
void SetToggle (bool inFlag)
{
- if (inFlag)
- mFlags |= kAUParameterMIDIMapping_Toggle;
+ if (inFlag)
+ mFlags |= kAUParameterMIDIMapping_Toggle;
else
mFlags &= ~kAUParameterMIDIMapping_Toggle;
}
-
+
bool IsBipolar() const { return (mFlags & kAUParameterMIDIMapping_Bipolar) != 0; }
// inUseOnValue is valid ONLY if inFlag is true
void SetBipolar (bool inFlag, bool inUseOnValue = false)
@@ -326,56 +326,56 @@ public:
bool IsSubRange () const { return (mFlags & kAUParameterMIDIMapping_SubRange) != 0; }
void SetSubRange (Float32 inStartValue, Float32 inStopValue)
{
- mFlags |= kAUParameterMIDIMapping_SubRange;
-
+ mFlags |= kAUParameterMIDIMapping_SubRange;
+
mSubRangeMin = inStartValue;
mSubRangeMax = inStopValue;
}
-
+
void SetParamRange(Float32 minValue, Float32 maxValue)
{
mMinValue = minValue;
- mMaxValue = maxValue;
+ mMaxValue = maxValue;
}
-
+
// this will retain the subrange values previously set.
- void SetSubRange (bool inFlag)
- {
+ void SetSubRange (bool inFlag)
+ {
if (inFlag)
- mFlags |= kAUParameterMIDIMapping_SubRange;
+ mFlags |= kAUParameterMIDIMapping_SubRange;
else
- mFlags &= ~kAUParameterMIDIMapping_SubRange;
+ mFlags &= ~kAUParameterMIDIMapping_SubRange;
}
-
+
bool IsAnyValue() const{return !IsBipolar();}
bool IsOnValue() const{return IsBipolar_OnValue();}
bool IsOffValue() const{return IsBipolar();}
-
+
bool IsNoteOff () const { return ((mStatus & 0xF0) == 0x80); }
bool IsNoteOn () const { return ((mStatus & 0xF0) == 0x90); }
-
+
bool IsKeyPressure () const { return ((mStatus & 0xF0) == 0xA0); }
-
+
bool IsKeyEvent () const { return (mStatus > 0x7F) && (mStatus < 0xB0); }
-
+
bool IsPatchChange () const { return ((mStatus & 0xF0) == 0xC0); }
bool IsChannelPressure () const { return ((mStatus & 0xF0) == 0xD0); }
bool IsPitchBend () const { return ((mStatus & 0xF0) == 0xE0); }
bool IsControlChange () const { return ((mStatus & 0xF0) == 0xB0); }
-
-
+
+
void SetControllerOnValue(){SetBipolar(true,true);}
void SetControllerOffValue(){SetBipolar(true,false);}
void SetControllerAnyValue(){SetBipolar(false,false);}
-
- // All of these Set calls will reset the mFlags field based on the
+
+ // All of these Set calls will reset the mFlags field based on the
// anyChannel param value
void SetNoteOff (UInt8 key, SInt8 channel, bool anyChannel = false)
{
mStatus = 0x80 | (channel & 0xF);
mData1 = key;
mFlags = (anyChannel ? kAUParameterMIDIMapping_AnyChannelFlag : 0);
-
+
}
void SetNoteOn (UInt8 key, SInt8 channel, bool anyChannel = false)
@@ -398,7 +398,7 @@ public:
mData1 = controllerID;
mFlags = (anyChannel ? kAUParameterMIDIMapping_AnyChannelFlag : 0);
}
-
+
void SetPatchChange (UInt8 patchChange, SInt8 channel, bool anyChannel = false)
{
mStatus = 0xC0 | (channel & 0xF);
@@ -419,8 +419,8 @@ public:
mData1 = 0;
mFlags = (anyChannel ? kAUParameterMIDIMapping_AnyChannelFlag : 0);
}
-
-
+
+
Float32 ParamValueFromMIDILinear (Float32 inLinearValue) const
{
Float32 low, high;
@@ -432,32 +432,32 @@ public:
low = mMinValue;
high = mMaxValue;
}
-
-
+
+
// WE ARE ASSUMING YOU HAVE SET THIS UP PROPERLY!!!!! (or this will crash cause it will be NULL)
return (Float32)mTransType->fromlinear((inLinearValue * (high - low)) + low);
}
-
+
// The CALLER of this method must ensure that the status byte's MIDI Command (ignoring the channel) matches!!!
bool MIDI_Matches (UInt8 inChannel, UInt8 inData1, UInt8 inData2, Float32 &outLinear) const;
-
+
void Print () const;
-
+
void Save (CFPropertyListRef &outData) const;
void Restore (CFDictionaryRef inData);
-
- static void SaveAsMapPList (AudioUnit inUnit,
- const AUParameterMIDIMapping * inMappings,
- UInt32 inNumMappings,
+
+ static void SaveAsMapPList (AudioUnit inUnit,
+ const AUParameterMIDIMapping * inMappings,
+ UInt32 inNumMappings,
CFPropertyListRef &outData,
CFStringRef inName = NULL);
// inNumMappings describes how much memory is allocated in outMappings
- static void RestoreFromMapPList (const CFDictionaryRef inData,
- AUParameterMIDIMapping * outMappings,
+ static void RestoreFromMapPList (const CFDictionaryRef inData,
+ AUParameterMIDIMapping * outMappings,
UInt32 inNumMappings);
-
+
static UInt32 NumberOfMaps (const CFDictionaryRef inData);
};
@@ -472,15 +472,15 @@ inline bool operator== (const CAAUMIDIMap &a, const CAAUMIDIMap &b)
&& (a.mParameterID == b.mParameterID)
&& (a.mElement == b.mElement)
&& (a.mScope == b.mScope));
-
+
// reserved field comparisons - ignored until/if they are used
}
inline bool operator< (const CAAUMIDIMap &a, const CAAUMIDIMap &b)
{
- if ((a.mStatus & 0xF0) != (b.mStatus & 0xF0))
+ if ((a.mStatus & 0xF0) != (b.mStatus & 0xF0))
return ((a.mStatus & 0xF0) < (b.mStatus & 0xF0));
-
+
if (a.mData1 != b.mData1)
return (a.mData1 < b.mData1);
@@ -488,7 +488,7 @@ inline bool operator< (const CAAUMIDIMap &a, const CAAUMIDIMap &b)
return ((a.mStatus & 0xF) < (b.mStatus & 0xf));
// reserved field comparisons - ignored until/if they are used
-
+
// we're sorting this by MIDI, so we don't really care how the rest is sorted
return ((a.mParameterID < b.mParameterID)
&& (a.mElement < b.mElement)
@@ -498,7 +498,7 @@ inline bool operator< (const CAAUMIDIMap &a, const CAAUMIDIMap &b)
class CompareMIDIMap {
- int compare (const CAAUMIDIMap &a, const CAAUMIDIMap &b)
+ int compare (const CAAUMIDIMap &a, const CAAUMIDIMap &b)
{
if ((a.mStatus & 0xF0) < (b.mStatus & 0xF0))
return -1;
@@ -512,7 +512,7 @@ class CompareMIDIMap {
if (a.mData1 < b.mData1) return -1;
return 0;
}
-
+
public:
bool operator() (const CAAUMIDIMap &a, const CAAUMIDIMap &b) {
return compare (a, b) < 0;
@@ -533,7 +533,7 @@ public:
break;
// ...
}
-
+
in the for loop you call the MIDI_Matches call, to see if the MIDI event matches a given AUMIDIParam mapping
special note: you HAVE to transform note on (with vel zero) events to the note off status byte
*/
diff --git a/libs/appleutility/CoreAudio/PublicUtility/CAAUMIDIMapManager.cpp b/libs/appleutility/CoreAudio/PublicUtility/CAAUMIDIMapManager.cpp
index b24ff9945c..74872296f4 100644
--- a/libs/appleutility/CoreAudio/PublicUtility/CAAUMIDIMapManager.cpp
+++ b/libs/appleutility/CoreAudio/PublicUtility/CAAUMIDIMapManager.cpp
@@ -2,14 +2,14 @@
File: CAAUMIDIMapManager.cpp
Abstract: CAAUMIDIMapManager.h
Version: 1.1
-
+
Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple
Inc. ("Apple") in consideration of your agreement to the following
terms, and your use, installation, modification or redistribution of
this Apple software constitutes acceptance of these terms. If you do
not agree with these terms, please do not use, install, modify or
redistribute this Apple software.
-
+
In consideration of your agreement to abide by the following terms, and
subject to these terms, Apple grants you a personal, non-exclusive
license, under Apple's copyrights in this original Apple software (the
@@ -25,13 +25,13 @@
implied, are granted by Apple herein, including but not limited to any
patent rights that may be infringed by your derivative works or by other
works in which the Apple Software may be incorporated.
-
+
The Apple Software is provided by Apple on an "AS IS" basis. APPLE
MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND
OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
-
+
IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
@@ -40,42 +40,42 @@
AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),
STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
-
+
Copyright (C) 2014 Apple Inc. All Rights Reserved.
-
+
*/
#include "CAAUMIDIMapManager.h"
#include <AudioToolbox/AudioUnitUtilities.h>
CAAUMIDIMapManager::CAAUMIDIMapManager()
-{
- hotMapping = false;
+{
+ hotMapping = false;
}
static void FillInMap (CAAUMIDIMap &map, AUBase &That)
{
AudioUnitParameterInfo info;
That.GetParameterInfo (map.mScope, map.mParameterID, info);
-
+
if (map.IsSubRange()) {
map.mMinValue = map.mSubRangeMin;
map.mMaxValue = map.mSubRangeMax;
} else {
- map.mMinValue = info.minValue;
- map.mMaxValue = info.maxValue;
+ map.mMinValue = info.minValue;
+ map.mMaxValue = info.maxValue;
}
-
+
map.mTransType = CAAUMIDIMap::GetTransformer(info.flags);
}
OSStatus CAAUMIDIMapManager::SortedInsertToParamaterMaps (AUParameterMIDIMapping *maps, UInt32 inNumMaps, AUBase &That)
-{
- for (unsigned int i = 0; i < inNumMaps; ++i)
+{
+ for (unsigned int i = 0; i < inNumMaps; ++i)
{
CAAUMIDIMap map(maps[i]);
FillInMap (map, That);
-
+
int idx = FindParameterIndex (maps[i]);
if (idx > -1)
mParameterMaps.erase(mParameterMaps.begin() + idx);
@@ -83,9 +83,9 @@ OSStatus CAAUMIDIMapManager::SortedInsertToParamaterMaps (AUParameterMIDIMapping
// least disruptive place to put this is at the end
mParameterMaps.push_back(map);
}
-
- std::sort(mParameterMaps.begin(), mParameterMaps.end(), CompareMIDIMap());
-
+
+ std::sort(mParameterMaps.begin(), mParameterMaps.end(), CompareMIDIMap());
+
return noErr;
}
@@ -95,7 +95,7 @@ void CAAUMIDIMapManager::GetHotParameterMap(AUParameterMIDIMapping &outMap )
}
void CAAUMIDIMapManager::SortedRemoveFromParameterMaps(AUParameterMIDIMapping *maps, UInt32 inNumMaps, bool &outMapDidChange)
-{
+{
if (hotMapping) {
hotMapping = false;
}
@@ -122,7 +122,7 @@ void CAAUMIDIMapManager::ReplaceAllMaps (AUParameterMIDIMapping* inMappings, UIn
mParameterMaps.push_back (mapping);
}
- std::sort(mParameterMaps.begin(),mParameterMaps.end(), CompareMIDIMap());
+ std::sort(mParameterMaps.begin(),mParameterMaps.end(), CompareMIDIMap());
}
bool CAAUMIDIMapManager::HandleHotMapping(UInt8 inStatus,
@@ -132,13 +132,13 @@ bool CAAUMIDIMapManager::HandleHotMapping(UInt8 inStatus,
{ //used to set the hot map info
if (inStatus == 0xf0) return false;
-
+
if (!hotMapping) return false;
hotMapping = false;
- mHotMap.mStatus = inStatus | inChannel;
- mHotMap.mData1 = inData1;
-
+ mHotMap.mStatus = inStatus | inChannel;
+ mHotMap.mData1 = inData1;
+
SortedInsertToParamaterMaps (&mHotMap, 1, That);
return true;
}
@@ -147,10 +147,10 @@ bool CAAUMIDIMapManager::HandleHotMapping(UInt8 inStatus,
void CAAUMIDIMapManager::Print()
{
- for ( ParameterMaps::iterator i = mParameterMaps.begin(); i < mParameterMaps.end(); ++i) {
- CAAUMIDIMap* listmap = &(*i);
- listmap->Print();
- }
+ for ( ParameterMaps::iterator i = mParameterMaps.begin(); i < mParameterMaps.end(); ++i) {
+ CAAUMIDIMap* listmap = &(*i);
+ listmap->Print();
+ }
}
#endif // DEBUG
@@ -158,24 +158,24 @@ void CAAUMIDIMapManager::Print()
void CAAUMIDIMapManager::GetMaps(AUParameterMIDIMapping* maps)
{
int i = 0;
- for ( ParameterMaps::iterator iter = mParameterMaps.begin(); iter < mParameterMaps.end(); ++iter, ++i) {
- AUParameterMIDIMapping &listmap = (*iter);
- maps[i] = listmap;
+ for ( ParameterMaps::iterator iter = mParameterMaps.begin(); iter < mParameterMaps.end(); ++iter, ++i) {
+ AUParameterMIDIMapping &listmap = (*iter);
+ maps[i] = listmap;
}
}
int CAAUMIDIMapManager::FindParameterIndex (AUParameterMIDIMapping &inMap)
-{
+{
//used to get back hot mapping and one at a time maps, for ui
-
+
int idx = 0;
- for ( ParameterMaps::iterator i = mParameterMaps.begin(); i < mParameterMaps.end(); ++i) {
+ for ( ParameterMaps::iterator i = mParameterMaps.begin(); i < mParameterMaps.end(); ++i) {
CAAUMIDIMap & listmap = (*i);
- if ( (listmap.mParameterID == inMap.mParameterID) &&
- (listmap.mScope == inMap.mScope) &&
+ if ( (listmap.mParameterID == inMap.mParameterID) &&
+ (listmap.mScope == inMap.mScope) &&
(listmap.mElement == inMap.mElement) )
- {
- return idx;
+ {
+ return idx;
}
idx++;
}
@@ -193,37 +193,37 @@ bool CAAUMIDIMapManager::FindParameterMapEventMatch( UInt8 inStatus,
if (inStatus == 0x90 && !inData2)
inStatus = 0x80 | inChannel;
-
+
//used to test for midi matches once map is made
CAAUMIDIMap tempMap;
tempMap.mStatus = inStatus | inChannel;
tempMap.mData1 = inData1;
-
+
CompareMIDIMap compareObj;
AudioUnitEvent event;
event.mEventType = kAudioUnitEvent_ParameterValueChange;
event.mArgument.mParameter.mAudioUnit = inAUBase.GetComponentInstance();
-
- ParameterMaps::iterator lower_iter =
+
+ ParameterMaps::iterator lower_iter =
std::lower_bound(mParameterMaps.begin(), mParameterMaps.end(), tempMap, compareObj);
-
- while (lower_iter < mParameterMaps.end())
+
+ while (lower_iter < mParameterMaps.end())
{
CAAUMIDIMap & map = (*lower_iter);
- if (compareObj.Finish(map, tempMap))
+ if (compareObj.Finish(map, tempMap))
break;
-
+
Float32 value;
if (map.MIDI_Matches(inChannel, inData1, inData2, value))
- {
- inAUBase.SetParameter ( map.mParameterID, map.mScope, map.mElement,
+ {
+ inAUBase.SetParameter ( map.mParameterID, map.mScope, map.mElement,
map.ParamValueFromMIDILinear(value), inBufferOffset);
event.mArgument.mParameter.mParameterID = map.mParameterID;
event.mArgument.mParameter.mScope = map.mScope;
event.mArgument.mParameter.mElement = map.mElement;
-
+
AUEventListenerNotify(NULL, NULL, &event);
ret_value = true;
}
diff --git a/libs/appleutility/CoreAudio/PublicUtility/CAAUMIDIMapManager.h b/libs/appleutility/CoreAudio/PublicUtility/CAAUMIDIMapManager.h
index 8926d8f6e1..856c8fc5b8 100644
--- a/libs/appleutility/CoreAudio/PublicUtility/CAAUMIDIMapManager.h
+++ b/libs/appleutility/CoreAudio/PublicUtility/CAAUMIDIMapManager.h
@@ -2,14 +2,14 @@
File: CAAUMIDIMapManager.h
Abstract: Part of CoreAudio Utility Classes
Version: 1.1
-
+
Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple
Inc. ("Apple") in consideration of your agreement to the following
terms, and your use, installation, modification or redistribution of
this Apple software constitutes acceptance of these terms. If you do
not agree with these terms, please do not use, install, modify or
redistribute this Apple software.
-
+
In consideration of your agreement to abide by the following terms, and
subject to these terms, Apple grants you a personal, non-exclusive
license, under Apple's copyrights in this original Apple software (the
@@ -25,13 +25,13 @@
implied, are granted by Apple herein, including but not limited to any
patent rights that may be infringed by your derivative works or by other
works in which the Apple Software may be incorporated.
-
+
The Apple Software is provided by Apple on an "AS IS" basis. APPLE
MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND
OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
-
+
IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
@@ -40,9 +40,9 @@
AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),
STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
-
+
Copyright (C) 2014 Apple Inc. All Rights Reserved.
-
+
*/
#ifndef __CAAUMIDIMapManager_h_
#define __CAAUMIDIMapManager_h_
@@ -53,46 +53,46 @@
#include <AudioToolbox/AudioUnitUtilities.h>
class CAAUMIDIMapManager {
-
+
protected:
-
+
typedef std::vector<CAAUMIDIMap> ParameterMaps;
ParameterMaps mParameterMaps;
-
+
bool hotMapping;
AUParameterMIDIMapping mHotMap;
-
+
public:
-
+
CAAUMIDIMapManager();
-
+
UInt32 NumMaps(){return static_cast<UInt32>(mParameterMaps.size());}
void GetMaps(AUParameterMIDIMapping* maps);
-
+
int FindParameterIndex(AUParameterMIDIMapping &map);
-
+
void GetHotParameterMap(AUParameterMIDIMapping &outMap);
-
+
void SortedRemoveFromParameterMaps (AUParameterMIDIMapping *maps, UInt32 inNumMaps, bool &outMapDidChange);
OSStatus SortedInsertToParamaterMaps (AUParameterMIDIMapping *maps, UInt32 inNumMaps, AUBase &That);
-
+
void ReplaceAllMaps (AUParameterMIDIMapping* inMappings, UInt32 inNumMaps, AUBase &That);
-
+
bool IsHotMapping(){return hotMapping;}
void SetHotMapping (AUParameterMIDIMapping &inMap){hotMapping = true; mHotMap = inMap; }
-
+
bool HandleHotMapping( UInt8 inStatus,
UInt8 inChannel,
UInt8 inData1,
AUBase &That);
-
-
+
+
bool FindParameterMapEventMatch(UInt8 inStatus,
UInt8 inChannel,
UInt8 inData1,
UInt8 inData2,
UInt32 inBufferOffset,
- AUBase& inAUBase);
+ AUBase& inAUBase);
#if DEBUG
void Print();
#endif
diff --git a/libs/appleutility/CoreAudio/PublicUtility/CAAUParameter.cpp b/libs/appleutility/CoreAudio/PublicUtility/CAAUParameter.cpp
index 2d8fe18341..bd8b784983 100644
--- a/libs/appleutility/CoreAudio/PublicUtility/CAAUParameter.cpp
+++ b/libs/appleutility/CoreAudio/PublicUtility/CAAUParameter.cpp
@@ -2,14 +2,14 @@
File: CAAUParameter.cpp
Abstract: CAAUParameter.h
Version: 1.1
-
+
Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple
Inc. ("Apple") in consideration of your agreement to the following
terms, and your use, installation, modification or redistribution of
this Apple software constitutes acceptance of these terms. If you do
not agree with these terms, please do not use, install, modify or
redistribute this Apple software.
-
+
In consideration of your agreement to abide by the following terms, and
subject to these terms, Apple grants you a personal, non-exclusive
license, under Apple's copyrights in this original Apple software (the
@@ -25,13 +25,13 @@
implied, are granted by Apple herein, including but not limited to any
patent rights that may be infringed by your derivative works or by other
works in which the Apple Software may be incorporated.
-
+
The Apple Software is provided by Apple on an "AS IS" basis. APPLE
MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND
OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
-
+
IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
@@ -40,13 +40,13 @@
AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),
STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
-
+
Copyright (C) 2014 Apple Inc. All Rights Reserved.
-
+
*/
#include "CAAUParameter.h"
-CAAUParameter::CAAUParameter()
+CAAUParameter::CAAUParameter()
{
memset(this, 0, sizeof(CAAUParameter));
}
@@ -63,7 +63,7 @@ CAAUParameter::CAAUParameter (AudioUnitParameter &inParam)
Init (inParam.mAudioUnit, inParam.mParameterID, inParam.mScope, inParam.mElement);
}
-CAAUParameter::CAAUParameter(const CAAUParameter &a)
+CAAUParameter::CAAUParameter(const CAAUParameter &a)
{
memset(this, 0, sizeof(CAAUParameter));
*this = a;
@@ -74,13 +74,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;
}
@@ -97,7 +97,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,11 +105,11 @@ void CAAUParameter::Init (AudioUnit au, AudioUnitParameterID param, AudioUnitSc
memset(&mParamInfo, 0, sizeof(mParamInfo));
if (mParamInfo.flags & kAudioUnitParameterFlag_HasCFNameString) {
mParamName = mParamInfo.cfNameString;
- if (!(mParamInfo.flags & kAudioUnitParameterFlag_CFNameRelease))
+ if (!(mParamInfo.flags & kAudioUnitParameterFlag_CFNameRelease))
CFRetain (mParamName);
} else
mParamName = CFStringCreateWithCString(NULL, mParamInfo.name, kCFStringEncodingUTF8);
-
+
const char* str = 0;
switch (mParamInfo.unit)
{
@@ -177,11 +177,11 @@ void CAAUParameter::Init (AudioUnit au, AudioUnitParameterID param, AudioUnitSc
case kAudioUnitParameterUnit_Indexed:
{
propertySize = sizeof(mNamedParams);
- err = AudioUnitGetProperty (au,
+ err = AudioUnitGetProperty (au,
kAudioUnitProperty_ParameterValueStrings,
- scope,
- param,
- &mNamedParams,
+ scope,
+ param,
+ &mNamedParams,
&propertySize);
if (!err && mNamedParams) {
mNumIndexedParams = CFArrayGetCount(mNamedParams);
@@ -208,7 +208,7 @@ void CAAUParameter::Init (AudioUnit au, AudioUnitParameterID param, AudioUnitSc
str = NULL;
break;
}
-
+
if (str)
mParamTag = CFStringCreateWithCString(NULL, str, kCFStringEncodingUTF8);
else
@@ -219,7 +219,7 @@ void CAAUParameter::Init (AudioUnit au, AudioUnitParameterID param, AudioUnitSc
Float32 CAAUParameter::GetValue() const
{
Float32 value = 0.;
- //OSStatus err =
+ //OSStatus err =
AudioUnitGetParameter(mAudioUnit, mParameterID, mScope, mElement, &value);
return value;
}
@@ -227,7 +227,7 @@ Float32 CAAUParameter::GetValue() const
CFStringRef CreateLocalizedStringForParameterValue ( double inParameterValue,
const CAAUParameter * inParameter,
UInt32 inDigits,
- UInt32 minDigits) {
+ UInt32 minDigits) {
if (!inParameter) return nil;
AudioUnitParameterInfo info = inParameter->ParamInfo();
@@ -252,30 +252,30 @@ CFStringRef CreateLocalizedStringForParameterValue ( double inParameterValue
// 2 100-999 0
// 3 1000-9990 -1
// 4 10000-99900 -2
-
+
int nDigitsAfterDecimal = inDigits - (pow10 + 1);
if (nDigitsAfterDecimal < 0)
nDigitsAfterDecimal = 0; // the least number of digits possible is zero
if (info.flags & kAudioUnitParameterFlag_IsHighResolution)
nDigitsAfterDecimal = 4;
-
- CFLocaleRef currentLocale = CFLocaleCopyCurrent();
+
+ CFLocaleRef currentLocale = CFLocaleCopyCurrent();
CFNumberFormatterRef numberFormatter = CFNumberFormatterCreate (NULL, currentLocale, kCFNumberFormatterDecimalStyle);
-
+
CFNumberRef maxFractionDigits = CFNumberCreate (NULL, kCFNumberIntType, &nDigitsAfterDecimal);
-
+
if (nDigitsAfterDecimal > 0)
nDigitsAfterDecimal = minDigits;
-
- CFNumberRef minFractionDigits = CFNumberCreate (NULL, kCFNumberIntType, &nDigitsAfterDecimal);
- CFNumberFormatterSetProperty (numberFormatter, kCFNumberFormatterMinFractionDigits, minFractionDigits);
- CFNumberFormatterSetProperty (numberFormatter, kCFNumberFormatterMaxFractionDigits, maxFractionDigits);
- CFStringRef formattedNumberString = CFNumberFormatterCreateStringWithValue (NULL, numberFormatter, kCFNumberDoubleType, &inParameterValue);
+ CFNumberRef minFractionDigits = CFNumberCreate (NULL, kCFNumberIntType, &nDigitsAfterDecimal);
- CFRelease(currentLocale);
- CFRelease(numberFormatter);
+ CFNumberFormatterSetProperty (numberFormatter, kCFNumberFormatterMinFractionDigits, minFractionDigits);
+ CFNumberFormatterSetProperty (numberFormatter, kCFNumberFormatterMaxFractionDigits, maxFractionDigits);
+ CFStringRef formattedNumberString = CFNumberFormatterCreateStringWithValue (NULL, numberFormatter, kCFNumberDoubleType, &inParameterValue);
+
+ CFRelease(currentLocale);
+ CFRelease(numberFormatter);
CFRelease(maxFractionDigits);
CFRelease(minFractionDigits);
@@ -284,20 +284,20 @@ CFStringRef CreateLocalizedStringForParameterValue ( double inParameterValue
CFStringRef CreateLocalizedStringForParameterValue ( double inParameterValue,
const CAAUParameter * inParameter,
- UInt32 inDigits) {
+ UInt32 inDigits) {
return CreateLocalizedStringForParameterValue (inParameterValue, inParameter, inDigits, 1);
}
double ValueForLocalizedParameterString (CFStringRef string, const CAAUParameter * inParameter) {
- CFLocaleRef currentLocale = CFLocaleCopyCurrent();
+ CFLocaleRef currentLocale = CFLocaleCopyCurrent();
CFNumberFormatterRef numberFormatter = CFNumberFormatterCreate (NULL, currentLocale, kCFNumberFormatterDecimalStyle);
double value = 0;
Boolean worked = CFNumberFormatterGetValueFromString (numberFormatter, string, NULL, kCFNumberDoubleType, &value);
-
+
CFRelease(currentLocale);
CFRelease(numberFormatter);
-
+
if (worked)
return value;
else {
@@ -318,25 +318,25 @@ CFStringRef CAAUParameter::GetStringFromValueCopy(const Float32 *value) const
return str;
}
}
- else if (ValuesHaveStrings())
+ else if (ValuesHaveStrings())
{
AudioUnitParameterStringFromValue stringValue;
stringValue.inParamID = mParameterID;
stringValue.inValue = value;
stringValue.outString = NULL;
UInt32 propertySize = sizeof(stringValue);
-
- OSStatus err = AudioUnitGetProperty (mAudioUnit,
+
+ OSStatus err = AudioUnitGetProperty (mAudioUnit,
kAudioUnitProperty_ParameterStringFromValue,
- mScope,
- 0,
- &stringValue,
+ mScope,
+ 0,
+ &stringValue,
&propertySize);
-
+
if (!err && stringValue.outString != NULL)
return stringValue.outString;
}
-
+
Float32 val = (value == NULL ? GetValue() : *value);
AudioUnitParameterUnit unit = this->ParamInfo().unit;
if (unit == kAudioUnitParameterUnit_Cents || unit == kAudioUnitParameterUnit_AbsoluteCents)
@@ -347,29 +347,29 @@ CFStringRef CAAUParameter::GetStringFromValueCopy(const Float32 *value) const
Float32 CAAUParameter::GetValueFromString(CFStringRef str) const
{
- if (ValuesHaveStrings())
+ if (ValuesHaveStrings())
{
AudioUnitParameterValueFromString valueString;
valueString.inParamID = mParameterID;
valueString.inString = str;
UInt32 propertySize = sizeof(valueString);
-
- OSStatus err = AudioUnitGetProperty (mAudioUnit,
+
+ OSStatus err = AudioUnitGetProperty (mAudioUnit,
kAudioUnitProperty_ParameterValueFromString,
- mScope,
- 0,
- &valueString,
+ mScope,
+ 0,
+ &valueString,
&propertySize);
-
+
if (!err) {
return valueString.outValue;
}
}
-
+
return (Float32) ValueForLocalizedParameterString(str, this);
}
-void CAAUParameter::SetValue( AUParameterListenerRef inListener,
+void CAAUParameter::SetValue( AUParameterListenerRef inListener,
void * inObject,
Float32 inValue) const
{
@@ -379,7 +379,7 @@ void CAAUParameter::SetValue( AUParameterListenerRef inListener,
valueToSet = mParamInfo.maxValue;
if (valueToSet < mParamInfo.minValue)
valueToSet = mParamInfo.minValue;
-
+
AUParameterSet(inListener, inObject, this, valueToSet, 0);
}
@@ -388,12 +388,12 @@ void CAAUParameter::Print() const
{
UInt32 clump = 0;
GetClumpID (clump);
-
+
UInt32 len = static_cast<UInt32>(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: %u, Name: %s\n", (long unsigned int) mParameterID, (unsigned int) clump, chars);
free (chars);
}
diff --git a/libs/appleutility/CoreAudio/PublicUtility/CAAUParameter.h b/libs/appleutility/CoreAudio/PublicUtility/CAAUParameter.h
index f8b5733d8c..42402edcc1 100644
--- a/libs/appleutility/CoreAudio/PublicUtility/CAAUParameter.h
+++ b/libs/appleutility/CoreAudio/PublicUtility/CAAUParameter.h
@@ -2,14 +2,14 @@
File: CAAUParameter.h
Abstract: Part of CoreAudio Utility Classes
Version: 1.1
-
+
Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple
Inc. ("Apple") in consideration of your agreement to the following
terms, and your use, installation, modification or redistribution of
this Apple software constitutes acceptance of these terms. If you do
not agree with these terms, please do not use, install, modify or
redistribute this Apple software.
-
+
In consideration of your agreement to abide by the following terms, and
subject to these terms, Apple grants you a personal, non-exclusive
license, under Apple's copyrights in this original Apple software (the
@@ -25,13 +25,13 @@
implied, are granted by Apple herein, including but not limited to any
patent rights that may be infringed by your derivative works or by other
works in which the Apple Software may be incorporated.
-
+
The Apple Software is provided by Apple on an "AS IS" basis. APPLE
MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND
OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
-
+
IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
@@ -40,9 +40,9 @@
AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),
STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
-
+
Copyright (C) 2014 Apple Inc. All Rights Reserved.
-
+
*/
#ifndef __CAAUParameter_h__
#define __CAAUParameter_h__
@@ -65,107 +65,107 @@ public:
CAAUParameter(const CAAUParameter &a);
/*! @dtor ~CAAUParameter */
~CAAUParameter();
-
+
/*! @method operator <@ */
- bool operator < (const CAAUParameter &a) const
- {
- return memcmp(this, &a, sizeof(AudioUnitParameter)) < 0;
+ bool operator < (const CAAUParameter &a) const
+ {
+ return memcmp(this, &a, sizeof(AudioUnitParameter)) < 0;
}
/*! @method operator ==@ */
- bool operator == (const CAAUParameter &a) const
- {
- return !memcmp(this, &a, sizeof(AudioUnitParameter));
+ bool operator == (const CAAUParameter &a) const
+ {
+ 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 SetValue( AUParameterListenerRef inListener,
void * inObject,
Float32 inValue) const;
-
+
/*! @method GetName */
- CFStringRef GetName() const { return mParamName; }
+ 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
/*! @method ValuesHaveStrings */
- bool ValuesHaveStrings () const
- {
- return (mParamInfo.flags & kAudioUnitParameterFlag_ValuesHaveStrings) != 0;
+ bool ValuesHaveStrings () const
+ {
+ 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 */
CFStringRef GetParamTag() const { return mParamTag; }
- // this may return null! -
+ // this may return null! -
// in which case there is no descriptive tag for the parameter
/*! @method GetParamName */
CFStringRef GetParamName (int inIndex) const
// this can return null if there is no name for the parameter
- {
- return (mNamedParams && inIndex < mNumIndexedParams)
+ {
+ return (mNamedParams && inIndex < mNumIndexedParams)
? (CFStringRef) CFArrayGetValueAtIndex(mNamedParams, inIndex)
- : 0;
+ : 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
- {
+ bool GetClumpID (UInt32 &outClumpID) const
+ {
if (mParamInfo.flags & kAudioUnitParameterFlag_HasClump) {
outClumpID = mParamInfo.clumpID;
return true;
}
return false;
}
-
+
/*! @method HasDisplayTransformation */
- bool HasDisplayTransformation () const
- {
- return GetAudioUnitParameterDisplayType (mParamInfo.flags);
+ bool HasDisplayTransformation () const
+ {
+ return GetAudioUnitParameterDisplayType (mParamInfo.flags);
}
/*! @method IsExpert */
- bool IsExpert () const
- {
- return mParamInfo.flags & kAudioUnitParameterFlag_ExpertMode;
+ bool IsExpert () const
+ {
+ return mParamInfo.flags & kAudioUnitParameterFlag_ExpertMode;
}
#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:
@@ -180,7 +180,7 @@ protected:
short mNumIndexedParams;
/*! @var mNamedParams */
CFArrayRef mNamedParams;
-
+
private:
void Init (AudioUnit au, AudioUnitParameterID param, AudioUnitScope scope, AudioUnitElement element);
diff --git a/libs/appleutility/CoreAudio/PublicUtility/CAAUProcessor.cpp b/libs/appleutility/CoreAudio/PublicUtility/CAAUProcessor.cpp
index 1cda39c99d..9aaba46a8d 100644
--- a/libs/appleutility/CoreAudio/PublicUtility/CAAUProcessor.cpp
+++ b/libs/appleutility/CoreAudio/PublicUtility/CAAUProcessor.cpp
@@ -2,14 +2,14 @@
File: CAAUProcessor.cpp
Abstract: CAAUProcessor.h
Version: 1.1
-
+
Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple
Inc. ("Apple") in consideration of your agreement to the following
terms, and your use, installation, modification or redistribution of
this Apple software constitutes acceptance of these terms. If you do
not agree with these terms, please do not use, install, modify or
redistribute this Apple software.
-
+
In consideration of your agreement to abide by the following terms, and
subject to these terms, Apple grants you a personal, non-exclusive
license, under Apple's copyrights in this original Apple software (the
@@ -25,13 +25,13 @@
implied, are granted by Apple herein, including but not limited to any
patent rights that may be infringed by your derivative works or by other
works in which the Apple Software may be incorporated.
-
+
The Apple Software is provided by Apple on an "AS IS" basis. APPLE
MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND
OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
-
+
IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
@@ -40,24 +40,24 @@
AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),
STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
-
+
Copyright (C) 2014 Apple Inc. All Rights Reserved.
-
+
*/
-#include "CAAUProcessor.h"
+#include "CAAUProcessor.h"
#include "CAXException.h"
-static OSStatus SilenceInputCallback (void *inRefCon,
- AudioUnitRenderActionFlags *ioActionFlags,
- const AudioTimeStamp *inTimeStamp,
- UInt32 inBusNumber,
- UInt32 inNumberFrames,
+static OSStatus SilenceInputCallback (void *inRefCon,
+ AudioUnitRenderActionFlags *ioActionFlags,
+ const AudioTimeStamp *inTimeStamp,
+ UInt32 inBusNumber,
+ UInt32 inNumberFrames,
AudioBufferList *ioData)
{
AudioBuffer *buf = ioData->mBuffers;
for (UInt32 i = ioData->mNumberBuffers; i--; ++buf)
memset((Byte *)buf->mData, 0, buf->mDataByteSize);
-
+
//provide a hint that our input data is silent.
*ioActionFlags &= kAudioUnitRenderAction_OutputIsSilence;
return noErr;
@@ -84,19 +84,19 @@ CAAUProcessor::~CAAUProcessor ()
inline OSStatus SetInputCallback (CAAudioUnit &inUnit, AURenderCallbackStruct &inInputCallback)
{
- return inUnit.SetProperty (kAudioUnitProperty_SetRenderCallback,
- kAudioUnitScope_Input,
+ return inUnit.SetProperty (kAudioUnitProperty_SetRenderCallback,
+ kAudioUnitScope_Input,
0,
- &inInputCallback,
+ &inInputCallback,
sizeof(inInputCallback));
}
static AURenderCallbackStruct sRenderCallback;
-static OSStatus PrerollRenderProc ( void * /*inRefCon*/,
+static OSStatus PrerollRenderProc ( void * /*inRefCon*/,
AudioUnitRenderActionFlags * /*inActionFlags*/,
- const AudioTimeStamp * /*inTimeStamp*/,
+ const AudioTimeStamp * /*inTimeStamp*/,
UInt32 /*inBusNumber*/,
- UInt32 /*inNumFrames*/,
+ UInt32 /*inNumFrames*/,
AudioBufferList *ioData)
{
AudioBuffer *buf = ioData->mBuffers;
@@ -111,18 +111,18 @@ OSStatus Preroll (CAAudioUnit & inAU, UInt32 inFrameSize)
CAStreamBasicDescription desc;
OSStatus result = inAU.GetFormat (kAudioUnitScope_Input, 0, desc);
bool hasInput = false;
- //we have input
- if (result == noErr)
+ //we have input
+ if (result == noErr)
{
sRenderCallback.inputProc = PrerollRenderProc;
sRenderCallback.inputProcRefCon = 0;
-
- result = inAU.SetProperty (kAudioUnitProperty_SetRenderCallback, kAudioUnitScope_Input,
+
+ result = inAU.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));
@@ -133,7 +133,7 @@ OSStatus Preroll (CAAudioUnit & inAU, UInt32 inFrameSize)
{
AUOutputBL list (outputFormat, inFrameSize);
list.Prepare ();
-
+
result = inAU.Render (&flags, &time, 0, inFrameSize, list.ABL());
if (result) { printf("A result %d\n", (int)result); goto home; }
}
@@ -143,8 +143,8 @@ home:
// remove our installed callback
sRenderCallback.inputProc = 0;
sRenderCallback.inputProcRefCon = 0;
-
- inAU.SetProperty (kAudioUnitProperty_SetRenderCallback, kAudioUnitScope_Input,
+
+ inAU.SetProperty (kAudioUnitProperty_SetRenderCallback, kAudioUnitScope_Input,
0, &sRenderCallback, sizeof(sRenderCallback));
}
return result;
@@ -163,10 +163,10 @@ OSStatus CAAUProcessor::EstablishInputCallback (AURenderCallbackStruct &inInput
OSStatus CAAUProcessor::SetAUPreset (CFPropertyListRef inPreset)
{
- return mUnit.SetProperty (kAudioUnitProperty_ClassInfo,
- kAudioUnitScope_Global,
- 0,
- &inPreset,
+ return mUnit.SetProperty (kAudioUnitProperty_ClassInfo,
+ kAudioUnitScope_Global,
+ 0,
+ &inPreset,
sizeof(inPreset));
}
@@ -215,12 +215,12 @@ OSStatus CAAUProcessor::Reinitialize (UInt32 inNewMaxFrames)
{
OSStatus result;
CAStreamBasicDescription inputDesc, outputDesc;
-
+
ca_require_noerr (result = mUnit.GetFormat (kAudioUnitScope_Input, 0, inputDesc), home);
ca_require_noerr (result = mUnit.GetFormat (kAudioUnitScope_Output, 0, outputDesc), home);
-
+
ca_require_noerr (result = DoInitialisation (inputDesc, outputDesc, mNumInputSamples, inNewMaxFrames), home);
-
+
home:
return result;
}
@@ -232,23 +232,23 @@ OSStatus CAAUProcessor::DoInitialisation (const CAStreamBasicDescription &inIn
UInt32 inMaxFrames)
{
OSStatus result;
-
+
if (inNumInputSamples == 0 && IsOfflineAU())
return kAudioUnitErr_InvalidOfflineRender;
-
+
mNumInputSamples = inNumInputSamples;
-
+
// first check that we can do this number of channels
if (mUnit.CanDo (inInputFormat.NumberChannels(), inOutputFormat.NumberChannels()) == false)
ca_require_noerr (result = kAudioUnitErr_FailedInitialization, home);
-
+
// just uninitialise the AU as a matter of course
ca_require_noerr (result = mUnit.Uninitialize(), home);
- ca_require_noerr (result = mUnit.SetFormat (kAudioUnitScope_Input, 0, inInputFormat), home);
- ca_require_noerr (result = mUnit.SetFormat (kAudioUnitScope_Output, 0, inOutputFormat), home);
+ ca_require_noerr (result = mUnit.SetFormat (kAudioUnitScope_Input, 0, inInputFormat), home);
+ ca_require_noerr (result = mUnit.SetFormat (kAudioUnitScope_Output, 0, inOutputFormat), home);
ca_require_noerr (result = SetMaxFramesPerRender (inMaxFrames), home);
-
+
#if !TARGET_OS_IPHONE
// if we're any AU but an offline AU, we should tell it that we've processing offline
if (!IsOfflineAU()) {
@@ -263,11 +263,11 @@ OSStatus CAAUProcessor::DoInitialisation (const CAStreamBasicDescription &inIn
&mNumInputSamples, sizeof(mNumInputSamples));
}
#endif
-
+
ca_require_noerr (result = mUnit.Initialize(), home);
ca_require_noerr (result = SetInputCallback (mUnit, mUserCallback), home);
-
+
// finally reset our time stamp
// the time stamp we use with the AU Render - only sample count is valid
memset (&mRenderTimeStamp, 0, sizeof(mRenderTimeStamp));
@@ -281,11 +281,11 @@ OSStatus CAAUProcessor::DoInitialisation (const CAStreamBasicDescription &inIn
delete mPreflightABL;
mPreflightABL = NULL;
}
-
+
mPreflightABL = new AUOutputBL (inOutputFormat);
mLastPercentReported = 0;
-
+
home:
return result;
}
@@ -297,27 +297,27 @@ void CAAUProcessor::CalculateRemainderSamples (Float64 inSampleRate)
mTailSamples = 0;
mTailSamplesRemaining = 0;
return;
-
+
// nothing to do because we're not processing offline
if (IsOfflineContext() == false) return;
-
+
// because an offline unit has some indeterminancy about what it does with the input samples
// it is *required* to deal internally with both latency and tail
- if (!IsOfflineAU())
+ if (!IsOfflineAU())
{
// when offline we need to deal with both latency and tail
-
+
// if the AU has latency - how many samples at the start will be zero?
// we'll end up chucking these away.
Float64 renderTimeProps;
UInt32 propSize = sizeof (renderTimeProps);
OSStatus result = mUnit.GetProperty (kAudioUnitProperty_Latency, kAudioUnitScope_Global, 0,
&renderTimeProps, &propSize);
-
+
Float64 latencySamples = 0;
if (result == noErr) // we have latency to deal with - its reported in seconds
latencySamples = renderTimeProps * inSampleRate;
-
+
// AU tail
// if the AU has a tail - we'll pull that many zeroes through at the end to flush
// out this tail - think of a decaying digital delay or reverb...
@@ -328,7 +328,7 @@ void CAAUProcessor::CalculateRemainderSamples (Float64 inSampleRate)
Float64 tailSamples = 0;
if (result == noErr)
tailSamples = renderTimeProps * inSampleRate;
-
+
// this dictates how many samples at the end we need to pull through...
// we add latency to tail because we throw the latency samples away from the start of the rendering
// and we have to pull that many samples after the end of course to get the last of the original data
@@ -342,7 +342,7 @@ void CAAUProcessor::CalculateRemainderSamples (Float64 inSampleRate)
#if !TARGET_OS_IPHONE
CFStringRef CAAUProcessor::GetOLPreflightName () const
{
- if (OfflineAUNeedsPreflight())
+ if (OfflineAUNeedsPreflight())
{
CFStringRef str;
UInt32 size = sizeof(str);
@@ -389,8 +389,8 @@ OSStatus CAAUProcessor::Preflight (bool inProcessPreceedingTail)
UInt32 numFrames = MaxFramesPerRender();
if (numFrames == 0)
return kAudioUnitErr_InvalidProperty;
-
- if (!IsOfflineAU())
+
+ if (!IsOfflineAU())
{
if ((IsOfflineContext() == false && inProcessPreceedingTail) || IsOfflineContext())
{
@@ -399,22 +399,22 @@ OSStatus CAAUProcessor::Preflight (bool inProcessPreceedingTail)
// Consume the number of input samples indicated by the AU's latency or tail
// based on whether the AU is being used in an offline context or not.
-
- UInt32 latSamps = IsOfflineContext() ? mLatencySamples : mTailSamples;
+
+ UInt32 latSamps = IsOfflineContext() ? mLatencySamples : mTailSamples;
printf("latSamps %d\n", (int)latSamps);
latSamps = 0;
while (latSamps > 0)
{
if (latSamps < numFrames)
numFrames = latSamps;
-
+
// process the samples (the unit's input callback will read the samples
// from the file and convert them to float for processing
AudioUnitRenderActionFlags renderFlags = 0;
mPreflightABL->Prepare();
result = mUnit.Render (&renderFlags, &mRenderTimeStamp, 0, numFrames, mPreflightABL->ABL());
if (result) { printf("B result %d\n", (int)result); goto home; }
-
+
mRenderTimeStamp.mSampleTime += numFrames;
latSamps -= numFrames;
}
@@ -425,10 +425,10 @@ OSStatus CAAUProcessor::Preflight (bool inProcessPreceedingTail)
{
// processing real-time but not processing preceeding tail, so we should preroll the AU
ca_require_noerr (result = Preroll(mUnit, numFrames), home);
-
+
// re-establish the user's input callback
ca_require_noerr (result = SetInputCallback (mUnit, mUserCallback), home);
-
+
mRenderTimeStamp.mSampleTime = 0;
}
}
@@ -437,25 +437,25 @@ OSStatus CAAUProcessor::Preflight (bool inProcessPreceedingTail)
{
// re-establish the user's input callback
ca_require_noerr (result = SetInputCallback (mUnit, mUserCallback), home);
-
+
UInt32 preflightRequirements;
UInt32 size; size = sizeof(preflightRequirements);
ca_require_noerr (result = mUnit.GetProperty (kAudioUnitOfflineProperty_PreflightRequirements,
kAudioUnitScope_Global, 0,
&preflightRequirements, &size), home);
-
+
// 0 indicates none, otherwise optional or required -> we do it for either
- if (preflightRequirements)
+ if (preflightRequirements)
{
for (;;) {
- // here we need to do the preflight loop - we don't expect any data back, but have to
+ // here we need to do the preflight loop - we don't expect any data back, but have to
// give the offline unit all of its input data to allow it to prepare its processing
AudioUnitRenderActionFlags renderFlags = kAudioOfflineUnitRenderAction_Preflight;
mPreflightABL->Prepare();
result = mUnit.Render (&renderFlags, &mRenderTimeStamp, 0, numFrames, mPreflightABL->ABL());
if (result) { printf("C result %d\n", (int)result); goto home; }
mRenderTimeStamp.mSampleTime += numFrames;
-
+
if (renderFlags & kAudioOfflineUnitRenderAction_Complete)
break;
}
@@ -468,7 +468,7 @@ OSStatus CAAUProcessor::Preflight (bool inProcessPreceedingTail)
if (result == noErr) {
mPreflightDone = true;
}
-
+
home:
printf("<<<<CAAUProcessor::Preflight\n");
return result;
@@ -488,16 +488,16 @@ OSStatus CAAUProcessor::OfflineAUPreflight (UInt32 inNumFrames, bool &outIsDone
ca_require_noerr (result = mUnit.GetProperty (kAudioUnitOfflineProperty_PreflightRequirements,
kAudioUnitScope_Global, 0,
&preflightRequirements, &size), home);
-
+
// 0 indicates none, otherwise optional or required -> we do it for either
- if (preflightRequirements)
+ if (preflightRequirements)
{
AudioUnitRenderActionFlags renderFlags = kAudioOfflineUnitRenderAction_Preflight;
mPreflightABL->Prepare();
result = mUnit.Render (&renderFlags, &mRenderTimeStamp, 0, inNumFrames, mPreflightABL->ABL());
if (result) { printf("D result %d\n", (int)result); goto home; }
mRenderTimeStamp.mSampleTime += inNumFrames;
-
+
if (renderFlags & kAudioOfflineUnitRenderAction_Complete) {
outIsDone = true;
mRenderTimeStamp.mSampleTime = 0;
@@ -512,7 +512,7 @@ OSStatus CAAUProcessor::OfflineAUPreflight (UInt32 inNumFrames, bool &outIsDone
mPreflightDone = true;
mLastPercentReported = 0;
}
-
+
home:
return result;
}
@@ -527,33 +527,33 @@ void SetBufferListToNumFrames (AudioBufferList &list, UInt32 inNumFrames)
}
}
-OSStatus CAAUProcessor::Render (AudioBufferList *ioData,
- UInt32 &ioNumFrames,
+OSStatus CAAUProcessor::Render (AudioBufferList *ioData,
+ UInt32 &ioNumFrames,
bool &outIsSilence,
- bool *outOLCompleted,
+ bool *outOLCompleted,
bool *outOLRequiresPostProcess)
{
if (IsOfflineContext())
{
if (!mPreflightDone)
return kAudioUnitErr_InvalidOfflineRender;
-
+
// YES - this is correct!!! you have to provide both if rendering in an offline Context
*outOLCompleted = false;
*outOLRequiresPostProcess = false;
- if (!IsOfflineAU() && !mUnit.Comp().Desc().IsFConv())
+ if (!IsOfflineAU() && !mUnit.Comp().Desc().IsFConv())
{
// have we processed the input we expect too?
// in an offline case, we want to create output that matches the input
// for an OfflineAU type, it manages this internally, so we don't have to do anything
// for a FormatConverter AU, we don't know and can't tell, so we can't do anything here
- // for any other AU type (effect, instrument) the Prime assumption is that it will
+ // for any other AU type (effect, instrument) the Prime assumption is that it will
// ask for the same number of frames of input as it is asked to output
// so we can ask what it is doing, and get a sample accurate output (which is input + tail time)
- if (mRenderTimeStamp.mSampleTime + ioNumFrames >= InputSampleCount())
+ if (mRenderTimeStamp.mSampleTime + ioNumFrames >= InputSampleCount())
{
- // if we fall into here, we have just a partial number of input samples left
+ // if we fall into here, we have just a partial number of input samples left
// (less input less than what we've been asked to produce output for.
*outOLCompleted = true;
// we require post processing if we've got some tail (or latency) samples to flush through
@@ -579,8 +579,8 @@ OSStatus CAAUProcessor::Render (AudioBufferList *ioData,
OSStatus result = mUnit.Render (&renderFlags, &mRenderTimeStamp, 0, ioNumFrames, ioData);
if (result) { printf("E result %d\n", (int)result); }
if (result) {
- if (mUnit.Comp().Desc().IsFConv()) {
- // this is the only way we can tell we're done with a FormatConverter AU
+ if (mUnit.Comp().Desc().IsFConv()) {
+ // this is the only way we can tell we're done with a FormatConverter AU
// - ie. client returns an error from input
result = noErr;
*outOLCompleted = true;
@@ -600,7 +600,7 @@ OSStatus CAAUProcessor::Render (AudioBufferList *ioData,
// }
mRenderTimeStamp.mSampleTime += ioNumFrames;
outIsSilence = (renderFlags & kAudioUnitRenderAction_OutputIsSilence);
-
+
// if we're an Offline AU type, it will set this flag on completion of its processing
if (renderFlags & kAudioOfflineUnitRenderAction_Complete) {
// we now need to calculate how many frames we rendered.
@@ -617,7 +617,7 @@ OSStatus CAAUProcessor::Render (AudioBufferList *ioData,
mUnit.GlobalReset (); //flush this out, as we're done with this phase
}
}
-
+
return result;
}
@@ -637,20 +637,20 @@ OSStatus CAAUProcessor::Render (AudioBufferList *ioData,
// u.f = ((float*)(ioData->mBuffers[0].mData))[i];
// printf("aup out %4d %14.10f %02X %02X %02X %02X\n", (int)i, u.f, u.c[0], u.c[1], u.c[2], u.c[3]);
// }
-
- return result;
+
+ return result;
}
-
-OSStatus CAAUProcessor::PostProcess (AudioBufferList *ioData,
- UInt32 &ioNumFrames,
+
+OSStatus CAAUProcessor::PostProcess (AudioBufferList *ioData,
+ UInt32 &ioNumFrames,
bool &outIsSilence,
bool &outDone)
{
- if (IsOfflineAU() || !IsOfflineContext())
+ if (IsOfflineAU() || !IsOfflineContext())
return kAudioUnitErr_CannotDoInCurrentContext;
-
+
outDone = false;
-
+
// we've got less samples to process than we've been asked to process
if (mTailSamplesRemaining <= SInt32(ioNumFrames)) {
outDone = true;
@@ -659,7 +659,7 @@ OSStatus CAAUProcessor::PostProcess (AudioBufferList *ioData,
if (ioNumFrames == 0)
return noErr;
}
-
+
AudioUnitRenderActionFlags renderFlags = 0;
OSStatus result;
result = mUnit.Render (&renderFlags, &mRenderTimeStamp, 0, ioNumFrames, ioData);
@@ -667,14 +667,14 @@ OSStatus CAAUProcessor::PostProcess (AudioBufferList *ioData,
mRenderTimeStamp.mSampleTime += ioNumFrames;
mTailSamplesRemaining -= ioNumFrames;
outIsSilence = (renderFlags & kAudioUnitRenderAction_OutputIsSilence);
-
+
if (outDone) {
ca_require_noerr (result = SetInputCallback (mUnit, mUserCallback), home);
mUnit.GlobalReset (); //flush this out, as we're done with this phase
}
home:
return result;
-}
+}
#if !TARGET_OS_IPHONE
Float32 CAAUProcessor::GetOLPercentComplete ()
@@ -683,22 +683,22 @@ Float32 CAAUProcessor::GetOLPercentComplete ()
return 0;
Float32 percentDone = mLastPercentReported;
-
- if (IsOfflineAU())
+
+ if (IsOfflineAU())
{
// we get the output size every time, as this can change as parameters are changed
UInt64 numOutputSamples = mNumInputSamples;
UInt32 propSize = sizeof(numOutputSamples);
mUnit.GetProperty (kAudioUnitOfflineProperty_OutputSize,
kAudioUnitScope_Global, 0, &numOutputSamples, &propSize);
-
+
percentDone = (mRenderTimeStamp.mSampleTime / Float64(numOutputSamples)) * 100.;
}
else
{
percentDone = (mRenderTimeStamp.mSampleTime / Float64(mNumInputSamples + mTailSamples)) * 100.;
}
-
+
if (percentDone > mLastPercentReported)
mLastPercentReported = percentDone;
diff --git a/libs/appleutility/CoreAudio/PublicUtility/CAAUProcessor.h b/libs/appleutility/CoreAudio/PublicUtility/CAAUProcessor.h
index f0fb34574d..c8c02bed91 100644
--- a/libs/appleutility/CoreAudio/PublicUtility/CAAUProcessor.h
+++ b/libs/appleutility/CoreAudio/PublicUtility/CAAUProcessor.h
@@ -2,14 +2,14 @@
File: CAAUProcessor.h
Abstract: Part of CoreAudio Utility Classes
Version: 1.1
-
+
Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple
Inc. ("Apple") in consideration of your agreement to the following
terms, and your use, installation, modification or redistribution of
this Apple software constitutes acceptance of these terms. If you do
not agree with these terms, please do not use, install, modify or
redistribute this Apple software.
-
+
In consideration of your agreement to abide by the following terms, and
subject to these terms, Apple grants you a personal, non-exclusive
license, under Apple's copyrights in this original Apple software (the
@@ -25,13 +25,13 @@
implied, are granted by Apple herein, including but not limited to any
patent rights that may be infringed by your derivative works or by other
works in which the Apple Software may be incorporated.
-
+
The Apple Software is provided by Apple on an "AS IS" basis. APPLE
MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND
OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
-
+
IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
@@ -40,9 +40,9 @@
AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),
STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
-
+
Copyright (C) 2014 Apple Inc. All Rights Reserved.
-
+
*/
#ifndef __CAAUProcessor_h__
#define __CAAUProcessor_h__
@@ -60,76 +60,76 @@
It can be used in a RealTime context (rendering data with RT constraints) or in an OffLine context
such as using an AU to process data that is stored in a file, and on which there are no
RT constraints to be imposed.
-
+
Order of operations:
Create an instance
Establish an Input Callback
Initialize the AU to the audio formats and whether it is going to process in an offline or RT context
Preflight
-
+
while (...)
Render // based on your calling context
-
+
PostProcess if needed (only in OL case)
-
+
After any initialization, preflighting is required.
-
+
Parameter Values on the AU should be set just before each call to Render. The sampleFrameOffsets
supplied when setting those values are an offset into that next render buffer's numFrames.
-
+
RT vs OT is determined by whether the inputSampleCount is set during Initialization, thus
this class can move the AU between RT and OL contexts. If you are using an AU of type 'auol'
(Offline), then it cannot be used in a RT context.
The CAAUProcessor will only call your Input Callback for input when it needs valid input.
This input callback will contain a sample time that indicates where within your input
- you should read data from, where after preflighting, the first output data produces is for
+ you should read data from, where after preflighting, the first output data produces is for
the output sample count of zero.
-
+
MaxFrames should be set before initialisation (or is also passed in to the Reinitialize API)
-
+
If RT, then PostProcessing will *never* be required, nor will Render ever return an isDone value
If OL, then Render will at some point return isDone==true, and then also indicate if PostProcessing is required
-
+
If using a Format Converter AU in offline context, then the only way for it to determine that you've finished
is for the Input callback to return an error. This means ultimately, that you'll have potentially longer output
- than you should have. The only way to manage this is for the caller to know the relationship between
+ than you should have. The only way to manage this is for the caller to know the relationship between
input to output samples that will be required, and to call Render for just that amount of output samples
then return an error, so the tail and latency can be processed.
-
+
Tail and Latency are *only* calculated at initialisation.. Some AU's may change these properties based on
either different presets or parameter settings... Ideally, this class should listen to those properties
and recalculate its values based on those changes.
-*/
-
+*/
+
class CAAUProcessor {
public:
// by default this is set to process offline
CAAUProcessor (const CAComponent& inComp);
~CAAUProcessor ();
-
+
CAAudioUnit& AU() { return mUnit; }
const CAAudioUnit& AU() const { return mUnit; }
-
-#pragma mark __Setup APIs
+
+#pragma mark __Setup APIs
bool IsOfflineContext () const { return mNumInputSamples != 0; }
-
- // this contains the callback and client data that the AU
+
+ // this contains the callback and client data that the AU
// uses to call when it needs input
OSStatus EstablishInputCallback (AURenderCallbackStruct &inInputCallback);
-
+
OSStatus SetAUPreset (CFPropertyListRef inPreset);
OSStatus SetAUPresetIndex (SInt32 inPresetIndex);
-
+
OSStatus SetParameter (AudioUnitParameterID inID, AudioUnitScope scope, AudioUnitElement element,
Float32 value, UInt32 bufferOffsetFrames = 0);
-
+
// a result of zero here signifies an error
UInt32 MaxFramesPerRender () const;
-
+
// this call can return an error if the AU is initialized - see Reinitialize
OSStatus SetMaxFramesPerRender (UInt32 inMaxFrames);
-
+
// Prepares the AU for processing at the specified format
// only doing n-n channel processing here.. could extend this for n-m channel processing easily enough
// if you are processing using an Offline AU, you HAVE to specify the numInputSamples to process
@@ -138,15 +138,15 @@ public:
{
return Initialize (inIODesc, inIODesc, inNumInputSamples);
}
- OSStatus Initialize (const CAStreamBasicDescription &inInputDesc,
- const CAStreamBasicDescription &inOutputDesc,
+ OSStatus Initialize (const CAStreamBasicDescription &inInputDesc,
+ const CAStreamBasicDescription &inOutputDesc,
UInt64 inNumInputSamples = 0);
-
+
// takes the existing format state of the AU, but resets the AUProcessor so that:
// applies an optional new number of max frames
// the AUProcessor will have to be Preflighted again after this call
// Use this when you want to keep the same formats, same input sample count,
- // but want to re-initialize the AU to use a new num max frames and prepare it
+ // but want to re-initialize the AU to use a new num max frames and prepare it
// appropriately...
OSStatus Reinitialize (UInt32 inNewMaxFrames);
@@ -155,18 +155,18 @@ public:
#pragma mark __Render APIs
// Preflighting - you HAVE to preflight
// returns noErr when preflighting is done
-
+
// Offline Context:
// Offline AU's require preflighting, even if they will end up doing no work.
- // In the case where the AU is offline the latency samples are trimmed and not returned
+ // In the case where the AU is offline the latency samples are trimmed and not returned
// from the consequent Render calls
-
- // If you are NOT an offline AU then the first time Render is called,
+
+ // If you are NOT an offline AU then the first time Render is called,
// there will need to be some consumption of the input before you will get any valid output data.
// This is determined by the value of the AU's reported latency. So, in this case preflight
// will consume those initial samples and then return.
// Your InputCallback MUST provide the initial data that is to be processed.
-
+
// RealTime Context:
// (1 No priming. In this case inProcessPreceedingTail is false (the default) and no
// processing is done on the AU. However, because preflight is the first time that Rendering
@@ -185,12 +185,12 @@ public:
// and you'll need to read up to the numSamples of tail time of the preceeding data.
// It discards the output results of the preflighting. If you don't have any previous data
// with which to prepare the AU, then you do NOT need to take this path and can do the step below.
-
+
// In both of these cases the inital latency frames are *not* trimmed from
// the output that will be generated by a consequent call to render.
OSStatus Preflight (bool inProcessPreceedingTail = false);
- // this can be used with an OfflineAU to do a gradual preflight (so you could for instance,
+ // this can be used with an OfflineAU to do a gradual preflight (so you could for instance,
// present a progress indicator. The Preflight call will do it all at once.
// If you break out of the preflight before you are done, then you HAVE to reinitialise the AU
// before you can either do another preflight or do a render, otherwise the Render call will produce
@@ -199,45 +199,45 @@ public:
// Here's the major stage that produces output.
// You pass in two bool flags and an ioNumFrames....
-
+
// So ioNumFrames will be *untouched* if outOLCompleted == false
// if outOLCompleted is true, ioNumFrames contains the number of valid frames within the ioData data that are valid data
// (ioData's pointers and sizes will also have been resized to match these number of frames)
- // outOLRequiresPostProcess should also be checked when outOLCompleted is true,
+ // outOLRequiresPostProcess should also be checked when outOLCompleted is true,
// to see if any post-processing is required
// if rendering in a RT context, then neither outOLCompleted or outOLRequiresPostProcess is required
// if rendering in an OL context, both must be specified.
// Caller MUST provide an ABL that is set up in the previously specified output format
-
+
// If you receive kAudioUnitErr_InvalidOfflineRender when dealing with an OfflineAU Type, then you have either not
// preflighted it (and the AU requires it) or you have changed some state (its num input samples, its start offest)
// and it needs to be re-preflighted. In that case, preflight the AU again first.
- OSStatus Render (AudioBufferList *ioData,
- UInt32 &ioNumFrames,
+ OSStatus Render (AudioBufferList *ioData,
+ UInt32 &ioNumFrames,
bool &outIsSilence,
- bool *outOLCompleted = NULL,
+ bool *outOLCompleted = NULL,
bool *outOLRequiresPostProcess = NULL);
-
+
// call this method if outOLRequiresPostProcess returned true upon rendering completion
OSStatus PostProcess (AudioBufferList *ioData, UInt32 &ioNumFrames, bool &outIsSilence, bool &outDone);
-
+
// This method returns how many input samples will need to be provided before
// valid output data is produced.
UInt32 LatencySampleCount () const { return mLatencySamples; }
-
+
UInt32 TailSampleCount () const { return mTailSamples; }
-
+
UInt64 InputSampleCount () const { return mNumInputSamples; }
-
+
// the class maintains the TimeStamp from render call to render call
// this value is the sample count that will be used in the *next* render call
Float64 SampleTime () const { return mRenderTimeStamp.mSampleTime; }
-
+
// in some settings (for instance a delay with 100% feedback) tail time is essentially infinite
// so you should safeguard the final OL render stage (post process) which is aimed at pulling the tail through
// default is 10 seconds
Float64 GetMaxTailTime () const { return mMaxTailTime; }
-
+
// this ONLY takes affect when you initialise the processor, it doesn't change that AU's tail time,
// but just the max amount of time that this object will allow the AU to post-process data
// set this to 0, to use the AU's tail time with no adjustment
@@ -247,20 +247,20 @@ public:
// if this is NULL, then there is no explicit (optional or required) preflight requirement of the AU
// if this is valid, then the AU either requires or optionally requires preflighting. The default
// behaviour in this case is that the processor will preflight. This name can be used to preset
- // to the user. If the AU doesn't present a name, but preflighting is optional/required, then the
+ // to the user. If the AU doesn't present a name, but preflighting is optional/required, then the
// processor return "Preflight" as its string.
// the String should be released by the caller.
CFStringRef GetOLPreflightName () const;
- // Returns true if this is processor is an offline AU, and that AU (whether optional or required)
+ // Returns true if this is processor is an offline AU, and that AU (whether optional or required)
// needs preflighting
bool OfflineAUNeedsPreflight () const;
-
+
// this provides a rough approximation of the progress of an Offline Processing operation (both for the
// preflight and the render phases)
Float32 GetOLPercentComplete ();
#endif
-
+
private:
CAAudioUnit mUnit;
UInt32 mLatencySamples;
@@ -274,11 +274,11 @@ private:
AURenderCallbackStruct mUserCallback;
Float64 mMaxTailTime;
Float32 mLastPercentReported;
-
+
bool IsOfflineAU () const { return mUnit.Comp().Desc().IsOffline(); }
void CalculateRemainderSamples (Float64 inSampleRate);
-
+
OSStatus DoInitialisation (const CAStreamBasicDescription &inInputFormat,
const CAStreamBasicDescription &inOutputFormat,
UInt64 inNumInputSamples,
diff --git a/libs/appleutility/CoreAudio/PublicUtility/CAAtomic.h b/libs/appleutility/CoreAudio/PublicUtility/CAAtomic.h
index 2a44868f72..ae3efd743f 100644
--- a/libs/appleutility/CoreAudio/PublicUtility/CAAtomic.h
+++ b/libs/appleutility/CoreAudio/PublicUtility/CAAtomic.h
@@ -2,14 +2,14 @@
File: CAAtomic.h
Abstract: Part of CoreAudio Utility Classes
Version: 1.1
-
+
Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple
Inc. ("Apple") in consideration of your agreement to the following
terms, and your use, installation, modification or redistribution of
this Apple software constitutes acceptance of these terms. If you do
not agree with these terms, please do not use, install, modify or
redistribute this Apple software.
-
+
In consideration of your agreement to abide by the following terms, and
subject to these terms, Apple grants you a personal, non-exclusive
license, under Apple's copyrights in this original Apple software (the
@@ -25,13 +25,13 @@
implied, are granted by Apple herein, including but not limited to any
patent rights that may be infringed by your derivative works or by other
works in which the Apple Software may be incorporated.
-
+
The Apple Software is provided by Apple on an "AS IS" basis. APPLE
MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND
OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
-
+
IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
@@ -40,17 +40,17 @@
AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),
STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
-
+
Copyright (C) 2014 Apple Inc. All Rights Reserved.
-
+
*/
/*
This file implements all Atomic operations using Interlocked functions specified in
Winbase.h
NOTE: According to Microsoft documentation, all Interlocked functions generates a
-full barrier.
+full barrier.
On Windows:
- As the Interlocked functions returns the Old value, Extra checks and operations
+ As the Interlocked functions returns the Old value, Extra checks and operations
are made after the atomic operation to return value consistent with OSX counterparts.
*/
#ifndef __CAAtomic_h__
@@ -66,7 +66,7 @@ full barrier.
#include <libkern/OSAtomic.h>
#endif
-inline void CAMemoryBarrier()
+inline void CAMemoryBarrier()
{
#if TARGET_OS_WIN32
MemoryBarrier();
diff --git a/libs/appleutility/CoreAudio/PublicUtility/CAAtomicStack.h b/libs/appleutility/CoreAudio/PublicUtility/CAAtomicStack.h
index 8d40fc5d27..6277865681 100644
--- a/libs/appleutility/CoreAudio/PublicUtility/CAAtomicStack.h
+++ b/libs/appleutility/CoreAudio/PublicUtility/CAAtomicStack.h
@@ -2,14 +2,14 @@
File: CAAtomicStack.h
Abstract: Part of CoreAudio Utility Classes
Version: 1.1
-
+
Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple
Inc. ("Apple") in consideration of your agreement to the following
terms, and your use, installation, modification or redistribution of
this Apple software constitutes acceptance of these terms. If you do
not agree with these terms, please do not use, install, modify or
redistribute this Apple software.
-
+
In consideration of your agreement to abide by the following terms, and
subject to these terms, Apple grants you a personal, non-exclusive
license, under Apple's copyrights in this original Apple software (the
@@ -25,13 +25,13 @@
implied, are granted by Apple herein, including but not limited to any
patent rights that may be infringed by your derivative works or by other
works in which the Apple Software may be incorporated.
-
+
The Apple Software is provided by Apple on an "AS IS" basis. APPLE
MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND
OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
-
+
IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
@@ -40,9 +40,9 @@
AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),
STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
-
+
Copyright (C) 2014 Apple Inc. All Rights Reserved.
-
+
*/
#ifndef __CAAtomicStack_h__
#define __CAAtomicStack_h__
@@ -63,14 +63,14 @@ template <class T>
class TAtomicStack {
public:
TAtomicStack() : mHead(NULL) { }
-
+
// non-atomic routines, for use when initializing/deinitializing, operate NON-atomically
void push_NA(T *item)
{
item->next() = mHead;
mHead = item;
}
-
+
T * pop_NA()
{
T *result = mHead;
@@ -78,11 +78,11 @@ public:
mHead = result->next();
return result;
}
-
+
bool empty() const { return mHead == NULL; }
-
+
T * head() { return mHead; }
-
+
// atomic routines
void push_atomic(T *item)
{
@@ -92,7 +92,7 @@ public:
item->next() = head_;
} while (!compare_and_swap(head_, item, &mHead));
}
-
+
void push_multiple_atomic(T *item)
// pushes entire linked list headed by item
{
@@ -107,7 +107,7 @@ public:
tail->next() = head_;
} while (!compare_and_swap(head_, item, &mHead));
}
-
+
T * pop_atomic_single_reader()
// this may only be used when only one thread may potentially pop from the stack.
// if multiple threads may pop, this suffers from the ABA problem.
@@ -120,7 +120,7 @@ public:
} while (!compare_and_swap(result, result->next(), &mHead));
return result;
}
-
+
T * pop_atomic()
// This is inefficient for large linked lists.
// prefer pop_all() to a series of calls to pop_atomic.
@@ -135,7 +135,7 @@ public:
}
return result;
}
-
+
T * pop_all()
{
T *result;
@@ -145,7 +145,7 @@ public:
} while (!compare_and_swap(result, NULL, &mHead));
return result;
}
-
+
T* pop_all_reversed()
{
TAtomicStack<T> reversed;
@@ -157,7 +157,7 @@ public:
}
return reversed.mHead;
}
-
+
static bool compare_and_swap(T *oldvalue, T *newvalue, T **pvalue)
{
#if TARGET_OS_MAC
@@ -173,7 +173,7 @@ public:
return CAAtomicCompareAndSwap32Barrier(SInt32(oldvalue), SInt32(newvalue), (SInt32*)pvalue);
#endif
}
-
+
protected:
T * mHead;
};
@@ -194,7 +194,7 @@ public:
void * pop_atomic() { return OSAtomicDequeue(&mHead, mNextPtrOffset); }
void * pop_atomic_single_reader() { return pop_atomic(); }
void * pop_NA() { return pop_atomic(); }
-
+
private:
OSQueueHead mHead;
size_t mNextPtrOffset;
@@ -221,10 +221,10 @@ public:
T * pop_atomic() { return (T *)OSAtomicDequeue(&mHead, mNextPtrOffset); }
T * pop_atomic_single_reader() { return pop_atomic(); }
T * pop_NA() { return pop_atomic(); }
-
+
// caution: do not try to implement pop_all_reversed here. the writer could add new elements
// while the reader is trying to pop old ones!
-
+
private:
OSQueueHead mHead;
ssize_t mNextPtrOffset;
diff --git a/libs/appleutility/CoreAudio/PublicUtility/CAAudioBufferList.cpp b/libs/appleutility/CoreAudio/PublicUtility/CAAudioBufferList.cpp
index d3644ed2e4..3e734599a5 100644
--- a/libs/appleutility/CoreAudio/PublicUtility/CAAudioBufferList.cpp
+++ b/libs/appleutility/CoreAudio/PublicUtility/CAAudioBufferList.cpp
@@ -2,14 +2,14 @@
File: CAAudioBufferList.cpp
Abstract: CAAudioBufferList.h
Version: 1.1
-
+
Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple
Inc. ("Apple") in consideration of your agreement to the following
terms, and your use, installation, modification or redistribution of
this Apple software constitutes acceptance of these terms. If you do
not agree with these terms, please do not use, install, modify or
redistribute this Apple software.
-
+
In consideration of your agreement to abide by the following terms, and
subject to these terms, Apple grants you a personal, non-exclusive
license, under Apple's copyrights in this original Apple software (the
@@ -25,13 +25,13 @@
implied, are granted by Apple herein, including but not limited to any
patent rights that may be infringed by your derivative works or by other
works in which the Apple Software may be incorporated.
-
+
The Apple Software is provided by Apple on an "AS IS" basis. APPLE
MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND
OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
-
+
IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
@@ -40,9 +40,9 @@
AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),
STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
-
+
Copyright (C) 2014 Apple Inc. All Rights Reserved.
-
+
*/
//=============================================================================
// Includes
@@ -84,12 +84,12 @@ UInt32 CAAudioBufferList::CalculateByteSize(UInt32 inNumberBuffers)
UInt32 CAAudioBufferList::GetTotalNumberChannels(const AudioBufferList& inBufferList)
{
UInt32 theAnswer = 0;
-
+
for(UInt32 theIndex = 0; theIndex < inBufferList.mNumberBuffers; ++theIndex)
{
theAnswer += inBufferList.mBuffers[theIndex].mNumberChannels;
}
-
+
return theAnswer;
}
@@ -97,20 +97,20 @@ bool CAAudioBufferList::GetBufferForChannel(const AudioBufferList& inBufferList,
{
bool theAnswer = false;
UInt32 theIndex = 0;
-
+
while((theIndex < inBufferList.mNumberBuffers) && (inChannel >= inBufferList.mBuffers[theIndex].mNumberChannels))
{
inChannel -= inBufferList.mBuffers[theIndex].mNumberChannels;
++theIndex;
}
-
+
if(theIndex < inBufferList.mNumberBuffers)
{
outBufferNumber = theIndex;
outBufferChannel = inChannel;
theAnswer = true;
}
-
+
return theAnswer;
}
@@ -136,7 +136,7 @@ void CAAudioBufferList::Copy(const AudioBufferList& inSource, UInt32 inStartingS
UInt32 theNumberInputChannels = GetTotalNumberChannels(inSource);
UInt32 theOutputChannel = inStartingDestinationChannel;
UInt32 theNumberOutputChannels = GetTotalNumberChannels(outDestination);
-
+
UInt32 theInputBufferIndex = 0;
UInt32 theInputBufferChannel = 0;
UInt32 theOutputBufferIndex = 0;
@@ -144,11 +144,11 @@ void CAAudioBufferList::Copy(const AudioBufferList& inSource, UInt32 inStartingS
while((theInputChannel < theNumberInputChannels) && (theOutputChannel < theNumberOutputChannels))
{
GetBufferForChannel(inSource, theInputChannel, theInputBufferIndex, theInputBufferChannel);
-
+
GetBufferForChannel(inSource, theOutputChannel, theOutputBufferIndex, theOutputBufferChannel);
-
+
CopyChannel(inSource.mBuffers[theInputBufferIndex], theInputBufferChannel, outDestination.mBuffers[theOutputBufferIndex], theOutputBufferChannel);
-
+
++theInputChannel;
++theOutputChannel;
}
@@ -160,13 +160,13 @@ void CAAudioBufferList::CopyChannel(const AudioBuffer& inSource, UInt32 inSource
UInt32 theNumberFramesToCopy = outDestination.mDataByteSize / (outDestination.mNumberChannels * SizeOf32(Float32));
const Float32* theSource = static_cast<const Float32*>(inSource.mData);
Float32* theDestination = static_cast<Float32*>(outDestination.mData);
-
+
// loop through the data and copy the samples
while(theNumberFramesToCopy > 0)
{
// copy the data
theDestination[inDestinationChannel] = theSource[inSourceChannel];
-
+
// adjust the pointers
--theNumberFramesToCopy;
theSource += inSource.mNumberChannels;
@@ -218,7 +218,7 @@ bool CAAudioBufferList::HasData(AudioBufferList& inBufferList)
void CAAudioBufferList::PrintToLog(const AudioBufferList& inBufferList)
{
PrintInt(" Number streams: ", inBufferList.mNumberBuffers);
-
+
for(UInt32 theIndex = 0; theIndex < inBufferList.mNumberBuffers; ++theIndex)
{
PrintIndexedInt(" Channels in stream", theIndex + 1, inBufferList.mBuffers[theIndex].mNumberChannels);
diff --git a/libs/appleutility/CoreAudio/PublicUtility/CAAudioBufferList.h b/libs/appleutility/CoreAudio/PublicUtility/CAAudioBufferList.h
index 70614f3eb6..e28e723fd7 100644
--- a/libs/appleutility/CoreAudio/PublicUtility/CAAudioBufferList.h
+++ b/libs/appleutility/CoreAudio/PublicUtility/CAAudioBufferList.h
@@ -2,14 +2,14 @@
File: CAAudioBufferList.h
Abstract: Part of CoreAudio Utility Classes
Version: 1.1
-
+
Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple
Inc. ("Apple") in consideration of your agreement to the following
terms, and your use, installation, modification or redistribution of
this Apple software constitutes acceptance of these terms. If you do
not agree with these terms, please do not use, install, modify or
redistribute this Apple software.
-
+
In consideration of your agreement to abide by the following terms, and
subject to these terms, Apple grants you a personal, non-exclusive
license, under Apple's copyrights in this original Apple software (the
@@ -25,13 +25,13 @@
implied, are granted by Apple herein, including but not limited to any
patent rights that may be infringed by your derivative works or by other
works in which the Apple Software may be incorporated.
-
+
The Apple Software is provided by Apple on an "AS IS" basis. APPLE
MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND
OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
-
+
IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
@@ -40,9 +40,9 @@
AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),
STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
-
+
Copyright (C) 2014 Apple Inc. All Rights Reserved.
-
+
*/
#if !defined(__CAAudioBufferList_h__)
#define __CAAudioBufferList_h__
diff --git a/libs/appleutility/CoreAudio/PublicUtility/CAAudioChannelLayout.cpp b/libs/appleutility/CoreAudio/PublicUtility/CAAudioChannelLayout.cpp
index 74753598db..982dee1150 100644
--- a/libs/appleutility/CoreAudio/PublicUtility/CAAudioChannelLayout.cpp
+++ b/libs/appleutility/CoreAudio/PublicUtility/CAAudioChannelLayout.cpp
@@ -2,14 +2,14 @@
File: CAAudioChannelLayout.cpp
Abstract: CAAudioChannelLayout.h
Version: 1.1
-
+
Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple
Inc. ("Apple") in consideration of your agreement to the following
terms, and your use, installation, modification or redistribution of
this Apple software constitutes acceptance of these terms. If you do
not agree with these terms, please do not use, install, modify or
redistribute this Apple software.
-
+
In consideration of your agreement to abide by the following terms, and
subject to these terms, Apple grants you a personal, non-exclusive
license, under Apple's copyrights in this original Apple software (the
@@ -25,13 +25,13 @@
implied, are granted by Apple herein, including but not limited to any
patent rights that may be infringed by your derivative works or by other
works in which the Apple Software may be incorporated.
-
+
The Apple Software is provided by Apple on an "AS IS" basis. APPLE
MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND
OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
-
+
IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
@@ -40,9 +40,9 @@
AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),
STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
-
+
Copyright (C) 2014 Apple Inc. All Rights Reserved.
-
+
*/
//=============================================================================
// Includes
@@ -95,10 +95,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);
}
@@ -125,7 +125,7 @@ UInt32 CAAudioChannelLayout::NumberChannels (const AudioChannelLayout& inLayout)
{
if (inLayout.mChannelLayoutTag == kAudioChannelLayoutTag_UseChannelDescriptions)
return inLayout.mNumberChannelDescriptions;
-
+
if (inLayout.mChannelLayoutTag == kAudioChannelLayoutTag_UseChannelBitmap)
return CountOnes (inLayout.mChannelBitmap);
@@ -134,7 +134,7 @@ UInt32 CAAudioChannelLayout::NumberChannels (const AudioChannelLayout& inLayout)
void CAShowAudioChannelLayout (FILE* file, const AudioChannelLayout *layout)
{
- if (layout == NULL)
+ if (layout == NULL)
{
fprintf (file, "\tNULL layout\n");
return;
diff --git a/libs/appleutility/CoreAudio/PublicUtility/CAAudioChannelLayout.h b/libs/appleutility/CoreAudio/PublicUtility/CAAudioChannelLayout.h
index 4307054aee..93384297b0 100644
--- a/libs/appleutility/CoreAudio/PublicUtility/CAAudioChannelLayout.h
+++ b/libs/appleutility/CoreAudio/PublicUtility/CAAudioChannelLayout.h
@@ -2,14 +2,14 @@
File: CAAudioChannelLayout.h
Abstract: Part of CoreAudio Utility Classes
Version: 1.1
-
+
Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple
Inc. ("Apple") in consideration of your agreement to the following
terms, and your use, installation, modification or redistribution of
this Apple software constitutes acceptance of these terms. If you do
not agree with these terms, please do not use, install, modify or
redistribute this Apple software.
-
+
In consideration of your agreement to abide by the following terms, and
subject to these terms, Apple grants you a personal, non-exclusive
license, under Apple's copyrights in this original Apple software (the
@@ -25,13 +25,13 @@
implied, are granted by Apple herein, including but not limited to any
patent rights that may be infringed by your derivative works or by other
works in which the Apple Software may be incorporated.
-
+
The Apple Software is provided by Apple on an "AS IS" basis. APPLE
MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND
OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
-
+
IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
@@ -40,9 +40,9 @@
AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),
STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
-
+
Copyright (C) 2014 Apple Inc. All Rights Reserved.
-
+
*/
#if !defined(__CAAudioChannelLayout_h__)
#define __CAAudioChannelLayout_h__
@@ -85,27 +85,27 @@ class CAAudioChannelLayout
public:
static AudioChannelLayout* Create(UInt32 inNumberChannelDescriptions);
static void Destroy(AudioChannelLayout* inChannelLayout);
- static UInt32 CalculateByteSize(UInt32 inNumberChannelDescriptions) {
+ static UInt32 CalculateByteSize(UInt32 inNumberChannelDescriptions) {
return SizeOf32(AudioChannelLayout) - SizeOf32(AudioChannelDescription) + (inNumberChannelDescriptions * SizeOf32(AudioChannelDescription));
}
static void SetAllToUnknown(AudioChannelLayout& outChannelLayout, UInt32 inNumberChannelDescriptions);
static UInt32 NumberChannels(const AudioChannelLayout& inLayout);
-
+
#if !HAL_Build
-// object methods
+// object methods
public:
CAAudioChannelLayout ();
CAAudioChannelLayout (UInt32 inNumberChannels, bool inChooseSurround);
// if inChooseSurround is false, then symmetrical speaker arrangements
// are chosen in place of surround layouts if there is a choice
- // This call chooses layouts based on the expected defaults in
+ // This call chooses layouts based on the expected defaults in
// AudioUnit usage
CAAudioChannelLayout (AudioChannelLayoutTag inTag);
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;
@@ -115,38 +115,38 @@ public:
bool IsValid() const { return NumberChannels() > 0; }
UInt32 Size() const { return mLayout ? mLayout->Size() : 0; }
-
+
UInt32 NumberChannels() const { return mLayout ? mLayout->NumberChannels() : 0; }
-
+
AudioChannelLayoutTag Tag() const { return Layout().mChannelLayoutTag; }
const AudioChannelLayout& Layout() const { return mLayout->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 RefCountedLayout : public CAReferenceCounted {
void * operator new(size_t /* size */, size_t aclSize)
{
return CA_malloc(sizeof(RefCountedLayout) - sizeof(AudioChannelLayout) + aclSize);
}
-
+
void operator delete(void *mem)
{
free(mem);
}
-
-
+
+
RefCountedLayout(UInt32 inDataSize) :
mByteSize(inDataSize)
- {
+ {
memset(&mACL, 0, inDataSize);
}
-
+
public:
static RefCountedLayout *CreateWithNumberChannelDescriptions(unsigned nChannels) {
size_t size = CAAudioChannelLayout::CalculateByteSize(nChannels);
@@ -164,33 +164,33 @@ private:
acl->mACL.mChannelLayoutTag = layoutTag;
return acl;
}
-
+
const AudioChannelLayout & Layout() const { return mACL; }
-
+
UInt32 Size () const { return mByteSize; }
-
+
UInt32 NumberChannels() { return CAAudioChannelLayout::NumberChannels(Layout()); }
-
+
private:
const UInt32 mByteSize;
AudioChannelLayout mACL;
// * * * mACL is variable length and thus must be last * * *
-
+
// 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 &mACL; }
-
+
private:
// prohibited methods: private and unimplemented.
RefCountedLayout();
RefCountedLayout(const RefCountedLayout& c);
RefCountedLayout& operator=(const RefCountedLayout& c);
};
-
+
RefCountedLayout *mLayout;
#endif // HAL_Build
diff --git a/libs/appleutility/CoreAudio/PublicUtility/CAAudioChannelLayoutObject.cpp b/libs/appleutility/CoreAudio/PublicUtility/CAAudioChannelLayoutObject.cpp
index 009d4b3b5e..50687e97e6 100644
--- a/libs/appleutility/CoreAudio/PublicUtility/CAAudioChannelLayoutObject.cpp
+++ b/libs/appleutility/CoreAudio/PublicUtility/CAAudioChannelLayoutObject.cpp
@@ -2,14 +2,14 @@
File: CAAudioChannelLayoutObject.cpp
Abstract: CAAudioChannelLayoutObject.h
Version: 1.1
-
+
Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple
Inc. ("Apple") in consideration of your agreement to the following
terms, and your use, installation, modification or redistribution of
this Apple software constitutes acceptance of these terms. If you do
not agree with these terms, please do not use, install, modify or
redistribute this Apple software.
-
+
In consideration of your agreement to abide by the following terms, and
subject to these terms, Apple grants you a personal, non-exclusive
license, under Apple's copyrights in this original Apple software (the
@@ -25,13 +25,13 @@
implied, are granted by Apple herein, including but not limited to any
patent rights that may be infringed by your derivative works or by other
works in which the Apple Software may be incorporated.
-
+
The Apple Software is provided by Apple on an "AS IS" basis. APPLE
MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND
OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
-
+
IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
@@ -40,9 +40,9 @@
AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),
STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
-
+
Copyright (C) 2014 Apple Inc. All Rights Reserved.
-
+
*/
#include "CAAudioChannelLayout.h"
#if !defined(__COREAUDIO_USE_FLAT_INCLUDES__)
@@ -60,11 +60,11 @@ CAAudioChannelLayout::CAAudioChannelLayout ()
// CAAudioChannelLayout::CAAudioChannelLayout
//=============================================================================
CAAudioChannelLayout::CAAudioChannelLayout (UInt32 inNumberChannels, bool inChooseSurround)
-{
+{
// this chooses default layouts based on the number of channels...
AudioChannelLayoutTag tag;
-
- switch (inNumberChannels)
+
+ switch (inNumberChannels)
{
default:
// here we have a "broken" layout, in the sense that we haven't any idea how to lay this out
@@ -93,7 +93,7 @@ CAAudioChannelLayout::CAAudioChannelLayout (UInt32 inNumberChannels, bool inChoo
tag = kAudioChannelLayoutTag_AudioUnit_8;
break;
}
-
+
mLayout = RefCountedLayout::CreateWithLayoutTag(tag);
}
@@ -144,11 +144,11 @@ CAAudioChannelLayout& CAAudioChannelLayout::operator= (const CAAudioChannelLayou
if (mLayout != c.mLayout) {
if (mLayout)
mLayout->release();
-
+
if ((mLayout = c.mLayout) != NULL)
mLayout->retain();
}
-
+
return *this;
}
@@ -156,11 +156,11 @@ CAAudioChannelLayout& CAAudioChannelLayout::operator= (const AudioChannelLayout*
{
if (mLayout && &mLayout->Layout() == inChannelLayout)
return *this;
-
+
if (mLayout)
mLayout->release();
- if (inChannelLayout == NULL)
+ if (inChannelLayout == NULL)
{
mLayout = RefCountedLayout::CreateWithNumberChannelDescriptions(0);
}
@@ -175,7 +175,7 @@ void CAAudioChannelLayout::SetWithTag(AudioChannelLayoutTag inTag)
{
if (mLayout)
mLayout->release();
-
+
mLayout = RefCountedLayout::CreateWithLayoutTag(inTag);
}
diff --git a/libs/appleutility/CoreAudio/PublicUtility/CAAudioFileFormats.cpp b/libs/appleutility/CoreAudio/PublicUtility/CAAudioFileFormats.cpp
index ce2efeae60..fce21ecb74 100644
--- a/libs/appleutility/CoreAudio/PublicUtility/CAAudioFileFormats.cpp
+++ b/libs/appleutility/CoreAudio/PublicUtility/CAAudioFileFormats.cpp
@@ -2,14 +2,14 @@
File: CAAudioFileFormats.cpp
Abstract: CAAudioFileFormats.h
Version: 1.1
-
+
Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple
Inc. ("Apple") in consideration of your agreement to the following
terms, and your use, installation, modification or redistribution of
this Apple software constitutes acceptance of these terms. If you do
not agree with these terms, please do not use, install, modify or
redistribute this Apple software.
-
+
In consideration of your agreement to abide by the following terms, and
subject to these terms, Apple grants you a personal, non-exclusive
license, under Apple's copyrights in this original Apple software (the
@@ -25,13 +25,13 @@
implied, are granted by Apple herein, including but not limited to any
patent rights that may be infringed by your derivative works or by other
works in which the Apple Software may be incorporated.
-
+
The Apple Software is provided by Apple on an "AS IS" basis. APPLE
MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND
OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
-
+
IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
@@ -40,9 +40,9 @@
AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),
STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
-
+
Copyright (C) 2014 Apple Inc. All Rights Reserved.
-
+
*/
#include "CAAudioFileFormats.h"
#include <algorithm>
@@ -62,26 +62,26 @@ class CompareFileFormatNames {
public:
bool operator() (const CAAudioFileFormats::FileFormatInfo &a, const CAAudioFileFormats::FileFormatInfo &b)
{
- return CFStringCompare(a.mFileTypeName, b.mFileTypeName,
+ return CFStringCompare(a.mFileTypeName, b.mFileTypeName,
kCFCompareCaseInsensitive | kCFCompareLocalized) == kCFCompareLessThan;
}
};*/
static int CompareFileFormatNames(const void *va, const void *vb)
{
- CAAudioFileFormats::FileFormatInfo *a = (CAAudioFileFormats::FileFormatInfo *)va,
+ CAAudioFileFormats::FileFormatInfo *a = (CAAudioFileFormats::FileFormatInfo *)va,
*b = (CAAudioFileFormats::FileFormatInfo *)vb;
- return CFStringCompare(a->mFileTypeName, b->mFileTypeName,
+ return CFStringCompare(a->mFileTypeName, b->mFileTypeName,
kCFCompareCaseInsensitive | kCFCompareLocalized);
}
-CAAudioFileFormats::CAAudioFileFormats(bool loadDataFormats) :
+CAAudioFileFormats::CAAudioFileFormats(bool loadDataFormats) :
mNumFileFormats(0), mFileFormats(NULL)
{
OSStatus err;
UInt32 size;
UInt32 *fileTypes = NULL;
-
+
// get all file types
err = AudioFileGetGlobalInfoSize(kAudioFileGlobalInfo_WritableTypes, 0, NULL, &size);
if (err != noErr) goto bail;
@@ -90,32 +90,32 @@ CAAudioFileFormats::CAAudioFileFormats(bool loadDataFormats) :
fileTypes = new UInt32[mNumFileFormats];
err = AudioFileGetGlobalInfo(kAudioFileGlobalInfo_WritableTypes, 0, NULL, &size, fileTypes);
if (err != noErr) goto bail;
-
+
// get info for each file type
for (int i = 0; i < mNumFileFormats; ++i) {
FileFormatInfo *ffi = &mFileFormats[i];
OSType filetype = fileTypes[i];
ffi->mFileTypeID = filetype;
-
+
// file type name
ffi->mFileTypeName = NULL;
size = sizeof(CFStringRef);
err = AudioFileGetGlobalInfo(kAudioFileGlobalInfo_FileTypeName, sizeof(UInt32), &filetype, &size, &ffi->mFileTypeName);
if (err == noErr && ffi->mFileTypeName)
CFRetain(ffi->mFileTypeName);
-
+
// file extensions
size = sizeof(CFArrayRef);
err = AudioFileGetGlobalInfo(kAudioFileGlobalInfo_ExtensionsForType,
sizeof(OSType), &filetype, &size, &ffi->mExtensions);
if (err)
ffi->mExtensions = NULL;
-
+
// file data formats
ffi->mNumDataFormats = 0;
ffi->mDataFormats = NULL;
-
+
if (loadDataFormats)
ffi->LoadDataFormats();
}
@@ -129,7 +129,7 @@ bail:
void CAAudioFileFormats::FileFormatInfo::LoadDataFormats()
{
if (mDataFormats != NULL) return;
-
+
UInt32 *writableFormats = NULL, *readableFormats = NULL;
int nWritableFormats, nReadableFormats;
// get all writable formats
@@ -140,7 +140,7 @@ void CAAudioFileFormats::FileFormatInfo::LoadDataFormats()
writableFormats = new UInt32[nWritableFormats];
err = AudioFormatGetProperty(kAudioFormatProperty_EncodeFormatIDs, 0, NULL, &size, writableFormats);
if (err != noErr) goto bail;
-
+
// get all readable formats
err = AudioFormatGetPropertyInfo(kAudioFormatProperty_DecodeFormatIDs, 0, NULL, &size);
if (err != noErr) goto bail;
@@ -148,7 +148,7 @@ void CAAudioFileFormats::FileFormatInfo::LoadDataFormats()
readableFormats = new UInt32[nReadableFormats];
err = AudioFormatGetProperty(kAudioFormatProperty_DecodeFormatIDs, 0, NULL, &size, readableFormats);
if (err != noErr) goto bail;
-
+
err = AudioFileGetGlobalInfoSize(kAudioFileGlobalInfo_AvailableFormatIDs, sizeof(UInt32), &mFileTypeID, &size);
if (err == noErr) {
mNumDataFormats = size / sizeof(OSType);
@@ -174,7 +174,7 @@ void CAAudioFileFormats::FileFormatInfo::LoadDataFormats()
dfi->mWritable = true;
break;
}
-
+
dfi->mNumVariants = 0;
AudioFileTypeAndFormatID tf = { mFileTypeID, dfi->mFormatID };
err = AudioFileGetGlobalInfoSize(kAudioFileGlobalInfo_AvailableStreamDescriptionsForFormat,
@@ -200,7 +200,7 @@ void CAAudioFileFormats::FileFormatInfo::LoadDataFormats()
}
}
}
-
+
dfi->mEitherEndianPCM = (anyBigEndian && anyLittleEndian);
}
}
@@ -280,7 +280,7 @@ bool CAAudioFileFormats::InferFileFormatFromFilename(const char *filename, Audio
return result;
}
-bool CAAudioFileFormats::InferFileFormatFromDataFormat(const CAStreamBasicDescription &fmt,
+bool CAAudioFileFormats::InferFileFormatFromDataFormat(const CAStreamBasicDescription &fmt,
AudioFileTypeID &filetype)
{
// if there's exactly one file format that supports this data format
diff --git a/libs/appleutility/CoreAudio/PublicUtility/CAAudioFileFormats.h b/libs/appleutility/CoreAudio/PublicUtility/CAAudioFileFormats.h
index 3d2f90f6de..1f99711d21 100644
--- a/libs/appleutility/CoreAudio/PublicUtility/CAAudioFileFormats.h
+++ b/libs/appleutility/CoreAudio/PublicUtility/CAAudioFileFormats.h
@@ -2,14 +2,14 @@
File: CAAudioFileFormats.h
Abstract: Part of CoreAudio Utility Classes
Version: 1.1
-
+
Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple
Inc. ("Apple") in consideration of your agreement to the following
terms, and your use, installation, modification or redistribution of
this Apple software constitutes acceptance of these terms. If you do
not agree with these terms, please do not use, install, modify or
redistribute this Apple software.
-
+
In consideration of your agreement to abide by the following terms, and
subject to these terms, Apple grants you a personal, non-exclusive
license, under Apple's copyrights in this original Apple software (the
@@ -25,13 +25,13 @@
implied, are granted by Apple herein, including but not limited to any
patent rights that may be infringed by your derivative works or by other
works in which the Apple Software may be incorporated.
-
+
The Apple Software is provided by Apple on an "AS IS" basis. APPLE
MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND
OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
-
+
IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
@@ -40,9 +40,9 @@
AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),
STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
-
+
Copyright (C) 2014 Apple Inc. All Rights Reserved.
-
+
*/
#ifndef __CAAudioFileFormats_h__
#define __CAAudioFileFormats_h__
@@ -61,7 +61,7 @@ public:
struct DataFormatInfo {
DataFormatInfo() : mVariants(NULL) { }
~DataFormatInfo() { delete[] mVariants; }
-
+
UInt32 mFormatID;
int mNumVariants;
AudioStreamBasicDescription * mVariants;
@@ -73,7 +73,7 @@ public:
void DebugPrint();
#endif
};
-
+
struct FileFormatInfo {
FileFormatInfo() : mFileTypeName(NULL), mExtensions(NULL), mDataFormats(NULL) { }
~FileFormatInfo() {
@@ -83,13 +83,13 @@ public:
if (mExtensions)
CFRelease(mExtensions);
}
-
+
AudioFileTypeID mFileTypeID;
CFStringRef mFileTypeName;
CFArrayRef mExtensions;
int mNumDataFormats;
DataFormatInfo * mDataFormats; // NULL until loaded!
-
+
int NumberOfExtensions() { return static_cast<int>(mExtensions ? CFArrayGetCount(mExtensions) : 0); }
char * GetExtension(int index, char *buf, int buflen) {
CFStringRef cfext = (CFStringRef)CFArrayGetValueAtIndex(mExtensions, index);
@@ -107,19 +107,19 @@ public:
}
bool AnyWritableFormats();
void LoadDataFormats();
-
+
#if DEBUG
void DebugPrint();
#endif
};
-
+
private: // use Instance()
CAAudioFileFormats(bool loadDataFormats);
~CAAudioFileFormats();
public:
-
+
bool InferDataFormatFromFileFormat(AudioFileTypeID filetype, CAStreamBasicDescription &fmt);
-
+
bool InferFileFormatFromFilename(const char *filename, AudioFileTypeID &filetype);
bool InferFileFormatFromFilename(CFStringRef filename, AudioFileTypeID &filetype);
@@ -127,19 +127,19 @@ public:
bool InferFileFormatFromDataFormat(const CAStreamBasicDescription &fmt, AudioFileTypeID &filetype);
bool IsKnownDataFormat(UInt32 dataFormat);
-
+
#if DEBUG
void DebugPrint();
#endif
int mNumFileFormats;
FileFormatInfo * mFileFormats;
-
+
FileFormatInfo * FindFileFormat(UInt32 formatID);
static CAAudioFileFormats * Instance(bool loadDataFormats=true);
-private:
+private:
static CAAudioFileFormats * sInstance;
};
diff --git a/libs/appleutility/CoreAudio/PublicUtility/CAAudioTimeStamp.cpp b/libs/appleutility/CoreAudio/PublicUtility/CAAudioTimeStamp.cpp
index 0200ec9b79..48e5ff4cb6 100644
--- a/libs/appleutility/CoreAudio/PublicUtility/CAAudioTimeStamp.cpp
+++ b/libs/appleutility/CoreAudio/PublicUtility/CAAudioTimeStamp.cpp
@@ -2,14 +2,14 @@
File: CAAudioTimeStamp.cpp
Abstract: CAAudioTimeStamp.h
Version: 1.1
-
+
Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple
Inc. ("Apple") in consideration of your agreement to the following
terms, and your use, installation, modification or redistribution of
this Apple software constitutes acceptance of these terms. If you do
not agree with these terms, please do not use, install, modify or
redistribute this Apple software.
-
+
In consideration of your agreement to abide by the following terms, and
subject to these terms, Apple grants you a personal, non-exclusive
license, under Apple's copyrights in this original Apple software (the
@@ -25,13 +25,13 @@
implied, are granted by Apple herein, including but not limited to any
patent rights that may be infringed by your derivative works or by other
works in which the Apple Software may be incorporated.
-
+
The Apple Software is provided by Apple on an "AS IS" basis. APPLE
MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND
OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
-
+
IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
@@ -40,9 +40,9 @@
AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),
STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
-
+
Copyright (C) 2014 Apple Inc. All Rights Reserved.
-
+
*/
//=============================================================================
// Includes
@@ -60,7 +60,7 @@ bool operator<(const AudioTimeStamp& x, const AudioTimeStamp& y)
{
bool isLessThan = false;
bool isDone = false;
-
+
// check the sample time
if(!isDone)
{
@@ -70,7 +70,7 @@ bool operator<(const AudioTimeStamp& x, const AudioTimeStamp& y)
isDone = true;
}
}
-
+
// check the host time
if(!isDone)
{
@@ -80,7 +80,7 @@ bool operator<(const AudioTimeStamp& x, const AudioTimeStamp& y)
isDone = true;
}
}
-
+
// check the word clock time
if(!isDone)
{
@@ -91,7 +91,7 @@ bool operator<(const AudioTimeStamp& x, const AudioTimeStamp& y)
//isDone = true;
}
}
-
+
return isLessThan;
}
@@ -99,7 +99,7 @@ bool operator==(const AudioTimeStamp& x, const AudioTimeStamp& y)
{
bool isEqual = false;
bool isDone = false;
-
+
// check the sample time
if(!isDone)
{
@@ -109,7 +109,7 @@ bool operator==(const AudioTimeStamp& x, const AudioTimeStamp& y)
isDone = true;
}
}
-
+
// check the host time
if(!isDone)
{
@@ -119,7 +119,7 @@ bool operator==(const AudioTimeStamp& x, const AudioTimeStamp& y)
isDone = true;
}
}
-
+
// check the word clock time
if(!isDone)
{
@@ -130,6 +130,6 @@ bool operator==(const AudioTimeStamp& x, const AudioTimeStamp& y)
//isDone = true;
}
}
-
+
return isEqual;
}
diff --git a/libs/appleutility/CoreAudio/PublicUtility/CAAudioTimeStamp.h b/libs/appleutility/CoreAudio/PublicUtility/CAAudioTimeStamp.h
index 9b8d6abe41..e7d3b11665 100644
--- a/libs/appleutility/CoreAudio/PublicUtility/CAAudioTimeStamp.h
+++ b/libs/appleutility/CoreAudio/PublicUtility/CAAudioTimeStamp.h
@@ -2,14 +2,14 @@
File: CAAudioTimeStamp.h
Abstract: Part of CoreAudio Utility Classes
Version: 1.1
-
+
Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple
Inc. ("Apple") in consideration of your agreement to the following
terms, and your use, installation, modification or redistribution of
this Apple software constitutes acceptance of these terms. If you do
not agree with these terms, please do not use, install, modify or
redistribute this Apple software.
-
+
In consideration of your agreement to abide by the following terms, and
subject to these terms, Apple grants you a personal, non-exclusive
license, under Apple's copyrights in this original Apple software (the
@@ -25,13 +25,13 @@
implied, are granted by Apple herein, including but not limited to any
patent rights that may be infringed by your derivative works or by other
works in which the Apple Software may be incorporated.
-
+
The Apple Software is provided by Apple on an "AS IS" basis. APPLE
MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND
OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
-
+
IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
@@ -40,9 +40,9 @@
AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),
STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
-
+
Copyright (C) 2014 Apple Inc. All Rights Reserved.
-
+
*/
#if !defined(__CAAudioTimeStamp_h__)
#define __CAAudioTimeStamp_h__
diff --git a/libs/appleutility/CoreAudio/PublicUtility/CAAudioUnit.cpp b/libs/appleutility/CoreAudio/PublicUtility/CAAudioUnit.cpp
index 53da5a1cc6..cfa02977e0 100644
--- a/libs/appleutility/CoreAudio/PublicUtility/CAAudioUnit.cpp
+++ b/libs/appleutility/CoreAudio/PublicUtility/CAAudioUnit.cpp
@@ -2,14 +2,14 @@
File: CAAudioUnit.cpp
Abstract: CAAudioUnit.h
Version: 1.1
-
+
Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple
Inc. ("Apple") in consideration of your agreement to the following
terms, and your use, installation, modification or redistribution of
this Apple software constitutes acceptance of these terms. If you do
not agree with these terms, please do not use, install, modify or
redistribute this Apple software.
-
+
In consideration of your agreement to abide by the following terms, and
subject to these terms, Apple grants you a personal, non-exclusive
license, under Apple's copyrights in this original Apple software (the
@@ -25,13 +25,13 @@
implied, are granted by Apple herein, including but not limited to any
patent rights that may be infringed by your derivative works or by other
works in which the Apple Software may be incorporated.
-
+
The Apple Software is provided by Apple on an "AS IS" basis. APPLE
MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND
OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
-
+
IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
@@ -40,9 +40,9 @@
AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),
STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
-
+
Copyright (C) 2014 Apple Inc. All Rights Reserved.
-
+
*/
#include "CAAudioUnit.h"
@@ -62,7 +62,7 @@
struct StackAUChannelInfo {
StackAUChannelInfo (UInt32 inSize) : mChanInfo ((AUChannelInfo*)malloc (inSize)) {}
~StackAUChannelInfo() { free (mChanInfo); }
-
+
AUChannelInfo* mChanInfo;
};
@@ -81,21 +81,21 @@ class CAAudioUnit::AUState : public CAReferenceCounted {
public:
AUState (AudioComponent inComp)
: mUnit(0), mNode (0)
- {
- OSStatus result = ::AudioComponentInstanceNew (inComp, &mUnit);
+ {
+ OSStatus result = ::AudioComponentInstanceNew (inComp, &mUnit);
if (result)
throw result;
Init();
}
AUState (const AUNode &inNode, const AudioUnit& inUnit)
- : mUnit (inUnit), mNode (inNode)
+ : mUnit (inUnit), mNode (inNode)
{
Init();
}
-
+
~AUState();
-
+
AudioUnit mUnit;
AUNode mNode;
@@ -105,7 +105,7 @@ public:
#if CA_AU_USE_FAST_DISPATCH
if (mGetParamProc != NULL) {
return (mGetParamProc) (mConnInstanceStorage, inID, scope, element, &outValue);
- }
+ }
#endif
return AudioUnitGetParameter(mUnit, inID, scope, element, &outValue);
}
@@ -116,11 +116,11 @@ public:
#if CA_AU_USE_FAST_DISPATCH
if (mSetParamProc != NULL) {
return (mSetParamProc) (mConnInstanceStorage, inID, scope, element, value, bufferOffsetFrames);
- }
+ }
#endif
return AudioUnitSetParameter(mUnit, inID, scope, element, value, bufferOffsetFrames);
}
-
+
OSStatus Render (AudioUnitRenderActionFlags * ioActionFlags,
const AudioTimeStamp * inTimeStamp,
UInt32 inOutputBusNumber,
@@ -130,11 +130,11 @@ public:
#if CA_AU_USE_FAST_DISPATCH
if (mRenderProc != NULL) {
return (mRenderProc) (mConnInstanceStorage, ioActionFlags, inTimeStamp, inOutputBusNumber, inNumberFrames, ioData);
- }
+ }
#endif
return AudioUnitRender(mUnit, ioActionFlags, inTimeStamp, inOutputBusNumber, inNumberFrames, ioData);
}
-
+
OSStatus MIDIEvent (UInt32 inStatus,
UInt32 inData1,
UInt32 inData2,
@@ -187,7 +187,7 @@ public:
private:
// get the fast dispatch pointers
- void Init()
+ void Init()
{
#if CA_AU_USE_FAST_DISPATCH
UInt32 size = sizeof(AudioUnitRenderProc);
@@ -195,13 +195,13 @@ private:
kAudioUnitScope_Global, kAudioUnitRenderSelect,
&mRenderProc, &size) != noErr)
mRenderProc = NULL;
-
+
size = sizeof(AudioUnitGetParameterProc);
if (AudioUnitGetProperty(mUnit, kAudioUnitProperty_FastDispatch,
kAudioUnitScope_Global, kAudioUnitGetParameterSelect,
&mGetParamProc, &size) != noErr)
mGetParamProc = NULL;
-
+
size = sizeof(AudioUnitSetParameterProc);
if (AudioUnitGetProperty(mUnit, kAudioUnitProperty_FastDispatch,
kAudioUnitScope_Global, kAudioUnitSetParameterSelect,
@@ -225,7 +225,7 @@ private:
kAudioUnitScope_Global, kMusicDeviceStopNoteSelect,
&mStopNoteProc, &size) != noErr)
mStopNoteProc = NULL;
-
+
if (mRenderProc || mGetParamProc || mSetParamProc || mMIDIEventProc || mStartNoteProc || mStopNoteProc) {
mConnInstanceStorage = LoadGetComponentInstanceStorage ( mUnit );
} else
@@ -234,10 +234,10 @@ private:
mConnInstanceStorage = NULL;
#endif
}
-
+
#if CA_AU_USE_FAST_DISPATCH
AudioUnitRenderProc mRenderProc;
- AudioUnitGetParameterProc mGetParamProc;
+ AudioUnitGetParameterProc mGetParamProc;
AudioUnitSetParameterProc mSetParamProc;
MusicDeviceMIDIEventProc mMIDIEventProc;
MusicDeviceStartNoteProc mStartNoteProc;
@@ -251,9 +251,9 @@ private:
AUState () {}
AUState (const AUState&);
AUState& operator= (const AUState&);
-};
-
-
+};
+
+
CAAudioUnit::AUState::~AUState ()
{
if (mUnit && (mNode == 0)) {
@@ -266,7 +266,7 @@ CAAudioUnit::AUState::~AUState ()
OSStatus CAAudioUnit::Open (const CAComponent& inComp, CAAudioUnit &outUnit)
{
try {
- outUnit = inComp;
+ outUnit = inComp;
return noErr;
} catch (OSStatus res) {
return res;
@@ -286,7 +286,7 @@ CAAudioUnit::CAAudioUnit (const CAComponent& inComp)
}
CAAudioUnit::CAAudioUnit (const AUNode &inNode, const AudioUnit& inUnit)
- : mComp (inUnit), mDataPtr(new AUState (inNode, inUnit))
+ : mComp (inUnit), mDataPtr(new AUState (inNode, inUnit))
{
}
@@ -308,13 +308,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;
}
@@ -338,36 +338,36 @@ OSStatus CAAudioUnit::RemovePropertyListener (AudioUnitPropertyID inID,
{
// we call this first. If it fails we call the old API as the failure can
// mean that the AU doesn't implement that selector.
- OSStatus result = AudioUnitRemovePropertyListenerWithUserData(AU(), inID,
+ OSStatus result = AudioUnitRemovePropertyListenerWithUserData(AU(), inID,
inProc, inProcUserData);
#if !__LP64__ && !TARGET_OS_IPHONE
if (result) result = AudioUnitRemovePropertyListener (AU(), inID, inProc);
- #endif
+ #endif
return result;
-}
+}
-#pragma mark __State Management
+#pragma mark __State Management
-bool CAAudioUnit::IsValid () const
-{
- return mDataPtr ? mDataPtr->mUnit != 0 : false;
+bool CAAudioUnit::IsValid () const
+{
+ return mDataPtr ? mDataPtr->mUnit != 0 : false;
}
-
-AudioUnit CAAudioUnit::AU() const
-{
- return mDataPtr ? mDataPtr->mUnit : 0;
+
+AudioUnit CAAudioUnit::AU() const
+{
+ return mDataPtr ? mDataPtr->mUnit : 0;
}
AUNode CAAudioUnit::GetAUNode () const
{
- return mDataPtr ? mDataPtr->mNode : 0;
+ return mDataPtr ? mDataPtr->mNode : 0;
}
#pragma mark __Format Handling
-
-bool CAAudioUnit::CanDo ( int inChannelsIn,
+
+bool CAAudioUnit::CanDo ( int inChannelsIn,
int inChannelsOut) const
-{
+{
// this is the default assumption of an audio effect unit
Boolean* isWritable = 0;
UInt32 dataSize = 0;
@@ -376,31 +376,31 @@ 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)
+ if (result)
{
if ((Comp().Desc().IsEffect() && inChannelsIn == inChannelsOut)
|| (Comp().Desc().IsOffline() && inChannelsIn == inChannelsOut))
{
return true;
}
- else
+ else
{
// the au should either really tell us about this
// or we will assume the worst
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)));
}
@@ -414,10 +414,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())
@@ -430,16 +430,16 @@ int CAAudioUnit::GetChannelInfo (AUChannelInfo** chaninfo, UInt32& cnt)
// (eg. Kick, Snare,.. on a Drummachine)
// eventually the Bus-Name for each configuration should be exposed
// for the User to select..
-
+
UInt32 elCountIn, elCountOut;
-
+
if (GetElementCount (kAudioUnitScope_Input, elCountIn)) return -1;
if (GetElementCount (kAudioUnitScope_Output, elCountOut)) return -1;
-
+
cnt = std::max(elCountIn, elCountOut);
-
+
*chaninfo = (AUChannelInfo*) malloc (sizeof (AUChannelInfo) * cnt);
-
+
for (unsigned int i = 0; i < elCountIn; ++i) {
UInt32 numChans;
if (NumberChannels (kAudioUnitScope_Input, i, numChans)) return -1;
@@ -448,7 +448,7 @@ int CAAudioUnit::GetChannelInfo (AUChannelInfo** chaninfo, UInt32& cnt)
for (unsigned int i = elCountIn; i < cnt; ++i) {
(*chaninfo)[i].inChannels = 0;
}
-
+
for (unsigned int i = 0; i < elCountOut; ++i) {
UInt32 numChans;
if (NumberChannels (kAudioUnitScope_Output, i, numChans)) return -1;
@@ -459,26 +459,26 @@ int CAAudioUnit::GetChannelInfo (AUChannelInfo** chaninfo, UInt32& cnt)
}
return 0;
}
- else
+ else
{
// the au should either really tell us about this
// or we will assume the worst
return -1;
}
}
-
+
*chaninfo = (AUChannelInfo*) malloc (dataSize);
cnt = dataSize / sizeof (AUChannelInfo);
-
+
result = GetProperty (kAudioUnitProperty_SupportedNumChannels,
kAudioUnitScope_Global, 0,
*chaninfo, &dataSize);
-
+
if (result) { return -1; }
return 0;
}
-bool CAAudioUnit::ValidateChannelPair (int inChannelsIn,
+bool CAAudioUnit::ValidateChannelPair (int inChannelsIn,
int inChannelsOut,
const AUChannelInfo * info,
UInt32 numChanInfo) const
@@ -490,8 +490,8 @@ bool CAAudioUnit::ValidateChannelPair (int inChannelsIn,
-1 wild card:
-1,-1 any num channels as long as same channels on in and out
-1,-2 any num channels channels on in and out - special meaning
--2+ indicates total num channs AU can handle
- - elements configurable to any num channels,
+-2+ indicates total num channs AU can handle
+ - elements configurable to any num channels,
- element count in scope must be writable
*/
@@ -510,7 +510,7 @@ bool CAAudioUnit::ValidateChannelPair (int inChannelsIn,
return true; // if one of these is zero, then a -1 means any
}
else if ((info[i].inChannels == -1 && info[i].outChannels == -2)
- || (info[i].inChannels == -2 && info[i].outChannels == -1))
+ || (info[i].inChannels == -2 && info[i].outChannels == -1))
{
return true;
}
@@ -522,22 +522,22 @@ bool CAAudioUnit::ValidateChannelPair (int inChannelsIn,
IsElementCountWritable (kAudioUnitScope_Input, inWrite);
if (inWrite && outWrite) {
if ((inChannelsOut <= abs(info[i].outChannels))
- && (inChannelsIn <= abs(info[i].inChannels)))
+ && (inChannelsIn <= abs(info[i].inChannels)))
{
return true;
}
}
}
}
-
+
// special meaning on input, specific num on output
else if (info[i].inChannels < 0) {
- if (info[i].outChannels == inChannelsOut)
+ if (info[i].outChannels == inChannelsOut)
{
// can do any in channels
if (info[i].inChannels == -1) {
return true;
- }
+ }
// total chans on input
else {
bool inWrite = false;
@@ -548,15 +548,15 @@ bool CAAudioUnit::ValidateChannelPair (int inChannelsIn,
}
}
}
-
+
// special meaning on output, specific num on input
else if (info[i].outChannels < 0) {
- if (info[i].inChannels == inChannelsIn)
+ if (info[i].inChannels == inChannelsIn)
{
// can do any out channels
if (info[i].outChannels == -1) {
return true;
- }
+ }
// total chans on output
else {
bool outWrite = false;
@@ -571,9 +571,9 @@ bool CAAudioUnit::ValidateChannelPair (int inChannelsIn,
// both chans in struct >= 0 - thus has to explicitly match
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
+ }
+
+ // 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) {
if (info[i].outChannels == inChannelsOut) {
@@ -586,7 +586,7 @@ bool CAAudioUnit::ValidateChannelPair (int inChannelsIn,
}
}
}
-
+
return false;
}
@@ -599,9 +599,9 @@ bool CheckDynCount (SInt32 inTotalChans, const CAAUChanHelper &inHelper)
return (totalChans <= inTotalChans);
}
-bool CAAudioUnit::CheckOneSide (const CAAUChanHelper &inHelper,
- bool checkOutput,
- const AUChannelInfo *info,
+bool CAAudioUnit::CheckOneSide (const CAAUChanHelper &inHelper,
+ bool checkOutput,
+ const AUChannelInfo *info,
UInt32 numInfo) const
{
// now we can use the wildcard option (see above impl) to see if this matches
@@ -624,25 +624,25 @@ bool CAAudioUnit::CheckOneSide (const CAAUChanHelper &inHelper,
return true;
}
-bool CAAudioUnit::CanDo (const CAAUChanHelper &inputs,
+bool CAAudioUnit::CanDo (const CAAUChanHelper &inputs,
const CAAUChanHelper &outputs) const
{
// 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,
- kAudioUnitScope_Global, 0, &dataSize, NULL) != noErr)
+ kAudioUnitScope_Global, 0, &dataSize, NULL) != noErr)
{
if (Comp().Desc().IsEffect() || Comp().Desc().IsOffline()) {
UInt32 numChan = outputs.mNumEls > 0 ? outputs.mChans[0] : inputs.mChans[0];
@@ -652,7 +652,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) {
@@ -667,22 +667,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;
+ {
+ 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)) {
@@ -706,7 +706,7 @@ bool CAAudioUnit::CanDo (const CAAUChanHelper &inputs,
}
// (4) - not a dynamic AU, has ins and outs, and has channel constraints so we test every possible pairing
- for (unsigned int in = 0; in < inputs.mNumEls; ++in)
+ for (unsigned int in = 0; in < inputs.mNumEls; ++in)
{
bool testInAlready = false;
for (unsigned int i = 0; i < in; ++i) {
@@ -733,7 +733,7 @@ bool CAAudioUnit::CanDo (const CAAUChanHelper &inputs,
}
}
}
-
+
return true;
}
@@ -747,7 +747,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) {
@@ -761,7 +761,7 @@ OSStatus CAAudioUnit::GetChannelLayoutTags (AudioUnitScope inScope,
AudioUnitElement inEl,
ChannelTagVector &outChannelVector) const
{
- if (HasChannelLayouts (inScope, inEl) == false) return kAudioUnitErr_InvalidProperty;
+ if (HasChannelLayouts (inScope, inEl) == false) return kAudioUnitErr_InvalidProperty;
UInt32 dataSize;
OSStatus result = AudioUnitGetPropertyInfo (AU(),
@@ -770,7 +770,7 @@ OSStatus CAAudioUnit::GetChannelLayoutTags (AudioUnitScope inScope,
&dataSize, NULL);
if (result) return result;
-
+
// OK lets get our channel layouts and see if the one we want is present
AudioChannelLayoutTag* info = (AudioChannelLayoutTag*)malloc (dataSize);
result = AudioUnitGetProperty (AU(),
@@ -778,7 +778,7 @@ OSStatus CAAudioUnit::GetChannelLayoutTags (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]);
@@ -788,7 +788,7 @@ home:
return result;
}
-bool CAAudioUnit::HasChannelLayouts (AudioUnitScope inScope,
+bool CAAudioUnit::HasChannelLayouts (AudioUnitScope inScope,
AudioUnitElement inEl) const
{
OSStatus result = AudioUnitGetPropertyInfo (AU(),
@@ -798,17 +798,17 @@ bool CAAudioUnit::HasChannelLayouts (AudioUnitScope inScope,
return !result;
}
-bool CAAudioUnit::HasChannelLayout (AudioUnitScope inScope,
+bool CAAudioUnit::HasChannelLayout (AudioUnitScope inScope,
AudioUnitElement inEl) const
{
Boolean writable;
UInt32 size;
-
+
return AudioUnitGetPropertyInfo (AU(),
kAudioUnitProperty_AudioChannelLayout,
inScope, inEl,
&size, &writable) == noErr;
-}
+}
OSStatus CAAudioUnit::GetChannelLayout (AudioUnitScope inScope,
AudioUnitElement inEl,
@@ -818,14 +818,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);
ca_require_noerr (result = AudioUnitGetProperty (AU(), kAudioUnitProperty_AudioChannelLayout,
inScope, inEl, layout, &size), home);
outLayout = CAAudioChannelLayout (layout);
-
+
home:
free (layout);
return result;
@@ -842,7 +842,7 @@ OSStatus CAAudioUnit::SetChannelLayout (AudioUnitScope inScope,
return result;
}
-OSStatus CAAudioUnit::SetChannelLayout (AudioUnitScope inScope,
+OSStatus CAAudioUnit::SetChannelLayout (AudioUnitScope inScope,
AudioUnitElement inEl,
const AudioChannelLayout &inLayout,
UInt32 inSize)
@@ -868,7 +868,7 @@ OSStatus CAAudioUnit::GetFormat (AudioUnitScope inScope,
{
UInt32 dataSize = sizeof (AudioStreamBasicDescription);
return AudioUnitGetProperty (AU(), kAudioUnitProperty_StreamFormat,
- inScope, inEl,
+ inScope, inEl,
&outFormat, &dataSize);
}
@@ -878,7 +878,7 @@ OSStatus CAAudioUnit::SetFormat (AudioUnitScope inScope,
{
return AudioUnitSetProperty (AU(), kAudioUnitProperty_StreamFormat,
inScope, inEl,
- const_cast<AudioStreamBasicDescription*>(&inFormat),
+ const_cast<AudioStreamBasicDescription*>(&inFormat),
sizeof (AudioStreamBasicDescription));
}
@@ -888,7 +888,7 @@ OSStatus CAAudioUnit::GetSampleRate (AudioUnitScope inScope,
{
UInt32 dataSize = sizeof (Float64);
return AudioUnitGetProperty (AU(), kAudioUnitProperty_SampleRate,
- inScope, inEl,
+ inScope, inEl,
&outRate, &dataSize);
}
@@ -906,7 +906,7 @@ OSStatus CAAudioUnit::SetSampleRate (AudioUnitScope inScope,
OSStatus CAAudioUnit::SetSampleRate (Float64 inSampleRate)
{
OSStatus result;
-
+
UInt32 elCount;
ca_require_noerr (result = GetElementCount(kAudioUnitScope_Input, elCount), home);
if (elCount) {
@@ -921,7 +921,7 @@ OSStatus CAAudioUnit::SetSampleRate (Float64 inSampleRate)
ca_require_noerr (result = SetSampleRate (kAudioUnitScope_Output, i, inSampleRate), home);
}
}
-
+
home:
return result;
}
@@ -958,7 +958,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
@@ -981,12 +981,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);
@@ -1003,9 +1003,9 @@ bool CAAudioUnit::HasDynamicScope (AudioUnitScope inScope, SInt32 &outTotalNum
-N (where N is less than -2), signifies the total channel count on the scope side (in or out)
*/
-bool CAAudioUnit::ValidateDynamicScope (AudioUnitScope inScope,
- SInt32 &outTotalNumChannels,
- const AUChannelInfo *info,
+bool CAAudioUnit::ValidateDynamicScope (AudioUnitScope inScope,
+ SInt32 &outTotalNumChannels,
+ const AUChannelInfo *info,
UInt32 numInfo) const
{
bool writable = false;
@@ -1024,48 +1024,48 @@ 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,
- UInt32 inNumElements,
- UInt32 *inChannelsPerElement,
+OSStatus CAAudioUnit::ConfigureDynamicScope (AudioUnitScope inScope,
+ UInt32 inNumElements,
+ UInt32 *inChannelsPerElement,
Float64 inSampleRate)
{
SInt32 numChannels = 0;
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) {
@@ -1075,11 +1075,11 @@ OSStatus CAAudioUnit::ConfigureDynamicScope (AudioUnitScope inScope,
if (count > numChannels)
return kAudioUnitErr_InvalidPropertyValue;
}
-
+
OSStatus result = SetElementCount (inScope, inNumElements);
if (result)
return result;
-
+
for (unsigned int i = 0; i < inNumElements; ++i) {
CAStreamBasicDescription desc;
result = GetFormat (inScope, i, desc);
@@ -1115,7 +1115,7 @@ bool CAAudioUnit::GetBypass () const
}
OSStatus CAAudioUnit::SetBypass (bool inBypass) const
-{
+{
UInt32 bypass = inBypass ? 1 : 0;
return AudioUnitSetProperty (AU(), kAudioUnitProperty_BypassEffect,
kAudioUnitScope_Global, 0,
@@ -1134,7 +1134,7 @@ OSStatus CAAudioUnit::SetMaxFramesPerSlice (UInt32 inMaxFrames)
{
return AudioUnitSetProperty (AU(), kAudioUnitProperty_MaximumFramesPerSlice,
kAudioUnitScope_Global, 0,
- &inMaxFrames, sizeof (UInt32));
+ &inMaxFrames, sizeof (UInt32));
}
Float64 CAAudioUnit::Latency () const
@@ -1177,7 +1177,7 @@ OSStatus CAAudioUnit::GetPresentPreset (AUPreset &outData) const
kAudioUnitScope_Global, 0,
&outData, &dataSize);
#if !TARGET_OS_IPHONE
-#ifndef __LP64__
+#ifndef __LP64__
if (result == kAudioUnitErr_InvalidProperty) {
dataSize = sizeof(outData);
result = AudioUnitGetProperty (AU(), kAudioUnitProperty_CurrentPreset,
@@ -1194,7 +1194,7 @@ OSStatus CAAudioUnit::GetPresentPreset (AUPreset &outData) const
#endif
return result;
}
-
+
OSStatus CAAudioUnit::SetPresentPreset (AUPreset &inData)
{
OSStatus result = AudioUnitSetProperty (AU(), kAudioUnitProperty_PresentPreset,
@@ -1220,7 +1220,7 @@ bool CAAudioUnit::HasCustomView () const
#ifndef __LP64__
result = GetPropertyInfo(kAudioUnitProperty_GetUIComponentList,
kAudioUnitScope_Global, 0,
- &dataSize, NULL);
+ &dataSize, NULL);
#endif
if (result || !dataSize) {
dataSize = 0;
@@ -1263,7 +1263,7 @@ OSStatus CAAudioUnit::StartNote (MusicDeviceInstrumentID inInstrument,
UInt32 inOffsetSampleFrame,
const MusicDeviceNoteParams * inParams)
{
- return mDataPtr ? mDataPtr->StartNote (inInstrument, inGroupID, outNoteInstanceID, inOffsetSampleFrame, inParams)
+ return mDataPtr ? mDataPtr->StartNote (inInstrument, inGroupID, outNoteInstanceID, inOffsetSampleFrame, inParams)
: paramErr;
}
@@ -1287,10 +1287,10 @@ OSStatus CAAudioUnit::Render (AudioUnitRenderActionFlags * ioActionFlags,
}
extern "C" OSStatus
-AudioUnitProcess ( AudioUnit inUnit,
- AudioUnitRenderActionFlags * ioActionFlags,
- const AudioTimeStamp * inTimeStamp,
- UInt32 inNumberFrames,
+AudioUnitProcess ( AudioUnit inUnit,
+ AudioUnitRenderActionFlags * ioActionFlags,
+ const AudioTimeStamp * inTimeStamp,
+ UInt32 inNumberFrames,
AudioBufferList * ioData);
OSStatus CAAudioUnit::Process (AudioUnitRenderActionFlags & ioActionFlags,
@@ -1306,9 +1306,9 @@ OSStatus CAAudioUnit::Process (AudioUnitRenderActionFlags & ioActionFlags,
}
extern "C" OSStatus
-AudioUnitProcessMultiple ( AudioUnit inUnit,
- AudioUnitRenderActionFlags * ioActionFlags,
- const AudioTimeStamp * inTimeStamp,
+AudioUnitProcessMultiple ( AudioUnit inUnit,
+ AudioUnitRenderActionFlags * ioActionFlags,
+ const AudioTimeStamp * inTimeStamp,
UInt32 inNumberFrames,
UInt32 inNumberInputBufferLists,
const AudioBufferList ** inInputBufferLists,
@@ -1324,7 +1324,7 @@ OSStatus CAAudioUnit::ProcessMultiple (AudioUnitRenderActionFlags & ioActionFl
AudioBufferList ** ioOutputBufferLists)
{
#if defined(__MAC_10_7) || defined(__IPHONE_4_0)
- return AudioUnitProcessMultiple (AU(), &ioActionFlags, &inTimeStamp, inNumberFrames,
+ return AudioUnitProcessMultiple (AU(), &ioActionFlags, &inTimeStamp, inNumberFrames,
inNumberInputBufferLists, inInputBufferLists, inNumberOutputBufferLists, ioOutputBufferLists);
#else
return -4/*unimpErr*/;
@@ -1354,8 +1354,8 @@ CAAUChanHelper::CAAUChanHelper(const CAAudioUnit &inAU, AudioUnitScope inScope)
mNumEls = elCount;
}
-CAAUChanHelper::CAAUChanHelper(UInt32 inMaxElems)
- : mNumEls(inMaxElems), mDidAllocate(false)
+CAAUChanHelper::CAAUChanHelper(UInt32 inMaxElems)
+ : mNumEls(inMaxElems), mDidAllocate(false)
{
if (inMaxElems > kStaticElCount) {
mChans = new UInt32[inMaxElems];
@@ -1372,8 +1372,8 @@ CAAUChanHelper::~CAAUChanHelper()
if (mDidAllocate) delete [] mChans;
}
-CAAUChanHelper& CAAUChanHelper::operator= (const CAAUChanHelper &c)
-{
+CAAUChanHelper& CAAUChanHelper::operator= (const CAAUChanHelper &c)
+{
if (mDidAllocate) delete [] mChans;
if (c.mDidAllocate) {
mChans = new UInt32[c.mNumEls];
@@ -1383,8 +1383,8 @@ CAAUChanHelper& CAAUChanHelper::operator= (const CAAUChanHelper &c)
mChans = mStaticChans;
}
memcpy (mChans, c.mChans, c.mNumEls * sizeof(int));
-
- return *this;
+
+ return *this;
}
@@ -1393,7 +1393,7 @@ CAAUChanHelper& CAAUChanHelper::operator= (const CAAUChanHelper &c)
void CAAudioUnit::Print (FILE* file) const
{
fprintf (file, "AudioUnit:%p\n", AU());
- if (IsValid()) {
+ if (IsValid()) {
fprintf (file, "\tnode=%ld\t", (long)GetAUNode()); Comp().Print (file);
}
}
@@ -1404,13 +1404,13 @@ static void *LoadGetComponentInstanceStorage (void *inst)
{
typedef void* (*GetComponentInstanceStorageProc)(void* aComponentInstance);
static GetComponentInstanceStorageProc sGetComponentInstanceStorageProc = NULL;
-
+
static int sDoCSLoad = 1;
if (sDoCSLoad) {
sDoCSLoad = 0;
void *theImage = dlopen("/System/Library/Frameworks/CoreServices.framework/CoreServices", RTLD_LAZY);
if (!theImage) return NULL;
-
+
sGetComponentInstanceStorageProc = (GetComponentInstanceStorageProc) dlsym(theImage, "GetComponentInstanceStorage");
}
if (sGetComponentInstanceStorageProc)
diff --git a/libs/appleutility/CoreAudio/PublicUtility/CAAudioUnit.h b/libs/appleutility/CoreAudio/PublicUtility/CAAudioUnit.h
index 07a522e912..d06a20cc6b 100644
--- a/libs/appleutility/CoreAudio/PublicUtility/CAAudioUnit.h
+++ b/libs/appleutility/CoreAudio/PublicUtility/CAAudioUnit.h
@@ -2,14 +2,14 @@
File: CAAudioUnit.h
Abstract: Part of CoreAudio Utility Classes
Version: 1.1
-
+
Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple
Inc. ("Apple") in consideration of your agreement to the following
terms, and your use, installation, modification or redistribution of
this Apple software constitutes acceptance of these terms. If you do
not agree with these terms, please do not use, install, modify or
redistribute this Apple software.
-
+
In consideration of your agreement to abide by the following terms, and
subject to these terms, Apple grants you a personal, non-exclusive
license, under Apple's copyrights in this original Apple software (the
@@ -25,13 +25,13 @@
implied, are granted by Apple herein, including but not limited to any
patent rights that may be infringed by your derivative works or by other
works in which the Apple Software may be incorporated.
-
+
The Apple Software is provided by Apple on an "AS IS" basis. APPLE
MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND
OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
-
+
IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
@@ -40,9 +40,9 @@
AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),
STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
-
+
Copyright (C) 2014 Apple Inc. All Rights Reserved.
-
+
*/
#ifndef __CAAudioUnit_h__
#define __CAAudioUnit_h__
@@ -73,7 +73,7 @@ class CAAUChanHelper;
// The destructor will NOT automatically close the AU down
// This state should be managed by the Caller
// once closed, the unit represented by this object is no longer valid
-// it is up to the user of this object to ensure its validity is in sync
+// it is up to the user of this object to ensure its validity is in sync
// if it is removed from a graph
// methods that can significantly change the state of the AU (like its format) are
@@ -89,7 +89,7 @@ public:
typedef ChannelTagVector::iterator ChannelTagVectorIter;
public:
- CAAudioUnit ()
+ CAAudioUnit ()
: mDataPtr(0) {}
CAAudioUnit (const AudioUnit& inUnit);
@@ -105,28 +105,28 @@ public:
void Close ();
-
+
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; }
-
+
const CAComponentDescription& Desc() const { return mComp.Desc(); }
-
+
bool FromAUGraph () const { return GetAUNode() != 0 && GetAUNode() != kCAAU_DoNotKnowIfAUNode; }
-
+
AUNode GetAUNode () const;
operator AUNode () const { return GetAUNode(); }
-
+
#pragma mark __API Wrapper
OSStatus Initialize() const {
return AudioUnitInitialize(AU());
@@ -151,7 +151,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;
@@ -165,7 +165,7 @@ public:
const AudioTimeStamp & inTimeStamp,
UInt32 inNumberFrames,
AudioBufferList & ioData);
-
+
OSStatus ProcessMultiple (AudioUnitRenderActionFlags & ioActionFlags,
const AudioTimeStamp & inTimeStamp,
UInt32 inNumberFrames,
@@ -174,7 +174,7 @@ public:
UInt32 inNumberOutputBufferLists,
AudioBufferList ** ioOutputBufferLists);
-
+
OSStatus Reset (AudioUnitScope scope, AudioUnitElement element)
{
return AudioUnitReset (AU(), scope, element);
@@ -188,7 +188,7 @@ public:
{
return AudioUnitAddRenderNotify (AU(), inProc, inProcRefCon);
}
-
+
OSStatus RemoveRenderNotify (AURenderCallback inProc, void *inProcRefCon)
{
return AudioUnitRemoveRenderNotify (AU(), inProc, inProcRefCon);
@@ -200,24 +200,24 @@ public:
{
return AudioUnitAddPropertyListener (AU(), inID, inProc, inProcRefCon);
}
-
+
OSStatus RemovePropertyListener (AudioUnitPropertyID inID,
AudioUnitPropertyListenerProc inProc,
void * inProcUserData);
-
+
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,
UInt32 inOffsetSampleFrame,
const MusicDeviceNoteParams * inParams)
{
- return StartNote (kMusicNoteEvent_UseGroupInstrument,
- inGroupID, outNoteInstanceID,
+ return StartNote (kMusicNoteEvent_UseGroupInstrument,
+ inGroupID, outNoteInstanceID,
inOffsetSampleFrame, inParams);
}
@@ -241,45 +241,45 @@ public:
{
return CanDo (inChannelsInOut, inChannelsInOut);
}
-
- bool CanDo ( int inChannelsIn,
+
+ 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,
+ bool HasChannelLayouts (AudioUnitScope inScope,
AudioUnitElement inEl) const;
-
+
int GetChannelInfo (AUChannelInfo** chaninfo, UInt32& cnt);
OSStatus GetChannelLayoutTags (AudioUnitScope inScope,
AudioUnitElement inEl,
ChannelTagVector &outChannelVector) const;
-
- bool HasChannelLayout (AudioUnitScope inScope,
+
+ bool HasChannelLayout (AudioUnitScope inScope,
AudioUnitElement inEl) const;
-
+
OSStatus GetChannelLayout (AudioUnitScope inScope,
AudioUnitElement inEl,
- CAAudioChannelLayout &outLayout) const;
+ CAAudioChannelLayout &outLayout) const;
- OSStatus SetChannelLayout (AudioUnitScope inScope,
+ OSStatus SetChannelLayout (AudioUnitScope inScope,
AudioUnitElement inEl,
const CAAudioChannelLayout &inLayout);
- OSStatus SetChannelLayout (AudioUnitScope inScope,
+ OSStatus SetChannelLayout (AudioUnitScope inScope,
AudioUnitElement inEl,
const AudioChannelLayout &inLayout,
UInt32 inSize);
-
+
OSStatus ClearChannelLayout (AudioUnitScope inScope,
AudioUnitElement inEl);
-
+
OSStatus GetFormat (AudioUnitScope inScope,
AudioUnitElement inEl,
AudioStreamBasicDescription &outFormat) const;
@@ -298,16 +298,16 @@ 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;
OSStatus GetNumberChannels (AudioUnitScope inScope,
AudioUnitElement inEl,
- UInt32 &outChans) const
- {
- return NumberChannels (inScope, inEl, outChans);
+ UInt32 &outChans) const
+ {
+ return NumberChannels (inScope, inEl, outChans);
}
OSStatus SetNumberChannels (AudioUnitScope inScope,
@@ -319,28 +319,28 @@ 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
+ // for ex. the Matrix Mixer satisfies this (its in/out element count is writable, and can be set to
// any number of channels.
// outTotalNumChannels is only valid if method returns true...
bool HasDynamicInputs (SInt32 &outTotalNumChannels) const
{
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);
@@ -351,57 +351,57 @@ public:
bool GetBypass () const;
OSStatus SetBypass (bool inBypass) const;
-
+
OSStatus GetMaxFramesPerSlice (UInt32& outMaxFrames) const;
-
+
OSStatus SetMaxFramesPerSlice (UInt32 inMaxFrames);
-
+
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 SetAUPresetFromDocument (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);
bool HasDynamicScope (AudioUnitScope inScope, SInt32 &outTotalNumChannels) const;
- OSStatus ConfigureDynamicScope (AudioUnitScope inScope,
- UInt32 inNumElements,
- UInt32 *inChannelsPerElement,
+ OSStatus ConfigureDynamicScope (AudioUnitScope inScope,
+ UInt32 inNumElements,
+ UInt32 *inChannelsPerElement,
Float64 inSampleRate);
- bool ValidateChannelPair (int inChannelsIn,
+ bool ValidateChannelPair (int inChannelsIn,
int inChannelsOut,
const AUChannelInfo * info,
UInt32 numChanInfo) const;
-
- bool ValidateDynamicScope (AudioUnitScope inScope,
- SInt32 &outTotalNumChannels,
- const AUChannelInfo * info,
+
+ bool ValidateDynamicScope (AudioUnitScope inScope,
+ SInt32 &outTotalNumChannels,
+ const AUChannelInfo * info,
UInt32 numInfo) const;
- bool CheckOneSide (const CAAUChanHelper &inHelper,
- bool checkOutput,
- const AUChannelInfo *info,
+ bool CheckOneSide (const CAAUChanHelper &inHelper,
+ bool checkOutput,
+ const AUChannelInfo *info,
UInt32 numInfo) const;
enum {
kCAAU_DoNotKnowIfAUNode = -1
@@ -410,24 +410,24 @@ private:
class CAAUChanHelper {
public:
- CAAUChanHelper()
- : mChans(mStaticChans), mNumEls(0), mDidAllocate(false)
+ CAAUChanHelper()
+ : mChans(mStaticChans), mNumEls(0), mDidAllocate(false)
{
memset (mChans, 0, sizeof(UInt32) * kStaticElCount);
}
CAAUChanHelper(UInt32 inMaxElems);
CAAUChanHelper(const CAAudioUnit &inAU, AudioUnitScope inScope);
- CAAUChanHelper (const CAAUChanHelper &c)
- : mChans(mStaticChans), mNumEls(0), mDidAllocate(false)
+ CAAUChanHelper (const CAAUChanHelper &c)
+ : mChans(mStaticChans), mNumEls(0), mDidAllocate(false)
{ *this = c; }
-
+
~CAAUChanHelper();
CAAUChanHelper& operator= (const CAAUChanHelper &c);
UInt32 * mChans;
UInt32 mNumEls;
-
+
private:
enum {
kStaticElCount = 8
diff --git a/libs/appleutility/CoreAudio/PublicUtility/CAAudioUnitOutputCapturer.h b/libs/appleutility/CoreAudio/PublicUtility/CAAudioUnitOutputCapturer.h
index 42bebfacc3..0053b1843e 100644
--- a/libs/appleutility/CoreAudio/PublicUtility/CAAudioUnitOutputCapturer.h
+++ b/libs/appleutility/CoreAudio/PublicUtility/CAAudioUnitOutputCapturer.h
@@ -2,14 +2,14 @@
File: CAAudioUnitOutputCapturer.h
Abstract: Part of CoreAudio Utility Classes
Version: 1.1
-
+
Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple
Inc. ("Apple") in consideration of your agreement to the following
terms, and your use, installation, modification or redistribution of
this Apple software constitutes acceptance of these terms. If you do
not agree with these terms, please do not use, install, modify or
redistribute this Apple software.
-
+
In consideration of your agreement to abide by the following terms, and
subject to these terms, Apple grants you a personal, non-exclusive
license, under Apple's copyrights in this original Apple software (the
@@ -25,13 +25,13 @@
implied, are granted by Apple herein, including but not limited to any
patent rights that may be infringed by your derivative works or by other
works in which the Apple Software may be incorporated.
-
+
The Apple Software is provided by Apple on an "AS IS" basis. APPLE
MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND
OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
-
+
IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
@@ -40,9 +40,9 @@
AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),
STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
-
+
Copyright (C) 2014 Apple Inc. All Rights Reserved.
-
+
*/
#ifndef __CAAudioUnitOutputCapturer_h__
#define __CAAudioUnitOutputCapturer_h__
@@ -77,13 +77,13 @@ public:
mAudioUnit(au),
mExtAudioFile(NULL),
mBusNumber (busNumber)
- {
+ {
CFShow(outputFileURL);
OSStatus err = ExtAudioFileCreateWithURL(outputFileURL, fileType, &format, NULL, kAudioFileFlags_EraseFile, &mExtAudioFile);
if (!err)
mFileOpen = true;
}
-
+
void Start() {
if (mFileOpen) {
if (!mClientFormatSet) {
@@ -97,19 +97,19 @@ public:
AudioUnitAddRenderNotify(mAudioUnit, RenderCallback, this);
}
}
-
+
void Stop() {
if (mFileOpen)
AudioUnitRemoveRenderNotify(mAudioUnit, RenderCallback, this);
}
-
+
void Close() {
if (mExtAudioFile) {
ExtAudioFileDispose(mExtAudioFile);
mExtAudioFile = NULL;
}
}
-
+
~CAAudioUnitOutputCapturer() {
Close();
}
@@ -132,7 +132,7 @@ private:
}
return noErr;
}
-
+
bool mFileOpen;
bool mClientFormatSet;
AudioUnit mAudioUnit;
diff --git a/libs/appleutility/CoreAudio/PublicUtility/CAAudioValueRange.cpp b/libs/appleutility/CoreAudio/PublicUtility/CAAudioValueRange.cpp
index 203e437af6..50faf8fa47 100644
--- a/libs/appleutility/CoreAudio/PublicUtility/CAAudioValueRange.cpp
+++ b/libs/appleutility/CoreAudio/PublicUtility/CAAudioValueRange.cpp
@@ -2,14 +2,14 @@
File: CAAudioValueRange.cpp
Abstract: CAAudioValueRange.h
Version: 1.1
-
+
Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple
Inc. ("Apple") in consideration of your agreement to the following
terms, and your use, installation, modification or redistribution of
this Apple software constitutes acceptance of these terms. If you do
not agree with these terms, please do not use, install, modify or
redistribute this Apple software.
-
+
In consideration of your agreement to abide by the following terms, and
subject to these terms, Apple grants you a personal, non-exclusive
license, under Apple's copyrights in this original Apple software (the
@@ -25,13 +25,13 @@
implied, are granted by Apple herein, including but not limited to any
patent rights that may be infringed by your derivative works or by other
works in which the Apple Software may be incorporated.
-
+
The Apple Software is provided by Apple on an "AS IS" basis. APPLE
MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND
OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
-
+
IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
@@ -40,9 +40,9 @@
AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),
STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
-
+
Copyright (C) 2014 Apple Inc. All Rights Reserved.
-
+
*/
//==================================================================================================
// Includes
@@ -80,7 +80,7 @@ Float64 CAAudioValueRange::PickCommonSampleRate(const AudioValueRange& inRange)
// if no common rates can be found. It assumes that inRange contains a continuous range of
// sample rates.
Float64 theAnswer = inRange.mMaximum;
-
+
if(ContainsValue(inRange, 44100.0))
{
theAnswer = 44100.0;
@@ -129,7 +129,7 @@ Float64 CAAudioValueRange::PickCommonSampleRate(const AudioValueRange& inRange)
{
theAnswer = 8000.0;
}
-
+
return theAnswer;
}
@@ -173,50 +173,50 @@ void CAAudioValueRange_ComputeUnion(const AudioValueRange& inRange, const CAAudi
{
// this method assumes that the ranges in inRangeList are disjoint and that they are sorted from low to high and
outUnion.clear();
-
+
// start at the beginning of inRangeList
CAAudioValueRangeList::const_iterator theIterator = inRangeList.begin();
-
+
// iterate through inRangeList and add all the ranges that are strictly less than inRange
while((theIterator != inRangeList.end()) && CAAudioValueRange::IsStrictlyLessThan(*theIterator, inRange))
{
// put this range in the union
outUnion.push_back(*theIterator);
-
+
// go to the next one
std::advance(theIterator, 1);
}
-
+
if(theIterator != inRangeList.end())
{
if(!CAAudioValueRange::IsStrictlyGreaterThan(*theIterator, inRange))
{
// inRange intersects the range that theIterator points at, but might actually intersect several contiguous ranges
-
+
// initialize the starting point, noting that we can skip the current one since we already know it's in the intersection
CAAudioValueRangeList::const_iterator theGreaterIterator = theIterator;
std::advance(theGreaterIterator, 1);
-
+
// iterate until we find a range that is strictly greater than inRange
while((theGreaterIterator != inRangeList.end()) && !CAAudioValueRange::IsStrictlyGreaterThan(*theGreaterIterator, inRange))
{
// go to the next one
std::advance(theGreaterIterator, 1);
}
-
+
// theGreaterIterator now points at either one past the highest range in the intersection or the end of the vector
// Either way, we have to adjust it to point at the true highest range in the intersection
std::advance(theGreaterIterator, -1);
-
+
// now theIterator points at the lowest range in the intersection and theGreaterIterator points at the highest
// so we can compute the coagulated range
AudioValueRange theCoagulation;
theCoagulation.mMinimum = std::min(theIterator->mMinimum, inRange.mMinimum);
theCoagulation.mMaximum = std::max(theGreaterIterator->mMaximum, inRange.mMaximum);
-
+
// add the coagulation to the union
outUnion.push_back(theCoagulation);
-
+
// adjust theIterator to point at the next range for processing
theIterator = theGreaterIterator;
std::advance(theIterator, 1);
@@ -226,13 +226,13 @@ void CAAudioValueRange_ComputeUnion(const AudioValueRange& inRange, const CAAudi
// the range theIterator points at is strictly greater than inRange, so insert inRange in front of it and we're done
outUnion.push_back(inRange);
}
-
+
// we need to now copy the remaining higher ranges in inRangeList into the union
while(theIterator != inRangeList.end())
{
// put this range in the union
outUnion.push_back(*theIterator);
-
+
// go to the next one
std::advance(theIterator, 1);
}
diff --git a/libs/appleutility/CoreAudio/PublicUtility/CAAudioValueRange.h b/libs/appleutility/CoreAudio/PublicUtility/CAAudioValueRange.h
index e17c4574bc..c9f94ea27f 100644
--- a/libs/appleutility/CoreAudio/PublicUtility/CAAudioValueRange.h
+++ b/libs/appleutility/CoreAudio/PublicUtility/CAAudioValueRange.h
@@ -2,14 +2,14 @@
File: CAAudioValueRange.h
Abstract: Part of CoreAudio Utility Classes
Version: 1.1
-
+
Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple
Inc. ("Apple") in consideration of your agreement to the following
terms, and your use, installation, modification or redistribution of
this Apple software constitutes acceptance of these terms. If you do
not agree with these terms, please do not use, install, modify or
redistribute this Apple software.
-
+
In consideration of your agreement to abide by the following terms, and
subject to these terms, Apple grants you a personal, non-exclusive
license, under Apple's copyrights in this original Apple software (the
@@ -25,13 +25,13 @@
implied, are granted by Apple herein, including but not limited to any
patent rights that may be infringed by your derivative works or by other
works in which the Apple Software may be incorporated.
-
+
The Apple Software is provided by Apple on an "AS IS" basis. APPLE
MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND
OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
-
+
IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
@@ -40,9 +40,9 @@
AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),
STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
-
+
Copyright (C) 2014 Apple Inc. All Rights Reserved.
-
+
*/
#if !defined(__CAAudioValueRange_h__)
#define __CAAudioValueRange_h__
@@ -104,7 +104,7 @@ public:
return x.mMinimum < y.mMinimum;
}
};
-
+
};
inline bool operator<(const AudioValueRange& x, const AudioValueRange& y) { return x.mMinimum < y.mMinimum; }
diff --git a/libs/appleutility/CoreAudio/PublicUtility/CAAutoDisposer.h b/libs/appleutility/CoreAudio/PublicUtility/CAAutoDisposer.h
index 2da241506c..eef4762dc6 100644
--- a/libs/appleutility/CoreAudio/PublicUtility/CAAutoDisposer.h
+++ b/libs/appleutility/CoreAudio/PublicUtility/CAAutoDisposer.h
@@ -2,14 +2,14 @@
File: CAAutoDisposer.h
Abstract: Part of CoreAudio Utility Classes
Version: 1.1
-
+
Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple
Inc. ("Apple") in consideration of your agreement to the following
terms, and your use, installation, modification or redistribution of
this Apple software constitutes acceptance of these terms. If you do
not agree with these terms, please do not use, install, modify or
redistribute this Apple software.
-
+
In consideration of your agreement to abide by the following terms, and
subject to these terms, Apple grants you a personal, non-exclusive
license, under Apple's copyrights in this original Apple software (the
@@ -25,13 +25,13 @@
implied, are granted by Apple herein, including but not limited to any
patent rights that may be infringed by your derivative works or by other
works in which the Apple Software may be incorporated.
-
+
The Apple Software is provided by Apple on an "AS IS" basis. APPLE
MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND
OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
-
+
IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
@@ -40,9 +40,9 @@
AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),
STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
-
+
Copyright (C) 2014 Apple Inc. All Rights Reserved.
-
+
*/
#if !defined(__CAPtr_h__)
#define __CAPtr_h__
@@ -78,10 +78,10 @@ inline void* CA_realloc(void* old, size_t size)
#endif
inline void* CA_calloc(size_t n, size_t size)
-{
+{
// ensure that multiplication will not overflow
if (n && UINTPTR_MAX / n < size) throw std::bad_alloc();
-
+
size_t nsize = n*size;
void* p = malloc(nsize);
if (!p && nsize) throw std::bad_alloc();
@@ -107,87 +107,87 @@ private:
T* ptr_;
public:
-
+
CAAutoFree() : ptr_(0) {}
-
+
explicit CAAutoFree(T* ptr) : ptr_(ptr) {}
-
+
template<typename U>
CAAutoFree(CAAutoFree<U>& that) : ptr_(that.release()) {} // take ownership
// C++ std says: a template constructor is never a copy constructor
CAAutoFree(CAAutoFree<T>& that) : ptr_(that.release()) {} // take ownership
- CAAutoFree(size_t n, bool clear = false)
+ CAAutoFree(size_t n, bool clear = false)
// this becomes an ambiguous call if n == 0
- : ptr_(0)
+ : ptr_(0)
{
size_t maxItems = ~size_t(0) / sizeof(T);
- if (n > maxItems)
+ if (n > maxItems)
throw std::bad_alloc();
ptr_ = static_cast<T*>(clear ? CA_calloc(n, sizeof(T)) : CA_malloc(n * sizeof(T)));
}
-
+
~CAAutoFree() { free(); }
-
- void alloc(size_t numItems, bool clear = false)
+
+ void alloc(size_t numItems, bool clear = false)
{
size_t maxItems = ~size_t(0) / sizeof(T);
if (numItems > maxItems) throw std::bad_alloc();
-
+
free();
ptr_ = static_cast<T*>(clear ? CA_calloc(numItems, sizeof(T)) : CA_malloc(numItems * sizeof(T)));
}
-
- void allocBytes(size_t numBytes, bool clear = false)
+
+ void allocBytes(size_t numBytes, bool clear = false)
{
free();
ptr_ = static_cast<T*>(clear ? CA_calloc(1, numBytes) : CA_malloc(numBytes));
}
-
- void reallocBytes(size_t numBytes)
+
+ void reallocBytes(size_t numBytes)
{
ptr_ = static_cast<T*>(CA_realloc(ptr_, numBytes));
}
- void reallocItems(size_t numItems)
+ void reallocItems(size_t numItems)
{
size_t maxItems = ~size_t(0) / sizeof(T);
if (numItems > maxItems) throw std::bad_alloc();
-
+
ptr_ = static_cast<T*>(CA_realloc(ptr_, numItems * sizeof(T)));
}
-
+
template <typename U>
- CAAutoFree& operator=(CAAutoFree<U>& that)
- {
+ CAAutoFree& operator=(CAAutoFree<U>& that)
+ {
set(that.release()); // take ownership
return *this;
}
-
- CAAutoFree& operator=(CAAutoFree& that)
- {
+
+ CAAutoFree& operator=(CAAutoFree& that)
+ {
set(that.release()); // take ownership
return *this;
}
-
- CAAutoFree& operator=(T* ptr)
+
+ CAAutoFree& operator=(T* ptr)
{
- set(ptr);
+ set(ptr);
return *this;
}
-
+
template <typename U>
- CAAutoFree& operator=(U* ptr)
+ CAAutoFree& operator=(U* ptr)
{
- set(ptr);
+ set(ptr);
return *this;
}
-
+
T& operator*() const { return *ptr_; }
T* operator->() const { return ptr_; }
-
+
T* operator()() const { return ptr_; }
T* get() const { return ptr_; }
operator T*() const { return ptr_; }
@@ -196,15 +196,15 @@ public:
bool operator!=(CAAutoFree const& that) const { return ptr_ != that.ptr_; }
bool operator==(T* ptr) const { return ptr_ == ptr; }
bool operator!=(T* ptr) const { return ptr_ != ptr; }
-
- T* release()
+
+ T* release()
{
// release ownership
T* result = ptr_;
ptr_ = 0;
return result;
}
-
+
void set(T* ptr)
{
if (ptr != ptr_)
@@ -213,8 +213,8 @@ public:
ptr_ = ptr;
}
}
-
- void free()
+
+ void free()
{
set(0);
}
@@ -237,7 +237,7 @@ public:
template<typename U>
operator CAAutoFree<U>()
{ return CAAutoFree<U>(release()); }
-
+
};
@@ -251,61 +251,61 @@ public:
CAAutoDelete() : ptr_(0) {}
explicit CAAutoDelete(T* ptr) : ptr_(ptr) {}
-
+
template<typename U>
CAAutoDelete(CAAutoDelete<U>& that) : ptr_(that.release()) {} // take ownership
// C++ std says: a template constructor is never a copy constructor
CAAutoDelete(CAAutoDelete<T>& that) : ptr_(that.release()) {} // take ownership
-
+
~CAAutoDelete() { free(); }
-
+
template <typename U>
- CAAutoDelete& operator=(CAAutoDelete<U>& that)
- {
+ CAAutoDelete& operator=(CAAutoDelete<U>& that)
+ {
set(that.release()); // take ownership
return *this;
}
-
- CAAutoDelete& operator=(CAAutoDelete& that)
- {
+
+ CAAutoDelete& operator=(CAAutoDelete& that)
+ {
set(that.release()); // take ownership
return *this;
}
-
- CAAutoDelete& operator=(T* ptr)
+
+ CAAutoDelete& operator=(T* ptr)
{
- set(ptr);
+ set(ptr);
return *this;
}
-
+
template <typename U>
- CAAutoDelete& operator=(U* ptr)
+ CAAutoDelete& operator=(U* ptr)
{
- set(ptr);
+ set(ptr);
return *this;
}
-
+
T& operator*() const { return *ptr_; }
T* operator->() const { return ptr_; }
-
+
T* operator()() const { return ptr_; }
T* get() const { return ptr_; }
operator T*() const { return ptr_; }
-
+
bool operator==(CAAutoDelete const& that) const { return ptr_ == that.ptr_; }
bool operator!=(CAAutoDelete const& that) const { return ptr_ != that.ptr_; }
bool operator==(T* ptr) const { return ptr_ == ptr; }
bool operator!=(T* ptr) const { return ptr_ != ptr; }
-
- T* release()
+
+ T* release()
{
// release ownership
T* result = ptr_;
ptr_ = 0;
return result;
}
-
+
void set(T* ptr)
{
if (ptr != ptr_)
@@ -314,8 +314,8 @@ public:
ptr_ = ptr;
}
}
-
- void free()
+
+ void free()
{
set(0);
}
@@ -338,7 +338,7 @@ public:
template<typename U>
operator CAAutoFree<U>()
{ return CAAutoFree<U>(release()); }
-
+
};
@@ -352,53 +352,53 @@ public:
CAAutoArrayDelete() : ptr_(0) {}
explicit CAAutoArrayDelete(T* ptr) : ptr_(ptr) {}
-
+
template<typename U>
CAAutoArrayDelete(CAAutoArrayDelete<U>& that) : ptr_(that.release()) {} // take ownership
// C++ std says: a template constructor is never a copy constructor
CAAutoArrayDelete(CAAutoArrayDelete<T>& that) : ptr_(that.release()) {} // take ownership
-
+
// this becomes an ambiguous call if n == 0
CAAutoArrayDelete(size_t n) : ptr_(new T[n]) {}
-
+
~CAAutoArrayDelete() { free(); }
-
- void alloc(size_t numItems)
+
+ void alloc(size_t numItems)
{
free();
ptr_ = new T [numItems];
}
-
+
template <typename U>
- CAAutoArrayDelete& operator=(CAAutoArrayDelete<U>& that)
- {
+ CAAutoArrayDelete& operator=(CAAutoArrayDelete<U>& that)
+ {
set(that.release()); // take ownership
return *this;
}
-
- CAAutoArrayDelete& operator=(CAAutoArrayDelete& that)
- {
+
+ CAAutoArrayDelete& operator=(CAAutoArrayDelete& that)
+ {
set(that.release()); // take ownership
return *this;
}
-
- CAAutoArrayDelete& operator=(T* ptr)
+
+ CAAutoArrayDelete& operator=(T* ptr)
{
- set(ptr);
+ set(ptr);
return *this;
}
-
+
template <typename U>
- CAAutoArrayDelete& operator=(U* ptr)
+ CAAutoArrayDelete& operator=(U* ptr)
{
- set(ptr);
+ set(ptr);
return *this;
}
-
+
T& operator*() const { return *ptr_; }
T* operator->() const { return ptr_; }
-
+
T* operator()() const { return ptr_; }
T* get() const { return ptr_; }
operator T*() const { return ptr_; }
@@ -407,15 +407,15 @@ public:
bool operator!=(CAAutoArrayDelete const& that) const { return ptr_ != that.ptr_; }
bool operator==(T* ptr) const { return ptr_ == ptr; }
bool operator!=(T* ptr) const { return ptr_ != ptr; }
-
- T* release()
+
+ T* release()
{
// release ownership
T* result = ptr_;
ptr_ = 0;
return result;
}
-
+
void set(T* ptr)
{
if (ptr != ptr_)
@@ -424,8 +424,8 @@ public:
ptr_ = ptr;
}
}
-
- void free()
+
+ void free()
{
set(0);
}
@@ -448,7 +448,7 @@ public:
template<typename U>
operator CAAutoArrayDelete<U>()
{ return CAAutoFree<U>(release()); }
-
+
};
@@ -493,7 +493,7 @@ void sink(CAAutoFree<char> captr)
}
-int main (int argc, char * const argv[])
+int main (int argc, char * const argv[])
{
CAAutoFree<char> captr(source());
diff --git a/libs/appleutility/CoreAudio/PublicUtility/CABitOperations.h b/libs/appleutility/CoreAudio/PublicUtility/CABitOperations.h
index 21cb516a60..8394fbf4ae 100644
--- a/libs/appleutility/CoreAudio/PublicUtility/CABitOperations.h
+++ b/libs/appleutility/CoreAudio/PublicUtility/CABitOperations.h
@@ -2,14 +2,14 @@
File: CABitOperations.h
Abstract: Part of CoreAudio Utility Classes
Version: 1.1
-
+
Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple
Inc. ("Apple") in consideration of your agreement to the following
terms, and your use, installation, modification or redistribution of
this Apple software constitutes acceptance of these terms. If you do
not agree with these terms, please do not use, install, modify or
redistribute this Apple software.
-
+
In consideration of your agreement to abide by the following terms, and
subject to these terms, Apple grants you a personal, non-exclusive
license, under Apple's copyrights in this original Apple software (the
@@ -25,13 +25,13 @@
implied, are granted by Apple herein, including but not limited to any
patent rights that may be infringed by your derivative works or by other
works in which the Apple Software may be incorporated.
-
+
The Apple Software is provided by Apple on an "AS IS" basis. APPLE
MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND
OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
-
+
IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
@@ -40,9 +40,9 @@
AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),
STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
-
+
Copyright (C) 2014 Apple Inc. All Rights Reserved.
-
+
*/
#ifndef _CABitOperations_h_
#define _CABitOperations_h_
@@ -57,8 +57,8 @@
#include <TargetConditionals.h>
// return whether a number is a power of two
-inline UInt32 IsPowerOfTwo(UInt32 x)
-{
+inline UInt32 IsPowerOfTwo(UInt32 x)
+{
return (x & (x-1)) == 0;
}
diff --git a/libs/appleutility/CoreAudio/PublicUtility/CABool.h b/libs/appleutility/CoreAudio/PublicUtility/CABool.h
index 719fd74bb2..0d749618fa 100644
--- a/libs/appleutility/CoreAudio/PublicUtility/CABool.h
+++ b/libs/appleutility/CoreAudio/PublicUtility/CABool.h
@@ -2,14 +2,14 @@
File: CABool.h
Abstract: Part of CoreAudio Utility Classes
Version: 1.1
-
+
Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple
Inc. ("Apple") in consideration of your agreement to the following
terms, and your use, installation, modification or redistribution of
this Apple software constitutes acceptance of these terms. If you do
not agree with these terms, please do not use, install, modify or
redistribute this Apple software.
-
+
In consideration of your agreement to abide by the following terms, and
subject to these terms, Apple grants you a personal, non-exclusive
license, under Apple's copyrights in this original Apple software (the
@@ -25,13 +25,13 @@
implied, are granted by Apple herein, including but not limited to any
patent rights that may be infringed by your derivative works or by other
works in which the Apple Software may be incorporated.
-
+
The Apple Software is provided by Apple on an "AS IS" basis. APPLE
MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND
OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
-
+
IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
@@ -40,9 +40,9 @@
AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),
STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
-
+
Copyright (C) 2014 Apple Inc. All Rights Reserved.
-
+
*/
#if !defined(__CABool_h__)
#define __CABool_h__
@@ -72,17 +72,17 @@ public:
CABool(bool inValue) : mValue(inValue ? 1 : 0) {}
CABool(const CABool& inValue) : mValue(inValue.mValue) {}
~CABool() {}
-
+
CABool& operator=(bool inValue) { mValue = inValue; return *this; }
CABool& operator=(const CABool& inValue) { mValue = inValue.mValue; return *this; }
-
+
operator bool() const { ThrowIf(mValue == -1, CAException('nope'), "CABool: uninitialized"); return mValue != 0; }
bool IsInitialized() const { return mValue != -1; }
void Uninitialize() { mValue = -1; }
private:
SInt32 mValue;
-
+
CABool(const void*); // prevent accidental instantiation with a pointer via bool constructor
};
diff --git a/libs/appleutility/CoreAudio/PublicUtility/CABufferList.cpp b/libs/appleutility/CoreAudio/PublicUtility/CABufferList.cpp
index 3249013b59..f43cdaa656 100644
--- a/libs/appleutility/CoreAudio/PublicUtility/CABufferList.cpp
+++ b/libs/appleutility/CoreAudio/PublicUtility/CABufferList.cpp
@@ -2,14 +2,14 @@
File: CABufferList.cpp
Abstract: CABufferList.h
Version: 1.1
-
+
Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple
Inc. ("Apple") in consideration of your agreement to the following
terms, and your use, installation, modification or redistribution of
this Apple software constitutes acceptance of these terms. If you do
not agree with these terms, please do not use, install, modify or
redistribute this Apple software.
-
+
In consideration of your agreement to abide by the following terms, and
subject to these terms, Apple grants you a personal, non-exclusive
license, under Apple's copyrights in this original Apple software (the
@@ -25,13 +25,13 @@
implied, are granted by Apple herein, including but not limited to any
patent rights that may be infringed by your derivative works or by other
works in which the Apple Software may be incorporated.
-
+
The Apple Software is provided by Apple on an "AS IS" basis. APPLE
MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND
OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
-
+
IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
@@ -40,9 +40,9 @@
AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),
STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
-
+
Copyright (C) 2014 Apple Inc. All Rights Reserved.
-
+
*/
#include "CABufferList.h"
#include "CAByteOrder.h"
@@ -58,7 +58,7 @@ void CABufferList::AllocateBuffers(UInt32 nBytes)
UInt32 memorySize = nBytes * mABL.mNumberBuffers;
Byte *newMemory = new Byte[memorySize], *p = newMemory;
memset(newMemory, 0, memorySize); // get page faults now, not later
-
+
AudioBuffer *buf = mABL.mBuffers;
for (UInt32 i = mABL.mNumberBuffers; i--; ++buf) {
if (buf->mData != NULL && buf->mDataByteSize > 0)
@@ -84,7 +84,7 @@ void CABufferList::AllocateBuffersAndCopyFrom(UInt32 nBytes, CABufferList *inSr
}
inSetPtrList->VerifyNotTrashingOwnedBuffer();
UInt32 fromByteSize = inSrcList->GetNumBytes();
-
+
if (mABL.mNumberBuffers > 1)
// align successive buffers for Altivec and to take alternating
// cache line hits by spacing them by odd multiples of 16
@@ -92,7 +92,7 @@ void CABufferList::AllocateBuffersAndCopyFrom(UInt32 nBytes, CABufferList *inSr
UInt32 memorySize = nBytes * mABL.mNumberBuffers;
Byte *newMemory = new Byte[memorySize], *p = newMemory;
memset(newMemory, 0, memorySize); // make buffer "hot"
-
+
AudioBuffer *buf = mABL.mBuffers;
AudioBuffer *ptrBuf = inSetPtrList->mABL.mBuffers;
AudioBuffer *srcBuf = inSrcList->mABL.mBuffers;
@@ -126,7 +126,7 @@ void CABufferList::DeallocateBuffers()
mBufferMemory = NULL;
mBufferCapacity = 0;
}
-
+
}
static void show(const AudioBufferList &abl, int framesToPrint, int wordSize, const char *label, const char *fmtstr=NULL)
@@ -193,7 +193,7 @@ void CAShowAudioBufferList(const AudioBufferList &abl, int framesToPrint, const
CAStreamBasicDescription fmt(asbd);
int wordSize = 1;
char fmtstr[80] = { 0 };
-
+
if (fmt.mFormatID == kAudioFormatLinearPCM) {
if (fmt.mFormatFlags & kLinearPCMFormatFlagIsFloat) {
if (fmt.mBitsPerChannel == 32) {
diff --git a/libs/appleutility/CoreAudio/PublicUtility/CABufferList.h b/libs/appleutility/CoreAudio/PublicUtility/CABufferList.h
index 72c93f8626..67bf272867 100644
--- a/libs/appleutility/CoreAudio/PublicUtility/CABufferList.h
+++ b/libs/appleutility/CoreAudio/PublicUtility/CABufferList.h
@@ -2,14 +2,14 @@
File: CABufferList.h
Abstract: Part of CoreAudio Utility Classes
Version: 1.1
-
+
Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple
Inc. ("Apple") in consideration of your agreement to the following
terms, and your use, installation, modification or redistribution of
this Apple software constitutes acceptance of these terms. If you do
not agree with these terms, please do not use, install, modify or
redistribute this Apple software.
-
+
In consideration of your agreement to abide by the following terms, and
subject to these terms, Apple grants you a personal, non-exclusive
license, under Apple's copyrights in this original Apple software (the
@@ -25,13 +25,13 @@
implied, are granted by Apple herein, including but not limited to any
patent rights that may be infringed by your derivative works or by other
works in which the Apple Software may be incorporated.
-
+
The Apple Software is provided by Apple on an "AS IS" basis. APPLE
MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND
OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
-
+
IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
@@ -40,9 +40,9 @@
AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),
STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
-
+
Copyright (C) 2014 Apple Inc. All Rights Reserved.
-
+
*/
#ifndef __CABufferList_h__
#define __CABufferList_h__
@@ -61,7 +61,7 @@ extern "C" int CrashIfClientProvidedBogusAudioBufferList(const AudioBufferList *
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).
@@ -107,20 +107,20 @@ public:
if (mBufferMemory)
delete[] mBufferMemory;
}
-
+
const char * Name() { return mName; }
-
+
const AudioBufferList & GetBufferList() const { return mABL; }
-
+
AudioBufferList & GetModifiableBufferList() { return _GetBufferList(); }
-
+
UInt32 GetNumberBuffers() const { return mABL.mNumberBuffers; }
-
+
UInt32 GetNumBytes() const
{
return mABL.mBuffers[0].mDataByteSize;
}
-
+
void SetBytes(UInt32 nBytes, void *data)
{
VerifyNotTrashingOwnedBuffer();
@@ -128,7 +128,7 @@ public:
mABL.mBuffers[0].mDataByteSize = nBytes;
mABL.mBuffers[0].mData = data;
}
-
+
void CopyAllFrom(CABufferList *srcbl, CABufferList *ptrbl)
// copies bytes from srcbl
// make ptrbl reflect the length copied
@@ -150,17 +150,17 @@ public:
if (srcbl != ptrbl)
srcbl->BytesConsumed(nBytes);
}
-
+
// copies data from another buffer list.
void CopyDataFrom(const AudioBufferList &other)
{
for (unsigned i = 0; i < other.mNumberBuffers; ++i) {
XAssert(mBufferCapacity == 0 || other.mBuffers[i].mDataByteSize <= mBufferCapacity);
- memcpy(mABL.mBuffers[i].mData, other.mBuffers[i].mData,
+ memcpy(mABL.mBuffers[i].mData, other.mBuffers[i].mData,
mABL.mBuffers[i].mDataByteSize = other.mBuffers[i].mDataByteSize);
}
}
-
+
void AppendFrom(CABufferList *blp, UInt32 nBytes)
{
// this may mutate a buffer that owns memory.
@@ -173,7 +173,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
@@ -186,7 +186,7 @@ public:
buf->mDataByteSize = desiredBufferSize;
}
}
-
+
void SetToZeroes(UInt32 nBytes)
{
XAssert(mBufferCapacity == 0 || nBytes <= mBufferCapacity);
@@ -196,23 +196,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 (mABL.mNumberBuffers != anotherBufferList->mABL.mNumberBuffers) return false;
-
+
for (UInt32 i = 0; i < mABL.mNumberBuffers; ++i) {
if (mABL.mBuffers[i].mData != anotherBufferList->mABL.mBuffers[i].mData) return false;
}
return true;
}
-
+
void BytesConsumed(UInt32 nBytes)
// advance buffer pointers, decrease buffer sizes
{
@@ -224,18 +224,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();
@@ -247,25 +247,25 @@ 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[mABL.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) // $$$ ReducingSize
// this is for bufferlists that function simply as
// an array of pointers into another bufferlist, being advanced,
@@ -278,7 +278,7 @@ public:
buf->mDataByteSize -= nBytes;
}
}
-
+
void SetNumBytes(UInt32 nBytes)
{
XAssert(mBufferCapacity == 0 || nBytes <= mBufferCapacity);
@@ -296,9 +296,9 @@ public:
if (mBufferMemory)
printf(" owned memory @ 0x%p:\n", mBufferMemory);
}
-
+
UInt32 GetCapacityBytes() const { return mBufferCapacity; }
-
+
template <typename T>
T* GetData(UInt32 inBuffer) {
return static_cast<T*>(mABL.mBuffers[inBuffer].mData);
diff --git a/libs/appleutility/CoreAudio/PublicUtility/CABundleLocker.cpp b/libs/appleutility/CoreAudio/PublicUtility/CABundleLocker.cpp
index 2161be7447..2e4655ce4b 100644
--- a/libs/appleutility/CoreAudio/PublicUtility/CABundleLocker.cpp
+++ b/libs/appleutility/CoreAudio/PublicUtility/CABundleLocker.cpp
@@ -2,14 +2,14 @@
File: CABundleLocker.cpp
Abstract: CABundleLocker.h
Version: 1.1
-
+
Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple
Inc. ("Apple") in consideration of your agreement to the following
terms, and your use, installation, modification or redistribution of
this Apple software constitutes acceptance of these terms. If you do
not agree with these terms, please do not use, install, modify or
redistribute this Apple software.
-
+
In consideration of your agreement to abide by the following terms, and
subject to these terms, Apple grants you a personal, non-exclusive
license, under Apple's copyrights in this original Apple software (the
@@ -25,13 +25,13 @@
implied, are granted by Apple herein, including but not limited to any
patent rights that may be infringed by your derivative works or by other
works in which the Apple Software may be incorporated.
-
+
The Apple Software is provided by Apple on an "AS IS" basis. APPLE
MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND
OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
-
+
IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
@@ -40,9 +40,9 @@
AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),
STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
-
+
Copyright (C) 2014 Apple Inc. All Rights Reserved.
-
+
*/
#include "CABundleLocker.h"
#include <pthread.h>
diff --git a/libs/appleutility/CoreAudio/PublicUtility/CABundleLocker.h b/libs/appleutility/CoreAudio/PublicUtility/CABundleLocker.h
index 821ca34af0..898b2cf4f3 100644
--- a/libs/appleutility/CoreAudio/PublicUtility/CABundleLocker.h
+++ b/libs/appleutility/CoreAudio/PublicUtility/CABundleLocker.h
@@ -2,14 +2,14 @@
File: CABundleLocker.h
Abstract: Part of CoreAudio Utility Classes
Version: 1.1
-
+
Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple
Inc. ("Apple") in consideration of your agreement to the following
terms, and your use, installation, modification or redistribution of
this Apple software constitutes acceptance of these terms. If you do
not agree with these terms, please do not use, install, modify or
redistribute this Apple software.
-
+
In consideration of your agreement to abide by the following terms, and
subject to these terms, Apple grants you a personal, non-exclusive
license, under Apple's copyrights in this original Apple software (the
@@ -25,13 +25,13 @@
implied, are granted by Apple herein, including but not limited to any
patent rights that may be infringed by your derivative works or by other
works in which the Apple Software may be incorporated.
-
+
The Apple Software is provided by Apple on an "AS IS" basis. APPLE
MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND
OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
-
+
IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
@@ -40,15 +40,15 @@
AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),
STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
-
+
Copyright (C) 2014 Apple Inc. All Rights Reserved.
-
+
*/
#ifndef _CABundleLocker_h_
#define _CABundleLocker_h_
#include <TargetConditionals.h>
-
+
/*
some bundle operations are not thread safe, notably CFCopyLocalizedStringFromTableInBundle
*/
diff --git a/libs/appleutility/CoreAudio/PublicUtility/CAByteOrder.h b/libs/appleutility/CoreAudio/PublicUtility/CAByteOrder.h
index 9a56c6d858..78a512a32f 100644
--- a/libs/appleutility/CoreAudio/PublicUtility/CAByteOrder.h
+++ b/libs/appleutility/CoreAudio/PublicUtility/CAByteOrder.h
@@ -2,14 +2,14 @@
File: CAByteOrder.h
Abstract: Part of CoreAudio Utility Classes
Version: 1.1
-
+
Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple
Inc. ("Apple") in consideration of your agreement to the following
terms, and your use, installation, modification or redistribution of
this Apple software constitutes acceptance of these terms. If you do
not agree with these terms, please do not use, install, modify or
redistribute this Apple software.
-
+
In consideration of your agreement to abide by the following terms, and
subject to these terms, Apple grants you a personal, non-exclusive
license, under Apple's copyrights in this original Apple software (the
@@ -25,13 +25,13 @@
implied, are granted by Apple herein, including but not limited to any
patent rights that may be infringed by your derivative works or by other
works in which the Apple Software may be incorporated.
-
+
The Apple Software is provided by Apple on an "AS IS" basis. APPLE
MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND
OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
-
+
IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
@@ -40,9 +40,9 @@
AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),
STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
-
+
Copyright (C) 2014 Apple Inc. All Rights Reserved.
-
+
*/
#if !defined(__CAByteOrder_h__)
#define __CAByteOrder_h__
@@ -71,7 +71,7 @@ CF_INLINE Float32 CASwapFloat32 (Float32 arg) {
flip.f = arg;
flip.i = CFSwapInt32 (flip.i);
-
+
return flip.f;
}
@@ -83,7 +83,7 @@ CF_INLINE Float64 CASwapFloat64 (Float64 arg) {
flip.f = arg;
flip.i = CFSwapInt64 (flip.i);
-
+
return flip.f;
}
diff --git a/libs/appleutility/CoreAudio/PublicUtility/CACFArray.cpp b/libs/appleutility/CoreAudio/PublicUtility/CACFArray.cpp
index e7c057d8da..ec1e93c311 100644
--- a/libs/appleutility/CoreAudio/PublicUtility/CACFArray.cpp
+++ b/libs/appleutility/CoreAudio/PublicUtility/CACFArray.cpp
@@ -2,14 +2,14 @@
File: CACFArray.cpp
Abstract: CACFArray.h
Version: 1.1
-
+
Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple
Inc. ("Apple") in consideration of your agreement to the following
terms, and your use, installation, modification or redistribution of
this Apple software constitutes acceptance of these terms. If you do
not agree with these terms, please do not use, install, modify or
redistribute this Apple software.
-
+
In consideration of your agreement to abide by the following terms, and
subject to these terms, Apple grants you a personal, non-exclusive
license, under Apple's copyrights in this original Apple software (the
@@ -25,13 +25,13 @@
implied, are granted by Apple herein, including but not limited to any
patent rights that may be infringed by your derivative works or by other
works in which the Apple Software may be incorporated.
-
+
The Apple Software is provided by Apple on an "AS IS" basis. APPLE
MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND
OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
-
+
IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
@@ -40,9 +40,9 @@
AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),
STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
-
+
Copyright (C) 2014 Apple Inc. All Rights Reserved.
-
+
*/
//=============================================================================
// Includes
@@ -91,7 +91,7 @@ bool CACFArray::GetIndexOfItem(const void* inItem, UInt32& outIndex) const
bool CACFArray::GetBool(UInt32 inIndex, bool& outValue) const
{
bool theAnswer = false;
-
+
CFTypeRef theValue = NULL;
if(GetCFType(inIndex, theValue))
{
@@ -108,14 +108,14 @@ bool CACFArray::GetBool(UInt32 inIndex, bool& outValue) const
theAnswer = true;
}
}
-
+
return theAnswer;
}
bool CACFArray::GetSInt32(UInt32 inIndex, SInt32& outItem) const
{
bool theAnswer = false;
-
+
CFTypeRef theItem = NULL;
if(GetCFType(inIndex, theItem))
{
@@ -125,14 +125,14 @@ bool CACFArray::GetSInt32(UInt32 inIndex, SInt32& outItem) const
theAnswer = true;
}
}
-
+
return theAnswer;
}
bool CACFArray::GetUInt32(UInt32 inIndex, UInt32& outItem) const
{
bool theAnswer = false;
-
+
CFTypeRef theItem = NULL;
if(GetCFType(inIndex, theItem))
{
@@ -142,14 +142,14 @@ bool CACFArray::GetUInt32(UInt32 inIndex, UInt32& outItem) const
theAnswer = true;
}
}
-
+
return theAnswer;
}
bool CACFArray::GetSInt64(UInt32 inIndex, SInt64& outItem) const
{
bool theAnswer = false;
-
+
CFTypeRef theItem = NULL;
if(GetCFType(inIndex, theItem))
{
@@ -159,14 +159,14 @@ bool CACFArray::GetSInt64(UInt32 inIndex, SInt64& outItem) const
theAnswer = true;
}
}
-
+
return theAnswer;
}
bool CACFArray::GetUInt64(UInt32 inIndex, UInt64& outItem) const
{
bool theAnswer = false;
-
+
CFTypeRef theItem = NULL;
if(GetCFType(inIndex, theItem))
{
@@ -176,14 +176,14 @@ bool CACFArray::GetUInt64(UInt32 inIndex, UInt64& outItem) const
theAnswer = true;
}
}
-
+
return theAnswer;
}
bool CACFArray::GetFloat32(UInt32 inIndex, Float32& outItem) const
{
bool theAnswer = false;
-
+
CFTypeRef theItem = NULL;
if(GetCFType(inIndex, theItem))
{
@@ -193,14 +193,14 @@ bool CACFArray::GetFloat32(UInt32 inIndex, Float32& outItem) const
theAnswer = true;
}
}
-
+
return theAnswer;
}
bool CACFArray::GetFloat64(UInt32 inIndex, Float64& outItem) const
{
bool theAnswer = false;
-
+
CFTypeRef theItem = NULL;
if(GetCFType(inIndex, theItem))
{
@@ -210,14 +210,14 @@ bool CACFArray::GetFloat64(UInt32 inIndex, Float64& outItem) const
theAnswer = true;
}
}
-
+
return theAnswer;
}
bool CACFArray::Get4CC(UInt32 inIndex, UInt32& outValue) const
{
bool theAnswer = false;
-
+
CFTypeRef theValue = NULL;
if(GetCFType(inIndex, theValue))
{
@@ -237,14 +237,14 @@ bool CACFArray::Get4CC(UInt32 inIndex, UInt32& outValue) const
}
}
}
-
+
return theAnswer;
}
bool CACFArray::GetString(UInt32 inIndex, CFStringRef& outItem) const
{
bool theAnswer = false;
-
+
CFTypeRef theItem = NULL;
if(GetCFType(inIndex, theItem))
{
@@ -254,14 +254,14 @@ bool CACFArray::GetString(UInt32 inIndex, CFStringRef& outItem) const
theAnswer = true;
}
}
-
+
return theAnswer;
}
bool CACFArray::GetArray(UInt32 inIndex, CFArrayRef& outItem) const
{
bool theAnswer = false;
-
+
CFTypeRef theItem = NULL;
if(GetCFType(inIndex, theItem))
{
@@ -271,14 +271,14 @@ bool CACFArray::GetArray(UInt32 inIndex, CFArrayRef& outItem) const
theAnswer = true;
}
}
-
+
return theAnswer;
}
bool CACFArray::GetDictionary(UInt32 inIndex, CFDictionaryRef& outItem) const
{
bool theAnswer = false;
-
+
CFTypeRef theItem = NULL;
if(GetCFType(inIndex, theItem))
{
@@ -288,14 +288,14 @@ bool CACFArray::GetDictionary(UInt32 inIndex, CFDictionaryRef& outItem) const
theAnswer = true;
}
}
-
+
return theAnswer;
}
bool CACFArray::GetData(UInt32 inIndex, CFDataRef& outItem) const
{
bool theAnswer = false;
-
+
CFTypeRef theItem = NULL;
if(GetCFType(inIndex, theItem))
{
@@ -305,14 +305,14 @@ bool CACFArray::GetData(UInt32 inIndex, CFDataRef& outItem) const
theAnswer = true;
}
}
-
+
return theAnswer;
}
bool CACFArray::GetUUID(UInt32 inIndex, CFUUIDRef& outItem) const
{
bool theAnswer = false;
-
+
CFTypeRef theItem = NULL;
if(GetCFType(inIndex, theItem))
{
@@ -322,20 +322,20 @@ bool CACFArray::GetUUID(UInt32 inIndex, CFUUIDRef& outItem) const
theAnswer = true;
}
}
-
+
return theAnswer;
}
bool CACFArray::GetCFType(UInt32 inIndex, CFTypeRef& outItem) const
{
bool theAnswer = false;
-
+
if((mCFArray != NULL) && (inIndex < GetNumberItems()))
{
outItem = CFArrayGetValueAtIndex(mCFArray, static_cast<CFIndex>(inIndex));
theAnswer = outItem != NULL;
}
-
+
return theAnswer;
}
@@ -381,7 +381,7 @@ void CACFArray::GetCACFDictionary(UInt32 inIndex, CACFDictionary& outItem) const
bool CACFArray::AppendBool(bool inItem)
{
bool theAnswer = false;
-
+
if((mCFArray != NULL) && mMutable)
{
CACFBoolean theItem(inItem);
@@ -390,14 +390,14 @@ bool CACFArray::AppendBool(bool inItem)
theAnswer = AppendCFType(theItem.GetCFBoolean());
}
}
-
+
return theAnswer;
}
bool CACFArray::AppendSInt32(SInt32 inItem)
{
bool theAnswer = false;
-
+
if((mCFArray != NULL) && mMutable)
{
CACFNumber theItem(inItem);
@@ -406,14 +406,14 @@ bool CACFArray::AppendSInt32(SInt32 inItem)
theAnswer = AppendCFType(theItem.GetCFNumber());
}
}
-
+
return theAnswer;
}
bool CACFArray::AppendUInt32(UInt32 inItem)
{
bool theAnswer = false;
-
+
if((mCFArray != NULL) && mMutable)
{
CACFNumber theItem(inItem);
@@ -422,14 +422,14 @@ bool CACFArray::AppendUInt32(UInt32 inItem)
theAnswer = AppendCFType(theItem.GetCFNumber());
}
}
-
+
return theAnswer;
}
bool CACFArray::AppendSInt64(SInt64 inItem)
{
bool theAnswer = false;
-
+
if((mCFArray != NULL) && mMutable)
{
CACFNumber theItem(inItem);
@@ -438,14 +438,14 @@ bool CACFArray::AppendSInt64(SInt64 inItem)
theAnswer = AppendCFType(theItem.GetCFNumber());
}
}
-
+
return theAnswer;
}
bool CACFArray::AppendUInt64(UInt64 inItem)
{
bool theAnswer = false;
-
+
if((mCFArray != NULL) && mMutable)
{
CACFNumber theItem(inItem);
@@ -454,14 +454,14 @@ bool CACFArray::AppendUInt64(UInt64 inItem)
theAnswer = AppendCFType(theItem.GetCFNumber());
}
}
-
+
return theAnswer;
}
bool CACFArray::AppendFloat32(Float32 inItem)
{
bool theAnswer = false;
-
+
if((mCFArray != NULL) && mMutable)
{
CACFNumber theItem(inItem);
@@ -470,14 +470,14 @@ bool CACFArray::AppendFloat32(Float32 inItem)
theAnswer = AppendCFType(theItem.GetCFNumber());
}
}
-
+
return theAnswer;
}
bool CACFArray::AppendFloat64(Float64 inItem)
{
bool theAnswer = false;
-
+
if((mCFArray != NULL) && mMutable)
{
CACFNumber theItem(inItem);
@@ -486,7 +486,7 @@ bool CACFArray::AppendFloat64(Float64 inItem)
theAnswer = AppendCFType(theItem.GetCFNumber());
}
}
-
+
return theAnswer;
}
@@ -513,20 +513,20 @@ bool CACFArray::AppendData(const CFDataRef inItem)
bool CACFArray::AppendCFType(const CFTypeRef inItem)
{
bool theAnswer = false;
-
+
if((mCFArray != NULL) && mMutable)
{
CFArrayAppendValue(mCFArray, inItem);
theAnswer = true;
}
-
+
return theAnswer;
}
bool CACFArray::InsertBool(UInt32 inIndex, bool inItem)
{
bool theAnswer = false;
-
+
if((mCFArray != NULL) && mMutable)
{
CACFBoolean theItem(inItem);
@@ -535,14 +535,14 @@ bool CACFArray::InsertBool(UInt32 inIndex, bool inItem)
theAnswer = InsertCFType(inIndex, theItem.GetCFBoolean());
}
}
-
+
return theAnswer;
}
bool CACFArray::InsertSInt32(UInt32 inIndex, SInt32 inItem)
{
bool theAnswer = false;
-
+
if((mCFArray != NULL) && mMutable)
{
CACFNumber theItem(inItem);
@@ -551,14 +551,14 @@ bool CACFArray::InsertSInt32(UInt32 inIndex, SInt32 inItem)
theAnswer = InsertCFType(inIndex, theItem.GetCFNumber());
}
}
-
+
return theAnswer;
}
bool CACFArray::InsertUInt32(UInt32 inIndex, UInt32 inItem)
{
bool theAnswer = false;
-
+
if((mCFArray != NULL) && mMutable)
{
CACFNumber theItem(inItem);
@@ -567,14 +567,14 @@ bool CACFArray::InsertUInt32(UInt32 inIndex, UInt32 inItem)
theAnswer = InsertCFType(inIndex, theItem.GetCFNumber());
}
}
-
+
return theAnswer;
}
bool CACFArray::InsertSInt64(UInt32 inIndex, SInt64 inItem)
{
bool theAnswer = false;
-
+
if((mCFArray != NULL) && mMutable)
{
CACFNumber theItem(inItem);
@@ -583,14 +583,14 @@ bool CACFArray::InsertSInt64(UInt32 inIndex, SInt64 inItem)
theAnswer = InsertCFType(inIndex, theItem.GetCFNumber());
}
}
-
+
return theAnswer;
}
bool CACFArray::InsertUInt64(UInt32 inIndex, UInt64 inItem)
{
bool theAnswer = false;
-
+
if((mCFArray != NULL) && mMutable)
{
CACFNumber theItem(inItem);
@@ -599,14 +599,14 @@ bool CACFArray::InsertUInt64(UInt32 inIndex, UInt64 inItem)
theAnswer = InsertCFType(inIndex, theItem.GetCFNumber());
}
}
-
+
return theAnswer;
}
bool CACFArray::InsertFloat32(UInt32 inIndex, Float32 inItem)
{
bool theAnswer = false;
-
+
if((mCFArray != NULL) && mMutable)
{
CACFNumber theItem(inItem);
@@ -615,14 +615,14 @@ bool CACFArray::InsertFloat32(UInt32 inIndex, Float32 inItem)
theAnswer = InsertCFType(inIndex, theItem.GetCFNumber());
}
}
-
+
return theAnswer;
}
bool CACFArray::InsertFloat64(UInt32 inIndex, Float64 inItem)
{
bool theAnswer = false;
-
+
if((mCFArray != NULL) && mMutable)
{
CACFNumber theItem(inItem);
@@ -631,7 +631,7 @@ bool CACFArray::InsertFloat64(UInt32 inIndex, Float64 inItem)
theAnswer = InsertCFType(inIndex, theItem.GetCFNumber());
}
}
-
+
return theAnswer;
}
@@ -658,7 +658,7 @@ bool CACFArray::InsertData(UInt32 inIndex, const CFDataRef inItem)
bool CACFArray::InsertCFType(UInt32 inIndex, const CFTypeRef inItem)
{
bool theAnswer = false;
-
+
if((mCFArray != NULL) && mMutable)
{
if(inIndex < GetNumberItems())
@@ -671,14 +671,14 @@ bool CACFArray::InsertCFType(UInt32 inIndex, const CFTypeRef inItem)
}
theAnswer = true;
}
-
+
return theAnswer;
}
bool CACFArray::SetBool(UInt32 inIndex, bool inItem)
{
bool theAnswer = false;
-
+
if((mCFArray != NULL) && mMutable && (inIndex <= GetNumberItems()))
{
CACFBoolean theItem(inItem);
@@ -687,14 +687,14 @@ bool CACFArray::SetBool(UInt32 inIndex, bool inItem)
theAnswer = SetCFType(inIndex, theItem.GetCFBoolean());
}
}
-
+
return theAnswer;
}
bool CACFArray::SetSInt32(UInt32 inIndex, SInt32 inItem)
{
bool theAnswer = false;
-
+
if((mCFArray != NULL) && mMutable && (inIndex <= GetNumberItems()))
{
CACFNumber theItem(inItem);
@@ -703,14 +703,14 @@ bool CACFArray::SetSInt32(UInt32 inIndex, SInt32 inItem)
theAnswer = SetCFType(inIndex, theItem.GetCFNumber());
}
}
-
+
return theAnswer;
}
bool CACFArray::SetUInt32(UInt32 inIndex, UInt32 inItem)
{
bool theAnswer = false;
-
+
if((mCFArray != NULL) && mMutable && (inIndex <= GetNumberItems()))
{
CACFNumber theItem(inItem);
@@ -719,14 +719,14 @@ bool CACFArray::SetUInt32(UInt32 inIndex, UInt32 inItem)
theAnswer = SetCFType(inIndex, theItem.GetCFNumber());
}
}
-
+
return theAnswer;
}
bool CACFArray::SetSInt64(UInt32 inIndex, SInt64 inItem)
{
bool theAnswer = false;
-
+
if((mCFArray != NULL) && mMutable && (inIndex <= GetNumberItems()))
{
CACFNumber theItem(inItem);
@@ -735,14 +735,14 @@ bool CACFArray::SetSInt64(UInt32 inIndex, SInt64 inItem)
theAnswer = SetCFType(inIndex, theItem.GetCFNumber());
}
}
-
+
return theAnswer;
}
bool CACFArray::SetUInt64(UInt32 inIndex, UInt64 inItem)
{
bool theAnswer = false;
-
+
if((mCFArray != NULL) && mMutable && (inIndex <= GetNumberItems()))
{
CACFNumber theItem(inItem);
@@ -751,14 +751,14 @@ bool CACFArray::SetUInt64(UInt32 inIndex, UInt64 inItem)
theAnswer = SetCFType(inIndex, theItem.GetCFNumber());
}
}
-
+
return theAnswer;
}
bool CACFArray::SetFloat32(UInt32 inIndex, Float32 inItem)
{
bool theAnswer = false;
-
+
if((mCFArray != NULL) && mMutable && (inIndex <= GetNumberItems()))
{
CACFNumber theItem(inItem);
@@ -767,14 +767,14 @@ bool CACFArray::SetFloat32(UInt32 inIndex, Float32 inItem)
theAnswer = SetCFType(inIndex, theItem.GetCFNumber());
}
}
-
+
return theAnswer;
}
bool CACFArray::SetFloat64(UInt32 inIndex, Float64 inItem)
{
bool theAnswer = false;
-
+
if((mCFArray != NULL) && mMutable && (inIndex <= GetNumberItems()))
{
CACFNumber theItem(inItem);
@@ -783,7 +783,7 @@ bool CACFArray::SetFloat64(UInt32 inIndex, Float64 inItem)
theAnswer = SetCFType(inIndex, theItem.GetCFNumber());
}
}
-
+
return theAnswer;
}
@@ -810,12 +810,12 @@ bool CACFArray::SetData(UInt32 inIndex, const CFDataRef inItem)
bool CACFArray::SetCFType(UInt32 inIndex, const CFTypeRef inItem)
{
bool theAnswer = false;
-
+
if((mCFArray != NULL) && mMutable && (inIndex <= GetNumberItems()))
{
CFArraySetValueAtIndex(mCFArray, static_cast<CFIndex>(inIndex), inItem);
theAnswer = true;
}
-
+
return theAnswer;
}
diff --git a/libs/appleutility/CoreAudio/PublicUtility/CACFArray.h b/libs/appleutility/CoreAudio/PublicUtility/CACFArray.h
index 89c8c559e4..4c9fb79a6c 100644
--- a/libs/appleutility/CoreAudio/PublicUtility/CACFArray.h
+++ b/libs/appleutility/CoreAudio/PublicUtility/CACFArray.h
@@ -2,14 +2,14 @@
File: CACFArray.h
Abstract: Part of CoreAudio Utility Classes
Version: 1.1
-
+
Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple
Inc. ("Apple") in consideration of your agreement to the following
terms, and your use, installation, modification or redistribution of
this Apple software constitutes acceptance of these terms. If you do
not agree with these terms, please do not use, install, modify or
redistribute this Apple software.
-
+
In consideration of your agreement to abide by the following terms, and
subject to these terms, Apple grants you a personal, non-exclusive
license, under Apple's copyrights in this original Apple software (the
@@ -25,13 +25,13 @@
implied, are granted by Apple herein, including but not limited to any
patent rights that may be infringed by your derivative works or by other
works in which the Apple Software may be incorporated.
-
+
The Apple Software is provided by Apple on an "AS IS" basis. APPLE
MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND
OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
-
+
IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
@@ -40,9 +40,9 @@
AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),
STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
-
+
Copyright (C) 2014 Apple Inc. All Rights Reserved.
-
+
*/
#if !defined(__CACFArray_h__)
#define __CACFArray_h__
@@ -92,21 +92,21 @@ public:
private:
void Retain() { if(mRelease && (mCFArray != NULL)) { CFRetain(mCFArray); } }
void Release() { if(mRelease && (mCFArray != NULL)) { CFRelease(mCFArray); } }
-
+
// Attributes
public:
bool IsValid() const { return mCFArray != NULL; }
bool IsMutable() const { return mMutable; }
bool CanModify() const { return mMutable && (mCFArray != NULL); }
-
+
bool WillRelease() const { return mRelease; }
void ShouldRelease(bool inRelease) { mRelease = inRelease; }
-
+
CFTypeID GetTypeID() const { return CFGetTypeID(mCFArray); }
-
+
CFArrayRef GetCFArray() const { return mCFArray; }
CFArrayRef CopyCFArray() const { if(mCFArray != NULL) { CFRetain(mCFArray); } return mCFArray; }
-
+
CFMutableArrayRef GetCFMutableArray() const { return mCFArray; }
CFMutableArrayRef CopyCFMutableArray() const { if(mCFArray != NULL) { CFRetain(mCFArray); } return mCFArray; }
CFPropertyListRef AsPropertyList() const { return mCFArray; }
@@ -124,7 +124,7 @@ public:
void Sort(CFComparatorFunction inCompareFunction) { if(CanModify()) { CFRange theRange = { 0, CFArrayGetCount(mCFArray) }; CFArraySortValues(mCFArray, theRange, inCompareFunction, NULL); } }
void SortNumbers() { Sort((CFComparatorFunction)CFNumberCompare); }
void SortStrings() { Sort((CFComparatorFunction)CFStringCompare); }
-
+
bool GetBool(UInt32 inIndex, bool& outValue) const;
bool GetSInt32(UInt32 inIndex, SInt32& outItem) const;
bool GetUInt32(UInt32 inIndex, UInt32& outItem) const;
@@ -139,11 +139,11 @@ public:
bool GetData(UInt32 inIndex, CFDataRef& outItem) const;
bool GetUUID(UInt32 inIndex, CFUUIDRef& outItem) const;
bool GetCFType(UInt32 inIndex, CFTypeRef& outItem) const;
-
+
void GetCACFString(UInt32 inIndex, CACFString& outItem) const;
void GetCACFArray(UInt32 inIndex, CACFArray& outItem) const;
void GetCACFDictionary(UInt32 inIndex, CACFDictionary& outItem) const;
-
+
bool AppendBool(bool inItem);
bool AppendSInt32(SInt32 inItem);
bool AppendUInt32(UInt32 inItem);
@@ -156,7 +156,7 @@ public:
bool AppendDictionary(const CFDictionaryRef inItem);
bool AppendData(const CFDataRef inItem);
bool AppendCFType(const CFTypeRef inItem);
-
+
bool InsertBool(UInt32 inIndex, bool inItem);
bool InsertSInt32(UInt32 inIndex, SInt32 inItem);
bool InsertUInt32(UInt32 inIndex, UInt32 inItem);
@@ -169,7 +169,7 @@ public:
bool InsertDictionary(UInt32 inIndex, const CFDictionaryRef inItem);
bool InsertData(UInt32 inIndex, const CFDataRef inItem);
bool InsertCFType(UInt32 inIndex, const CFTypeRef inItem);
-
+
bool SetBool(UInt32 inIndex, bool inItem);
bool SetSInt32(UInt32 inIndex, SInt32 inItem);
bool SetUInt32(UInt32 inIndex, UInt32 inItem);
@@ -188,7 +188,7 @@ private:
CFMutableArrayRef mCFArray;
bool mRelease;
bool mMutable;
-
+
CACFArray(const void*); // prevent accidental instantiation with a pointer via bool constructor
};
diff --git a/libs/appleutility/CoreAudio/PublicUtility/CACFData.h b/libs/appleutility/CoreAudio/PublicUtility/CACFData.h
index 7ce08dcf13..b289f602f6 100644
--- a/libs/appleutility/CoreAudio/PublicUtility/CACFData.h
+++ b/libs/appleutility/CoreAudio/PublicUtility/CACFData.h
@@ -2,14 +2,14 @@
File: CACFData.h
Abstract: Part of CoreAudio Utility Classes
Version: 1.1
-
+
Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple
Inc. ("Apple") in consideration of your agreement to the following
terms, and your use, installation, modification or redistribution of
this Apple software constitutes acceptance of these terms. If you do
not agree with these terms, please do not use, install, modify or
redistribute this Apple software.
-
+
In consideration of your agreement to abide by the following terms, and
subject to these terms, Apple grants you a personal, non-exclusive
license, under Apple's copyrights in this original Apple software (the
@@ -25,13 +25,13 @@
implied, are granted by Apple herein, including but not limited to any
patent rights that may be infringed by your derivative works or by other
works in which the Apple Software may be incorporated.
-
+
The Apple Software is provided by Apple on an "AS IS" basis. APPLE
MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND
OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
-
+
IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
@@ -40,9 +40,9 @@
AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),
STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
-
+
Copyright (C) 2014 Apple Inc. All Rights Reserved.
-
+
*/
#if !defined(__CACFData_h__)
#define __CACFData_h__
@@ -81,7 +81,7 @@ public:
private:
void Retain() { if(mWillRelease && (mCFData != NULL)) { CFRetain(mCFData); } }
void Release() { if(mWillRelease && (mCFData != NULL)) { CFRelease(mCFData); } }
-
+
CFDataRef mCFData;
bool mWillRelease;
@@ -95,11 +95,11 @@ public:
public:
CFDataRef GetCFData() const { return mCFData; }
CFDataRef CopyCFData() const { if(mCFData != NULL) { CFRetain(mCFData); } return mCFData; }
-
+
UInt32 GetSize() const { return ToUInt32(CFDataGetLength(mCFData)); }
const void* GetDataPtr() const { return CFDataGetBytePtr(mCFData); }
void CopyData(UInt32 inStartOffset, void* outData, UInt32 inDataSize) const { CFRange theRange = { static_cast<CFIndex>(inStartOffset), static_cast<CFIndex>(inDataSize) }; CFDataGetBytes(mCFData, theRange, static_cast<UInt8*>(outData)); }
-
+
SInt32 GetSInt32() const { SInt32 theAnswer = 0; CopyData(0, &theAnswer, SizeOf32(SInt32)); return theAnswer; }
Float32 GetFloat32() const { Float32 theAnswer = 0; CopyData(0, &theAnswer, SizeOf32(Float32)); return theAnswer; }
diff --git a/libs/appleutility/CoreAudio/PublicUtility/CACFDictionary.cpp b/libs/appleutility/CoreAudio/PublicUtility/CACFDictionary.cpp
index fbac774ab5..a488a8560d 100644
--- a/libs/appleutility/CoreAudio/PublicUtility/CACFDictionary.cpp
+++ b/libs/appleutility/CoreAudio/PublicUtility/CACFDictionary.cpp
@@ -2,14 +2,14 @@
File: CACFDictionary.cpp
Abstract: CACFDictionary.h
Version: 1.1
-
+
Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple
Inc. ("Apple") in consideration of your agreement to the following
terms, and your use, installation, modification or redistribution of
this Apple software constitutes acceptance of these terms. If you do
not agree with these terms, please do not use, install, modify or
redistribute this Apple software.
-
+
In consideration of your agreement to abide by the following terms, and
subject to these terms, Apple grants you a personal, non-exclusive
license, under Apple's copyrights in this original Apple software (the
@@ -25,13 +25,13 @@
implied, are granted by Apple herein, including but not limited to any
patent rights that may be infringed by your derivative works or by other
works in which the Apple Software may be incorporated.
-
+
The Apple Software is provided by Apple on an "AS IS" basis. APPLE
MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND
OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
-
+
IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
@@ -40,9 +40,9 @@
AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),
STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
-
+
Copyright (C) 2014 Apple Inc. All Rights Reserved.
-
+
*/
//=============================================================================
// Includes
@@ -83,7 +83,7 @@ void CACFDictionary::GetKeysAndValues (const void **keys, const void **values) c
bool CACFDictionary::GetBool(const CFStringRef inKey, bool& outValue) const
{
bool theAnswer = false;
-
+
CFTypeRef theValue = NULL;
if(GetCFType(inKey, theValue))
{
@@ -100,14 +100,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))
{
@@ -117,14 +117,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))
{
@@ -134,14 +134,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))
{
@@ -151,14 +151,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))
{
@@ -168,14 +168,14 @@ bool CACFDictionary::GetUInt64(const CFStringRef inKey, UInt64& outValue) const
theAnswer = true;
}
}
-
+
return theAnswer;
}
bool CACFDictionary::GetFloat32FromString(const CFStringRef inKey, Float32& outValue) const
{
bool theAnswer = false;
-
+
CFTypeRef theValue = NULL;
if(GetCFType(inKey, theValue))
{
@@ -184,14 +184,14 @@ bool CACFDictionary::GetFloat32FromString(const CFStringRef inKey, Float32& outV
outValue = static_cast<Float32>(CFStringGetDoubleValue(static_cast<CFStringRef>(theValue)));
}
}
-
+
return theAnswer;
}
bool CACFDictionary::GetUInt32FromString(const CFStringRef inKey, UInt32& outValue) const
{
bool theAnswer = false;
-
+
CFTypeRef theValue = NULL;
if(GetCFType(inKey, theValue))
{
@@ -200,14 +200,14 @@ bool CACFDictionary::GetUInt32FromString(const CFStringRef inKey, UInt32& outVal
outValue = CFStringGetIntValue(static_cast<CFStringRef>(theValue));
}
}
-
+
return theAnswer;
}
bool CACFDictionary::GetFloat32(const CFStringRef inKey, Float32& outValue) const
{
bool theAnswer = false;
-
+
CFTypeRef theValue = NULL;
if(GetCFType(inKey, theValue))
{
@@ -217,14 +217,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))
{
@@ -234,14 +234,14 @@ bool CACFDictionary::GetFloat64(const CFStringRef inKey, Float64& outValue) cons
theAnswer = true;
}
}
-
+
return theAnswer;
}
bool CACFDictionary::GetFixed32(const CFStringRef inKey, Float32& outValue) const
{
bool theAnswer = false;
-
+
CFTypeRef theValue = NULL;
if(GetCFType(inKey, theValue))
{
@@ -249,7 +249,7 @@ bool CACFDictionary::GetFixed32(const CFStringRef inKey, Float32& outValue) cons
{
SInt32 theFixed32 = 0;
CFNumberGetValue(static_cast<CFNumberRef>(theValue), kCFNumberSInt32Type, &theFixed32);
-
+
// this is a 16.16 value so convert it to a float
Float32 theSign = theFixed32 < 0 ? -1.0f : 1.0f;
theFixed32 *= (SInt32)theSign;
@@ -260,14 +260,14 @@ bool CACFDictionary::GetFixed32(const CFStringRef inKey, Float32& outValue) cons
theAnswer = true;
}
}
-
+
return theAnswer;
}
bool CACFDictionary::GetFixed64(const CFStringRef inKey, Float64& outValue) const
{
bool theAnswer = false;
-
+
CFTypeRef theValue = NULL;
if(GetCFType(inKey, theValue))
{
@@ -280,14 +280,14 @@ bool CACFDictionary::GetFixed64(const CFStringRef inKey, Float64& outValue) cons
theAnswer = true;
}
}
-
+
return theAnswer;
}
bool CACFDictionary::Get4CC(const CFStringRef inKey, UInt32& outValue) const
{
bool theAnswer = false;
-
+
CFTypeRef theValue = NULL;
if(GetCFType(inKey, theValue))
{
@@ -307,14 +307,14 @@ bool CACFDictionary::Get4CC(const CFStringRef inKey, UInt32& outValue) const
}
}
}
-
+
return theAnswer;
}
bool CACFDictionary::GetString(const CFStringRef inKey, CFStringRef& outValue) const
{
bool theAnswer = false;
-
+
CFTypeRef theValue = NULL;
if(GetCFType(inKey, theValue))
{
@@ -324,14 +324,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))
{
@@ -341,14 +341,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))
{
@@ -358,14 +358,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))
{
@@ -375,27 +375,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::GetURL(const CFStringRef inKey, CFURLRef& outValue) const
{
bool theAnswer = false;
-
+
CFTypeRef theValue = NULL;
if(GetCFType(inKey, theValue))
{
@@ -405,14 +405,14 @@ bool CACFDictionary::GetURL(const CFStringRef inKey, CFURLRef& outValue) const
theAnswer = true;
}
}
-
+
return theAnswer;
}
bool CACFDictionary::GetCFTypeWithCStringKey(const char* inKey, CFTypeRef& outValue) const
{
bool theAnswer = false;
-
+
if(mCFDictionary != NULL)
{
CACFString theKey(inKey);
@@ -421,7 +421,7 @@ bool CACFDictionary::GetCFTypeWithCStringKey(const char* inKey, CFTypeRef& outVa
theAnswer = GetCFType(theKey.GetCFString(), outValue);
}
}
-
+
return theAnswer;
}
@@ -437,7 +437,7 @@ void CACFDictionary::GetCACFString(const CFStringRef inKey, CACFString& outValue
}
}
}
-
+
void CACFDictionary::GetCACFArray(const CFStringRef inKey, CACFArray& outValue) const
{
outValue = static_cast<CFArrayRef>(NULL);
@@ -450,7 +450,7 @@ void CACFDictionary::GetCACFArray(const CFStringRef inKey, CACFArray& outValue)
}
}
}
-
+
void CACFDictionary::GetCACFDictionary(const CFStringRef inKey, CACFDictionary& outValue) const
{
outValue = static_cast<CFDictionaryRef>(NULL);
@@ -539,7 +539,7 @@ bool CACFDictionary::AddURL(const CFStringRef inKey, const CFURLRef inValue)
bool CACFDictionary::AddCFTypeWithCStringKey(const char* inKey, const CFTypeRef inValue)
{
bool theAnswer = false;
-
+
if (inKey)
{
CACFString theKey(inKey);
@@ -548,14 +548,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 (inValue)
{
CACFString theValue(inValue);
@@ -570,12 +570,12 @@ bool CACFDictionary::AddCString(const CFStringRef inKey, const char* inValue)
bool CACFDictionary::AddCFType(const CFStringRef inKey, const CFTypeRef inValue)
{
bool theAnswer = false;
-
+
if(mMutable && (mCFDictionary != NULL) && inValue)
{
CFDictionarySetValue(mCFDictionary, inKey, inValue);
theAnswer = true;
}
-
+
return theAnswer;
}
diff --git a/libs/appleutility/CoreAudio/PublicUtility/CACFDictionary.h b/libs/appleutility/CoreAudio/PublicUtility/CACFDictionary.h
index c389e50042..db61f6382f 100644
--- a/libs/appleutility/CoreAudio/PublicUtility/CACFDictionary.h
+++ b/libs/appleutility/CoreAudio/PublicUtility/CACFDictionary.h
@@ -2,14 +2,14 @@
File: CACFDictionary.h
Abstract: Part of CoreAudio Utility Classes
Version: 1.1
-
+
Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple
Inc. ("Apple") in consideration of your agreement to the following
terms, and your use, installation, modification or redistribution of
this Apple software constitutes acceptance of these terms. If you do
not agree with these terms, please do not use, install, modify or
redistribute this Apple software.
-
+
In consideration of your agreement to abide by the following terms, and
subject to these terms, Apple grants you a personal, non-exclusive
license, under Apple's copyrights in this original Apple software (the
@@ -25,13 +25,13 @@
implied, are granted by Apple herein, including but not limited to any
patent rights that may be infringed by your derivative works or by other
works in which the Apple Software may be incorporated.
-
+
The Apple Software is provided by Apple on an "AS IS" basis. APPLE
MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND
OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
-
+
IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
@@ -40,9 +40,9 @@
AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),
STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
-
+
Copyright (C) 2014 Apple Inc. All Rights Reserved.
-
+
*/
#if !defined(__CACFDictionary_h__)
#define __CACFDictionary_h__
@@ -69,7 +69,7 @@ class CACFString;
// CACFDictionary
//=============================================================================
-class CACFDictionary
+class CACFDictionary
{
// Construction/Destruction
@@ -79,24 +79,24 @@ public:
CACFDictionary(CFDictionaryRef inCFDictionary, bool inRelease) : mCFDictionary(const_cast<CFMutableDictionaryRef>(inCFDictionary)), mRelease(inRelease), mMutable(false) {}
CACFDictionary(CFMutableDictionaryRef inCFDictionary, bool inRelease) : mCFDictionary(inCFDictionary), mRelease(inRelease), mMutable(true) {}
CACFDictionary(const CACFDictionary& inDictionary) : mCFDictionary(inDictionary.mCFDictionary), mRelease(inDictionary.mRelease), mMutable(inDictionary.mMutable) { Retain(); }
- CACFDictionary& operator=(const CACFDictionary& inDictionary) { Release(); mCFDictionary = inDictionary.mCFDictionary; mRelease = inDictionary.mRelease; mMutable = inDictionary.mMutable; Retain(); return *this; }
- CACFDictionary& operator=(CFDictionaryRef inDictionary) { Release(); mCFDictionary = const_cast<CFMutableDictionaryRef>(inDictionary); mMutable = false; Retain(); return *this; }
- CACFDictionary& operator=(CFMutableDictionaryRef inDictionary) { Release(); mCFDictionary = inDictionary; mMutable = true; Retain(); return *this; }
+ CACFDictionary& operator=(const CACFDictionary& inDictionary) { Release(); mCFDictionary = inDictionary.mCFDictionary; mRelease = inDictionary.mRelease; mMutable = inDictionary.mMutable; Retain(); return *this; }
+ CACFDictionary& operator=(CFDictionaryRef inDictionary) { Release(); mCFDictionary = const_cast<CFMutableDictionaryRef>(inDictionary); mMutable = false; Retain(); return *this; }
+ CACFDictionary& operator=(CFMutableDictionaryRef inDictionary) { Release(); mCFDictionary = inDictionary; mMutable = true; Retain(); return *this; }
~CACFDictionary() { Release(); }
private:
void Retain() { if(mRelease && (mCFDictionary != NULL)) { CFRetain(mCFDictionary); } }
void Release() { 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; }
@@ -116,7 +116,7 @@ public:
UInt32 Size() const;
void GetKeys(const void** keys) const;
void GetKeysAndValues (const void **keys, const void **values) 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;
@@ -129,9 +129,9 @@ public:
bool GetFixed32(const CFStringRef inKey, Float32& outValue) const;
bool GetFixed64(const CFStringRef inKey, Float64& outValue) const;
bool Get4CC(const CFStringRef inKey, UInt32& 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 GetURL(const CFStringRef inKey, CFURLRef& outValue) const;
@@ -140,7 +140,7 @@ public:
void GetCACFString(const CFStringRef inKey, CACFString& outItem) const;
void GetCACFArray(const CFStringRef inKey, CACFArray& outItem) const;
void GetCACFDictionary(const CFStringRef inKey, CACFDictionary& outItem) const;
-
+
bool AddBool(const CFStringRef inKey, bool inValue);
bool AddSInt32(const CFStringRef inKey, SInt32 inValue);
bool AddUInt32(const CFStringRef inKey, UInt32 inValue);
@@ -155,21 +155,21 @@ public:
bool AddData(const CFStringRef inKey, const CFDataRef inValue);
bool AddCFType(const CFStringRef inKey, const CFTypeRef inValue);
bool AddURL(const CFStringRef inKey, const CFURLRef inValue);
-
+
bool AddCFTypeWithCStringKey(const char* inKey, const CFTypeRef inValue);
bool AddCString(const CFStringRef inKey, const char* inValue);
void RemoveKey(const CFStringRef inKey) { if(CanModify()) { CFDictionaryRemoveValue(mCFDictionary, inKey); } }
void Clear() { if(CanModify()) { CFDictionaryRemoveAllValues(mCFDictionary); } }
-
+
void Show() { CFShow(mCFDictionary); }
-
+
// Implementation
private:
CFMutableDictionaryRef mCFDictionary;
bool mRelease;
bool mMutable;
-
+
CACFDictionary(const void*); // prevent accidental instantiation with a pointer via bool constructor
};
diff --git a/libs/appleutility/CoreAudio/PublicUtility/CACFDistributedNotification.cpp b/libs/appleutility/CoreAudio/PublicUtility/CACFDistributedNotification.cpp
index 36c6923e2d..7744ef25cb 100644
--- a/libs/appleutility/CoreAudio/PublicUtility/CACFDistributedNotification.cpp
+++ b/libs/appleutility/CoreAudio/PublicUtility/CACFDistributedNotification.cpp
@@ -2,14 +2,14 @@
File: CACFDistributedNotification.cpp
Abstract: CACFDistributedNotification.h
Version: 1.1
-
+
Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple
Inc. ("Apple") in consideration of your agreement to the following
terms, and your use, installation, modification or redistribution of
this Apple software constitutes acceptance of these terms. If you do
not agree with these terms, please do not use, install, modify or
redistribute this Apple software.
-
+
In consideration of your agreement to abide by the following terms, and
subject to these terms, Apple grants you a personal, non-exclusive
license, under Apple's copyrights in this original Apple software (the
@@ -25,13 +25,13 @@
implied, are granted by Apple herein, including but not limited to any
patent rights that may be infringed by your derivative works or by other
works in which the Apple Software may be incorporated.
-
+
The Apple Software is provided by Apple on an "AS IS" basis. APPLE
MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND
OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
-
+
IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
@@ -40,9 +40,9 @@
AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),
STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
-
+
Copyright (C) 2014 Apple Inc. All Rights Reserved.
-
+
*/
//==================================================================================================
// Includes
@@ -68,7 +68,7 @@ void CACFDistributedNotification::AddObserver(const void* inObserver, CFNotifica
CFNotificationCenterRef theCenter = CFNotificationCenterGetDarwinNotifyCenter();
CFNotificationSuspensionBehavior theSuspensionBehavior = static_cast<CFNotificationSuspensionBehavior>(0);
#endif
-
+
CFNotificationCenterAddObserver(theCenter, inObserver, inCallback, inName, NULL, theSuspensionBehavior);
}
@@ -79,7 +79,7 @@ void CACFDistributedNotification::RemoveObserver(const void* inObserver, CFStrin
#else
CFNotificationCenterRef theCenter = CFNotificationCenterGetDarwinNotifyCenter();
#endif
-
+
CFNotificationCenterRemoveObserver(theCenter, inObserver, inName, NULL);
}
@@ -97,11 +97,11 @@ void CACFDistributedNotification::PostNotification(CFStringRef inName, CFDiction
// flag unsupported features
Assert(inUserInfo == NULL, "CACFDistributedNotification::PostNotification: distributed notifications do not support a payload");
Assert(inPostToAllSessions, "CACFDistributedNotification::PostNotification: distributed notifications do not support per-session delivery");
-
+
CFNotificationCenterRef theCenter = CFNotificationCenterGetDarwinNotifyCenter();
CFDictionaryRef theUserInfo = NULL;
CFOptionFlags theFlags = 0;
#endif
-
+
CFNotificationCenterPostNotificationWithOptions(theCenter, inName, NULL, theUserInfo, theFlags);
}
diff --git a/libs/appleutility/CoreAudio/PublicUtility/CACFDistributedNotification.h b/libs/appleutility/CoreAudio/PublicUtility/CACFDistributedNotification.h
index d75e23bd8a..8132379444 100644
--- a/libs/appleutility/CoreAudio/PublicUtility/CACFDistributedNotification.h
+++ b/libs/appleutility/CoreAudio/PublicUtility/CACFDistributedNotification.h
@@ -2,14 +2,14 @@
File: CACFDistributedNotification.h
Abstract: Part of CoreAudio Utility Classes
Version: 1.1
-
+
Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple
Inc. ("Apple") in consideration of your agreement to the following
terms, and your use, installation, modification or redistribution of
this Apple software constitutes acceptance of these terms. If you do
not agree with these terms, please do not use, install, modify or
redistribute this Apple software.
-
+
In consideration of your agreement to abide by the following terms, and
subject to these terms, Apple grants you a personal, non-exclusive
license, under Apple's copyrights in this original Apple software (the
@@ -25,13 +25,13 @@
implied, are granted by Apple herein, including but not limited to any
patent rights that may be infringed by your derivative works or by other
works in which the Apple Software may be incorporated.
-
+
The Apple Software is provided by Apple on an "AS IS" basis. APPLE
MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND
OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
-
+
IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
@@ -40,9 +40,9 @@
AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),
STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
-
+
Copyright (C) 2014 Apple Inc. All Rights Reserved.
-
+
*/
#if !defined(__CACFDistributedNotification_h__)
#define __CACFDistributedNotification_h__
diff --git a/libs/appleutility/CoreAudio/PublicUtility/CACFMachPort.cpp b/libs/appleutility/CoreAudio/PublicUtility/CACFMachPort.cpp
index 9a33d5dae1..520c37ab8b 100644
--- a/libs/appleutility/CoreAudio/PublicUtility/CACFMachPort.cpp
+++ b/libs/appleutility/CoreAudio/PublicUtility/CACFMachPort.cpp
@@ -2,14 +2,14 @@
File: CACFMachPort.cpp
Abstract: CACFMachPort.h
Version: 1.1
-
+
Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple
Inc. ("Apple") in consideration of your agreement to the following
terms, and your use, installation, modification or redistribution of
this Apple software constitutes acceptance of these terms. If you do
not agree with these terms, please do not use, install, modify or
redistribute this Apple software.
-
+
In consideration of your agreement to abide by the following terms, and
subject to these terms, Apple grants you a personal, non-exclusive
license, under Apple's copyrights in this original Apple software (the
@@ -25,13 +25,13 @@
implied, are granted by Apple herein, including but not limited to any
patent rights that may be infringed by your derivative works or by other
works in which the Apple Software may be incorporated.
-
+
The Apple Software is provided by Apple on an "AS IS" basis. APPLE
MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND
OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
-
+
IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
@@ -40,9 +40,9 @@
AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),
STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
-
+
Copyright (C) 2014 Apple Inc. All Rights Reserved.
-
+
*/
//==================================================================================================
// Includes
@@ -93,7 +93,7 @@ CACFMachPort::CACFMachPort(mach_port_t inMachPort, CFMachPortCallBack inCallBack
mOwnsPort(false)
{
CFMachPortContext theContext = { 1, inUserData, NULL, NULL, NULL };
-
+
if(inMachPort == MACH_PORT_NULL)
{
mMachPort = CFMachPortCreate(NULL, inCallBack, &theContext, NULL);
@@ -119,7 +119,7 @@ CACFMachPort::CACFMachPort(mach_port_t inMachPort, CFMachPortCallBack inCallBack
DebugMessage("CACFMachPort::CACFMachPort: couldn't create the CFRunLoopSource");
throw CAException('what');
}
-
+
if(inInvalidationCallBack != NULL)
{
CFMachPortSetInvalidationCallBack(mMachPort, inInvalidationCallBack);
@@ -132,7 +132,7 @@ CACFMachPort::~CACFMachPort()
{
CFRelease(mRunLoopSource);
}
-
+
if(mMachPort != NULL)
{
if(mOwnsPort)
@@ -162,7 +162,7 @@ kern_return_t CACFMachPort::ReceiveMessage(UInt32 inMaxMessageSize, mach_msg_hea
{
theOptions |= MACH_RCV_TIMEOUT;
}
-
+
// receive the messsage
return mach_msg(outMessage, theOptions, 0, inMaxMessageSize, thePort, inTimeOut, MACH_PORT_NULL);
}
diff --git a/libs/appleutility/CoreAudio/PublicUtility/CACFMachPort.h b/libs/appleutility/CoreAudio/PublicUtility/CACFMachPort.h
index 18b8ccc6c2..1eb11d2782 100644
--- a/libs/appleutility/CoreAudio/PublicUtility/CACFMachPort.h
+++ b/libs/appleutility/CoreAudio/PublicUtility/CACFMachPort.h
@@ -2,14 +2,14 @@
File: CACFMachPort.h
Abstract: Part of CoreAudio Utility Classes
Version: 1.1
-
+
Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple
Inc. ("Apple") in consideration of your agreement to the following
terms, and your use, installation, modification or redistribution of
this Apple software constitutes acceptance of these terms. If you do
not agree with these terms, please do not use, install, modify or
redistribute this Apple software.
-
+
In consideration of your agreement to abide by the following terms, and
subject to these terms, Apple grants you a personal, non-exclusive
license, under Apple's copyrights in this original Apple software (the
@@ -25,13 +25,13 @@
implied, are granted by Apple herein, including but not limited to any
patent rights that may be infringed by your derivative works or by other
works in which the Apple Software may be incorporated.
-
+
The Apple Software is provided by Apple on an "AS IS" basis. APPLE
MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND
OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
-
+
IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
@@ -40,9 +40,9 @@
AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),
STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
-
+
Copyright (C) 2014 Apple Inc. All Rights Reserved.
-
+
*/
#if !defined(__CACFMachPort_h__)
#define __CACFMachPort_h__
@@ -59,7 +59,7 @@
// CACFMachPort
//
// This class wraps a CFMachPort.
-//
+//
// Note that when you create a CFMachPort object, CF will attach the run loop source for the the
// Mach Port that handles Port Death notifications (aka the Invalidation Callback) to the current
// thread's run loop. This is something over which there is no control, so be sure to create the
diff --git a/libs/appleutility/CoreAudio/PublicUtility/CACFMessagePort.cpp b/libs/appleutility/CoreAudio/PublicUtility/CACFMessagePort.cpp
index 97b5da1dd9..c56a7acec6 100644
--- a/libs/appleutility/CoreAudio/PublicUtility/CACFMessagePort.cpp
+++ b/libs/appleutility/CoreAudio/PublicUtility/CACFMessagePort.cpp
@@ -2,14 +2,14 @@
File: CACFMessagePort.cpp
Abstract: CACFMessagePort.h
Version: 1.1
-
+
Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple
Inc. ("Apple") in consideration of your agreement to the following
terms, and your use, installation, modification or redistribution of
this Apple software constitutes acceptance of these terms. If you do
not agree with these terms, please do not use, install, modify or
redistribute this Apple software.
-
+
In consideration of your agreement to abide by the following terms, and
subject to these terms, Apple grants you a personal, non-exclusive
license, under Apple's copyrights in this original Apple software (the
@@ -25,13 +25,13 @@
implied, are granted by Apple herein, including but not limited to any
patent rights that may be infringed by your derivative works or by other
works in which the Apple Software may be incorporated.
-
+
The Apple Software is provided by Apple on an "AS IS" basis. APPLE
MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND
OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
-
+
IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
@@ -40,9 +40,9 @@
AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),
STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
-
+
Copyright (C) 2014 Apple Inc. All Rights Reserved.
-
+
*/
//=============================================================================
// Includes
@@ -123,7 +123,7 @@ CACFRemoteMessagePort::CACFRemoteMessagePort(CFStringRef inName, CFMessagePortIn
// because it isn't really an error since the port in question may not
// exist and this fact requires a more complex response than an excpeption
// provides for.
-
+
// add the invalidation callback, if any
if(inInvalidationCallBack != NULL)
{
diff --git a/libs/appleutility/CoreAudio/PublicUtility/CACFMessagePort.h b/libs/appleutility/CoreAudio/PublicUtility/CACFMessagePort.h
index c369251664..e5b6dab294 100644
--- a/libs/appleutility/CoreAudio/PublicUtility/CACFMessagePort.h
+++ b/libs/appleutility/CoreAudio/PublicUtility/CACFMessagePort.h
@@ -2,14 +2,14 @@
File: CACFMessagePort.h
Abstract: Part of CoreAudio Utility Classes
Version: 1.1
-
+
Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple
Inc. ("Apple") in consideration of your agreement to the following
terms, and your use, installation, modification or redistribution of
this Apple software constitutes acceptance of these terms. If you do
not agree with these terms, please do not use, install, modify or
redistribute this Apple software.
-
+
In consideration of your agreement to abide by the following terms, and
subject to these terms, Apple grants you a personal, non-exclusive
license, under Apple's copyrights in this original Apple software (the
@@ -25,13 +25,13 @@
implied, are granted by Apple herein, including but not limited to any
patent rights that may be infringed by your derivative works or by other
works in which the Apple Software may be incorporated.
-
+
The Apple Software is provided by Apple on an "AS IS" basis. APPLE
MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND
OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
-
+
IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
@@ -40,9 +40,9 @@
AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),
STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
-
+
Copyright (C) 2014 Apple Inc. All Rights Reserved.
-
+
*/
#if !defined(__CACFMessagePort_h__)
#define __CACFMessagePort_h__
diff --git a/libs/appleutility/CoreAudio/PublicUtility/CACFNumber.cpp b/libs/appleutility/CoreAudio/PublicUtility/CACFNumber.cpp
index 36d1c2e2e2..7bb8345a03 100644
--- a/libs/appleutility/CoreAudio/PublicUtility/CACFNumber.cpp
+++ b/libs/appleutility/CoreAudio/PublicUtility/CACFNumber.cpp
@@ -2,14 +2,14 @@
File: CACFNumber.cpp
Abstract: CACFNumber.h
Version: 1.1
-
+
Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple
Inc. ("Apple") in consideration of your agreement to the following
terms, and your use, installation, modification or redistribution of
this Apple software constitutes acceptance of these terms. If you do
not agree with these terms, please do not use, install, modify or
redistribute this Apple software.
-
+
In consideration of your agreement to abide by the following terms, and
subject to these terms, Apple grants you a personal, non-exclusive
license, under Apple's copyrights in this original Apple software (the
@@ -25,13 +25,13 @@
implied, are granted by Apple herein, including but not limited to any
patent rights that may be infringed by your derivative works or by other
works in which the Apple Software may be incorporated.
-
+
The Apple Software is provided by Apple on an "AS IS" basis. APPLE
MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND
OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
-
+
IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
@@ -40,9 +40,9 @@
AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),
STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
-
+
Copyright (C) 2014 Apple Inc. All Rights Reserved.
-
+
*/
//=============================================================================
// Includes
@@ -57,27 +57,27 @@
Float32 CACFNumber::GetFixed32() const
{
SInt32 theFixedValue = GetSInt32();
-
+
// this is a 16.16 value so convert it to a float
Float32 theSign = theFixedValue < 0 ? -1.0f : 1.0f;
theFixedValue *= (SInt32)theSign;
Float32 theWholePart = (theFixedValue & 0x7FFF0000) >> 16;
Float32 theFractPart = theFixedValue & 0x0000FFFF;
theFractPart /= 65536.0f;
-
+
return theSign * (theWholePart + theFractPart);
}
Float64 CACFNumber::GetFixed64() const
{
SInt64 theFixedValue = GetSInt64();
-
+
// this is a 32.32 value so convert it to a double
Float64 theSign = theFixedValue < 0 ? -1.0 : 1.0;
theFixedValue *= (SInt64)theSign;
Float64 theWholePart = (theFixedValue & 0x7FFFFFFF00000000LL) >> 32;
Float64 theFractPart = theFixedValue & 0x00000000FFFFFFFFLL;
theFractPart /= 4294967296.0;
-
+
return theSign * (theWholePart + theFractPart);
}
diff --git a/libs/appleutility/CoreAudio/PublicUtility/CACFNumber.h b/libs/appleutility/CoreAudio/PublicUtility/CACFNumber.h
index 25887f6ca1..8bf34b49e6 100644
--- a/libs/appleutility/CoreAudio/PublicUtility/CACFNumber.h
+++ b/libs/appleutility/CoreAudio/PublicUtility/CACFNumber.h
@@ -2,14 +2,14 @@
File: CACFNumber.h
Abstract: Part of CoreAudio Utility Classes
Version: 1.1
-
+
Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple
Inc. ("Apple") in consideration of your agreement to the following
terms, and your use, installation, modification or redistribution of
this Apple software constitutes acceptance of these terms. If you do
not agree with these terms, please do not use, install, modify or
redistribute this Apple software.
-
+
In consideration of your agreement to abide by the following terms, and
subject to these terms, Apple grants you a personal, non-exclusive
license, under Apple's copyrights in this original Apple software (the
@@ -25,13 +25,13 @@
implied, are granted by Apple herein, including but not limited to any
patent rights that may be infringed by your derivative works or by other
works in which the Apple Software may be incorporated.
-
+
The Apple Software is provided by Apple on an "AS IS" basis. APPLE
MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND
OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
-
+
IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
@@ -40,9 +40,9 @@
AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),
STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
-
+
Copyright (C) 2014 Apple Inc. All Rights Reserved.
-
+
*/
#if !defined(__CACFNumber_h__)
#define __CACFNumber_h__
@@ -78,7 +78,7 @@ public:
private:
void Retain() { if(mWillRelease && (mCFBoolean != NULL)) { CFRetain(mCFBoolean); } }
void Release() { if(mWillRelease && (mCFBoolean != NULL)) { CFRelease(mCFBoolean); } }
-
+
CFBooleanRef mCFBoolean;
bool mWillRelease;
@@ -94,7 +94,7 @@ public:
CFBooleanRef CopyCFBoolean() const { if(mCFBoolean != NULL) { CFRetain(mCFBoolean); } return mCFBoolean; }
bool GetBoolean() const { bool theAnswer = false; if(mCFBoolean != NULL) { theAnswer = CFEqual(mCFBoolean, kCFBooleanTrue); } return theAnswer; }
-
+
CACFBoolean(const void*); // prevent accidental instantiation with a pointer via bool constructor
};
@@ -122,7 +122,7 @@ public:
private:
void Retain() { if(mWillRelease && (mCFNumber != NULL)) { CFRetain(mCFNumber); } }
void Release() { if(mWillRelease && (mCFNumber != NULL)) { CFRelease(mCFNumber); } }
-
+
CFNumberRef mCFNumber;
bool mWillRelease;
@@ -144,7 +144,7 @@ public:
Float32 GetFixed32() const;
Float64 GetFixed64() const;
SInt64 GetSInt64() const { SInt64 theAnswer = 0; if(mCFNumber != NULL) { CFNumberGetValue(mCFNumber, kCFNumberSInt64Type, &theAnswer); } return theAnswer; }
-
+
CACFNumber(const void*); // prevent accidental instantiation with a pointer via bool constructor
};
diff --git a/libs/appleutility/CoreAudio/PublicUtility/CACFObject.h b/libs/appleutility/CoreAudio/PublicUtility/CACFObject.h
index 748016b48f..7a4ed9d2b4 100644
--- a/libs/appleutility/CoreAudio/PublicUtility/CACFObject.h
+++ b/libs/appleutility/CoreAudio/PublicUtility/CACFObject.h
@@ -2,14 +2,14 @@
File: CACFObject.h
Abstract: Part of CoreAudio Utility Classes
Version: 1.1
-
+
Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple
Inc. ("Apple") in consideration of your agreement to the following
terms, and your use, installation, modification or redistribution of
this Apple software constitutes acceptance of these terms. If you do
not agree with these terms, please do not use, install, modify or
redistribute this Apple software.
-
+
In consideration of your agreement to abide by the following terms, and
subject to these terms, Apple grants you a personal, non-exclusive
license, under Apple's copyrights in this original Apple software (the
@@ -25,13 +25,13 @@
implied, are granted by Apple herein, including but not limited to any
patent rights that may be infringed by your derivative works or by other
works in which the Apple Software may be incorporated.
-
+
The Apple Software is provided by Apple on an "AS IS" basis. APPLE
MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND
OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
-
+
IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
@@ -40,9 +40,9 @@
AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),
STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
-
+
Copyright (C) 2014 Apple Inc. All Rights Reserved.
-
+
*/
#if !defined(__CACFObject_h__)
#define __CACFObject_h__
@@ -109,7 +109,7 @@ public:
private:
void Retain() { if(mWillRelease && (mCFObject != NULL)) { CFRetain(mCFObject); } }
void Release() { if(mWillRelease && (mCFObject != NULL)) { CFRelease(mCFObject); mCFObject = NULL; } }
-
+
CFObjectType mCFObject;
bool mWillRelease;
diff --git a/libs/appleutility/CoreAudio/PublicUtility/CACFPlugIn.h b/libs/appleutility/CoreAudio/PublicUtility/CACFPlugIn.h
index babde13b90..5dcf2b1e38 100644
--- a/libs/appleutility/CoreAudio/PublicUtility/CACFPlugIn.h
+++ b/libs/appleutility/CoreAudio/PublicUtility/CACFPlugIn.h
@@ -2,14 +2,14 @@
File: CACFPlugIn.h
Abstract: Part of CoreAudio Utility Classes
Version: 1.1
-
+
Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple
Inc. ("Apple") in consideration of your agreement to the following
terms, and your use, installation, modification or redistribution of
this Apple software constitutes acceptance of these terms. If you do
not agree with these terms, please do not use, install, modify or
redistribute this Apple software.
-
+
In consideration of your agreement to abide by the following terms, and
subject to these terms, Apple grants you a personal, non-exclusive
license, under Apple's copyrights in this original Apple software (the
@@ -25,13 +25,13 @@
implied, are granted by Apple herein, including but not limited to any
patent rights that may be infringed by your derivative works or by other
works in which the Apple Software may be incorporated.
-
+
The Apple Software is provided by Apple on an "AS IS" basis. APPLE
MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND
OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
-
+
IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
@@ -40,9 +40,9 @@
AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),
STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
-
+
Copyright (C) 2014 Apple Inc. All Rights Reserved.
-
+
*/
#if !defined(__CACFPlugIn_h__)
#define __CACFPlugIn_h__
@@ -75,7 +75,7 @@ public:
private:
void Retain() { if(mWillRelease && (mCFPlugIn != NULL)) { CFRetain(mCFPlugIn); } }
void Release() { if(mWillRelease && (mCFPlugIn != NULL)) { CFRelease(mCFPlugIn); mCFPlugIn = NULL; } }
-
+
CFPlugInRef mCFPlugIn;
bool mWillRelease;
@@ -84,7 +84,7 @@ public:
void AllowRelease() { mWillRelease = true; }
void DontAllowRelease() { mWillRelease = false; }
bool IsValid() const { return mCFPlugIn != NULL; }
-
+
CFBundleRef GetBundle() const { CFBundleRef theAnswer = NULL; if(IsValid()) { theAnswer = CFPlugInGetBundle(mCFPlugIn); } return theAnswer; }
CFStringRef CopyBundleID() const { CFStringRef theAnswer = NULL; CFBundleRef theBundle = GetBundle(); if(IsValid() && (theBundle != NULL)) { theAnswer = CFBundleGetIdentifier(theBundle); if(theAnswer != NULL) { CFRetain(theAnswer); } } return theAnswer; }
UInt32 GetBundleVersion() const { UInt32 theAnswer = 0; CFBundleRef theBundle = GetBundle(); if(IsValid() && (theBundle != NULL)) { theAnswer = CFBundleGetVersionNumber(theBundle); } return theAnswer; }
diff --git a/libs/appleutility/CoreAudio/PublicUtility/CACFPreferences.cpp b/libs/appleutility/CoreAudio/PublicUtility/CACFPreferences.cpp
index cb2e86c34d..f605029bbc 100644
--- a/libs/appleutility/CoreAudio/PublicUtility/CACFPreferences.cpp
+++ b/libs/appleutility/CoreAudio/PublicUtility/CACFPreferences.cpp
@@ -2,14 +2,14 @@
File: CACFPreferences.cpp
Abstract: CACFPreferences.h
Version: 1.1
-
+
Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple
Inc. ("Apple") in consideration of your agreement to the following
terms, and your use, installation, modification or redistribution of
this Apple software constitutes acceptance of these terms. If you do
not agree with these terms, please do not use, install, modify or
redistribute this Apple software.
-
+
In consideration of your agreement to abide by the following terms, and
subject to these terms, Apple grants you a personal, non-exclusive
license, under Apple's copyrights in this original Apple software (the
@@ -25,13 +25,13 @@
implied, are granted by Apple herein, including but not limited to any
patent rights that may be infringed by your derivative works or by other
works in which the Apple Software may be incorporated.
-
+
The Apple Software is provided by Apple on an "AS IS" basis. APPLE
MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND
OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
-
+
IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
@@ -40,9 +40,9 @@
AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),
STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
-
+
Copyright (C) 2014 Apple Inc. All Rights Reserved.
-
+
*/
//==================================================================================================
// Includes
@@ -63,23 +63,23 @@ CFPropertyListRef CACFPreferences::CopyValue(CFStringRef inKey, bool inCurrentUs
{
// synchronize to make sure that what's in memory matches what's on disk
Synchronize(inCurrentUser, inCurrentHost, false);
-
+
CFPropertyListRef theAnswer = NULL;
CFStringRef theUser = inCurrentUser ? kCFPreferencesCurrentUser : kCFPreferencesAnyUser;
CFStringRef theHost = inCurrentHost ? kCFPreferencesCurrentHost : kCFPreferencesAnyHost;
-
+
theAnswer = CFPreferencesCopyValue(inKey, kCFPreferencesAnyApplication, theUser, theHost);
-
+
return theAnswer;
}
CFStringRef CACFPreferences::CopyStringValue(CFStringRef inKey, bool inCurrentUser, bool inCurrentHost)
{
CFStringRef theAnswer = NULL;
-
+
// get the raw value
CFPropertyListRef theRawValue = CopyValue(inKey, inCurrentUser, inCurrentHost);
-
+
if(theRawValue != NULL)
{
// get it's type ID and make sure it's a CFString
@@ -95,17 +95,17 @@ CFStringRef CACFPreferences::CopyStringValue(CFStringRef inKey, bool inCurrentUs
DebugMessage("CACFPreferences::CopyStringValue: not a CFString");
}
}
-
+
return theAnswer;
}
CFNumberRef CACFPreferences::CopyNumberValue(CFStringRef inKey, bool inCurrentUser, bool inCurrentHost)
{
CFNumberRef theAnswer = NULL;
-
+
// get the raw value
CFPropertyListRef theRawValue = CopyValue(inKey, inCurrentUser, inCurrentHost);
-
+
if(theRawValue != NULL)
{
// get it's type ID and make sure it's a CFNumber
@@ -121,17 +121,17 @@ CFNumberRef CACFPreferences::CopyNumberValue(CFStringRef inKey, bool inCurrentUs
DebugMessage("CACFPreferences::CopyNumberValue: not a CFNumber");
}
}
-
+
return theAnswer;
}
CFArrayRef CACFPreferences::CopyArrayValue(CFStringRef inKey, bool inCurrentUser, bool inCurrentHost)
{
CFArrayRef theAnswer = NULL;
-
+
// get the raw value
CFPropertyListRef theRawValue = CopyValue(inKey, inCurrentUser, inCurrentHost);
-
+
if(theRawValue != NULL)
{
// get it's type ID and make sure it's a CFArray
@@ -147,17 +147,17 @@ CFArrayRef CACFPreferences::CopyArrayValue(CFStringRef inKey, bool inCurrentUser
DebugMessage("CACFPreferences::CopyArrayValue: not a CFArray");
}
}
-
+
return theAnswer;
}
CFDictionaryRef CACFPreferences::CopyDictionaryValue(CFStringRef inKey, bool inCurrentUser, bool inCurrentHost)
{
CFDictionaryRef theAnswer = NULL;
-
+
// get the raw value
CFPropertyListRef theRawValue = CopyValue(inKey, inCurrentUser, inCurrentHost);
-
+
if(theRawValue != NULL)
{
// get it's type ID and make sure it's a CFDictionary
@@ -173,7 +173,7 @@ CFDictionaryRef CACFPreferences::CopyDictionaryValue(CFStringRef inKey, bool inC
DebugMessage("CACFPreferences::CopyDictionaryValue: not a CFDictionary");
}
}
-
+
return theAnswer;
}
@@ -182,7 +182,7 @@ void CACFPreferences::SetValue(CFStringRef inKey, CFPropertyListRef inValue, boo
CFStringRef theUser = inCurrentUser ? kCFPreferencesCurrentUser : kCFPreferencesAnyUser;
CFStringRef theHost = inCurrentHost ? kCFPreferencesCurrentHost : kCFPreferencesAnyHost;
CFPreferencesSetValue(inKey, inValue, kCFPreferencesAnyApplication, theUser, theHost);
-
+
if(inSynchronize)
{
Synchronize(inCurrentUser, inCurrentHost, true);
@@ -194,7 +194,7 @@ void CACFPreferences::DeleteValue(CFStringRef inKey, bool inCurrentUser, bool in
CFStringRef theUser = inCurrentUser ? kCFPreferencesCurrentUser : kCFPreferencesAnyUser;
CFStringRef theHost = inCurrentHost ? kCFPreferencesCurrentHost : kCFPreferencesAnyHost;
CFPreferencesSetValue(inKey, NULL, kCFPreferencesAnyApplication, theUser, theHost);
-
+
if(inSynchronize)
{
Synchronize(theUser, inCurrentHost, true);
@@ -260,7 +260,7 @@ void CACFPreferences::SendNotification(CFStringRef inName)
bool CACFPreferences::ArePrefsOutOfDate(bool inCurrentUser, bool inCurrentHost)
{
bool theAnswer = false;
-
+
if(!inCurrentUser && !inCurrentHost)
{
theAnswer = sAnyUserAnyHostPrefsOutOfDate;
@@ -277,7 +277,7 @@ bool CACFPreferences::ArePrefsOutOfDate(bool inCurrentUser, bool inCurrentHost)
{
theAnswer = sCurrentUserCurrentHostPrefsOutOfDate;
}
-
+
return theAnswer;
}
diff --git a/libs/appleutility/CoreAudio/PublicUtility/CACFPreferences.h b/libs/appleutility/CoreAudio/PublicUtility/CACFPreferences.h
index 040490f74e..53c1b91e74 100644
--- a/libs/appleutility/CoreAudio/PublicUtility/CACFPreferences.h
+++ b/libs/appleutility/CoreAudio/PublicUtility/CACFPreferences.h
@@ -2,14 +2,14 @@
File: CACFPreferences.h
Abstract: Part of CoreAudio Utility Classes
Version: 1.1
-
+
Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple
Inc. ("Apple") in consideration of your agreement to the following
terms, and your use, installation, modification or redistribution of
this Apple software constitutes acceptance of these terms. If you do
not agree with these terms, please do not use, install, modify or
redistribute this Apple software.
-
+
In consideration of your agreement to abide by the following terms, and
subject to these terms, Apple grants you a personal, non-exclusive
license, under Apple's copyrights in this original Apple software (the
@@ -25,13 +25,13 @@
implied, are granted by Apple herein, including but not limited to any
patent rights that may be infringed by your derivative works or by other
works in which the Apple Software may be incorporated.
-
+
The Apple Software is provided by Apple on an "AS IS" basis. APPLE
MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND
OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
-
+
IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
@@ -40,9 +40,9 @@
AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),
STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
-
+
Copyright (C) 2014 Apple Inc. All Rights Reserved.
-
+
*/
#if !defined(__CACFPreferences_h__)
#define __CACFPreferences_h__
@@ -81,7 +81,7 @@ public:
private:
static bool ArePrefsOutOfDate(bool inCurrentUser, bool inCurrentHost);
-
+
static bool sAnyUserAnyHostPrefsOutOfDate;
static bool sAnyUserCurrentHostPrefsOutOfDate;
static bool sCurrentUserAnyHostPrefsOutOfDate;
diff --git a/libs/appleutility/CoreAudio/PublicUtility/CACFString.cpp b/libs/appleutility/CoreAudio/PublicUtility/CACFString.cpp
index 3ce81a56f4..b5328ae351 100644
--- a/libs/appleutility/CoreAudio/PublicUtility/CACFString.cpp
+++ b/libs/appleutility/CoreAudio/PublicUtility/CACFString.cpp
@@ -2,14 +2,14 @@
File: CACFString.cpp
Abstract: CACFString.h
Version: 1.1
-
+
Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple
Inc. ("Apple") in consideration of your agreement to the following
terms, and your use, installation, modification or redistribution of
this Apple software constitutes acceptance of these terms. If you do
not agree with these terms, please do not use, install, modify or
redistribute this Apple software.
-
+
In consideration of your agreement to abide by the following terms, and
subject to these terms, Apple grants you a personal, non-exclusive
license, under Apple's copyrights in this original Apple software (the
@@ -25,13 +25,13 @@
implied, are granted by Apple herein, including but not limited to any
patent rights that may be infringed by your derivative works or by other
works in which the Apple Software may be incorporated.
-
+
The Apple Software is provided by Apple on an "AS IS" basis. APPLE
MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND
OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
-
+
IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
@@ -40,9 +40,9 @@
AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),
STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
-
+
Copyright (C) 2014 Apple Inc. All Rights Reserved.
-
+
*/
//=============================================================================
// Includes
@@ -57,13 +57,13 @@
UInt32 CACFString::GetStringByteLength(CFStringRef inCFString, CFStringEncoding inEncoding)
{
CFIndex theAnswer = 0;
-
+
if(inCFString != NULL)
{
CFRange theRange = { 0, CFStringGetLength(inCFString) };
CFStringGetBytes(inCFString, theRange, inEncoding, 0, false, NULL, 0x7FFFFFFF, &theAnswer);
}
-
+
return UInt32(theAnswer);
}
diff --git a/libs/appleutility/CoreAudio/PublicUtility/CACFString.h b/libs/appleutility/CoreAudio/PublicUtility/CACFString.h
index 3abce514bf..65127d772c 100644
--- a/libs/appleutility/CoreAudio/PublicUtility/CACFString.h
+++ b/libs/appleutility/CoreAudio/PublicUtility/CACFString.h
@@ -2,14 +2,14 @@
File: CACFString.h
Abstract: Part of CoreAudio Utility Classes
Version: 1.1
-
+
Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple
Inc. ("Apple") in consideration of your agreement to the following
terms, and your use, installation, modification or redistribution of
this Apple software constitutes acceptance of these terms. If you do
not agree with these terms, please do not use, install, modify or
redistribute this Apple software.
-
+
In consideration of your agreement to abide by the following terms, and
subject to these terms, Apple grants you a personal, non-exclusive
license, under Apple's copyrights in this original Apple software (the
@@ -25,13 +25,13 @@
implied, are granted by Apple herein, including but not limited to any
patent rights that may be infringed by your derivative works or by other
works in which the Apple Software may be incorporated.
-
+
The Apple Software is provided by Apple on an "AS IS" basis. APPLE
MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND
OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
-
+
IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
@@ -40,9 +40,9 @@
AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),
STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
-
+
Copyright (C) 2014 Apple Inc. All Rights Reserved.
-
+
*/
#if !defined(__CACFString_h__)
#define __CACFString_h__
@@ -89,7 +89,7 @@ public:
private:
void Retain() { if(mWillRelease && (mCFString != NULL)) { CFRetain(mCFString); } }
void Release() { if(mWillRelease && (mCFString != NULL)) { CFRelease(mCFString); } }
-
+
CFStringRef mCFString;
bool mWillRelease;
@@ -121,7 +121,7 @@ public:
static void GetUnicodeString(CFStringRef inCFString, UInt16* outString, UInt32& ioStringSize);
static SInt32 GetAsInteger(CFStringRef inCFString) { SInt32 theAnswer = 0; if(inCFString != NULL){ theAnswer = CFStringGetIntValue(inCFString); } return theAnswer; }
static Float64 GetAsFloat64(CFStringRef inCFString) { Float64 theAnswer = 0; if(inCFString != NULL){ theAnswer = CFStringGetDoubleValue(inCFString); } return theAnswer; }
-
+
};
inline bool operator<(const CACFString& x, const CACFString& y) { return CFStringCompare(x.GetCFString(), y.GetCFString(), 0) == kCFCompareLessThan; }
@@ -166,7 +166,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/CoreAudio/PublicUtility/CAComponent.cpp b/libs/appleutility/CoreAudio/PublicUtility/CAComponent.cpp
index 04eae545cf..77913c46a3 100644
--- a/libs/appleutility/CoreAudio/PublicUtility/CAComponent.cpp
+++ b/libs/appleutility/CoreAudio/PublicUtility/CAComponent.cpp
@@ -2,14 +2,14 @@
File: CAComponent.cpp
Abstract: CAComponent.h
Version: 1.1
-
+
Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple
Inc. ("Apple") in consideration of your agreement to the following
terms, and your use, installation, modification or redistribution of
this Apple software constitutes acceptance of these terms. If you do
not agree with these terms, please do not use, install, modify or
redistribute this Apple software.
-
+
In consideration of your agreement to abide by the following terms, and
subject to these terms, Apple grants you a personal, non-exclusive
license, under Apple's copyrights in this original Apple software (the
@@ -25,13 +25,13 @@
implied, are granted by Apple herein, including but not limited to any
patent rights that may be infringed by your derivative works or by other
works in which the Apple Software may be incorporated.
-
+
The Apple Software is provided by Apple on an "AS IS" basis. APPLE
MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND
OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
-
+
IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
@@ -40,9 +40,9 @@
AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),
STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
-
+
Copyright (C) 2014 Apple Inc. All Rights Reserved.
-
+
*/
#include "CAComponent.h"
#include "CAComponentDescription.h"
@@ -60,21 +60,21 @@ CAComponent::CAComponent (const AudioComponentDescription& inDesc, CAComponent*
memcpy (&mDesc, &inDesc, sizeof(AudioComponentDescription));
}
-CAComponent::CAComponent (const AudioComponent& comp)
+CAComponent::CAComponent (const AudioComponent& comp)
: mComp (comp),
- mManuName(0),
- mAUName(0),
+ mManuName(0),
+ mAUName(0),
mCompName(0)
{
AudioComponentGetDescription (Comp(), &mDesc);
}
-CAComponent::CAComponent (const AudioComponentInstance& compInst)
- : mComp (NULL),
- mManuName(0),
- mAUName(0),
+CAComponent::CAComponent (const AudioComponentInstance& compInst)
+ : mComp (NULL),
+ mManuName(0),
+ mAUName(0),
mCompName(0)
-{
+{
mComp = AudioComponentInstanceGetComponent (compInst);
AudioComponentGetDescription (Comp(), &mDesc);
}
@@ -113,7 +113,7 @@ CAComponent& CAComponent::operator= (const CAComponent& y)
if (y.mManuName) { mManuName = y.mManuName; CFRetain (mManuName); }
if (y.mAUName) { mAUName = y.mAUName; CFRetain (mAUName); }
- if (y.mCompName) { mCompName = y.mCompName; CFRetain (mCompName); }
+ if (y.mCompName) { mCompName = y.mCompName; CFRetain (mCompName); }
return *this;
}
@@ -121,33 +121,33 @@ CAComponent& CAComponent::operator= (const CAComponent& y)
void CAComponent::SetCompNames () const
{
if (!mCompName) {
-
+
CFStringRef compName;
OSStatus result = AudioComponentCopyName (Comp(), &compName);
if (result) return;
-
+
const_cast<CAComponent*>(this)->mCompName = compName;
if (compName)
{
CFArrayRef splitStrArray = CFStringCreateArrayBySeparatingStrings(NULL, compName, CFSTR(":"));
-
+
// we need to retain these values so the strings are not lost when the array is released
const_cast<CAComponent*>(this)->mManuName = (CFStringRef)CFArrayGetValueAtIndex(splitStrArray, 0);
CFRetain(this->mManuName);
if (CFArrayGetCount(splitStrArray) > 1)
{
CFStringRef str = (CFStringRef)CFArrayGetValueAtIndex(splitStrArray, 1);
-
+
CFMutableStringRef mstr = CFStringCreateMutableCopy (NULL, CFStringGetLength(str), str);
// this needs to trim out white space:
-
+
CFStringTrimWhitespace (mstr);
-
+
const_cast<CAComponent*>(this)->mAUName = mstr;
} else
const_cast<CAComponent*>(this)->mAUName = NULL;
-
+
CFRelease(splitStrArray);
}
}
@@ -177,6 +177,6 @@ void CAComponent::Print(FILE* file) const
fprintf (file, ", Manu:"); _ShowCF (file, mManuName);
if (mAUName) fprintf (file, ", Name:"); _ShowCF (file, mAUName);
}
- fprintf (file, ", ");
+ fprintf (file, ", ");
Desc ().Print(file);
}
diff --git a/libs/appleutility/CoreAudio/PublicUtility/CAComponent.h b/libs/appleutility/CoreAudio/PublicUtility/CAComponent.h
index 5ff24ee01a..17bbb61401 100644
--- a/libs/appleutility/CoreAudio/PublicUtility/CAComponent.h
+++ b/libs/appleutility/CoreAudio/PublicUtility/CAComponent.h
@@ -2,14 +2,14 @@
File: CAComponent.h
Abstract: Part of CoreAudio Utility Classes
Version: 1.1
-
+
Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple
Inc. ("Apple") in consideration of your agreement to the following
terms, and your use, installation, modification or redistribution of
this Apple software constitutes acceptance of these terms. If you do
not agree with these terms, please do not use, install, modify or
redistribute this Apple software.
-
+
In consideration of your agreement to abide by the following terms, and
subject to these terms, Apple grants you a personal, non-exclusive
license, under Apple's copyrights in this original Apple software (the
@@ -25,13 +25,13 @@
implied, are granted by Apple herein, including but not limited to any
patent rights that may be infringed by your derivative works or by other
works in which the Apple Software may be incorporated.
-
+
The Apple Software is provided by Apple on an "AS IS" basis. APPLE
MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND
OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
-
+
IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
@@ -40,9 +40,9 @@
AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),
STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
-
+
Copyright (C) 2014 Apple Inc. All Rights Reserved.
-
+
*/
#ifndef __CAComponent_h__
#define __CAComponent_h__
@@ -54,63 +54,63 @@
#include "CAComponentDescription.h"
-class CAComponent
+class CAComponent
{
public:
CAComponent ()
: mComp (0), mDesc(), mManuName(0), mAUName(0), mCompName(0) {}
-
+
// if next is specifed that is used to find the next component after that one
CAComponent (const AudioComponentDescription& inDesc, CAComponent* next = 0);
-
- CAComponent (const CAComponent& y)
+
+ CAComponent (const CAComponent& y)
: mComp (0), mDesc(), mManuName(0), mAUName(0), mCompName(0) { *this = y; }
CAComponent (const AudioComponent& comp);
-
+
CAComponent (const AudioComponentInstance& 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; }
-
+
const CAComponentDescription& Desc () const { return mDesc; }
-
- OSStatus Open (AudioComponentInstance& outInst) const
+
+ OSStatus Open (AudioComponentInstance& outInst) const
{
return AudioComponentInstanceNew (Comp(), &outInst);
}
OSStatus GetVersion (UInt32 &outVersion) const;
-
+
const AudioComponent& Comp() const { return mComp; }
-
+
void Print(FILE* file = stdout) const;
OSStatus Save (CFPropertyListRef *outData) const;
-
+
OSStatus Restore (CFPropertyListRef &inData);
-
+
private:
AudioComponent mComp;
CAComponentDescription mDesc;
-
+
CFStringRef mManuName, mAUName, mCompName;
void SetCompNames () const;
diff --git a/libs/appleutility/CoreAudio/PublicUtility/CAComponentDescription.cpp b/libs/appleutility/CoreAudio/PublicUtility/CAComponentDescription.cpp
index a3c877b6fe..53dae27d80 100644
--- a/libs/appleutility/CoreAudio/PublicUtility/CAComponentDescription.cpp
+++ b/libs/appleutility/CoreAudio/PublicUtility/CAComponentDescription.cpp
@@ -2,14 +2,14 @@
File: CAComponentDescription.cpp
Abstract: CAComponentDescription.h
Version: 1.1
-
+
Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple
Inc. ("Apple") in consideration of your agreement to the following
terms, and your use, installation, modification or redistribution of
this Apple software constitutes acceptance of these terms. If you do
not agree with these terms, please do not use, install, modify or
redistribute this Apple software.
-
+
In consideration of your agreement to abide by the following terms, and
subject to these terms, Apple grants you a personal, non-exclusive
license, under Apple's copyrights in this original Apple software (the
@@ -25,13 +25,13 @@
implied, are granted by Apple herein, including but not limited to any
patent rights that may be infringed by your derivative works or by other
works in which the Apple Software may be incorporated.
-
+
The Apple Software is provided by Apple on an "AS IS" basis. APPLE
MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND
OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
-
+
IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
@@ -40,9 +40,9 @@
AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),
STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
-
+
Copyright (C) 2014 Apple Inc. All Rights Reserved.
-
+
*/
#include "CAComponentDescription.h"
#include "CAStreamBasicDescription.h"
@@ -60,7 +60,7 @@ void CAComponentDescription::_CAShowComponentDescription(const AudioComponentDe
char str[24];
fprintf (file, "AudioComponentDescription: %s - ", CAStringForOSType(desc->componentType, str, sizeof(str)));
fprintf (file, "%s - ", CAStringForOSType(desc->componentSubType, str, sizeof(str)));
- fprintf (file, "%s", CAStringForOSType(desc->componentManufacturer, str, sizeof(str)));
+ fprintf (file, "%s", CAStringForOSType(desc->componentManufacturer, str, sizeof(str)));
fprintf (file, ", 0x%X, 0x%X\n", (int)desc->componentFlags, (int)desc->componentFlagsMask);
}
}
@@ -74,11 +74,11 @@ CAComponentDescription::CAComponentDescription (OSType inType, OSType inSubtype,
componentFlagsMask = 0;
}
-bool CAComponentDescription::IsAU () const
-{
+bool CAComponentDescription::IsAU () const
+{
bool flag = IsEffect() || IsMusicDevice() || IsOffline();
if (flag) return true;
-
+
switch (componentType) {
case kAudioUnitType_Output:
case kAudioUnitType_FormatConverter:
@@ -90,21 +90,21 @@ bool CAComponentDescription::IsAU () const
inline bool _MatchTest (const OSType &inTypeA, const OSType &inTypeB)
{
- return ((inTypeA == inTypeB) || (!inTypeA && !inTypeB) || (inTypeA && !inTypeB) || (!inTypeA && inTypeB));
+ return ((inTypeA == inTypeB) || (!inTypeA && !inTypeB) || (inTypeA && !inTypeB) || (!inTypeA && inTypeB));
}
bool CAComponentDescription::Matches (const AudioComponentDescription &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/CoreAudio/PublicUtility/CAComponentDescription.h b/libs/appleutility/CoreAudio/PublicUtility/CAComponentDescription.h
index 5c756eaebf..1531129079 100644
--- a/libs/appleutility/CoreAudio/PublicUtility/CAComponentDescription.h
+++ b/libs/appleutility/CoreAudio/PublicUtility/CAComponentDescription.h
@@ -2,14 +2,14 @@
File: CAComponentDescription.h
Abstract: Part of CoreAudio Utility Classes
Version: 1.1
-
+
Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple
Inc. ("Apple") in consideration of your agreement to the following
terms, and your use, installation, modification or redistribution of
this Apple software constitutes acceptance of these terms. If you do
not agree with these terms, please do not use, install, modify or
redistribute this Apple software.
-
+
In consideration of your agreement to abide by the following terms, and
subject to these terms, Apple grants you a personal, non-exclusive
license, under Apple's copyrights in this original Apple software (the
@@ -25,13 +25,13 @@
implied, are granted by Apple herein, including but not limited to any
patent rights that may be infringed by your derivative works or by other
works in which the Apple Software may be incorporated.
-
+
The Apple Software is provided by Apple on an "AS IS" basis. APPLE
MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND
OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
-
+
IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
@@ -40,9 +40,9 @@
AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),
STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
-
+
Copyright (C) 2014 Apple Inc. All Rights Reserved.
-
+
*/
#ifndef __CAComponentDescription_h__
#define __CAComponentDescription_h__
@@ -66,57 +66,57 @@ void CAShowComponentDescription(const AudioComponentDescription *desc);
class CAComponentDescription : public AudioComponentDescription {
public:
CAComponentDescription() { memset (this, 0, sizeof (AudioComponentDescription)); }
-
+
CAComponentDescription (OSType inType, OSType inSubtype = 0, OSType inManu = 0);
CAComponentDescription(const AudioComponentDescription& desc) { memcpy (this, &desc, sizeof (AudioComponentDescription)); }
-
+
// _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
//
// interrogation
-
+
bool IsAU () const;
-
+
bool IsAUFX() const { return componentType == kAudioUnitType_Effect; }
bool IsAUFM() const { return componentType == kAudioUnitType_MusicEffect; }
-
+
bool IsAUMI() const { return componentType == 'aumi' /*kAudioUnitType_MIDIProcessor*/; }
-
+
bool IsAUAX () const { return componentType == 'auax' /*kAudioUnitType_Auxiliary*/; }
-
+
bool IsEffect () const { return IsAUFX() || IsAUFM() || IsPanner(); }
-
+
bool IsOffline () const { return componentType == 'auol' /*kAudioUnitType_Offline*/; }
-
+
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 AudioComponentCount(const_cast<CAComponentDescription*>(this)); }
-
+
// does a semantic match where "wild card" values for type, subtype, manu will match
bool Matches (const AudioComponentDescription &desc) const;
-
+
// _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
//
// other
-
+
void Print(FILE* file = stdout) const { _CAShowComponentDescription (this, file); }
OSStatus Save (CFPropertyListRef *outData) const;
diff --git a/libs/appleutility/CoreAudio/PublicUtility/CADebugMacros.cpp b/libs/appleutility/CoreAudio/PublicUtility/CADebugMacros.cpp
index 9739e3753c..f60b54db35 100644
--- a/libs/appleutility/CoreAudio/PublicUtility/CADebugMacros.cpp
+++ b/libs/appleutility/CoreAudio/PublicUtility/CADebugMacros.cpp
@@ -2,14 +2,14 @@
File: CADebugMacros.cpp
Abstract: CADebugMacros.h
Version: 1.1
-
+
Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple
Inc. ("Apple") in consideration of your agreement to the following
terms, and your use, installation, modification or redistribution of
this Apple software constitutes acceptance of these terms. If you do
not agree with these terms, please do not use, install, modify or
redistribute this Apple software.
-
+
In consideration of your agreement to abide by the following terms, and
subject to these terms, Apple grants you a personal, non-exclusive
license, under Apple's copyrights in this original Apple software (the
@@ -25,13 +25,13 @@
implied, are granted by Apple herein, including but not limited to any
patent rights that may be infringed by your derivative works or by other
works in which the Apple Software may be incorporated.
-
+
The Apple Software is provided by Apple on an "AS IS" basis. APPLE
MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND
OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
-
+
IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
@@ -40,9 +40,9 @@
AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),
STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
-
+
Copyright (C) 2014 Apple Inc. All Rights Reserved.
-
+
*/
#include "CADebugMacros.h"
#include <stdio.h>
diff --git a/libs/appleutility/CoreAudio/PublicUtility/CADebugMacros.h b/libs/appleutility/CoreAudio/PublicUtility/CADebugMacros.h
index 15af91909f..980f6b5e2e 100644
--- a/libs/appleutility/CoreAudio/PublicUtility/CADebugMacros.h
+++ b/libs/appleutility/CoreAudio/PublicUtility/CADebugMacros.h
@@ -2,14 +2,14 @@
File: CADebugMacros.h
Abstract: Part of CoreAudio Utility Classes
Version: 1.1
-
+
Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple
Inc. ("Apple") in consideration of your agreement to the following
terms, and your use, installation, modification or redistribution of
this Apple software constitutes acceptance of these terms. If you do
not agree with these terms, please do not use, install, modify or
redistribute this Apple software.
-
+
In consideration of your agreement to abide by the following terms, and
subject to these terms, Apple grants you a personal, non-exclusive
license, under Apple's copyrights in this original Apple software (the
@@ -25,13 +25,13 @@
implied, are granted by Apple herein, including but not limited to any
patent rights that may be infringed by your derivative works or by other
works in which the Apple Software may be incorporated.
-
+
The Apple Software is provided by Apple on an "AS IS" basis. APPLE
MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND
OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
-
+
IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
@@ -40,9 +40,9 @@
AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),
STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
-
+
Copyright (C) 2014 Apple Inc. All Rights Reserved.
-
+
*/
#if !defined(__CADebugMacros_h__)
#define __CADebugMacros_h__
@@ -95,7 +95,7 @@
#if DEBUG || CoreAudio_Debug
// can be used to break into debugger immediately, also see CADebugger
#define BusError() { long* p=NULL; *p=0; }
-
+
// basic debugging print routines
#if TARGET_OS_MAC && !TARGET_API_MAC_CARBON
extern void DebugStr(const unsigned char* debuggerMsg);
@@ -105,13 +105,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"
@@ -137,7 +137,7 @@
#else
#define vprint(msg)
#endif
-
+
// Original macro keeps its function of turning on and off use of CADebuggerStop() for both asserts and throws.
// For backwards compat, it overrides any setting of the two sub-macros.
#if CoreAudio_StopOnFailure
diff --git a/libs/appleutility/CoreAudio/PublicUtility/CADebugPrintf.cpp b/libs/appleutility/CoreAudio/PublicUtility/CADebugPrintf.cpp
index d691de3cd5..b401c3a3bd 100644
--- a/libs/appleutility/CoreAudio/PublicUtility/CADebugPrintf.cpp
+++ b/libs/appleutility/CoreAudio/PublicUtility/CADebugPrintf.cpp
@@ -2,14 +2,14 @@
File: CADebugPrintf.cpp
Abstract: CADebugPrintf.h
Version: 1.1
-
+
Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple
Inc. ("Apple") in consideration of your agreement to the following
terms, and your use, installation, modification or redistribution of
this Apple software constitutes acceptance of these terms. If you do
not agree with these terms, please do not use, install, modify or
redistribute this Apple software.
-
+
In consideration of your agreement to abide by the following terms, and
subject to these terms, Apple grants you a personal, non-exclusive
license, under Apple's copyrights in this original Apple software (the
@@ -25,13 +25,13 @@
implied, are granted by Apple herein, including but not limited to any
patent rights that may be infringed by your derivative works or by other
works in which the Apple Software may be incorporated.
-
+
The Apple Software is provided by Apple on an "AS IS" basis. APPLE
MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND
OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
-
+
IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
@@ -40,9 +40,9 @@
AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),
STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
-
+
Copyright (C) 2014 Apple Inc. All Rights Reserved.
-
+
*/
//==================================================================================================
// Includes
@@ -69,7 +69,7 @@
return 0;
}
#endif
-
+
#if defined(CoreAudio_UseSideFile)
#include <unistd.h>
FILE* sDebugPrintfSideFile = NULL;
diff --git a/libs/appleutility/CoreAudio/PublicUtility/CADebugPrintf.h b/libs/appleutility/CoreAudio/PublicUtility/CADebugPrintf.h
index 79aa15dafa..905d0f2663 100644
--- a/libs/appleutility/CoreAudio/PublicUtility/CADebugPrintf.h
+++ b/libs/appleutility/CoreAudio/PublicUtility/CADebugPrintf.h
@@ -2,14 +2,14 @@
File: CADebugPrintf.h
Abstract: Part of CoreAudio Utility Classes
Version: 1.1
-
+
Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple
Inc. ("Apple") in consideration of your agreement to the following
terms, and your use, installation, modification or redistribution of
this Apple software constitutes acceptance of these terms. If you do
not agree with these terms, please do not use, install, modify or
redistribute this Apple software.
-
+
In consideration of your agreement to abide by the following terms, and
subject to these terms, Apple grants you a personal, non-exclusive
license, under Apple's copyrights in this original Apple software (the
@@ -25,13 +25,13 @@
implied, are granted by Apple herein, including but not limited to any
patent rights that may be infringed by your derivative works or by other
works in which the Apple Software may be incorporated.
-
+
The Apple Software is provided by Apple on an "AS IS" basis. APPLE
MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND
OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
-
+
IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
@@ -40,9 +40,9 @@
AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),
STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
-
+
Copyright (C) 2014 Apple Inc. All Rights Reserved.
-
+
*/
#if !defined(__CADebugPrintf_h__)
#define __CADebugPrintf_h__
@@ -65,14 +65,14 @@
//#define CoreAudio_UseSideFile "/CoreAudio-%d.txt"
#if DEBUG || CoreAudio_Debug
-
+
#if TARGET_OS_WIN32
#if defined(__cplusplus)
extern "C"
#endif
extern int CAWin32DebugPrintf(char* inFormat, ...);
#define DebugPrintfRtn CAWin32DebugPrintf
- #define DebugPrintfFile
+ #define DebugPrintfFile
#define DebugPrintfLineEnding "\n"
#define DebugPrintfFileComma
#else
@@ -104,9 +104,9 @@
#define DebugPrintf(inFormat, ...) DebugPrintfRtn(DebugPrintfFileComma inFormat DebugPrintfLineEnding, ## __VA_ARGS__)
#else
- #define DebugPrintfRtn
- #define DebugPrintfFile
- #define DebugPrintfLineEnding
+ #define DebugPrintfRtn
+ #define DebugPrintfFile
+ #define DebugPrintfLineEnding
#define DebugPrintfFileComma
#define DebugPrintf(inFormat, ...)
#endif
diff --git a/libs/appleutility/CoreAudio/PublicUtility/CADebugger.cpp b/libs/appleutility/CoreAudio/PublicUtility/CADebugger.cpp
index 7f0141d206..eb690a5c14 100644
--- a/libs/appleutility/CoreAudio/PublicUtility/CADebugger.cpp
+++ b/libs/appleutility/CoreAudio/PublicUtility/CADebugger.cpp
@@ -2,14 +2,14 @@
File: CADebugger.cpp
Abstract: CADebugger.h
Version: 1.1
-
+
Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple
Inc. ("Apple") in consideration of your agreement to the following
terms, and your use, installation, modification or redistribution of
this Apple software constitutes acceptance of these terms. If you do
not agree with these terms, please do not use, install, modify or
redistribute this Apple software.
-
+
In consideration of your agreement to abide by the following terms, and
subject to these terms, Apple grants you a personal, non-exclusive
license, under Apple's copyrights in this original Apple software (the
@@ -25,13 +25,13 @@
implied, are granted by Apple herein, including but not limited to any
patent rights that may be infringed by your derivative works or by other
works in which the Apple Software may be incorporated.
-
+
The Apple Software is provided by Apple on an "AS IS" basis. APPLE
MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND
OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
-
+
IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
@@ -40,9 +40,9 @@
AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),
STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
-
+
Copyright (C) 2014 Apple Inc. All Rights Reserved.
-
+
*/
//=============================================================================
// Includes
diff --git a/libs/appleutility/CoreAudio/PublicUtility/CADebugger.h b/libs/appleutility/CoreAudio/PublicUtility/CADebugger.h
index 9391f011a2..6c07514d7f 100644
--- a/libs/appleutility/CoreAudio/PublicUtility/CADebugger.h
+++ b/libs/appleutility/CoreAudio/PublicUtility/CADebugger.h
@@ -2,14 +2,14 @@
File: CADebugger.h
Abstract: Part of CoreAudio Utility Classes
Version: 1.1
-
+
Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple
Inc. ("Apple") in consideration of your agreement to the following
terms, and your use, installation, modification or redistribution of
this Apple software constitutes acceptance of these terms. If you do
not agree with these terms, please do not use, install, modify or
redistribute this Apple software.
-
+
In consideration of your agreement to abide by the following terms, and
subject to these terms, Apple grants you a personal, non-exclusive
license, under Apple's copyrights in this original Apple software (the
@@ -25,13 +25,13 @@
implied, are granted by Apple herein, including but not limited to any
patent rights that may be infringed by your derivative works or by other
works in which the Apple Software may be incorporated.
-
+
The Apple Software is provided by Apple on an "AS IS" basis. APPLE
MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND
OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
-
+
IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
@@ -40,9 +40,9 @@
AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),
STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
-
+
Copyright (C) 2014 Apple Inc. All Rights Reserved.
-
+
*/
#if !defined(__CADebugger_h__)
#define __CADebugger_h__
diff --git a/libs/appleutility/CoreAudio/PublicUtility/CAException.h b/libs/appleutility/CoreAudio/PublicUtility/CAException.h
index 7217001d78..26b3af1923 100644
--- a/libs/appleutility/CoreAudio/PublicUtility/CAException.h
+++ b/libs/appleutility/CoreAudio/PublicUtility/CAException.h
@@ -2,14 +2,14 @@
File: CAException.h
Abstract: Part of CoreAudio Utility Classes
Version: 1.1
-
+
Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple
Inc. ("Apple") in consideration of your agreement to the following
terms, and your use, installation, modification or redistribution of
this Apple software constitutes acceptance of these terms. If you do
not agree with these terms, please do not use, install, modify or
redistribute this Apple software.
-
+
In consideration of your agreement to abide by the following terms, and
subject to these terms, Apple grants you a personal, non-exclusive
license, under Apple's copyrights in this original Apple software (the
@@ -25,13 +25,13 @@
implied, are granted by Apple herein, including but not limited to any
patent rights that may be infringed by your derivative works or by other
works in which the Apple Software may be incorporated.
-
+
The Apple Software is provided by Apple on an "AS IS" basis. APPLE
MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND
OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
-
+
IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
@@ -40,9 +40,9 @@
AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),
STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
-
+
Copyright (C) 2014 Apple Inc. All Rights Reserved.
-
+
*/
#if !defined(__CAException_h__)
#define __CAException_h__
@@ -71,7 +71,7 @@ public:
~CAException() {}
OSStatus GetError() const { return mError; }
-
+
protected:
OSStatus mError;
};
diff --git a/libs/appleutility/CoreAudio/PublicUtility/CAExtAudioFile.h b/libs/appleutility/CoreAudio/PublicUtility/CAExtAudioFile.h
index f1aa56fb5e..bf0c7e1385 100644
--- a/libs/appleutility/CoreAudio/PublicUtility/CAExtAudioFile.h
+++ b/libs/appleutility/CoreAudio/PublicUtility/CAExtAudioFile.h
@@ -2,14 +2,14 @@
File: CAExtAudioFile.h
Abstract: Part of CoreAudio Utility Classes
Version: 1.1
-
+
Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple
Inc. ("Apple") in consideration of your agreement to the following
terms, and your use, installation, modification or redistribution of
this Apple software constitutes acceptance of these terms. If you do
not agree with these terms, please do not use, install, modify or
redistribute this Apple software.
-
+
In consideration of your agreement to abide by the following terms, and
subject to these terms, Apple grants you a personal, non-exclusive
license, under Apple's copyrights in this original Apple software (the
@@ -25,13 +25,13 @@
implied, are granted by Apple herein, including but not limited to any
patent rights that may be infringed by your derivative works or by other
works in which the Apple Software may be incorporated.
-
+
The Apple Software is provided by Apple on an "AS IS" basis. APPLE
MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND
OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
-
+
IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
@@ -40,9 +40,9 @@
AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),
STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
-
+
Copyright (C) 2014 Apple Inc. All Rights Reserved.
-
+
*/
#ifndef __CAExtAudioFile_h__
#define __CAExtAudioFile_h__
@@ -74,9 +74,9 @@ public:
{
Close();
}
-
+
bool IsValid() const { return mExtAudioFile != NULL; }
-
+
void Open(const char* filename)
{
Close();
@@ -88,7 +88,7 @@ public:
Check(res, "ExtAudioFileOpenURL");
CFRelease (url);
}
-
+
// this group of methods maps directly to the API other than OSStatus results translating into exceptions.
// you must explicitly open, wrap or create a file.
void OpenURL(CFURLRef url)
@@ -96,7 +96,7 @@ public:
Close();
Check(ExtAudioFileOpenURL(url, &mExtAudioFile), "ExtAudioFileOpenURL");
}
-
+
void WrapAudioFileID(AudioFileID inFileID, Boolean forWriting)
{
Close();
@@ -114,7 +114,7 @@ public:
Check(res, "ExtAudioFileCreateWithURL");
CFRelease(url);
}
-
+
void CreateWithURL(CFURLRef url, AudioFileTypeID filetype, const AudioStreamBasicDescription &streamDesc, const AudioChannelLayout *channelLayout, UInt32 flags)
{
Close();
@@ -129,12 +129,12 @@ public:
mExtAudioFile = NULL;
}
}
-
+
void Read(UInt32 &ioNumberFrames, AudioBufferList *ioData)
{
Check(ExtAudioFileRead(mExtAudioFile, &ioNumberFrames, ioData), "ExtAudioFileRead");
}
-
+
OSStatus Write(UInt32 inNumberFrames, const AudioBufferList *ioData)
{
OSStatus err = ExtAudioFileWrite(mExtAudioFile, inNumberFrames, ioData);
@@ -154,41 +154,41 @@ public:
}
return err;
}
-
+
void WriteAsync(UInt32 inNumberFrames, const AudioBufferList *ioData)
{
Check(ExtAudioFileWriteAsync(mExtAudioFile, inNumberFrames, ioData), "ExtAudioFileWriteAsync");
}
-
+
void Seek(SInt64 inFrameOffset)
{
Check(ExtAudioFileSeek(mExtAudioFile, inFrameOffset), "ExtAudioFileSeek");
}
-
+
SInt64 Tell() const
{
SInt64 pos;
Check(ExtAudioFileTell(mExtAudioFile, &pos), "ExtAudioFileTell");
return pos;
}
-
+
UInt32 GetPropertyInfo(ExtAudioFilePropertyID propid, Boolean *outWritable) const
{
UInt32 size;
CheckProperty(ExtAudioFileGetPropertyInfo(mExtAudioFile, propid, &size, outWritable), "ExtAudioFileGetPropertyInfo", propid);
return size;
}
-
+
void GetProperty(ExtAudioFilePropertyID propid, UInt32 &ioSize, void *outData) const
{
CheckProperty(ExtAudioFileGetProperty(mExtAudioFile, propid, &ioSize, outData), "ExtAudioFileGetProperty", propid);
}
-
+
void SetProperty(ExtAudioFilePropertyID propid, UInt32 size, const void *inData)
{
CheckProperty(ExtAudioFileSetProperty(mExtAudioFile, propid, size, inData), "ExtAudioFileSetProperty", propid);
}
-
+
const CAAudioChannelLayout &GetFileChannelLayout()
{
return FetchChannelLayout(mFileChannelLayout, kExtAudioFileProperty_FileChannelLayout);
@@ -204,13 +204,13 @@ public:
GetProperty(kExtAudioFileProperty_FileDataFormat, size, &mFileDataFormat);
return mFileDataFormat;
}
-
+
const CAStreamBasicDescription &GetClientDataFormat() {
UInt32 size = sizeof(mClientDataFormat);
GetProperty(kExtAudioFileProperty_ClientDataFormat, size, &mClientDataFormat);
return mClientDataFormat;
}
-
+
void SetClientFormat(const CAStreamBasicDescription &dataFormat, const CAAudioChannelLayout *layout=NULL, UInt32 codecManuf=0) {
if (codecManuf != 0)
@@ -219,11 +219,11 @@ public:
if (layout)
SetClientChannelLayout(*layout);
}
-
+
void SetClientChannelLayout(const CAAudioChannelLayout &layout) {
SetProperty(kExtAudioFileProperty_ClientChannelLayout, layout.Size(), &layout.Layout());
}
-
+
AudioConverterRef GetConverter() const {
UInt32 size = sizeof(AudioConverterRef);
AudioConverterRef converter = NULL;
@@ -232,7 +232,7 @@ public:
}
bool HasConverter() const { return GetConverter() != NULL; }
-
+
OSStatus SetConverterProperty(AudioConverterPropertyID inPropertyID, UInt32 inPropertyDataSize, const void *inPropertyData, bool inCanFail=false)
{
OSStatus err = AudioConverterSetProperty(GetConverter(), inPropertyID, inPropertyDataSize, inPropertyData);
@@ -245,14 +245,14 @@ public:
}
return err;
}
-
+
SInt64 GetNumberFrames() {
SInt64 length;
UInt32 size = sizeof(SInt64);
GetProperty(kExtAudioFileProperty_FileLengthFrames, size, &length);
return length;
}
-
+
protected:
virtual void Check(OSStatus err, const char *func) const
@@ -263,7 +263,7 @@ protected:
throw CAXException(txt, err);
}
}
-
+
virtual void CheckProperty(OSStatus err, const char *func, UInt32 propid) const
{
if (err) {
@@ -289,7 +289,7 @@ private:
private:
ExtAudioFileRef mExtAudioFile;
-
+
// for convenience to the client, it helps if we hold onto some storage for these
CAStreamBasicDescription mFileDataFormat;
CAAudioChannelLayout mFileChannelLayout;
diff --git a/libs/appleutility/CoreAudio/PublicUtility/CAFilePathUtils.cpp b/libs/appleutility/CoreAudio/PublicUtility/CAFilePathUtils.cpp
index 124cb21433..1d46f29d79 100644
--- a/libs/appleutility/CoreAudio/PublicUtility/CAFilePathUtils.cpp
+++ b/libs/appleutility/CoreAudio/PublicUtility/CAFilePathUtils.cpp
@@ -2,14 +2,14 @@
File: CAFilePathUtils.cpp
Abstract: CAFilePathUtils.h
Version: 1.1
-
+
Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple
Inc. ("Apple") in consideration of your agreement to the following
terms, and your use, installation, modification or redistribution of
this Apple software constitutes acceptance of these terms. If you do
not agree with these terms, please do not use, install, modify or
redistribute this Apple software.
-
+
In consideration of your agreement to abide by the following terms, and
subject to these terms, Apple grants you a personal, non-exclusive
license, under Apple's copyrights in this original Apple software (the
@@ -25,13 +25,13 @@
implied, are granted by Apple herein, including but not limited to any
patent rights that may be infringed by your derivative works or by other
works in which the Apple Software may be incorporated.
-
+
The Apple Software is provided by Apple on an "AS IS" basis. APPLE
MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND
OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
-
+
IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
@@ -40,9 +40,9 @@
AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),
STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
-
+
Copyright (C) 2014 Apple Inc. All Rights Reserved.
-
+
*/
#include "CAFilePathUtils.h"
#include <string.h>
@@ -72,16 +72,16 @@ OSStatus PosixPathToParentFSRefAndName(const char *path, FSRef &outParentDir, CF
// get the directory's FSRef
OSStatus err = CFURLGetFSRef(dirurl, &outParentDir) ? OSStatus(noErr) : OSStatus(kAudio_FileNotFoundError);
CFRelease(dirurl);
-
+
CFStringRef lastPathComponent = CFURLCopyLastPathComponent(fullurl);
CFRelease(fullurl);
CFMutableStringRef filename = CFStringCreateMutableCopy(NULL, 0, lastPathComponent);
CFRelease(lastPathComponent);
// convert colons (legal in POSIX paths, illegal in File Manager) to slashes
CFStringFindAndReplace(filename, CFSTR(":"), CFSTR("/"), CFRangeMake(0, CFStringGetLength(filename)), 0);
-
+
outFileName = filename;
-
+
return err;
}
#endif // !CA_NO_CORE_SERVICES
@@ -92,29 +92,29 @@ OSStatus PosixPathToParentFSRefAndName(const char *path, FSRef &outParentDir, CF
char* dirname(const char* inPath)
{
static char sAnswer[1024];
-
+
char* theAnswer = NULL;
SInt32 thePathLength = strlen(inPath);
if(thePathLength < 1023)
{
// make a working copy
strlcpy(sAnswer, inPath, sizeof(sAnswer));
-
+
// start at the end of the string
SInt32 theIndex = thePathLength - 1;
-
+
// walk back over the '\' characters
while((theIndex > 0) && (sAnswer[theIndex] == '\\'))
{
--theIndex;
}
-
+
// now keep walking back until we get to a '\'
while((theIndex > 0) && (sAnswer[theIndex] != '\\'))
{
--theIndex;
}
-
+
// where we are now is either the first character of the path or the '\' that marks the end of the directory name
if(theIndex > 0)
{
@@ -127,34 +127,34 @@ char* dirname(const char* inPath)
sAnswer[0] = '.';
sAnswer[1] = 0;
}
-
+
// set the return value
theAnswer = sAnswer;
}
-
+
return theAnswer;
}
char* basename(const char* inPath)
{
static char sAnswer[1024];
-
+
char* theAnswer = NULL;
SInt32 thePathLength = strlen(inPath);
if(thePathLength < 1023)
{
// make a working copy
strlcpy(sAnswer, inPath, sizeof(sAnswer));
-
+
// start at the end of the string
SInt32 theLastIndex = thePathLength - 1;
-
+
// walk back over the '\' characters
while((theLastIndex > 0) && (sAnswer[theLastIndex] == '\\'))
{
--theLastIndex;
}
-
+
// check to see if we're at the beginning now
if(theLastIndex > 0)
{
@@ -164,10 +164,10 @@ char* basename(const char* inPath)
{
--theFirstIndex;
}
-
+
// we now have a string, so put a '\0' after the last character
sAnswer[theLastIndex + 1] = 0;
-
+
// and set the return value
theAnswer = &sAnswer[theFirstIndex];
}
@@ -176,12 +176,12 @@ char* basename(const char* inPath)
// the path was entirely '\' characters, so the return value is "\"
sAnswer[0] = '\\';
sAnswer[1] = 0;
-
+
// set the return value
theAnswer = sAnswer;
}
}
-
+
return theAnswer;
}
diff --git a/libs/appleutility/CoreAudio/PublicUtility/CAFilePathUtils.h b/libs/appleutility/CoreAudio/PublicUtility/CAFilePathUtils.h
index 41f1ee00af..53597a1a0a 100644
--- a/libs/appleutility/CoreAudio/PublicUtility/CAFilePathUtils.h
+++ b/libs/appleutility/CoreAudio/PublicUtility/CAFilePathUtils.h
@@ -2,14 +2,14 @@
File: CAFilePathUtils.h
Abstract: Part of CoreAudio Utility Classes
Version: 1.1
-
+
Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple
Inc. ("Apple") in consideration of your agreement to the following
terms, and your use, installation, modification or redistribution of
this Apple software constitutes acceptance of these terms. If you do
not agree with these terms, please do not use, install, modify or
redistribute this Apple software.
-
+
In consideration of your agreement to abide by the following terms, and
subject to these terms, Apple grants you a personal, non-exclusive
license, under Apple's copyrights in this original Apple software (the
@@ -25,13 +25,13 @@
implied, are granted by Apple herein, including but not limited to any
patent rights that may be infringed by your derivative works or by other
works in which the Apple Software may be incorporated.
-
+
The Apple Software is provided by Apple on an "AS IS" basis. APPLE
MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND
OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
-
+
IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
@@ -40,9 +40,9 @@
AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),
STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
-
+
Copyright (C) 2014 Apple Inc. All Rights Reserved.
-
+
*/
#ifndef __CAFilePathUtils_h__
#define __CAFilePathUtils_h__
diff --git a/libs/appleutility/CoreAudio/PublicUtility/CAGuard.cpp b/libs/appleutility/CoreAudio/PublicUtility/CAGuard.cpp
index a1c83be9dd..1c766f93f7 100644
--- a/libs/appleutility/CoreAudio/PublicUtility/CAGuard.cpp
+++ b/libs/appleutility/CoreAudio/PublicUtility/CAGuard.cpp
@@ -2,14 +2,14 @@
File: CAGuard.cpp
Abstract: CAGuard.h
Version: 1.1
-
+
Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple
Inc. ("Apple") in consideration of your agreement to the following
terms, and your use, installation, modification or redistribution of
this Apple software constitutes acceptance of these terms. If you do
not agree with these terms, please do not use, install, modify or
redistribute this Apple software.
-
+
In consideration of your agreement to abide by the following terms, and
subject to these terms, Apple grants you a personal, non-exclusive
license, under Apple's copyrights in this original Apple software (the
@@ -25,13 +25,13 @@
implied, are granted by Apple herein, including but not limited to any
patent rights that may be infringed by your derivative works or by other
works in which the Apple Software may be incorporated.
-
+
The Apple Software is provided by Apple on an "AS IS" basis. APPLE
MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND
OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
-
+
IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
@@ -40,9 +40,9 @@
AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),
STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
-
+
Copyright (C) 2014 Apple Inc. All Rights Reserved.
-
+
*/
//==================================================================================================
// Includes
@@ -169,7 +169,7 @@ bool CAGuard::WaitFor(UInt64 inNanos)
theTimeSpec.tv_sec = 0;
theTimeSpec.tv_nsec = static_cast<long>(inNanos);
}
-
+
#if Log_TimedWaits || Log_Latency || Log_Average_Latency
UInt64 theStartNanos = CAHostTimeBase::GetCurrentTimeInNanos();
#endif
@@ -183,19 +183,19 @@ bool CAGuard::WaitFor(UInt64 inNanos)
OSStatus theError = pthread_cond_timedwait_relative_np(&mCondVar, &mMutex, &theTimeSpec);
ThrowIf((theError != 0) && (theError != ETIMEDOUT), CAException(theError), "CAGuard::WaitFor: Wait got an error");
mOwner = pthread_self();
-
+
#if Log_TimedWaits || Log_Latency || Log_Average_Latency
UInt64 theEndNanos = CAHostTimeBase::GetCurrentTimeInNanos();
#endif
-
+
#if Log_TimedWaits
DebugMessageN1("CAGuard::WaitFor: waited %.0f", (Float64)(theEndNanos - theStartNanos));
#endif
-
+
#if Log_Latency
DebugMessageN1("CAGuard::WaitFor: latency %.0f", (Float64)((theEndNanos - theStartNanos) - inNanos));
#endif
-
+
#if Log_Average_Latency
++mAverageLatencyCount;
mAverageLatencyAccumulator += (theEndNanos - theStartNanos) - inNanos;
@@ -231,7 +231,7 @@ bool CAGuard::WaitFor(UInt64 inNanos)
#if Log_WaitOwnership
DebugPrintfRtn(DebugPrintfFileComma "%lu %.4f: CAGuard::WaitFor: thread %lu is waiting on %s, owner: %lu\n", GetCurrentThreadId(), ((Float64)(CAHostTimeBase::GetCurrentTimeInNanos()) / 1000000.0), GetCurrentThreadId(), mName, mOwner);
#endif
-
+
ReleaseMutex(mMutex);
HANDLE theHandles[] = { mMutex, mEvent };
OSStatus theError = WaitForMultipleObjects(2, theHandles, true, theWaitTime);
@@ -246,15 +246,15 @@ bool CAGuard::WaitFor(UInt64 inNanos)
#if Log_TimedWaits || Log_Latency || Log_Average_Latency
UInt64 theEndNanos = CAHostTimeBase::GetCurrentTimeInNanos();
#endif
-
+
#if Log_TimedWaits
DebugMessageN1("CAGuard::WaitFor: waited %.0f", (Float64)(theEndNanos - theStartNanos));
#endif
-
+
#if Log_Latency
DebugMessageN1("CAGuard::WaitFor: latency %.0f", (Float64)((theEndNanos - theStartNanos) - inNanos));
#endif
-
+
#if Log_Average_Latency
++mAverageLatencyCount;
mAverageLatencyAccumulator += (theEndNanos - theStartNanos) - inNanos;
@@ -280,11 +280,11 @@ bool CAGuard::WaitUntil(UInt64 inNanos)
{
bool theAnswer = false;
UInt64 theCurrentNanos = CAHostTimeBase::GetCurrentTimeInNanos();
-
+
#if Log_TimedWaits
DebugMessageN2("CAGuard::WaitUntil: now: %.0f, requested: %.0f", (double)theCurrentNanos, (double)inNanos);
#endif
-
+
if(inNanos > theCurrentNanos)
{
#if Log_Errors
@@ -319,7 +319,7 @@ void CAGuard::Notify()
#if Log_WaitOwnership
DebugPrintfRtn(DebugPrintfFileComma "%lu %.4f: CAGuard::Notify: thread %lu is notifying %s, owner: %lu\n", GetCurrentThreadId(), ((Float64)(CAHostTimeBase::GetCurrentTimeInNanos()) / 1000000.0), GetCurrentThreadId(), mName, mOwner);
#endif
-
+
SetEvent(mEvent);
#endif
}
@@ -337,7 +337,7 @@ void CAGuard::NotifyAll()
#if Log_WaitOwnership
DebugPrintfRtn(DebugPrintfFileComma "%lu %.4f: CAGuard::NotifyAll: thread %lu is notifying %s, owner: %lu\n", GetCurrentThreadId(), ((Float64)(CAHostTimeBase::GetCurrentTimeInNanos()) / 1000000.0), GetCurrentThreadId(), mName, mOwner);
#endif
-
+
SetEvent(mEvent);
#endif
}
diff --git a/libs/appleutility/CoreAudio/PublicUtility/CAGuard.h b/libs/appleutility/CoreAudio/PublicUtility/CAGuard.h
index ffcb59da8d..f6d80eccba 100644
--- a/libs/appleutility/CoreAudio/PublicUtility/CAGuard.h
+++ b/libs/appleutility/CoreAudio/PublicUtility/CAGuard.h
@@ -2,14 +2,14 @@
File: CAGuard.h
Abstract: Part of CoreAudio Utility Classes
Version: 1.1
-
+
Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple
Inc. ("Apple") in consideration of your agreement to the following
terms, and your use, installation, modification or redistribution of
this Apple software constitutes acceptance of these terms. If you do
not agree with these terms, please do not use, install, modify or
redistribute this Apple software.
-
+
In consideration of your agreement to abide by the following terms, and
subject to these terms, Apple grants you a personal, non-exclusive
license, under Apple's copyrights in this original Apple software (the
@@ -25,13 +25,13 @@
implied, are granted by Apple herein, including but not limited to any
patent rights that may be infringed by your derivative works or by other
works in which the Apple Software may be incorporated.
-
+
The Apple Software is provided by Apple on an "AS IS" basis. APPLE
MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND
OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
-
+
IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
@@ -40,9 +40,9 @@
AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),
STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
-
+
Copyright (C) 2014 Apple Inc. All Rights Reserved.
-
+
*/
#if !defined(__CAGuard_h__)
#define __CAGuard_h__
@@ -83,7 +83,7 @@ public:
virtual void Wait();
virtual bool WaitFor(UInt64 inNanos);
virtual bool WaitUntil(UInt64 inNanos);
-
+
virtual void Notify();
virtual void NotifyAll();
@@ -98,34 +98,34 @@ protected:
Float64 mAverageLatencyAccumulator;
UInt32 mAverageLatencyCount;
#endif
-
+
// Helper class to manage taking and releasing recursively
public:
class Locker
{
-
+
// Construction/Destruction
public:
Locker(CAGuard& inGuard) : mGuard(inGuard), mNeedsRelease(false) { mNeedsRelease = mGuard.Lock(); }
~Locker() { if(mNeedsRelease) { mGuard.Unlock(); } }
-
+
private:
Locker(const Locker&);
Locker& operator=(const Locker&);
-
+
// Actions
public:
void Wait() { mGuard.Wait(); }
bool WaitFor(UInt64 inNanos) { return mGuard.WaitFor(inNanos); }
bool WaitUntil(UInt64 inNanos) { return mGuard.WaitUntil(inNanos); }
-
+
void Notify() { mGuard.Notify(); }
void NotifyAll() { mGuard.NotifyAll(); }
// Implementation
private:
CAGuard& mGuard;
- bool mNeedsRelease;
+ bool mNeedsRelease;
};
};
diff --git a/libs/appleutility/CoreAudio/PublicUtility/CAHALAudioDevice.cpp b/libs/appleutility/CoreAudio/PublicUtility/CAHALAudioDevice.cpp
index 9bce34626a..fe668b9048 100644
--- a/libs/appleutility/CoreAudio/PublicUtility/CAHALAudioDevice.cpp
+++ b/libs/appleutility/CoreAudio/PublicUtility/CAHALAudioDevice.cpp
@@ -2,14 +2,14 @@
File: CAHALAudioDevice.cpp
Abstract: CAHALAudioDevice.h
Version: 1.1
-
+
Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple
Inc. ("Apple") in consideration of your agreement to the following
terms, and your use, installation, modification or redistribution of
this Apple software constitutes acceptance of these terms. If you do
not agree with these terms, please do not use, install, modify or
redistribute this Apple software.
-
+
In consideration of your agreement to abide by the following terms, and
subject to these terms, Apple grants you a personal, non-exclusive
license, under Apple's copyrights in this original Apple software (the
@@ -25,13 +25,13 @@
implied, are granted by Apple herein, including but not limited to any
patent rights that may be infringed by your derivative works or by other
works in which the Apple Software may be incorporated.
-
+
The Apple Software is provided by Apple on an "AS IS" basis. APPLE
MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND
OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
-
+
IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
@@ -40,9 +40,9 @@
AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),
STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
-
+
Copyright (C) 2014 Apple Inc. All Rights Reserved.
-
+
*/
//==================================================================================================
// Includes
@@ -544,7 +544,7 @@ void CAHALAudioDevice::StartIOProcAtTime(AudioDeviceIOProcID inIOProcID, AudioTi
{
theFlags |= kAudioDeviceStartTimeDontConsultDeviceFlag;
}
-
+
OSStatus theError = AudioDeviceStartAtTime(mObjectID, inIOProcID, &ioStartTime, theFlags);
ThrowIfError(theError, CAException(theError), "CAHALAudioDevice::StartIOProcAtTime: got an error starting an IOProc");
}
@@ -561,15 +561,15 @@ void CAHALAudioDevice::GetIOProcStreamUsage(AudioDeviceIOProcID inIOProcID, bool
UInt32 theNumberStreams = GetNumberStreams(inIsInput);
UInt32 theSize = SizeOf32(void*) + SizeOf32(UInt32) + (theNumberStreams * SizeOf32(UInt32));
CAAutoFree<AudioHardwareIOProcStreamUsage> theStreamUsage(theSize);
-
+
// set it up
theStreamUsage->mIOProc = reinterpret_cast<void*>(inIOProcID);
theStreamUsage->mNumberStreams = theNumberStreams;
-
+
// get the property
CAPropertyAddress theAddress(kAudioDevicePropertyIOProcStreamUsage, inIsInput ? kAudioDevicePropertyScopeInput : kAudioDevicePropertyScopeOutput);
GetPropertyData(theAddress, 0, NULL, theSize, theStreamUsage);
-
+
// fill out the return value
for(UInt32 theIndex = 0; theIndex < theNumberStreams; ++theIndex)
{
@@ -583,7 +583,7 @@ void CAHALAudioDevice::SetIOProcStreamUsage(AudioDeviceIOProcID inIOProcID, bool
UInt32 theNumberStreams = GetNumberStreams(inIsInput);
UInt32 theSize = SizeOf32(void*) + SizeOf32(UInt32) + (theNumberStreams * SizeOf32(UInt32));
CAAutoFree<AudioHardwareIOProcStreamUsage> theStreamUsage(theSize);
-
+
// set it up
theStreamUsage->mIOProc = reinterpret_cast<void*>(inIOProcID);
theStreamUsage->mNumberStreams = theNumberStreams;
@@ -591,7 +591,7 @@ void CAHALAudioDevice::SetIOProcStreamUsage(AudioDeviceIOProcID inIOProcID, bool
{
theStreamUsage->mStreamIsOn[theIndex] = (inStreamUsage[theIndex] ? 1 : 0);
}
-
+
// set the property
CAPropertyAddress theAddress(kAudioDevicePropertyIOProcStreamUsage, inIsInput ? kAudioDevicePropertyScopeInput : kAudioDevicePropertyScopeOutput);
SetPropertyData(theAddress, 0, NULL, theSize, theStreamUsage);
@@ -635,7 +635,7 @@ void CAHALAudioDevice::GetNearestStartTime(AudioTimeStamp& ioTime, bool inIsInpu
{
theFlags |= kAudioDeviceStartTimeDontConsultDeviceFlag;
}
-
+
OSStatus theError = AudioDeviceGetNearestStartTime(mObjectID, &ioTime, theFlags);
ThrowIfError(theError, CAException(theError), "CAHALAudioDevice::GetNearestStartTime: got an error getting the start time");
}
diff --git a/libs/appleutility/CoreAudio/PublicUtility/CAHALAudioDevice.h b/libs/appleutility/CoreAudio/PublicUtility/CAHALAudioDevice.h
index 8cfb466886..ea7a438bdf 100644
--- a/libs/appleutility/CoreAudio/PublicUtility/CAHALAudioDevice.h
+++ b/libs/appleutility/CoreAudio/PublicUtility/CAHALAudioDevice.h
@@ -2,14 +2,14 @@
File: CAHALAudioDevice.h
Abstract: Part of CoreAudio Utility Classes
Version: 1.1
-
+
Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple
Inc. ("Apple") in consideration of your agreement to the following
terms, and your use, installation, modification or redistribution of
this Apple software constitutes acceptance of these terms. If you do
not agree with these terms, please do not use, install, modify or
redistribute this Apple software.
-
+
In consideration of your agreement to abide by the following terms, and
subject to these terms, Apple grants you a personal, non-exclusive
license, under Apple's copyrights in this original Apple software (the
@@ -25,13 +25,13 @@
implied, are granted by Apple herein, including but not limited to any
patent rights that may be infringed by your derivative works or by other
works in which the Apple Software may be incorporated.
-
+
The Apple Software is provided by Apple on an "AS IS" basis. APPLE
MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND
OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
-
+
IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
@@ -40,9 +40,9 @@
AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),
STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
-
+
Copyright (C) 2014 Apple Inc. All Rights Reserved.
-
+
*/
#if !defined(__CAHALAudioDevice_h__)
#define __CAHALAudioDevice_h__
@@ -108,7 +108,7 @@ public:
UInt32 GetTotalNumberChannels(bool inIsInput) const;
void GetCurrentVirtualFormats(bool inIsInput, UInt32& ioNumberStreams, AudioStreamBasicDescription* outFormats) const;
void GetCurrentPhysicalFormats(bool inIsInput, UInt32& ioNumberStreams, AudioStreamBasicDescription* outFormats) const;
-
+
// IO Stuff
public:
bool IsRunning() const;
@@ -141,7 +141,7 @@ public:
void SetIOProcStreamUsage(AudioDeviceIOProcID inIOProcID, bool inIsInput, const bool* inStreamUsage);
Float32 GetIOCycleUsage() const;
void SetIOCycleUsage(Float32 inValue);
-
+
// Time Operations
public:
void GetCurrentTime(AudioTimeStamp& outTime);
@@ -158,7 +158,7 @@ public:
void SetVolumeControlDecibelValue(AudioObjectPropertyScope inScope, UInt32 inChannel, Float32 inValue);
Float32 GetVolumeControlScalarForDecibelValue(AudioObjectPropertyScope inScope, UInt32 inChannel, Float32 inValue) const;
Float32 GetVolumeControlDecibelForScalarValue(AudioObjectPropertyScope inScope, UInt32 inChannel, Float32 inValue) const;
-
+
bool HasSubVolumeControl(AudioObjectPropertyScope inScope, UInt32 inChannel) const;
bool SubVolumeControlIsSettable(AudioObjectPropertyScope inScope, UInt32 inChannel) const;
Float32 GetSubVolumeControlScalarValue(AudioObjectPropertyScope inScope, UInt32 inChannel) const;
@@ -167,31 +167,31 @@ public:
void SetSubVolumeControlDecibelValue(AudioObjectPropertyScope inScope, UInt32 inChannel, Float32 inValue);
Float32 GetSubVolumeControlScalarForDecibelValue(AudioObjectPropertyScope inScope, UInt32 inChannel, Float32 inValue) const;
Float32 GetSubVolumeControlDecibelForScalarValue(AudioObjectPropertyScope inScope, UInt32 inChannel, Float32 inValue) const;
-
+
bool HasMuteControl(AudioObjectPropertyScope inScope, UInt32 inChannel) const;
bool MuteControlIsSettable(AudioObjectPropertyScope inScope, UInt32 inChannel) const;
bool GetMuteControlValue(AudioObjectPropertyScope inScope, UInt32 inChannel) const;
void SetMuteControlValue(AudioObjectPropertyScope inScope, UInt32 inChannel, bool inValue);
-
+
bool HasSoloControl(AudioObjectPropertyScope inScope, UInt32 inChannel) const;
bool SoloControlIsSettable(AudioObjectPropertyScope inScope, UInt32 inChannel) const;
bool GetSoloControlValue(AudioObjectPropertyScope inScope, UInt32 inChannel) const;
void SetSoloControlValue(AudioObjectPropertyScope inScope, UInt32 inChannel, bool inValue);
-
+
bool HasStereoPanControl(AudioObjectPropertyScope inScope, UInt32 inChannel) const;
bool StereoPanControlIsSettable(AudioObjectPropertyScope inScope, UInt32 inChannel) const;
Float32 GetStereoPanControlValue(AudioObjectPropertyScope inScope, UInt32 inChannel) const;
void SetStereoPanControlValue(AudioObjectPropertyScope inScope, UInt32 inChannel, Float32 inValue);
void GetStereoPanControlChannels(AudioObjectPropertyScope inScope, UInt32 inChannel, UInt32& outLeftChannel, UInt32& outRightChannel) const;
-
+
bool HasJackControl(AudioObjectPropertyScope inScope, UInt32 inChannel) const;
bool GetJackControlValue(AudioObjectPropertyScope inScope, UInt32 inChannel) const;
-
+
bool HasSubMuteControl(AudioObjectPropertyScope inScope, UInt32 inChannel) const;
bool SubMuteControlIsSettable(AudioObjectPropertyScope inScope, UInt32 inChannel) const;
bool GetSubMuteControlValue(AudioObjectPropertyScope inScope, UInt32 inChannel) const;
void SetSubMuteControlValue(AudioObjectPropertyScope inScope, UInt32 inChannel, bool inValue);
-
+
bool HasiSubOwnerControl(AudioObjectPropertyScope inScope, UInt32 inChannel) const;
bool iSubOwnerControlIsSettable(AudioObjectPropertyScope inScope, UInt32 inChannel) const;
bool GetiSubOwnerControlValue(AudioObjectPropertyScope inScope, UInt32 inChannel) const;
@@ -224,7 +224,7 @@ public:
UInt32 GetAvailableClockSourceByIndex(UInt32 inIndex) const;
CFStringRef CopyClockSourceNameForID(UInt32 inID) const;
UInt32 GetClockSourceKindForID(UInt32 inID) const;
-
+
};
inline AudioDeviceIOProcID CAHALAudioDevice::CreateIOProcIDWithBlock(dispatch_queue_t inDispatchQueue, AudioDeviceIOBlock inIOBlock)
diff --git a/libs/appleutility/CoreAudio/PublicUtility/CAHALAudioObject.cpp b/libs/appleutility/CoreAudio/PublicUtility/CAHALAudioObject.cpp
index c8f16b4fb3..3e3255ef71 100644
--- a/libs/appleutility/CoreAudio/PublicUtility/CAHALAudioObject.cpp
+++ b/libs/appleutility/CoreAudio/PublicUtility/CAHALAudioObject.cpp
@@ -2,14 +2,14 @@
File: CAHALAudioObject.cpp
Abstract: CAHALAudioObject.h
Version: 1.1
-
+
Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple
Inc. ("Apple") in consideration of your agreement to the following
terms, and your use, installation, modification or redistribution of
this Apple software constitutes acceptance of these terms. If you do
not agree with these terms, please do not use, install, modify or
redistribute this Apple software.
-
+
In consideration of your agreement to abide by the following terms, and
subject to these terms, Apple grants you a personal, non-exclusive
license, under Apple's copyrights in this original Apple software (the
@@ -25,13 +25,13 @@
implied, are granted by Apple herein, including but not limited to any
patent rights that may be infringed by your derivative works or by other
works in which the Apple Software may be incorporated.
-
+
The Apple Software is provided by Apple on an "AS IS" basis. APPLE
MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND
OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
-
+
IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
@@ -40,9 +40,9 @@
AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),
STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
-
+
Copyright (C) 2014 Apple Inc. All Rights Reserved.
-
+
*/
//==================================================================================================
// Includes
@@ -85,17 +85,17 @@ AudioClassID CAHALAudioObject::GetClassID() const
{
// set up the return value
AudioClassID theAnswer = 0;
-
+
// set up the property address
CAPropertyAddress theAddress(kAudioObjectPropertyClass);
-
+
// make sure the property exists
if(HasProperty(theAddress))
{
UInt32 theSize = sizeof(AudioClassID);
GetPropertyData(theAddress, 0, NULL, theSize, &theAnswer);
}
-
+
return theAnswer;
}
@@ -103,10 +103,10 @@ AudioObjectID CAHALAudioObject::GetOwnerObjectID() const
{
// set up the return value
AudioObjectID theAnswer = 0;
-
+
// set up the property address
CAPropertyAddress theAddress(kAudioObjectPropertyOwner);
-
+
// make sure the property exists
if(HasProperty(theAddress))
{
@@ -114,7 +114,7 @@ AudioObjectID CAHALAudioObject::GetOwnerObjectID() const
UInt32 theSize = sizeof(AudioObjectID);
GetPropertyData(theAddress, 0, NULL, theSize, &theAnswer);
}
-
+
return theAnswer;
}
@@ -122,10 +122,10 @@ CFStringRef CAHALAudioObject::CopyOwningPlugInBundleID() const
{
// set up the return value
CFStringRef theAnswer = NULL;
-
+
// set up the property address
CAPropertyAddress theAddress(kAudioObjectPropertyCreator);
-
+
// make sure the property exists
if(HasProperty(theAddress))
{
@@ -133,7 +133,7 @@ CFStringRef CAHALAudioObject::CopyOwningPlugInBundleID() const
UInt32 theSize = sizeof(CFStringRef);
GetPropertyData(theAddress, 0, NULL, theSize, &theAnswer);
}
-
+
return theAnswer;
}
@@ -141,10 +141,10 @@ CFStringRef CAHALAudioObject::CopyName() const
{
// set up the return value
CFStringRef theAnswer = NULL;
-
+
// set up the property address
CAPropertyAddress theAddress(kAudioObjectPropertyName);
-
+
// make sure the property exists
if(HasProperty(theAddress))
{
@@ -152,7 +152,7 @@ CFStringRef CAHALAudioObject::CopyName() const
UInt32 theSize = sizeof(CFStringRef);
GetPropertyData(theAddress, 0, NULL, theSize, &theAnswer);
}
-
+
return theAnswer;
}
@@ -160,10 +160,10 @@ CFStringRef CAHALAudioObject::CopyManufacturer() const
{
// set up the return value
CFStringRef theAnswer = NULL;
-
+
// set up the property address
CAPropertyAddress theAddress(kAudioObjectPropertyManufacturer);
-
+
// make sure the property exists
if(HasProperty(theAddress))
{
@@ -171,7 +171,7 @@ CFStringRef CAHALAudioObject::CopyManufacturer() const
UInt32 theSize = sizeof(CFStringRef);
GetPropertyData(theAddress, 0, NULL, theSize, &theAnswer);
}
-
+
return theAnswer;
}
@@ -179,10 +179,10 @@ CFStringRef CAHALAudioObject::CopyNameForElement(AudioObjectPropertyScope inScop
{
// set up the return value
CFStringRef theAnswer = NULL;
-
+
// set up the property address
CAPropertyAddress theAddress(kAudioObjectPropertyElementName, inScope, inElement);
-
+
// make sure the property exists
if(HasProperty(theAddress))
{
@@ -190,7 +190,7 @@ CFStringRef CAHALAudioObject::CopyNameForElement(AudioObjectPropertyScope inScop
UInt32 theSize = sizeof(CFStringRef);
GetPropertyData(theAddress, 0, NULL, theSize, &theAnswer);
}
-
+
return theAnswer;
}
@@ -198,10 +198,10 @@ CFStringRef CAHALAudioObject::CopyCategoryNameForElement(AudioObjectPropertyScop
{
// set up the return value
CFStringRef theAnswer = NULL;
-
+
// set up the property address
CAPropertyAddress theAddress(kAudioObjectPropertyElementCategoryName, inScope, inElement);
-
+
// make sure the property exists
if(HasProperty(theAddress))
{
@@ -209,7 +209,7 @@ CFStringRef CAHALAudioObject::CopyCategoryNameForElement(AudioObjectPropertyScop
UInt32 theSize = sizeof(CFStringRef);
GetPropertyData(theAddress, 0, NULL, theSize, &theAnswer);
}
-
+
return theAnswer;
}
@@ -217,10 +217,10 @@ CFStringRef CAHALAudioObject::CopyNumberNameForElement(AudioObjectPropertyScope
{
// set up the return value
CFStringRef theAnswer = NULL;
-
+
// set up the property address
CAPropertyAddress theAddress(kAudioObjectPropertyElementNumberName, inScope, inElement);
-
+
// make sure the property exists
if(HasProperty(theAddress))
{
@@ -228,7 +228,7 @@ CFStringRef CAHALAudioObject::CopyNumberNameForElement(AudioObjectPropertyScope
UInt32 theSize = sizeof(CFStringRef);
GetPropertyData(theAddress, 0, NULL, theSize, &theAnswer);
}
-
+
return theAnswer;
}
@@ -243,10 +243,10 @@ UInt32 CAHALAudioObject::GetNumberOwnedObjects(AudioClassID inClass) const
{
// set up the return value
UInt32 theAnswer = 0;
-
+
// set up the property address
CAPropertyAddress theAddress(kAudioObjectPropertyOwnedObjects);
-
+
// figure out the qualifier
UInt32 theQualifierSize = 0;
void* theQualifierData = NULL;
@@ -255,13 +255,13 @@ UInt32 CAHALAudioObject::GetNumberOwnedObjects(AudioClassID inClass) const
theQualifierSize = sizeof(AudioObjectID);
theQualifierData = &inClass;
}
-
+
// get the property data size
theAnswer = GetPropertyDataSize(theAddress, theQualifierSize, theQualifierData);
-
+
// calculate the number of object IDs
theAnswer /= SizeOf32(AudioObjectID);
-
+
return theAnswer;
}
@@ -269,7 +269,7 @@ void CAHALAudioObject::GetAllOwnedObjects(AudioClassID inClass, UInt32& ioNumber
{
// set up the property address
CAPropertyAddress theAddress(kAudioObjectPropertyOwnedObjects);
-
+
// figure out the qualifier
UInt32 theQualifierSize = 0;
void* theQualifierData = NULL;
@@ -278,11 +278,11 @@ void CAHALAudioObject::GetAllOwnedObjects(AudioClassID inClass, UInt32& ioNumber
theQualifierSize = sizeof(AudioObjectID);
theQualifierData = &inClass;
}
-
+
// get the property data
UInt32 theDataSize = ioNumberObjects * SizeOf32(AudioClassID);
GetPropertyData(theAddress, theQualifierSize, theQualifierData, theDataSize, ioObjectIDs);
-
+
// set the number of object IDs being returned
ioNumberObjects = theDataSize / SizeOf32(AudioObjectID);
}
@@ -291,7 +291,7 @@ AudioObjectID CAHALAudioObject::GetOwnedObjectByIndex(AudioClassID inClass, UInt
{
// set up the property address
CAPropertyAddress theAddress(kAudioObjectPropertyOwnedObjects);
-
+
// figure out the qualifier
UInt32 theQualifierSize = 0;
void* theQualifierData = NULL;
@@ -300,27 +300,27 @@ AudioObjectID CAHALAudioObject::GetOwnedObjectByIndex(AudioClassID inClass, UInt
theQualifierSize = sizeof(AudioObjectID);
theQualifierData = &inClass;
}
-
+
// figure out how much space to allocate
UInt32 theDataSize = GetPropertyDataSize(theAddress, theQualifierSize, theQualifierData);
UInt32 theNumberObjectIDs = theDataSize / SizeOf32(AudioObjectID);
-
+
// set up the return value
AudioObjectID theAnswer = 0;
-
+
// maker sure the index is in range
if(inIndex < theNumberObjectIDs)
{
// allocate it
CAAutoArrayDelete<AudioObjectID> theObjectList(theDataSize / sizeof(AudioObjectID));
-
+
// get the property data
GetPropertyData(theAddress, theQualifierSize, theQualifierData, theDataSize, theObjectList);
-
+
// get the return value
theAnswer = theObjectList[inIndex];
}
-
+
return theAnswer;
}
diff --git a/libs/appleutility/CoreAudio/PublicUtility/CAHALAudioObject.h b/libs/appleutility/CoreAudio/PublicUtility/CAHALAudioObject.h
index d99ab0d59a..1933a27459 100644
--- a/libs/appleutility/CoreAudio/PublicUtility/CAHALAudioObject.h
+++ b/libs/appleutility/CoreAudio/PublicUtility/CAHALAudioObject.h
@@ -2,14 +2,14 @@
File: CAHALAudioObject.h
Abstract: Part of CoreAudio Utility Classes
Version: 1.1
-
+
Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple
Inc. ("Apple") in consideration of your agreement to the following
terms, and your use, installation, modification or redistribution of
this Apple software constitutes acceptance of these terms. If you do
not agree with these terms, please do not use, install, modify or
redistribute this Apple software.
-
+
In consideration of your agreement to abide by the following terms, and
subject to these terms, Apple grants you a personal, non-exclusive
license, under Apple's copyrights in this original Apple software (the
@@ -25,13 +25,13 @@
implied, are granted by Apple herein, including but not limited to any
patent rights that may be infringed by your derivative works or by other
works in which the Apple Software may be incorporated.
-
+
The Apple Software is provided by Apple on an "AS IS" basis. APPLE
MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND
OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
-
+
IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
@@ -40,9 +40,9 @@
AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),
STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
-
+
Copyright (C) 2014 Apple Inc. All Rights Reserved.
-
+
*/
#if !defined(__CAHALAudioObject_h__)
#define __CAHALAudioObject_h__
@@ -88,7 +88,7 @@ public:
CFStringRef CopyNameForElement(AudioObjectPropertyScope inScope, AudioObjectPropertyElement inElement) const;
CFStringRef CopyCategoryNameForElement(AudioObjectPropertyScope inScope, AudioObjectPropertyElement inElement) const;
CFStringRef CopyNumberNameForElement(AudioObjectPropertyScope inScope, AudioObjectPropertyElement inElement) const;
-
+
static bool ObjectExists(AudioObjectID inObjectID);
// Owned Objects
@@ -96,16 +96,16 @@ public:
UInt32 GetNumberOwnedObjects(AudioClassID inClass) const;
void GetAllOwnedObjects(AudioClassID inClass, UInt32& ioNumberObjects, AudioObjectID* ioObjectIDs) const;
AudioObjectID GetOwnedObjectByIndex(AudioClassID inClass, UInt32 inIndex);
-
+
// Property Operations
public:
bool HasProperty(const AudioObjectPropertyAddress& inAddress) const;
bool IsPropertySettable(const AudioObjectPropertyAddress& inAddress) const;
UInt32 GetPropertyDataSize(const AudioObjectPropertyAddress& inAddress, UInt32 inQualifierDataSize, const void* inQualifierData) const;
-
+
void GetPropertyData(const AudioObjectPropertyAddress& inAddress, UInt32 inQualifierDataSize, const void* inQualifierData, UInt32& ioDataSize, void* outData) const;
void SetPropertyData(const AudioObjectPropertyAddress& inAddress, UInt32 inQualifierDataSize, const void* inQualifierData, UInt32 inDataSize, const void* inData);
-
+
UInt32 GetPropertyData_UInt32(const AudioObjectPropertyAddress& inAddress, UInt32 inQualifierDataSize = 0, const void* inQualifierData = NULL) const { UInt32 theAnswer = 0; UInt32 theDataSize = SizeOf32(UInt32); GetPropertyData(inAddress, inQualifierDataSize, inQualifierData, theDataSize, &theAnswer); return theAnswer; }
void SetPropertyData_UInt32(const AudioObjectPropertyAddress& inAddress, UInt32 inValue, UInt32 inQualifierDataSize = 0, const void* inQualifierData = NULL) { SetPropertyData(inAddress, inQualifierDataSize, inQualifierData, SizeOf32(UInt32), &inValue); }
@@ -127,7 +127,7 @@ public:
template <class T> UInt32 GetPropertyData_ArraySize(const AudioObjectPropertyAddress& inAddress, UInt32 inQualifierDataSize = 0, const void* inQualifierData = NULL) const { return GetPropertyDataSize(inAddress, inQualifierDataSize, inQualifierData) / SizeOf32(T); }
template <class T> void GetPropertyData_Array(const AudioObjectPropertyAddress& inAddress, UInt32& ioNumberItems, T* outArray, UInt32 inQualifierDataSize = 0, const void* inQualifierData = NULL) const { UInt32 theDataSize = ioNumberItems * SizeOf32(T); GetPropertyData(inAddress, inQualifierDataSize, inQualifierData, theDataSize, outArray); ioNumberItems = theDataSize / SizeOf32(T); }
template <class T> void SetPropertyData_Array(const AudioObjectPropertyAddress& inAddress, UInt32 inNumberItems, T* inArray, UInt32 inQualifierDataSize = 0, const void* inQualifierData = NULL) { SetPropertyData(inAddress, inQualifierDataSize, inQualifierData, inNumberItems * SizeOf32(T), inArray); }
-
+
void AddPropertyListener(const AudioObjectPropertyAddress& inAddress, AudioObjectPropertyListenerProc inListenerProc, void* inClientData);
void RemovePropertyListener(const AudioObjectPropertyAddress& inAddress, AudioObjectPropertyListenerProc inListenerProc, void* inClientData);
diff --git a/libs/appleutility/CoreAudio/PublicUtility/CAHALAudioStream.cpp b/libs/appleutility/CoreAudio/PublicUtility/CAHALAudioStream.cpp
index 62b9b3c566..d28f0d2cd0 100644
--- a/libs/appleutility/CoreAudio/PublicUtility/CAHALAudioStream.cpp
+++ b/libs/appleutility/CoreAudio/PublicUtility/CAHALAudioStream.cpp
@@ -2,14 +2,14 @@
File: CAHALAudioStream.cpp
Abstract: CAHALAudioStream.h
Version: 1.1
-
+
Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple
Inc. ("Apple") in consideration of your agreement to the following
terms, and your use, installation, modification or redistribution of
this Apple software constitutes acceptance of these terms. If you do
not agree with these terms, please do not use, install, modify or
redistribute this Apple software.
-
+
In consideration of your agreement to abide by the following terms, and
subject to these terms, Apple grants you a personal, non-exclusive
license, under Apple's copyrights in this original Apple software (the
@@ -25,13 +25,13 @@
implied, are granted by Apple herein, including but not limited to any
patent rights that may be infringed by your derivative works or by other
works in which the Apple Software may be incorporated.
-
+
The Apple Software is provided by Apple on an "AS IS" basis. APPLE
MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND
OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
-
+
IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
@@ -40,9 +40,9 @@
AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),
STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
-
+
Copyright (C) 2014 Apple Inc. All Rights Reserved.
-
+
*/
//==================================================================================================
// Includes
diff --git a/libs/appleutility/CoreAudio/PublicUtility/CAHALAudioStream.h b/libs/appleutility/CoreAudio/PublicUtility/CAHALAudioStream.h
index 0c6cb55a85..a61c5adc7e 100644
--- a/libs/appleutility/CoreAudio/PublicUtility/CAHALAudioStream.h
+++ b/libs/appleutility/CoreAudio/PublicUtility/CAHALAudioStream.h
@@ -2,14 +2,14 @@
File: CAHALAudioStream.h
Abstract: Part of CoreAudio Utility Classes
Version: 1.1
-
+
Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple
Inc. ("Apple") in consideration of your agreement to the following
terms, and your use, installation, modification or redistribution of
this Apple software constitutes acceptance of these terms. If you do
not agree with these terms, please do not use, install, modify or
redistribute this Apple software.
-
+
In consideration of your agreement to abide by the following terms, and
subject to these terms, Apple grants you a personal, non-exclusive
license, under Apple's copyrights in this original Apple software (the
@@ -25,13 +25,13 @@
implied, are granted by Apple herein, including but not limited to any
patent rights that may be infringed by your derivative works or by other
works in which the Apple Software may be incorporated.
-
+
The Apple Software is provided by Apple on an "AS IS" basis. APPLE
MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND
OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
-
+
IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
@@ -40,9 +40,9 @@
AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),
STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
-
+
Copyright (C) 2014 Apple Inc. All Rights Reserved.
-
+
*/
#if !defined(__CAHALAudioStream_h__)
#define __CAHALAudioStream_h__
diff --git a/libs/appleutility/CoreAudio/PublicUtility/CAHALAudioSystemObject.cpp b/libs/appleutility/CoreAudio/PublicUtility/CAHALAudioSystemObject.cpp
index 404dd98498..50643db9dc 100644
--- a/libs/appleutility/CoreAudio/PublicUtility/CAHALAudioSystemObject.cpp
+++ b/libs/appleutility/CoreAudio/PublicUtility/CAHALAudioSystemObject.cpp
@@ -2,14 +2,14 @@
File: CAHALAudioSystemObject.cpp
Abstract: CAHALAudioSystemObject.h
Version: 1.1
-
+
Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple
Inc. ("Apple") in consideration of your agreement to the following
terms, and your use, installation, modification or redistribution of
this Apple software constitutes acceptance of these terms. If you do
not agree with these terms, please do not use, install, modify or
redistribute this Apple software.
-
+
In consideration of your agreement to abide by the following terms, and
subject to these terms, Apple grants you a personal, non-exclusive
license, under Apple's copyrights in this original Apple software (the
@@ -25,13 +25,13 @@
implied, are granted by Apple herein, including but not limited to any
patent rights that may be infringed by your derivative works or by other
works in which the Apple Software may be incorporated.
-
+
The Apple Software is provided by Apple on an "AS IS" basis. APPLE
MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND
OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
-
+
IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
@@ -40,9 +40,9 @@
AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),
STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
-
+
Copyright (C) 2014 Apple Inc. All Rights Reserved.
-
+
*/
//==================================================================================================
// Includes
@@ -124,15 +124,15 @@ void CAHALAudioSystemObject::LogBasicDeviceInfo()
char theCString[256];
UInt32 theCStringSize = sizeof(theCString);
DebugMessageN1("CAHALAudioSystemObject::LogBasicDeviceInfo: Device %d", (int)theDeviceIndex);
-
+
CAHALAudioDevice theDevice(theDeviceList[theDeviceIndex]);
DebugMessageN1("CAHALAudioSystemObject::LogBasicDeviceInfo: Object ID: %d", (int)theDeviceList[theDeviceIndex]);
-
+
CACFString theDeviceName(theDevice.CopyName());
theCStringSize = sizeof(theCString);
theDeviceName.GetCString(theCString, theCStringSize);
DebugMessageN1("CAHALAudioSystemObject::LogBasicDeviceInfo: Name: %s", theCString);
-
+
CACFString theDeviceUID(theDevice.CopyDeviceUID());
theCStringSize = sizeof(theCString);
theDeviceUID.GetCString(theCString, theCStringSize);
diff --git a/libs/appleutility/CoreAudio/PublicUtility/CAHALAudioSystemObject.h b/libs/appleutility/CoreAudio/PublicUtility/CAHALAudioSystemObject.h
index 0ade7a5098..6b0f938ed5 100644
--- a/libs/appleutility/CoreAudio/PublicUtility/CAHALAudioSystemObject.h
+++ b/libs/appleutility/CoreAudio/PublicUtility/CAHALAudioSystemObject.h
@@ -2,14 +2,14 @@
File: CAHALAudioSystemObject.h
Abstract: Part of CoreAudio Utility Classes
Version: 1.1
-
+
Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple
Inc. ("Apple") in consideration of your agreement to the following
terms, and your use, installation, modification or redistribution of
this Apple software constitutes acceptance of these terms. If you do
not agree with these terms, please do not use, install, modify or
redistribute this Apple software.
-
+
In consideration of your agreement to abide by the following terms, and
subject to these terms, Apple grants you a personal, non-exclusive
license, under Apple's copyrights in this original Apple software (the
@@ -25,13 +25,13 @@
implied, are granted by Apple herein, including but not limited to any
patent rights that may be infringed by your derivative works or by other
works in which the Apple Software may be incorporated.
-
+
The Apple Software is provided by Apple on an "AS IS" basis. APPLE
MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND
OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
-
+
IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
@@ -40,9 +40,9 @@
AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),
STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
-
+
Copyright (C) 2014 Apple Inc. All Rights Reserved.
-
+
*/
#if !defined(__CAHALAudioSystemObject_h__)
#define __CAHALAudioSystemObject_h__
@@ -80,7 +80,7 @@ public:
public:
AudioObjectID GetDefaultAudioDevice(bool inIsInput, bool inIsSystem) const;
void SetDefaultAudioDevice(bool inIsInput, bool inIsSystem, AudioObjectID inNewDefaultDevice);
-
+
// PlugIns
public:
AudioObjectID GetAudioPlugInForBundleID(CFStringRef inBundleID) const;
diff --git a/libs/appleutility/CoreAudio/PublicUtility/CAHostTimeBase.cpp b/libs/appleutility/CoreAudio/PublicUtility/CAHostTimeBase.cpp
index db78a4afee..60d91a1582 100644
--- a/libs/appleutility/CoreAudio/PublicUtility/CAHostTimeBase.cpp
+++ b/libs/appleutility/CoreAudio/PublicUtility/CAHostTimeBase.cpp
@@ -2,14 +2,14 @@
File: CAHostTimeBase.cpp
Abstract: CAHostTimeBase.h
Version: 1.1
-
+
Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple
Inc. ("Apple") in consideration of your agreement to the following
terms, and your use, installation, modification or redistribution of
this Apple software constitutes acceptance of these terms. If you do
not agree with these terms, please do not use, install, modify or
redistribute this Apple software.
-
+
In consideration of your agreement to abide by the following terms, and
subject to these terms, Apple grants you a personal, non-exclusive
license, under Apple's copyrights in this original Apple software (the
@@ -25,13 +25,13 @@
implied, are granted by Apple herein, including but not limited to any
patent rights that may be infringed by your derivative works or by other
works in which the Apple Software may be incorporated.
-
+
The Apple Software is provided by Apple on an "AS IS" basis. APPLE
MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND
OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
-
+
IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
@@ -40,9 +40,9 @@
AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),
STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
-
+
Copyright (C) 2014 Apple Inc. All Rights Reserved.
-
+
*/
//=============================================================================
// Includes
@@ -88,7 +88,7 @@ void CAHostTimeBase::Initialize()
sFrequency = static_cast<Float64>(*((UInt64*)&theFrequency));
#endif
sInverseFrequency = 1.0 / sFrequency;
-
+
#if Log_Host_Time_Base_Parameters
DebugPrintf("Host Time Base Parameters");
DebugPrintf(" Minimum Delta: %lu", (unsigned long)sMinDelta);
diff --git a/libs/appleutility/CoreAudio/PublicUtility/CAHostTimeBase.h b/libs/appleutility/CoreAudio/PublicUtility/CAHostTimeBase.h
index 50e3507648..7b5303b6fd 100644
--- a/libs/appleutility/CoreAudio/PublicUtility/CAHostTimeBase.h
+++ b/libs/appleutility/CoreAudio/PublicUtility/CAHostTimeBase.h
@@ -2,14 +2,14 @@
File: CAHostTimeBase.h
Abstract: Part of CoreAudio Utility Classes
Version: 1.1
-
+
Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple
Inc. ("Apple") in consideration of your agreement to the following
terms, and your use, installation, modification or redistribution of
this Apple software constitutes acceptance of these terms. If you do
not agree with these terms, please do not use, install, modify or
redistribute this Apple software.
-
+
In consideration of your agreement to abide by the following terms, and
subject to these terms, Apple grants you a personal, non-exclusive
license, under Apple's copyrights in this original Apple software (the
@@ -25,13 +25,13 @@
implied, are granted by Apple herein, including but not limited to any
patent rights that may be infringed by your derivative works or by other
works in which the Apple Software may be incorporated.
-
+
The Apple Software is provided by Apple on an "AS IS" basis. APPLE
MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND
OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
-
+
IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
@@ -40,9 +40,9 @@
AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),
STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
-
+
Copyright (C) 2014 Apple Inc. All Rights Reserved.
-
+
*/
#if !defined(__CAHostTimeBase_h__)
#define __CAHostTimeBase_h__
@@ -101,12 +101,12 @@ public:
static SInt64 HostDeltaToNanos(UInt64 inStartTime, UInt64 inEndTime);
static UInt64 MultiplyByRatio(UInt64 inMuliplicand, UInt32 inNumerator, UInt32 inDenominator);
-
+
private:
static void Initialize();
-
+
static pthread_once_t sIsInited;
-
+
static Float64 sFrequency;
static Float64 sInverseFrequency;
static UInt32 sMinDelta;
@@ -128,7 +128,7 @@ inline UInt64 CAHostTimeBase::GetTheCurrentTime()
QueryPerformanceCounter(&theValue);
theTime = *((UInt64*)&theValue);
#endif
-
+
#if Track_Host_TimeBase
if(sLastTime != 0)
{
@@ -150,7 +150,7 @@ inline UInt64 CAHostTimeBase::GetTheCurrentTime()
inline UInt64 CAHostTimeBase::ConvertToNanos(UInt64 inHostTime)
{
pthread_once(&sIsInited, Initialize);
-
+
UInt64 theAnswer = MultiplyByRatio(inHostTime, sToNanosNumerator, sToNanosDenominator);
#if CoreAudio_Debug
if(((sToNanosNumerator > sToNanosDenominator) && (theAnswer < inHostTime)) || ((sToNanosDenominator > sToNanosNumerator) && (theAnswer > inHostTime)))
@@ -158,7 +158,7 @@ inline UInt64 CAHostTimeBase::ConvertToNanos(UInt64 inHostTime)
DebugPrintf("CAHostTimeBase::ConvertToNanos: The conversion wrapped");
}
#endif
-
+
return theAnswer;
}
@@ -185,7 +185,7 @@ inline UInt64 CAHostTimeBase::GetCurrentTimeInNanos()
inline UInt64 CAHostTimeBase::AbsoluteHostDeltaToNanos(UInt64 inStartTime, UInt64 inEndTime)
{
UInt64 theAnswer;
-
+
if(inStartTime <= inEndTime)
{
theAnswer = inEndTime - inStartTime;
@@ -194,7 +194,7 @@ inline UInt64 CAHostTimeBase::AbsoluteHostDeltaToNanos(UInt64 inStartTime, UInt6
{
theAnswer = inStartTime - inEndTime;
}
-
+
return ConvertToNanos(theAnswer);
}
@@ -202,7 +202,7 @@ inline SInt64 CAHostTimeBase::HostDeltaToNanos(UInt64 inStartTime, UInt64 inEndT
{
SInt64 theAnswer;
SInt64 theSign = 1;
-
+
if(inStartTime <= inEndTime)
{
theAnswer = static_cast<SInt64>(inEndTime - inStartTime);
@@ -212,7 +212,7 @@ inline SInt64 CAHostTimeBase::HostDeltaToNanos(UInt64 inStartTime, UInt64 inEndT
theAnswer = static_cast<SInt64>(inStartTime - inEndTime);
theSign = -1;
}
-
+
return theSign * static_cast<SInt64>(ConvertToNanos(static_cast<UInt64>(theAnswer)));
}
diff --git a/libs/appleutility/CoreAudio/PublicUtility/CALogMacros.h b/libs/appleutility/CoreAudio/PublicUtility/CALogMacros.h
index 7fd4ac4c21..4c625065ef 100644
--- a/libs/appleutility/CoreAudio/PublicUtility/CALogMacros.h
+++ b/libs/appleutility/CoreAudio/PublicUtility/CALogMacros.h
@@ -2,14 +2,14 @@
File: CALogMacros.h
Abstract: Part of CoreAudio Utility Classes
Version: 1.1
-
+
Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple
Inc. ("Apple") in consideration of your agreement to the following
terms, and your use, installation, modification or redistribution of
this Apple software constitutes acceptance of these terms. If you do
not agree with these terms, please do not use, install, modify or
redistribute this Apple software.
-
+
In consideration of your agreement to abide by the following terms, and
subject to these terms, Apple grants you a personal, non-exclusive
license, under Apple's copyrights in this original Apple software (the
@@ -25,13 +25,13 @@
implied, are granted by Apple herein, including but not limited to any
patent rights that may be infringed by your derivative works or by other
works in which the Apple Software may be incorporated.
-
+
The Apple Software is provided by Apple on an "AS IS" basis. APPLE
MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND
OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
-
+
IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
@@ -40,9 +40,9 @@
AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),
STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
-
+
Copyright (C) 2014 Apple Inc. All Rights Reserved.
-
+
*/
#if !defined(__CALogMacros_h__)
#define __CALogMacros_h__
@@ -57,31 +57,31 @@
#include "CADebugPrintf.h"
#include <stdio.h>
#include <string.h>
-
+
#define PrintLine(msg) DebugPrintfRtn(DebugPrintfFileComma "%s\n", (msg))
-
+
#define PrintBool(msg, b) DebugPrintfRtn(DebugPrintfFileComma "%s%s\n", (msg), (b) ? "true" : "false")
#define PrintIndexedBool(msg, i, b) DebugPrintfRtn(DebugPrintfFileComma " %s %ld: %s\n", (msg), (long)(i), (b) ? "true" : "false")
-
+
#define PrintToggle(msg, b) DebugPrintfRtn(DebugPrintfFileComma "%s%s\n", (msg), (b) ? "on" : "off")
#define PrintIndexedToggle(msg, i, b) DebugPrintfRtn(DebugPrintfFileComma " %s %ld: %s\n", (msg), (long)(i), (b) ? "on" : "off")
-
+
#define PrintInt(msg, n) DebugPrintfRtn(DebugPrintfFileComma "%s%ld\n", (msg), (long)(n))
#define PrintIndexedInt(msg, i, n) DebugPrintfRtn(DebugPrintfFileComma " %s %ld: %ld\n", (msg), (long)(i), (long)(n))
-
+
#define PrintHex(msg, n) DebugPrintfRtn(DebugPrintfFileComma "%s0x%lX\n", (msg), (unsigned long)(n))
#define PrintIndexedHex(msg, i, n) DebugPrintfRtn(DebugPrintfFileComma " %s %ld: 0x%lX\n", (msg), (long)(i), (unsigned long)(n))
-
+
#define PrintFloat(msg, f) DebugPrintfRtn(DebugPrintfFileComma "%s%.6f\n", (msg), (f))
#define PrintIndexedFloat(msg, i, f) DebugPrintfRtn(DebugPrintfFileComma " %s %ld: %.6f\n", (msg), (long)(i), (f))
#define PrintFloatIndexedFloat(msg, i, f) DebugPrintfRtn(DebugPrintfFileComma " %s %.6f: %.6f\n", (msg), (i), (f))
-
+
#define PrintString(msg, s) DebugPrintfRtn(DebugPrintfFileComma "%s%s\n", (msg), (s))
#define PrintIndexedString(msg, i, s) DebugPrintfRtn(DebugPrintfFileComma " %s %ld: %s\n", (msg), (long)(i), (s))
-
+
#define PrintPointer(msg, p) DebugPrintfRtn(DebugPrintfFileComma "%s%p\n", (msg), (p))
#define PrintIndexedPointer(msg, i, p) DebugPrintfRtn(DebugPrintfFileComma " %s %ld: %p\n", (msg), (long)(i), (p))
-
+
#define Print4CharCode(msg, c) { \
UInt32 __4CC_number = (c); \
char __4CC_string[5] = CA4CCToCString(__4CC_number); \
@@ -92,46 +92,46 @@
char __4CC_string[5] = CA4CCToCString(__4CC_number); \
DebugPrintfRtn(DebugPrintfFileComma " %s %ld: '%s'\n", (msg), (long)(i), __4CC_string); \
}
-
+
#define ErrorLine(s) DebugPrintfRtn(DebugPrintfFileComma "%s\n", (s))
#define OSErrorLine(s, e) { \
OSStatus __err_number = (e); \
char __err_string[5] = CA4CCToCString(__err_number); \
DebugPrintfRtn(DebugPrintfFileComma "%s, OSStatus code: %s\n", (s), __err_string); \
}
-
+
#define MessageIfOSError(e, s) if((e) != 0) { OSErrorLine(s, e); }
#define MessageIfNULL(p, s) if((p) == 0) { ErrorLine(s); }
#else
- #define PrintLine(msg)
-
+ #define PrintLine(msg)
+
#define PrintBool(msg, b) (b)
#define PrintIndexedBool(msg, i, b) (b)
-
+
#define PrintInt(msg, n) (n)
#define PrintIndexedInt(msg, i, n) (n)
-
+
#define PrintHex(msg, n) (n)
#define PrintIndexedHex(msg, i, n) (n)
-
+
#define PrintFloat(msg, f) (f)
#define PrintIndexedFloat(msg, i, f) (f)
#define PrintFloatIndexedFloat(msg, i, f) (f)
-
+
#define PrintString(msg, s) (s)
#define PrintIndexedString(msg, i, s) (s)
-
+
#define PrintPointer(msg, p) (p)
#define PrintIndexedPointer(msg, i, p) (p)
-
+
#define Print4CharCode(msg, c) (c)
#define PrintIndexed4CharCode(msg, i, c) (c)
-
+
#define ErrorLine(s) (s)
#define OSErrorLine(s, e) (e)
-
+
#define MessageIfOSError(e, s) (e)
#define MessageIfNULL(p, s) (p)
diff --git a/libs/appleutility/CoreAudio/PublicUtility/CAMath.h b/libs/appleutility/CoreAudio/PublicUtility/CAMath.h
index eb81f26e95..ca7cd385a6 100644
--- a/libs/appleutility/CoreAudio/PublicUtility/CAMath.h
+++ b/libs/appleutility/CoreAudio/PublicUtility/CAMath.h
@@ -2,14 +2,14 @@
File: CAMath.h
Abstract: Part of CoreAudio Utility Classes
Version: 1.1
-
+
Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple
Inc. ("Apple") in consideration of your agreement to the following
terms, and your use, installation, modification or redistribution of
this Apple software constitutes acceptance of these terms. If you do
not agree with these terms, please do not use, install, modify or
redistribute this Apple software.
-
+
In consideration of your agreement to abide by the following terms, and
subject to these terms, Apple grants you a personal, non-exclusive
license, under Apple's copyrights in this original Apple software (the
@@ -25,13 +25,13 @@
implied, are granted by Apple herein, including but not limited to any
patent rights that may be infringed by your derivative works or by other
works in which the Apple Software may be incorporated.
-
+
The Apple Software is provided by Apple on an "AS IS" basis. APPLE
MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND
OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
-
+
IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
@@ -40,9 +40,9 @@
AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),
STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
-
+
Copyright (C) 2014 Apple Inc. All Rights Reserved.
-
+
*/
#ifndef __CAMath_h__
#define __CAMath_h__
diff --git a/libs/appleutility/CoreAudio/PublicUtility/CAMixMap.h b/libs/appleutility/CoreAudio/PublicUtility/CAMixMap.h
index 62e95d4aa5..58d476489c 100644
--- a/libs/appleutility/CoreAudio/PublicUtility/CAMixMap.h
+++ b/libs/appleutility/CoreAudio/PublicUtility/CAMixMap.h
@@ -2,14 +2,14 @@
File: CAMixMap.h
Abstract: Part of CoreAudio Utility Classes
Version: 1.1
-
+
Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple
Inc. ("Apple") in consideration of your agreement to the following
terms, and your use, installation, modification or redistribution of
this Apple software constitutes acceptance of these terms. If you do
not agree with these terms, please do not use, install, modify or
redistribute this Apple software.
-
+
In consideration of your agreement to abide by the following terms, and
subject to these terms, Apple grants you a personal, non-exclusive
license, under Apple's copyrights in this original Apple software (the
@@ -25,13 +25,13 @@
implied, are granted by Apple herein, including but not limited to any
patent rights that may be infringed by your derivative works or by other
works in which the Apple Software may be incorporated.
-
+
The Apple Software is provided by Apple on an "AS IS" basis. APPLE
MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND
OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
-
+
IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
@@ -40,45 +40,45 @@
AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),
STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
-
+
Copyright (C) 2014 Apple Inc. All Rights Reserved.
-
+
*/
#ifndef __CAMixMap_h__
#define __CAMixMap_h__
// manages the setting of mix map volumes
-
+
class CAMixMap {
public:
CAMixMap ()
: mIns(0), mOuts (0), mMixMap(NULL)
{}
-
- CAMixMap (const CAMixMap &mm)
+
+ CAMixMap (const CAMixMap &mm)
: mIns(0), mOuts (0), mMixMap(NULL)
{ *this = mm; }
-
- CAMixMap (UInt32 numIns, UInt32 numOuts)
+
+ CAMixMap (UInt32 numIns, UInt32 numOuts)
: mIns(numIns), mOuts (numOuts), mMixMap(NULL)
- {
- mMixMap = new Float32[numIns * numOuts];
+ {
+ mMixMap = new Float32[numIns * numOuts];
memset (mMixMap, 0, ByteSize());
}
-
+
~CAMixMap () { delete [] mMixMap; }
-
- CAMixMap& operator=(const CAMixMap& mm)
- {
+
+ CAMixMap& operator=(const CAMixMap& mm)
+ {
if (mMixMap) { delete [] mMixMap; mMixMap = NULL; }
mIns = mm.mIns; mOuts = mm.mOuts;
- if (NumIns() && NumOuts()) {
+ if (NumIns() && NumOuts()) {
mMixMap = new Float32 [ NumIns() * NumOuts() ];
memcpy (mMixMap, mm.mMixMap, ByteSize());
}
return *this;
}
-
+
UInt32 NumIns () const { return mIns; }
UInt32 NumOuts () const { return mOuts; }
@@ -100,10 +100,10 @@ public:
mMixMap[i * NumOuts() + i] = val;
}
}
-
+
void Clear () { memset (mMixMap, 0, ByteSize()); }
-
-
+
+
Float32* MM() { return mMixMap; }
const Float32* MM() const { return mMixMap; }
UInt32 ByteSize () const { return NumIns() * NumOuts() * sizeof(Float32); }
@@ -116,7 +116,7 @@ public:
}
return sum;
}
-
+
void Normalize()
{
// ensure that no output channel will sum over unity.
@@ -129,25 +129,25 @@ public:
}
if (sum > maxsum) maxsum = sum;
}
-
+
if (maxsum == 0.f) return;
Float32 scale = 1.f / maxsum;
for (UInt32 i = 0; i < mIns * mOuts; ++i) {
mixmap[i] *= scale;
}
}
-
+
void Print ()
{
printf ("Num Ins: %d, Num Outs: %d\n", (int)mIns, (int)mOuts);
for (unsigned int ins = 0; ins < mIns; ++ins) {
printf ("\t%d: ", ins);
for (unsigned int outs = 0; outs < mOuts; ++outs)
- printf ("(%.3f) ", mMixMap[ins * NumOuts() + outs]);
+ printf ("(%.3f) ", mMixMap[ins * NumOuts() + outs]);
printf("\n");
}
}
-
+
private:
UInt32 mIns;
UInt32 mOuts;
diff --git a/libs/appleutility/CoreAudio/PublicUtility/CAMutex.cpp b/libs/appleutility/CoreAudio/PublicUtility/CAMutex.cpp
index 88cf9b0b02..f6e7ca45da 100644
--- a/libs/appleutility/CoreAudio/PublicUtility/CAMutex.cpp
+++ b/libs/appleutility/CoreAudio/PublicUtility/CAMutex.cpp
@@ -2,14 +2,14 @@
File: CAMutex.cpp
Abstract: CAMutex.h
Version: 1.1
-
+
Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple
Inc. ("Apple") in consideration of your agreement to the following
terms, and your use, installation, modification or redistribution of
this Apple software constitutes acceptance of these terms. If you do
not agree with these terms, please do not use, install, modify or
redistribute this Apple software.
-
+
In consideration of your agreement to abide by the following terms, and
subject to these terms, Apple grants you a personal, non-exclusive
license, under Apple's copyrights in this original Apple software (the
@@ -25,13 +25,13 @@
implied, are granted by Apple herein, including but not limited to any
patent rights that may be infringed by your derivative works or by other
works in which the Apple Software may be incorporated.
-
+
The Apple Software is provided by Apple on an "AS IS" basis. APPLE
MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND
OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
-
+
IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
@@ -40,9 +40,9 @@
AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),
STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
-
+
Copyright (C) 2014 Apple Inc. All Rights Reserved.
-
+
*/
//==================================================================================================
// Includes
@@ -83,14 +83,14 @@ CAMutex::CAMutex(const char* inName)
#if TARGET_OS_MAC
OSStatus theError = pthread_mutex_init(&mMutex, NULL);
ThrowIf(theError != 0, CAException(theError), "CAMutex::CAMutex: Could not init the mutex");
-
+
#if Log_Ownership
DebugPrintfRtn(DebugPrintfFileComma "%p %.4f: CAMutex::CAMutex: creating %s, owner: %p\n", pthread_self(), ((Float64)(CAHostTimeBase::GetCurrentTimeInNanos()) / 1000000.0), mName, mOwner);
#endif
#elif TARGET_OS_WIN32
mMutex = CreateMutex(NULL, false, NULL);
ThrowIfNULL(mMutex, CAException(GetLastError()), "CAMutex::CAMutex: could not create the mutex.");
-
+
#if Log_Ownership
DebugPrintfRtn(DebugPrintfFileComma "%lu %.4f: CAMutex::CAMutex: creating %s, owner: %lu\n", GetCurrentThreadId(), ((Float64)(CAHostTimeBase::GetCurrentTimeInNanos()) / 1000000.0), mName, mOwner);
#endif
@@ -118,7 +118,7 @@ CAMutex::~CAMutex()
bool CAMutex::Lock()
{
bool theAnswer = false;
-
+
#if TARGET_OS_MAC
pthread_t theCurrentThread = pthread_self();
if(!pthread_equal(theCurrentThread, mOwner))
@@ -126,22 +126,22 @@ bool CAMutex::Lock()
#if Log_Ownership
DebugPrintfRtn(DebugPrintfFileComma "%p %.4f: CAMutex::Lock: thread %p is locking %s, owner: %p\n", theCurrentThread, ((Float64)(CAHostTimeBase::GetCurrentTimeInNanos()) / 1000000.0), theCurrentThread, mName, mOwner);
#endif
-
+
#if Log_LongLatencies
UInt64 lockTryTime = CAHostTimeBase::GetCurrentTimeInNanos();
#endif
-
+
OSStatus theError = pthread_mutex_lock(&mMutex);
ThrowIf(theError != 0, CAException(theError), "CAMutex::Lock: Could not lock the mutex");
mOwner = theCurrentThread;
theAnswer = true;
-
+
#if Log_LongLatencies
UInt64 lockAcquireTime = CAHostTimeBase::GetCurrentTimeInNanos();
if (lockAcquireTime - lockTryTime >= LongLatencyThresholdNS)
DebugPrintfRtn(DebugPrintfFileComma "Thread %p took %.6fs to acquire the lock %s\n", theCurrentThread, (lockAcquireTime - lockTryTime) * 1.0e-9 /* nanos to seconds */, mName);
#endif
-
+
#if Log_Ownership
DebugPrintfRtn(DebugPrintfFileComma "%p %.4f: CAMutex::Lock: thread %p has locked %s, owner: %p\n", pthread_self(), ((Float64)(CAHostTimeBase::GetCurrentTimeInNanos()) / 1000000.0), pthread_self(), mName, mOwner);
#endif
@@ -157,7 +157,7 @@ bool CAMutex::Lock()
ThrowIfError(theError, CAException(theError), "CAMutex::Lock: could not lock the mutex");
mOwner = GetCurrentThreadId();
theAnswer = true;
-
+
#if Log_Ownership
DebugPrintfRtn(DebugPrintfFileComma "%lu %.4f: CAMutex::Lock: thread %lu has locked %s, owner: %lu\n", GetCurrentThreadId(), ((Float64)(CAHostTimeBase::GetCurrentTimeInNanos()) / 1000000.0), GetCurrentThreadId(), mName, mOwner);
#endif
@@ -179,7 +179,7 @@ void CAMutex::Unlock()
mOwner = 0;
OSStatus theError = pthread_mutex_unlock(&mMutex);
ThrowIf(theError != 0, CAException(theError), "CAMutex::Unlock: Could not unlock the mutex");
-
+
#if Log_Ownership
DebugPrintfRtn(DebugPrintfFileComma "%p %.4f: CAMutex::Unlock: thread %p has unlocked %s, owner: %p\n", pthread_self(), ((Float64)(CAHostTimeBase::GetCurrentTimeInNanos()) / 1000000.0), pthread_self(), mName, mOwner);
#endif
@@ -198,7 +198,7 @@ void CAMutex::Unlock()
mOwner = 0;
bool wasReleased = ReleaseMutex(mMutex);
ThrowIf(!wasReleased, CAException(GetLastError()), "CAMutex::Unlock: Could not unlock the mutex");
-
+
#if Log_Ownership
DebugPrintfRtn(DebugPrintfFileComma "%lu %.4f: CAMutex::Unlock: thread %lu has unlocked %s, owner: %lu\n", GetCurrentThreadId(), ((Float64)(CAHostTimeBase::GetCurrentTimeInNanos()) / 1000000.0), GetCurrentThreadId(), mName, mOwner);
#endif
@@ -232,7 +232,7 @@ bool CAMutex::Try(bool& outWasLocked)
mOwner = theCurrentThread;
theAnswer = true;
outWasLocked = true;
-
+
#if Log_Ownership
DebugPrintfRtn(DebugPrintfFileComma "%p %.4f: CAMutex::Try: thread %p has locked %s, owner: %p\n", theCurrentThread, ((Float64)(CAHostTimeBase::GetCurrentTimeInNanos()) / 1000000.0), theCurrentThread, mName, mOwner);
#endif
@@ -242,7 +242,7 @@ bool CAMutex::Try(bool& outWasLocked)
// return value of EBUSY means that the lock was already locked by another thread
theAnswer = false;
outWasLocked = false;
-
+
#if Log_Ownership
DebugPrintfRtn(DebugPrintfFileComma "%p %.4f: CAMutex::Try: thread %p failed to lock %s, owner: %p\n", theCurrentThread, ((Float64)(CAHostTimeBase::GetCurrentTimeInNanos()) / 1000000.0), theCurrentThread, mName, mOwner);
#endif
@@ -266,7 +266,7 @@ bool CAMutex::Try(bool& outWasLocked)
#if Log_Ownership
DebugPrintfRtn(DebugPrintfFileComma "%lu %.4f: CAMutex::Try: thread %lu is try-locking %s, owner: %lu\n", GetCurrentThreadId(), ((Float64)(CAHostTimeBase::GetCurrentTimeInNanos()) / 1000000.0), GetCurrentThreadId(), mName, mOwner);
#endif
-
+
// try to acquire the mutex
OSStatus theError = WaitForSingleObject(mMutex, 0);
if(theError == WAIT_OBJECT_0)
@@ -275,7 +275,7 @@ bool CAMutex::Try(bool& outWasLocked)
mOwner = GetCurrentThreadId();
theAnswer = true;
outWasLocked = true;
-
+
#if Log_Ownership
DebugPrintfRtn(DebugPrintfFileComma "%lu %.4f: CAMutex::Try: thread %lu has locked %s, owner: %lu\n", GetCurrentThreadId(), ((Float64)(CAHostTimeBase::GetCurrentTimeInNanos()) / 1000000.0), GetCurrentThreadId(), mName, mOwner);
#endif
@@ -285,7 +285,7 @@ bool CAMutex::Try(bool& outWasLocked)
// this means that the lock was already locked by another thread
theAnswer = false;
outWasLocked = false;
-
+
#if Log_Ownership
DebugPrintfRtn(DebugPrintfFileComma "%lu %.4f: CAMutex::Try: thread %lu failed to lock %s, owner: %lu\n", GetCurrentThreadId(), ((Float64)(CAHostTimeBase::GetCurrentTimeInNanos()) / 1000000.0), GetCurrentThreadId(), mName, mOwner);
#endif
@@ -303,7 +303,7 @@ bool CAMutex::Try(bool& outWasLocked)
outWasLocked = false;
}
#endif
-
+
return theAnswer;
}
@@ -315,7 +315,7 @@ bool CAMutex::IsFree() const
bool CAMutex::IsOwnedByCurrentThread() const
{
bool theAnswer = true;
-
+
#if TARGET_OS_MAC
theAnswer = pthread_equal(pthread_self(), mOwner);
#elif TARGET_OS_WIN32
diff --git a/libs/appleutility/CoreAudio/PublicUtility/CAMutex.h b/libs/appleutility/CoreAudio/PublicUtility/CAMutex.h
index 093066b400..4cc8ac5b78 100644
--- a/libs/appleutility/CoreAudio/PublicUtility/CAMutex.h
+++ b/libs/appleutility/CoreAudio/PublicUtility/CAMutex.h
@@ -2,14 +2,14 @@
File: CAMutex.h
Abstract: Part of CoreAudio Utility Classes
Version: 1.1
-
+
Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple
Inc. ("Apple") in consideration of your agreement to the following
terms, and your use, installation, modification or redistribution of
this Apple software constitutes acceptance of these terms. If you do
not agree with these terms, please do not use, install, modify or
redistribute this Apple software.
-
+
In consideration of your agreement to abide by the following terms, and
subject to these terms, Apple grants you a personal, non-exclusive
license, under Apple's copyrights in this original Apple software (the
@@ -25,13 +25,13 @@
implied, are granted by Apple herein, including but not limited to any
patent rights that may be infringed by your derivative works or by other
works in which the Apple Software may be incorporated.
-
+
The Apple Software is provided by Apple on an "AS IS" basis. APPLE
MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND
OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
-
+
IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
@@ -40,9 +40,9 @@
AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),
STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
-
+
Copyright (C) 2014 Apple Inc. All Rights Reserved.
-
+
*/
#ifndef __CAMutex_h__
#define __CAMutex_h__
@@ -82,10 +82,10 @@ public:
virtual bool Lock();
virtual void Unlock();
virtual bool Try(bool& outWasLocked); // returns true if lock is free, false if not
-
+
virtual bool IsFree() const;
virtual bool IsOwnedByCurrentThread() const;
-
+
// Implementation
protected:
const char* mName;
@@ -101,24 +101,24 @@ protected:
public:
class Locker
{
-
+
// Construction/Destruction
public:
Locker(CAMutex& inMutex) : mMutex(&inMutex), mNeedsRelease(false) { mNeedsRelease = mMutex->Lock(); }
Locker(CAMutex* inMutex) : mMutex(inMutex), mNeedsRelease(false) { mNeedsRelease = (mMutex != NULL && mMutex->Lock()); }
// in this case the mutex can be null
~Locker() { if(mNeedsRelease) { mMutex->Unlock(); } }
-
-
+
+
private:
Locker(const Locker&);
Locker& operator=(const Locker&);
-
+
// Implementation
private:
CAMutex* mMutex;
bool mNeedsRelease;
-
+
};
// Unlocker
@@ -127,24 +127,24 @@ public:
public:
Unlocker(CAMutex& inMutex);
~Unlocker();
-
+
private:
CAMutex& mMutex;
bool mNeedsLock;
-
+
// Hidden definitions of copy ctor, assignment operator
Unlocker(const Unlocker& copy); // Not implemented
Unlocker& operator=(const Unlocker& copy); // Not implemented
};
-
+
// you can use this with Try - if you take the lock in try, pass in the outWasLocked var
class Tryer {
-
+
// Construction/Destruction
public:
Tryer (CAMutex &mutex) : mMutex(mutex), mNeedsRelease(false), mHasLock(false) { mHasLock = mMutex.Try (mNeedsRelease); }
~Tryer () { if (mNeedsRelease) mMutex.Unlock(); }
-
+
bool HasLock () const { return mHasLock; }
private:
diff --git a/libs/appleutility/CoreAudio/PublicUtility/CAPThread.cpp b/libs/appleutility/CoreAudio/PublicUtility/CAPThread.cpp
index 3da1058de7..2428a7a013 100644
--- a/libs/appleutility/CoreAudio/PublicUtility/CAPThread.cpp
+++ b/libs/appleutility/CoreAudio/PublicUtility/CAPThread.cpp
@@ -2,14 +2,14 @@
File: CAPThread.cpp
Abstract: CAPThread.h
Version: 1.1
-
+
Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple
Inc. ("Apple") in consideration of your agreement to the following
terms, and your use, installation, modification or redistribution of
this Apple software constitutes acceptance of these terms. If you do
not agree with these terms, please do not use, install, modify or
redistribute this Apple software.
-
+
In consideration of your agreement to abide by the following terms, and
subject to these terms, Apple grants you a personal, non-exclusive
license, under Apple's copyrights in this original Apple software (the
@@ -25,13 +25,13 @@
implied, are granted by Apple herein, including but not limited to any
patent rights that may be infringed by your derivative works or by other
works in which the Apple Software may be incorporated.
-
+
The Apple Software is provided by Apple on an "AS IS" basis. APPLE
MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND
OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
-
+
IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
@@ -40,9 +40,9 @@
AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),
STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
-
+
Copyright (C) 2014 Apple Inc. All Rights Reserved.
-
+
*/
//=============================================================================
// Includes
@@ -170,7 +170,7 @@ void CAPThread::SetPriority(UInt32 inPriority, bool inFixedPriority)
if(mPThread != 0)
{
SetPriority(mPThread, mPriority, mFixedPriority);
- }
+ }
#elif TARGET_OS_WIN32
if(mThreadID != NULL)
{
@@ -185,7 +185,7 @@ void CAPThread::SetPriority(NativeThread inThread, UInt32 inPriority, bool inFix
if(inThread != 0)
{
kern_return_t theError = 0;
-
+
// set whether or not this is a fixed priority thread
if (inFixedPriority)
{
@@ -193,17 +193,17 @@ void CAPThread::SetPriority(NativeThread inThread, UInt32 inPriority, bool inFix
theError = thread_policy_set(pthread_mach_thread_np(inThread), THREAD_EXTENDED_POLICY, (thread_policy_t)&theFixedPolicy, THREAD_EXTENDED_POLICY_COUNT);
AssertNoKernelError(theError, "CAPThread::SetPriority: failed to set the fixed-priority policy");
}
-
+
// set the thread's absolute priority which is relative to the priority on which thread_policy_set() is called
UInt32 theCurrentThreadPriority = getScheduledPriority(pthread_self(), CAPTHREAD_SET_PRIORITY);
thread_precedence_policy_data_t thePrecedencePolicy = { static_cast<integer_t>(inPriority - theCurrentThreadPriority) };
theError = thread_policy_set(pthread_mach_thread_np(inThread), THREAD_PRECEDENCE_POLICY, (thread_policy_t)&thePrecedencePolicy, THREAD_PRECEDENCE_POLICY_COUNT);
AssertNoKernelError(theError, "CAPThread::SetPriority: failed to set the precedence policy");
-
+
#if Log_SetPriority
DebugMessageN4("CAPThread::SetPriority: requsted: %lu spawning: %lu current: %lu assigned: %d", mPriority, mSpawningThreadPriority, theCurrentThreadPriority, thePrecedencePolicy.importance);
#endif
- }
+ }
#elif TARGET_OS_WIN32
if(inThread != NULL)
{
@@ -249,18 +249,18 @@ void CAPThread::Start()
{
OSStatus theResult;
pthread_attr_t theThreadAttributes;
-
+
theResult = pthread_attr_init(&theThreadAttributes);
ThrowIf(theResult != 0, CAException(theResult), "CAPThread::Start: Thread attributes could not be created.");
-
+
theResult = pthread_attr_setdetachstate(&theThreadAttributes, PTHREAD_CREATE_DETACHED);
ThrowIf(theResult != 0, CAException(theResult), "CAPThread::Start: A thread could not be created in the detached state.");
-
+
theResult = pthread_create(&mPThread, &theThreadAttributes, (ThreadRoutine)CAPThread::Entry, this);
ThrowIf(theResult != 0 || !mPThread, CAException(theResult), "CAPThread::Start: Could not create a thread.");
-
+
pthread_attr_destroy(&theThreadAttributes);
-
+
}
#elif TARGET_OS_WIN32
Assert(mThreadID == 0, "CAPThread::Start: can't start because the thread is already running");
@@ -272,7 +272,7 @@ void CAPThread::Start()
CloseHandle(mThreadHandle);
mThreadHandle = NULL;
}
-
+
// create a new thread
mThreadHandle = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)Entry, this, 0, &mThreadID);
ThrowIf(mThreadHandle == NULL, CAException(GetLastError()), "CAPThread::Start: Could not create a thread.");
@@ -291,7 +291,7 @@ void* CAPThread::Entry(CAPThread* inCAPThread)
#elif TARGET_OS_WIN32
// do we need to do something here?
#endif
-
+
#if !TARGET_OS_IPHONE && (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6)
if(inCAPThread->mThreadName[0] != 0)
{
@@ -299,7 +299,7 @@ void* CAPThread::Entry(CAPThread* inCAPThread)
}
#endif
- try
+ try
{
if(inCAPThread->mTimeConstraintSet)
{
@@ -333,11 +333,11 @@ UInt32 CAPThread::getScheduledPriority(pthread_t inThread, int inPriorityKind)
if (inThread == NULL)
return 0;
-
+
// get basic info
count = THREAD_BASIC_INFO_COUNT;
thread_info (pthread_mach_thread_np (inThread), THREAD_BASIC_INFO, (thread_info_t)&threadInfo, &count);
-
+
switch (threadInfo.policy) {
case POLICY_TIMESHARE:
count = POLICY_TIMESHARE_INFO_COUNT;
@@ -347,7 +347,7 @@ UInt32 CAPThread::getScheduledPriority(pthread_t inThread, int inPriorityKind)
}
return static_cast<UInt32>(thePolicyInfo.ts.base_priority);
break;
-
+
case POLICY_FIFO:
count = POLICY_FIFO_INFO_COUNT;
thread_info(pthread_mach_thread_np (inThread), THREAD_SCHED_FIFO_INFO, (thread_info_t)&(thePolicyInfo.fifo), &count);
@@ -356,7 +356,7 @@ UInt32 CAPThread::getScheduledPriority(pthread_t inThread, int inPriorityKind)
}
return static_cast<UInt32>(thePolicyInfo.fifo.base_priority);
break;
-
+
case POLICY_RR:
count = POLICY_RR_INFO_COUNT;
thread_info(pthread_mach_thread_np (inThread), THREAD_SCHED_RR_INFO, (thread_info_t)&(thePolicyInfo.rr), &count);
@@ -366,7 +366,7 @@ UInt32 CAPThread::getScheduledPriority(pthread_t inThread, int inPriorityKind)
return static_cast<UInt32>(thePolicyInfo.rr.base_priority);
break;
}
-
+
return 0;
}
@@ -376,7 +376,7 @@ UInt32 WINAPI CAPThread::Entry(CAPThread* inCAPThread)
{
UInt32 theAnswer = 0;
- try
+ try
{
if(inCAPThread->mTimeConstraintSet)
{
@@ -429,20 +429,20 @@ void CAPThread::DebugPriority(const char *label)
{
#if !TARGET_OS_WIN32
if (mTimeConstraintSet)
- printf("CAPThread::%s %p: pri=<time constraint>, spawning pri=%d, scheduled pri=%d\n", label, this,
+ printf("CAPThread::%s %p: pri=<time constraint>, spawning pri=%d, scheduled pri=%d\n", label, this,
(int)mSpawningThreadPriority, (mPThread != NULL) ? (int)GetScheduledPriority() : -1);
else
- printf("CAPThread::%s %p: pri=%d%s, spawning pri=%d, scheduled pri=%d\n", label, this, (int)mPriority, mFixedPriority ? " fixed" : "",
+ printf("CAPThread::%s %p: pri=%d%s, spawning pri=%d, scheduled pri=%d\n", label, this, (int)mPriority, mFixedPriority ? " fixed" : "",
(int)mSpawningThreadPriority, (mPThread != NULL) ? (int)GetScheduledPriority() : -1);
#else
if (mTimeConstraintSet)
{
- printf("CAPThread::%s %p: pri=<time constraint>, spawning pri=%d, scheduled pri=%d\n", label, this,
+ printf("CAPThread::%s %p: pri=<time constraint>, spawning pri=%d, scheduled pri=%d\n", label, this,
(int)mPriority, (mThreadHandle != NULL) ? (int)GetScheduledPriority() : -1);
}
else
{
- printf("CAPThread::%s %p: pri=%d%s, spawning pri=%d, scheduled pri=%d\n", label, this, (int)mPriority, mFixedPriority ? " fixed" : "",
+ printf("CAPThread::%s %p: pri=%d%s, spawning pri=%d, scheduled pri=%d\n", label, this, (int)mPriority, mFixedPriority ? " fixed" : "",
(int)mPriority, (mThreadHandle != NULL) ? (int)GetScheduledPriority() : -1);
}
#endif
diff --git a/libs/appleutility/CoreAudio/PublicUtility/CAPThread.h b/libs/appleutility/CoreAudio/PublicUtility/CAPThread.h
index 41451252f8..f85cdc0918 100644
--- a/libs/appleutility/CoreAudio/PublicUtility/CAPThread.h
+++ b/libs/appleutility/CoreAudio/PublicUtility/CAPThread.h
@@ -2,14 +2,14 @@
File: CAPThread.h
Abstract: Part of CoreAudio Utility Classes
Version: 1.1
-
+
Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple
Inc. ("Apple") in consideration of your agreement to the following
terms, and your use, installation, modification or redistribution of
this Apple software constitutes acceptance of these terms. If you do
not agree with these terms, please do not use, install, modify or
redistribute this Apple software.
-
+
In consideration of your agreement to abide by the following terms, and
subject to these terms, Apple grants you a personal, non-exclusive
license, under Apple's copyrights in this original Apple software (the
@@ -25,13 +25,13 @@
implied, are granted by Apple herein, including but not limited to any
patent rights that may be infringed by your derivative works or by other
works in which the Apple Software may be incorporated.
-
+
The Apple Software is provided by Apple on an "AS IS" basis. APPLE
MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND
OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
-
+
IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
@@ -40,9 +40,9 @@
AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),
STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
-
+
Copyright (C) 2014 Apple Inc. All Rights Reserved.
-
+
*/
#if !defined(__CAPThread_h__)
#define __CAPThread_h__
@@ -121,7 +121,7 @@ public:
static UInt32 getScheduledPriority(pthread_t inThread, int inPriorityKind);
#elif TARGET_OS_WIN32
typedef unsigned long NativeThread;
-
+
NativeThread GetNativeThread() { return mThreadID; }
static NativeThread GetCurrentThread() { return GetCurrentThreadId(); }
static bool IsNativeThreadsEqual(NativeThread a, NativeThread b) { return (a==b); }
@@ -146,13 +146,13 @@ public:
void GetTimeConstraints(UInt32& outPeriod, UInt32& outComputation, UInt32& outConstraint, bool& outIsPreemptible) const { outPeriod = mPeriod; outComputation = mComputation; outConstraint = mConstraint; outIsPreemptible = mIsPreemptible; }
void SetTimeConstraints(UInt32 inPeriod, UInt32 inComputation, UInt32 inConstraint, bool inIsPreemptible);
void ClearTimeConstraints() { SetPriority(mPriority); }
-
+
bool WillAutoDelete() const { return mAutoDelete; }
void SetAutoDelete(bool b) { mAutoDelete = b; }
-
+
void SetName(const char* inThreadName);
-#if CoreAudio_Debug
+#if CoreAudio_Debug
void DebugPriority(const char *label);
#endif
diff --git a/libs/appleutility/CoreAudio/PublicUtility/CAPersistence.cpp b/libs/appleutility/CoreAudio/PublicUtility/CAPersistence.cpp
index d3fe008eeb..cabec8b3b7 100644
--- a/libs/appleutility/CoreAudio/PublicUtility/CAPersistence.cpp
+++ b/libs/appleutility/CoreAudio/PublicUtility/CAPersistence.cpp
@@ -2,14 +2,14 @@
File: CAPersistence.cpp
Abstract: CAPersistence.h
Version: 1.1
-
+
Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple
Inc. ("Apple") in consideration of your agreement to the following
terms, and your use, installation, modification or redistribution of
this Apple software constitutes acceptance of these terms. If you do
not agree with these terms, please do not use, install, modify or
redistribute this Apple software.
-
+
In consideration of your agreement to abide by the following terms, and
subject to these terms, Apple grants you a personal, non-exclusive
license, under Apple's copyrights in this original Apple software (the
@@ -25,13 +25,13 @@
implied, are granted by Apple herein, including but not limited to any
patent rights that may be infringed by your derivative works or by other
works in which the Apple Software may be incorporated.
-
+
The Apple Software is provided by Apple on an "AS IS" basis. APPLE
MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND
OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
-
+
IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
@@ -40,9 +40,9 @@
AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),
STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
-
+
Copyright (C) 2014 Apple Inc. All Rights Reserved.
-
+
*/
#include "CACFArray.h"
#include "CACFDictionary.h"
@@ -80,7 +80,7 @@ OSStatus CAStreamBasicDescription::Save (CFPropertyListRef *outData) const
if (!dict.AddUInt32 (kFrameBytes, mBytesPerFrame)) goto error;
if (!dict.AddUInt32 (kFrameChannels, mChannelsPerFrame)) goto error;
if (!dict.AddUInt32 (kChannelBits, mBitsPerChannel)) goto error;
-
+
*outData = dict.GetDict();
return noErr;
@@ -90,14 +90,14 @@ error:
return paramErr;
}
-
+
// Given a CFData object generated by the save command, this will re-establish
// the CAStreamBasicDescription
OSStatus CAStreamBasicDescription::Restore (CFPropertyListRef& inData)
{
if (CFGetTypeID (inData) != CFDictionaryGetTypeID()) return paramErr;
CACFDictionary dict(static_cast<CFDictionaryRef>(inData), false);
-
+
if (!dict.GetFloat64 (kSampleRate, mSampleRate)) return paramErr;
if (!dict.GetUInt32 (kFormat, mFormatID)) return paramErr;
if (!dict.GetUInt32 (kFormatFlags, mFormatFlags)) return paramErr;
@@ -122,9 +122,9 @@ OSStatus CAComponentDescription::Save (CFPropertyListRef *outData) const
if (!dict.AddUInt32 (kType, componentType)) goto error;
if (!dict.AddUInt32 (kSubType, componentSubType)) goto error;
if (!dict.AddUInt32 (kManu, componentManufacturer)) goto error;
-
+
*outData = dict.GetDict();
-
+
return 0;
error:
dict.ShouldRelease (true);
@@ -135,14 +135,14 @@ OSStatus CAComponentDescription::Restore (CFPropertyListRef &inData)
{
if (CFGetTypeID (inData) != CFDictionaryGetTypeID()) return paramErr;
CACFDictionary dict(static_cast<CFDictionaryRef>(inData), false);
-
+
if (!dict.GetUInt32 (kType, componentType)) return paramErr;
if (!dict.GetUInt32 (kSubType, componentSubType)) return paramErr;
if (!dict.GetUInt32 (kManu, componentManufacturer)) return paramErr;
componentFlags = 0;
componentFlagsMask = 0;
-
+
return 0;
}
@@ -152,13 +152,13 @@ OSStatus CAComponent::Save (CFPropertyListRef *outData) const
{
OSStatus result = mDesc.Save (outData);
if (result) return result;
-
+
//add the name string of the component for a human readable name...
// this name string is *not* restored when restoring the component
CFStringRef name = GetCompName ();
if (name && *outData)
CFDictionarySetValue ((CFMutableDictionaryRef)(*outData), CFSTR("name"), name);
-
+
return noErr;
}
@@ -187,8 +187,8 @@ static const CFStringRef kACLCoords0Key = CFSTR("coords 0");
static const CFStringRef kACLCoords1Key = CFSTR("coords 1");
static const CFStringRef kACLCoords2Key = CFSTR("coords 2");
static const CFStringRef kACLDescsKey = CFSTR("descriptions");
-
-OSStatus CAAudioChannelLayout::Save (CFPropertyListRef *outData) const
+
+OSStatus CAAudioChannelLayout::Save (CFPropertyListRef *outData) const
{
const AudioChannelLayout& layout = Layout();
@@ -197,13 +197,13 @@ OSStatus CAAudioChannelLayout::Save (CFPropertyListRef *outData) const
goto badadd;
if (layout.mChannelBitmap && !dict.AddUInt32 (kACLBitmapKey, layout.mChannelBitmap))
goto badadd;
-
+
if (layout.mNumberChannelDescriptions)
- {
+ {
CFMutableArrayRef descs = CFArrayCreateMutable (NULL, layout.mNumberChannelDescriptions, &kCFTypeArrayCallBacks);
-
+
const AudioChannelDescription *desc = layout.mChannelDescriptions;
- for (unsigned int i = 0; i < layout.mNumberChannelDescriptions; ++i, ++desc)
+ for (unsigned int i = 0; i < layout.mNumberChannelDescriptions; ++i, ++desc)
{
CACFDictionary descDict (true);
if (!descDict.AddUInt32 (kACLLabelKey, desc->mChannelLabel))
@@ -216,41 +216,41 @@ OSStatus CAAudioChannelLayout::Save (CFPropertyListRef *outData) const
{ CFRelease (descs); goto badadd; }
if (!descDict.AddFloat32 (kACLCoords2Key, desc->mCoordinates[2]))
{ CFRelease (descs); goto badadd; }
-
+
CFArrayAppendValue (descs, descDict.AsPropertyList());
}
dict.AddArray (kACLDescsKey, descs);
-
+
CFRelease (descs);
}
-
- *outData = dict.GetDict();
-
+
+ *outData = dict.GetDict();
+
return noErr;
-
+
badadd:
dict.ShouldRelease(true);
return paramErr;
}
-OSStatus CAAudioChannelLayout::Restore (CFPropertyListRef &inData)
+OSStatus CAAudioChannelLayout::Restore (CFPropertyListRef &inData)
{
if (CFGetTypeID (inData) != CFDictionaryGetTypeID()) return paramErr;
CACFDictionary dict(static_cast<CFDictionaryRef>(inData), false);
RefCountedLayout *temp = NULL;
AudioChannelLayout* layout;
-
+
CFArrayRef descs = NULL;
UInt32 numDescs = 0;
if (dict.GetArray (kACLDescsKey, descs)) {
numDescs = static_cast<OSStatus>(CFArrayGetCount (descs));
}
-
+
temp = RefCountedLayout::CreateWithNumberChannelDescriptions(numDescs);
layout = temp->GetLayout();
-
+
if (!dict.GetUInt32 (kACLTagKey, layout->mChannelLayoutTag))
goto badget;
if (dict.HasKey (kACLBitmapKey)) {
@@ -258,17 +258,17 @@ OSStatus CAAudioChannelLayout::Restore (CFPropertyListRef &inData)
goto badget;
} else
layout->mChannelBitmap = 0;
-
+
layout->mNumberChannelDescriptions = numDescs;
-
+
if (numDescs)
{
AudioChannelDescription *desc = layout->mChannelDescriptions;
for (unsigned int i = 0; i < numDescs; ++i, ++desc)
{
- CFDictionaryRef descDict = (CFDictionaryRef)CFArrayGetValueAtIndex (descs, i);
+ CFDictionaryRef descDict = (CFDictionaryRef)CFArrayGetValueAtIndex (descs, i);
CACFDictionary theDesc (descDict, false);
-
+
if (!theDesc.GetUInt32 (kACLLabelKey, desc->mChannelLabel))
goto badget;
if (!theDesc.GetUInt32 (kACLFlagsKey, desc->mChannelFlags))
@@ -285,7 +285,7 @@ OSStatus CAAudioChannelLayout::Restore (CFPropertyListRef &inData)
mLayout->release();
mLayout = temp;
-
+
return noErr;
badget:
@@ -299,9 +299,9 @@ static const CFStringRef kAUScopeStr = CFSTR("scope");
static const CFStringRef kAUElementIDStr = CFSTR("element ID");
static const CFStringRef kAUParameterIDStr = CFSTR("paramID");
-void CAAUParameter::Save (CFPropertyListRef &outData) const
-{
- return CAAUParameter::Save (*this, outData);
+void CAAUParameter::Save (CFPropertyListRef &outData) const
+{
+ return CAAUParameter::Save (*this, outData);
}
// static functions to save/restore AudioUnitParameter
@@ -363,56 +363,56 @@ void CAAUMIDIMap::Save(CFPropertyListRef &outData) const
}
void CAAUMIDIMap::Restore(CFDictionaryRef inData)
-{
+{
CACFDictionary paramDict (inData, false);
- if (!paramDict.GetUInt32 (kLocalScopeStr, mScope)) return;
- if (!paramDict.GetUInt32 (kLocalElementIDStr, mElement)) return;
- if (!paramDict.GetUInt32 (kLocalParameterIDStr, mParameterID)) return;
+ if (!paramDict.GetUInt32 (kLocalScopeStr, mScope)) return;
+ if (!paramDict.GetUInt32 (kLocalElementIDStr, mElement)) return;
+ if (!paramDict.GetUInt32 (kLocalParameterIDStr, mParameterID)) return;
if (!paramDict.GetUInt32 (kMIDIFlagsStr, mFlags)) return;
- if (!paramDict.GetFloat32 (kMIDISubMinStr, mSubRangeMin)) return;
- if (!paramDict.GetFloat32 (kMIDISubMaxStr, mSubRangeMax)) return;
- UInt32 data;
+ if (!paramDict.GetFloat32 (kMIDISubMinStr, mSubRangeMin)) return;
+ if (!paramDict.GetFloat32 (kMIDISubMaxStr, mSubRangeMax)) return;
+ UInt32 data;
if (!paramDict.GetUInt32 (kMIDIStatusStr, data)) return;
mStatus = data;
- if (!paramDict.GetUInt32 (kMIDIDataByteStr, data)) return;
+ if (!paramDict.GetUInt32 (kMIDIDataByteStr, data)) return;
mData1 = data;
}
void CAAUMIDIMap::SaveAsMapPList (AudioUnit inUnit, const AUParameterMIDIMapping* inMappings, UInt32 inNumMappings, CFPropertyListRef &outData, CFStringRef inName)
{
- CACFDictionary mappingDict (false);
+ CACFDictionary mappingDict (false);
CACFArray maps (true);
-
- for (UInt32 i = 0; i< inNumMappings; ++i)
+
+ for (UInt32 i = 0; i< inNumMappings; ++i)
{
CFPropertyListRef data;
CAAUMIDIMap paramMap(inMappings[i]);
paramMap.Save (data);
- if (data)
+ if (data)
{
- maps.AppendCFType (data);
- CFRelease(data);
- }
+ maps.AppendCFType (data);
+ CFRelease(data);
+ }
}
if (maps.GetNumberItems()) {
mappingDict.AddCFType (kParamMIDIStr, maps.GetCFArray());
-
+
// Add the AU info here - where this map came from
CAAudioUnit au (inUnit);
CFPropertyListRef data;
au.Comp().Save (&data);
-
+
mappingDict.AddCFType (kAUStr, data);
CFRelease(data);
-
+
if (!inName) inName = CFSTR("Untitled");
mappingDict.AddString (CFSTR("name"), inName);
-
+
mappingDict.AddUInt32 (CFSTR("version"), 1);
-
+
outData = mappingDict.AsPropertyList();
} else {
mappingDict.ShouldRelease(true);
@@ -423,41 +423,41 @@ void CAAUMIDIMap::SaveAsMapPList (AudioUnit inUnit, const AUParameterMIDIMappin
UInt32 CAAUMIDIMap::NumberOfMaps (const CFDictionaryRef inData)
{
CACFDictionary dict (inData, false);
-
- if (dict.HasKey (kParamMIDIStr))
+
+ if (dict.HasKey (kParamMIDIStr))
{
CFArrayRef cfArray;
- dict.GetArray (kParamMIDIStr, cfArray);
-
+ dict.GetArray (kParamMIDIStr, cfArray);
+
CACFArray array (cfArray, false);
-
+
return array.GetNumberItems();
}
return 0;
}
-
+
void CAAUMIDIMap::RestoreFromMapPList (const CFDictionaryRef inData, AUParameterMIDIMapping* outMappings, UInt32 inNumMappings)
{
CACFDictionary dict (inData, false);
-
- if (dict.HasKey (kParamMIDIStr))
+
+ if (dict.HasKey (kParamMIDIStr))
{
CFArrayRef cfArray;
- dict.GetArray (kParamMIDIStr, cfArray);
-
+ dict.GetArray (kParamMIDIStr, cfArray);
+
CACFArray array (cfArray, false);
-
+
UInt32 count = array.GetNumberItems();
if (count > inNumMappings)
count = inNumMappings;
-
+
for (unsigned int i = 0; i < count; ++i)
{
CFDictionaryRef paramsDictRef;
- if (!array.GetDictionary(i, paramsDictRef))
+ if (!array.GetDictionary(i, paramsDictRef))
return;
-
+
CAAUMIDIMap parameterMap;
parameterMap.Restore(paramsDictRef);
outMappings[i] = parameterMap;
diff --git a/libs/appleutility/CoreAudio/PublicUtility/CAProcess.cpp b/libs/appleutility/CoreAudio/PublicUtility/CAProcess.cpp
index 23ad2c0282..fa7d203698 100644
--- a/libs/appleutility/CoreAudio/PublicUtility/CAProcess.cpp
+++ b/libs/appleutility/CoreAudio/PublicUtility/CAProcess.cpp
@@ -2,14 +2,14 @@
File: CAProcess.cpp
Abstract: CAProcess.h
Version: 1.1
-
+
Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple
Inc. ("Apple") in consideration of your agreement to the following
terms, and your use, installation, modification or redistribution of
this Apple software constitutes acceptance of these terms. If you do
not agree with these terms, please do not use, install, modify or
redistribute this Apple software.
-
+
In consideration of your agreement to abide by the following terms, and
subject to these terms, Apple grants you a personal, non-exclusive
license, under Apple's copyrights in this original Apple software (the
@@ -25,13 +25,13 @@
implied, are granted by Apple herein, including but not limited to any
patent rights that may be infringed by your derivative works or by other
works in which the Apple Software may be incorporated.
-
+
The Apple Software is provided by Apple on an "AS IS" basis. APPLE
MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND
OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
-
+
IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
@@ -40,9 +40,9 @@
AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),
STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
-
+
Copyright (C) 2014 Apple Inc. All Rights Reserved.
-
+
*/
//=============================================================================
// Includes
@@ -62,7 +62,7 @@ bool CAProcess::ProcessExists(pid_t inPID)
// pids <= 0 are reserved for special purposes and -1 is
// used as a sentinel value by the HAL.
bool theAnswer = inPID > 0;
-
+
if(theAnswer)
{
// according to kill(2), the process exists if kill(pid, 0) returns 0
@@ -75,7 +75,7 @@ bool CAProcess::ProcessExists(pid_t inPID)
}
}
-
+
return theAnswer;
}
@@ -85,7 +85,7 @@ pid_t CAProcess::GetPID()
{
sPID = getpid();
}
-
+
return sPID;
}
diff --git a/libs/appleutility/CoreAudio/PublicUtility/CAProcess.h b/libs/appleutility/CoreAudio/PublicUtility/CAProcess.h
index e512d911be..5602ccd57a 100644
--- a/libs/appleutility/CoreAudio/PublicUtility/CAProcess.h
+++ b/libs/appleutility/CoreAudio/PublicUtility/CAProcess.h
@@ -2,14 +2,14 @@
File: CAProcess.h
Abstract: Part of CoreAudio Utility Classes
Version: 1.1
-
+
Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple
Inc. ("Apple") in consideration of your agreement to the following
terms, and your use, installation, modification or redistribution of
this Apple software constitutes acceptance of these terms. If you do
not agree with these terms, please do not use, install, modify or
redistribute this Apple software.
-
+
In consideration of your agreement to abide by the following terms, and
subject to these terms, Apple grants you a personal, non-exclusive
license, under Apple's copyrights in this original Apple software (the
@@ -25,13 +25,13 @@
implied, are granted by Apple herein, including but not limited to any
patent rights that may be infringed by your derivative works or by other
works in which the Apple Software may be incorporated.
-
+
The Apple Software is provided by Apple on an "AS IS" basis. APPLE
MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND
OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
-
+
IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
@@ -40,9 +40,9 @@
AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),
STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
-
+
Copyright (C) 2014 Apple Inc. All Rights Reserved.
-
+
*/
#if !defined(__CAProcess_h__)
#define __CAProcess_h__
diff --git a/libs/appleutility/CoreAudio/PublicUtility/CAPropertyAddress.h b/libs/appleutility/CoreAudio/PublicUtility/CAPropertyAddress.h
index 6df444b0b4..f35776f54b 100644
--- a/libs/appleutility/CoreAudio/PublicUtility/CAPropertyAddress.h
+++ b/libs/appleutility/CoreAudio/PublicUtility/CAPropertyAddress.h
@@ -2,14 +2,14 @@
File: CAPropertyAddress.h
Abstract: Part of CoreAudio Utility Classes
Version: 1.1
-
+
Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple
Inc. ("Apple") in consideration of your agreement to the following
terms, and your use, installation, modification or redistribution of
this Apple software constitutes acceptance of these terms. If you do
not agree with these terms, please do not use, install, modify or
redistribute this Apple software.
-
+
In consideration of your agreement to abide by the following terms, and
subject to these terms, Apple grants you a personal, non-exclusive
license, under Apple's copyrights in this original Apple software (the
@@ -25,13 +25,13 @@
implied, are granted by Apple herein, including but not limited to any
patent rights that may be infringed by your derivative works or by other
works in which the Apple Software may be incorporated.
-
+
The Apple Software is provided by Apple on an "AS IS" basis. APPLE
MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND
OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
-
+
IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
@@ -40,9 +40,9 @@
AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),
STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
-
+
Copyright (C) 2014 Apple Inc. All Rights Reserved.
-
+
*/
#if !defined(__CAPropertyAddress_h__)
#define __CAPropertyAddress_h__
@@ -88,7 +88,7 @@ public:
CAPropertyAddress(const CAPropertyAddress& inAddress) : AudioObjectPropertyAddress(inAddress){}
CAPropertyAddress& operator=(const AudioObjectPropertyAddress& inAddress) { AudioObjectPropertyAddress::operator=(inAddress); return *this; }
CAPropertyAddress& operator=(const CAPropertyAddress& inAddress) { AudioObjectPropertyAddress::operator=(inAddress); return *this; }
-
+
// Operations
public:
static bool IsSameAddress(const AudioObjectPropertyAddress& inAddress1, const AudioObjectPropertyAddress& inAddress2) { return (inAddress1.mScope == inAddress2.mScope) && (inAddress1.mSelector == inAddress2.mSelector) && (inAddress1.mElement == inAddress2.mElement); }
@@ -145,18 +145,18 @@ public:
public:
void* GetToken() const { return mToken; }
void SetToken(void* inToken) { mToken = inToken; }
-
+
uintptr_t GetIntToken() const { return reinterpret_cast<uintptr_t>(mToken); }
void SetIntToken(uintptr_t inToken) { mToken = reinterpret_cast<void*>(inToken); }
-
+
AudioObjectID GetAudioObjectIDToken() const { return static_cast<AudioObjectID>(reinterpret_cast<uintptr_t>(mToken)); }
-
+
bool IsEmpty() const { return mAddressList.empty(); }
UInt32 GetNumberItems() const { return ToUInt32(mAddressList.size()); }
void GetItemByIndex(UInt32 inIndex, AudioObjectPropertyAddress& outAddress) const { if(inIndex < mAddressList.size()) { outAddress = mAddressList.at(inIndex); } }
const AudioObjectPropertyAddress* GetItems() const { return &(*mAddressList.begin()); }
AudioObjectPropertyAddress* GetItems() { return &(*mAddressList.begin()); }
-
+
bool HasItem(const AudioObjectPropertyAddress& inAddress) const { AddressList::const_iterator theIterator = std::find_if(mAddressList.begin(), mAddressList.end(), std::bind1st(CAPropertyAddress::CongruentEqualTo(), inAddress)); return theIterator != mAddressList.end(); }
bool HasExactItem(const AudioObjectPropertyAddress& inAddress) const { AddressList::const_iterator theIterator = std::find_if(mAddressList.begin(), mAddressList.end(), std::bind1st(CAPropertyAddress::EqualTo(), inAddress)); return theIterator != mAddressList.end(); }
@@ -174,7 +174,7 @@ private:
AddressList mAddressList;
void* mToken;
-
+
};
//==================================================================================================
@@ -207,10 +207,10 @@ public:
CAPropertyAddressList* GetItemByToken(void* inToken);
const CAPropertyAddressList* GetItemByIntToken(uintptr_t inToken) const;
CAPropertyAddressList* GetItemByIntToken(uintptr_t inToken);
-
+
void AppendItem(const CAPropertyAddressList& inAddressList) { mAddressListVector.push_back(inAddressList); }
void EraseAllItems() { mAddressListVector.clear(); }
-
+
// Implementation
private:
typedef std::vector<CAPropertyAddressList> AddressListVector;
diff --git a/libs/appleutility/CoreAudio/PublicUtility/CAReferenceCounted.h b/libs/appleutility/CoreAudio/PublicUtility/CAReferenceCounted.h
index f00fc61675..9e4de362a3 100644
--- a/libs/appleutility/CoreAudio/PublicUtility/CAReferenceCounted.h
+++ b/libs/appleutility/CoreAudio/PublicUtility/CAReferenceCounted.h
@@ -2,14 +2,14 @@
File: CAReferenceCounted.h
Abstract: Part of CoreAudio Utility Classes
Version: 1.1
-
+
Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple
Inc. ("Apple") in consideration of your agreement to the following
terms, and your use, installation, modification or redistribution of
this Apple software constitutes acceptance of these terms. If you do
not agree with these terms, please do not use, install, modify or
redistribute this Apple software.
-
+
In consideration of your agreement to abide by the following terms, and
subject to these terms, Apple grants you a personal, non-exclusive
license, under Apple's copyrights in this original Apple software (the
@@ -25,13 +25,13 @@
implied, are granted by Apple herein, including but not limited to any
patent rights that may be infringed by your derivative works or by other
works in which the Apple Software may be incorporated.
-
+
The Apple Software is provided by Apple on an "AS IS" basis. APPLE
MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND
OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
-
+
IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
@@ -40,9 +40,9 @@
AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),
STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
-
+
Copyright (C) 2014 Apple Inc. All Rights Reserved.
-
+
*/
#ifndef __CAReferenceCounted_h__
#define __CAReferenceCounted_h__
@@ -53,11 +53,11 @@
class CAReferenceCounted {
public:
CAReferenceCounted() : mRefCount(1) {}
-
+
void retain() { CAAtomicIncrement32(&mRefCount); }
-
- void release()
- {
+
+ void release()
+ {
SInt32 rc = CAAtomicDecrement32(&mRefCount);
if (rc == 0) {
releaseObject();
@@ -69,17 +69,17 @@ public:
public:
Retainer(CAReferenceCounted *obj) : mObject(obj) { mObject->retain(); }
~Retainer() { mObject->release(); }
-
+
private:
CAReferenceCounted * mObject;
};
protected:
virtual ~CAReferenceCounted() { }
-
- virtual void releaseObject ()
- {
- delete this;
+
+ virtual void releaseObject ()
+ {
+ delete this;
}
#if DEBUG
diff --git a/libs/appleutility/CoreAudio/PublicUtility/CARingBuffer.cpp b/libs/appleutility/CoreAudio/PublicUtility/CARingBuffer.cpp
index c78acd2c2d..8d9584e04a 100644
--- a/libs/appleutility/CoreAudio/PublicUtility/CARingBuffer.cpp
+++ b/libs/appleutility/CoreAudio/PublicUtility/CARingBuffer.cpp
@@ -2,14 +2,14 @@
File: CARingBuffer.cpp
Abstract: CARingBuffer.h
Version: 1.1
-
+
Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple
Inc. ("Apple") in consideration of your agreement to the following
terms, and your use, installation, modification or redistribution of
this Apple software constitutes acceptance of these terms. If you do
not agree with these terms, please do not use, install, modify or
redistribute this Apple software.
-
+
In consideration of your agreement to abide by the following terms, and
subject to these terms, Apple grants you a personal, non-exclusive
license, under Apple's copyrights in this original Apple software (the
@@ -25,13 +25,13 @@
implied, are granted by Apple herein, including but not limited to any
patent rights that may be infringed by your derivative works or by other
works in which the Apple Software may be incorporated.
-
+
The Apple Software is provided by Apple on an "AS IS" basis. APPLE
MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND
OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
-
+
IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
@@ -40,9 +40,9 @@
AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),
STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
-
+
Copyright (C) 2014 Apple Inc. All Rights Reserved.
-
+
*/
#include "CARingBuffer.h"
#include "CABitOperations.h"
@@ -69,9 +69,9 @@ CARingBuffer::~CARingBuffer()
void CARingBuffer::Allocate(int nChannels, UInt32 bytesPerFrame, UInt32 capacityFrames)
{
Deallocate();
-
+
capacityFrames = NextPowerOfTwo(capacityFrames);
-
+
mNumberChannels = nChannels;
mBytesPerFrame = bytesPerFrame;
mCapacityFrames = capacityFrames;
@@ -88,7 +88,7 @@ void CARingBuffer::Allocate(int nChannels, UInt32 bytesPerFrame, UInt32 capacity
mBuffers[i] = p;
p += mCapacityBytes;
}
-
+
for (UInt32 i = 0; i<kGeneralRingTimeBoundsQueueSize; ++i)
{
mTimeBoundsQueue[i].mStartTime = 0;
@@ -157,12 +157,12 @@ CARingBufferError CARingBuffer::Store(const AudioBufferList *abl, UInt32 framesT
{
if (framesToWrite == 0)
return kCARingBufferError_OK;
-
+
if (framesToWrite > mCapacityFrames)
return kCARingBufferError_TooMuch; // too big!
SampleTime endWrite = startWrite + framesToWrite;
-
+
if (startWrite < EndTime()) {
// going backwards, throw everything out
SetTimeBounds(startWrite, startWrite);
@@ -174,13 +174,13 @@ CARingBufferError CARingBuffer::Store(const AudioBufferList *abl, UInt32 framesT
SampleTime newEnd = std::max(newStart, EndTime());
SetTimeBounds(newStart, newEnd);
}
-
+
// write the new frames
Byte **buffers = mBuffers;
int nchannels = mNumberChannels;
int offset0, offset1, nbytes;
SampleTime curEnd = EndTime();
-
+
if (startWrite > curEnd) {
// we are skipping some samples, so zero the range we are skipping
offset0 = FrameOffset(curEnd);
@@ -204,10 +204,10 @@ CARingBufferError CARingBuffer::Store(const AudioBufferList *abl, UInt32 framesT
StoreABL(buffers, offset0, abl, 0, nbytes);
StoreABL(buffers, 0, abl, nbytes, offset1);
}
-
+
// now update the end time
SetTimeBounds(StartTime(), endWrite);
-
+
return kCARingBufferError_OK; // success
}
@@ -215,7 +215,7 @@ void CARingBuffer::SetTimeBounds(SampleTime startTime, SampleTime endTime)
{
UInt32 nextPtr = mTimeBoundsQueuePtr + 1;
UInt32 index = nextPtr & kGeneralRingTimeBoundsQueueMask;
-
+
mTimeBoundsQueue[index].mStartTime = startTime;
mTimeBoundsQueue[index].mEndTime = endTime;
mTimeBoundsQueue[index].mUpdateCounter = nextPtr;
@@ -229,12 +229,12 @@ CARingBufferError CARingBuffer::GetTimeBounds(SampleTime &startTime, SampleTime
UInt32 curPtr = mTimeBoundsQueuePtr;
UInt32 index = curPtr & kGeneralRingTimeBoundsQueueMask;
CARingBuffer::TimeBounds* bounds = mTimeBoundsQueue + index;
-
+
startTime = bounds->mStartTime;
endTime = bounds->mEndTime;
UInt32 newPtr = bounds->mUpdateCounter;
-
- if (newPtr == curPtr)
+
+ if (newPtr == curPtr)
return kCARingBufferError_OK;
}
return kCARingBufferError_CPUOverload;
@@ -243,19 +243,19 @@ CARingBufferError CARingBuffer::GetTimeBounds(SampleTime &startTime, SampleTime
CARingBufferError CARingBuffer::ClipTimeBounds(SampleTime& startRead, SampleTime& endRead)
{
SampleTime startTime, endTime;
-
+
CARingBufferError err = GetTimeBounds(startTime, endTime);
if (err) return err;
-
+
if (startRead > endTime || endRead < startTime) {
endRead = startRead;
return kCARingBufferError_OK;
}
-
+
startRead = std::max(startRead, startTime);
endRead = std::min(endRead, endTime);
endRead = std::max(endRead, startRead);
-
+
return kCARingBufferError_OK; // success
}
@@ -263,9 +263,9 @@ CARingBufferError CARingBuffer::Fetch(AudioBufferList *abl, UInt32 nFrames, Samp
{
if (nFrames == 0)
return kCARingBufferError_OK;
-
+
startRead = std::max(0LL, startRead);
-
+
SampleTime endRead = startRead + nFrames;
SampleTime startRead0 = startRead;
@@ -278,25 +278,25 @@ CARingBufferError CARingBuffer::Fetch(AudioBufferList *abl, UInt32 nFrames, Samp
ZeroABL(abl, 0, nFrames * mBytesPerFrame);
return kCARingBufferError_OK;
}
-
+
SInt32 byteSize = (SInt32)((endRead - startRead) * mBytesPerFrame);
-
- SInt32 destStartByteOffset = std::max((SInt32)0, (SInt32)((startRead - startRead0) * mBytesPerFrame));
-
+
+ SInt32 destStartByteOffset = std::max((SInt32)0, (SInt32)((startRead - startRead0) * mBytesPerFrame));
+
if (destStartByteOffset > 0) {
ZeroABL(abl, 0, std::min((SInt32)(nFrames * mBytesPerFrame), destStartByteOffset));
}
- SInt32 destEndSize = std::max((SInt32)0, (SInt32)(endRead0 - endRead));
+ SInt32 destEndSize = std::max((SInt32)0, (SInt32)(endRead0 - endRead));
if (destEndSize > 0) {
ZeroABL(abl, destStartByteOffset + byteSize, destEndSize * mBytesPerFrame);
}
-
+
Byte **buffers = mBuffers;
int offset0 = FrameOffset(startRead);
int offset1 = FrameOffset(endRead);
int nbytes;
-
+
if (offset0 < offset1) {
nbytes = offset1 - offset0;
FetchABL(abl, destStartByteOffset, buffers, offset0, nbytes);
diff --git a/libs/appleutility/CoreAudio/PublicUtility/CARingBuffer.h b/libs/appleutility/CoreAudio/PublicUtility/CARingBuffer.h
index 9569e9a2a8..4331194e22 100644
--- a/libs/appleutility/CoreAudio/PublicUtility/CARingBuffer.h
+++ b/libs/appleutility/CoreAudio/PublicUtility/CARingBuffer.h
@@ -2,14 +2,14 @@
File: CARingBuffer.h
Abstract: Part of CoreAudio Utility Classes
Version: 1.1
-
+
Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple
Inc. ("Apple") in consideration of your agreement to the following
terms, and your use, installation, modification or redistribution of
this Apple software constitutes acceptance of these terms. If you do
not agree with these terms, please do not use, install, modify or
redistribute this Apple software.
-
+
In consideration of your agreement to abide by the following terms, and
subject to these terms, Apple grants you a personal, non-exclusive
license, under Apple's copyrights in this original Apple software (the
@@ -25,13 +25,13 @@
implied, are granted by Apple herein, including but not limited to any
patent rights that may be infringed by your derivative works or by other
works in which the Apple Software may be incorporated.
-
+
The Apple Software is provided by Apple on an "AS IS" basis. APPLE
MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND
OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
-
+
IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
@@ -40,9 +40,9 @@
AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),
STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
-
+
Copyright (C) 2014 Apple Inc. All Rights Reserved.
-
+
*/
#if !defined(__COREAUDIO_USE_FLAT_INCLUDES__)
#include <CoreAudio/CoreAudioTypes.h>
@@ -71,37 +71,37 @@ public:
CARingBuffer();
~CARingBuffer();
-
+
void Allocate(int nChannels, UInt32 bytesPerFrame, UInt32 capacityFrames);
// capacityFrames will be rounded up to a power of 2
void Deallocate();
-
+
CARingBufferError Store(const AudioBufferList *abl, UInt32 nFrames, SampleTime frameNumber);
// Copy nFrames of data into the ring buffer at the specified sample time.
// The sample time should normally increase sequentially, though gaps
// are filled with zeroes. A sufficiently large gap effectively empties
- // the buffer before storing the new data.
-
+ // the buffer before storing the new data.
+
// If frameNumber is less than the previous frame number, the behavior is undefined.
-
+
// Return false for failure (buffer not large enough).
-
+
CARingBufferError Fetch(AudioBufferList *abl, UInt32 nFrames, SampleTime frameNumber);
// will alter mNumDataBytes of the buffers
-
+
CARingBufferError GetTimeBounds(SampleTime &startTime, SampleTime &endTime);
-
+
protected:
int FrameOffset(SampleTime frameNumber) { return (frameNumber & mCapacityFramesMask) * mBytesPerFrame; }
CARingBufferError ClipTimeBounds(SampleTime& startRead, SampleTime& endRead);
-
+
// these should only be called from Store.
SampleTime StartTime() const { return mTimeBoundsQueue[mTimeBoundsQueuePtr & kGeneralRingTimeBoundsQueueMask].mStartTime; }
SampleTime EndTime() const { return mTimeBoundsQueue[mTimeBoundsQueuePtr & kGeneralRingTimeBoundsQueueMask].mEndTime; }
void SetTimeBounds(SampleTime startTime, SampleTime endTime);
-
+
protected:
Byte ** mBuffers; // allocated in one chunk of memory
int mNumberChannels;
@@ -109,14 +109,14 @@ protected:
UInt32 mCapacityFrames; // per channel, must be a power of 2
UInt32 mCapacityFramesMask;
UInt32 mCapacityBytes; // per channel
-
+
// range of valid sample time in the buffer
typedef struct {
volatile SampleTime mStartTime;
volatile SampleTime mEndTime;
volatile UInt32 mUpdateCounter;
} TimeBounds;
-
+
CARingBuffer::TimeBounds mTimeBoundsQueue[kGeneralRingTimeBoundsQueueSize];
UInt32 mTimeBoundsQueuePtr;
};
diff --git a/libs/appleutility/CoreAudio/PublicUtility/CASettingsStorage.cpp b/libs/appleutility/CoreAudio/PublicUtility/CASettingsStorage.cpp
index 69bdffcb72..3982f3d484 100644
--- a/libs/appleutility/CoreAudio/PublicUtility/CASettingsStorage.cpp
+++ b/libs/appleutility/CoreAudio/PublicUtility/CASettingsStorage.cpp
@@ -2,14 +2,14 @@
File: CASettingsStorage.cpp
Abstract: CASettingsStorage.h
Version: 1.1
-
+
Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple
Inc. ("Apple") in consideration of your agreement to the following
terms, and your use, installation, modification or redistribution of
this Apple software constitutes acceptance of these terms. If you do
not agree with these terms, please do not use, install, modify or
redistribute this Apple software.
-
+
In consideration of your agreement to abide by the following terms, and
subject to these terms, Apple grants you a personal, non-exclusive
license, under Apple's copyrights in this original Apple software (the
@@ -25,13 +25,13 @@
implied, are granted by Apple herein, including but not limited to any
patent rights that may be infringed by your derivative works or by other
works in which the Apple Software may be incorporated.
-
+
The Apple Software is provided by Apple on an "AS IS" basis. APPLE
MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND
OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
-
+
IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
@@ -40,9 +40,9 @@
AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),
STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
-
+
Copyright (C) 2014 Apple Inc. All Rights Reserved.
-
+
*/
//==================================================================================================
// Includes
@@ -81,17 +81,17 @@ CASettingsStorage::CASettingsStorage(const char* inSettingsFilePath, mode_t inSe
size_t theLength = strlen(inSettingsFilePath);
mSettingsFilePath = new char[theLength + 2];
strlcpy(mSettingsFilePath, inSettingsFilePath, theLength + 2);
-
+
mSettingsCacheTime.tv_sec = 0;
mSettingsCacheTime.tv_nsec = 0;
-
+
mSettingsCacheForceRefresh = true;
}
CASettingsStorage::~CASettingsStorage()
{
delete[] mSettingsFilePath;
-
+
if(mSettingsCache != NULL)
{
CFRelease(mSettingsCache);
@@ -119,11 +119,11 @@ void CASettingsStorage::CopyBoolValue(CFStringRef inKey, bool& outValue, bool in
{
// initialize the return value
outValue = inDefaultValue;
-
+
// get the raw value
CFTypeRef theValue = NULL;
CopyCFTypeValue(inKey, theValue, NULL);
-
+
// for this type, NULL is an invalid value
if(theValue != NULL)
{
@@ -138,11 +138,11 @@ void CASettingsStorage::CopyBoolValue(CFStringRef inKey, bool& outValue, bool in
// get the numeric value
SInt32 theNumericValue = 0;
CFNumberGetValue(static_cast<CFNumberRef>(theValue), kCFNumberSInt32Type, &theNumericValue);
-
+
// non-zero indicates true
outValue = theNumericValue != 0;
}
-
+
// release the value since we aren't returning it
CFRelease(theValue);
}
@@ -152,11 +152,11 @@ void CASettingsStorage::CopySInt32Value(CFStringRef inKey, SInt32& outValue, SIn
{
// initialize the return value
outValue = inDefaultValue;
-
+
// get the raw value
CFTypeRef theValue = NULL;
CopyCFTypeValue(inKey, theValue, NULL);
-
+
// for this type, NULL is an invalid value
if(theValue != NULL)
{
@@ -166,7 +166,7 @@ void CASettingsStorage::CopySInt32Value(CFStringRef inKey, SInt32& outValue, SIn
// get the return value from the CF object
CFNumberGetValue(static_cast<CFNumberRef>(theValue), kCFNumberSInt32Type, &outValue);
}
-
+
// release the value since we aren't returning it
CFRelease(theValue);
}
@@ -176,11 +176,11 @@ void CASettingsStorage::CopyUInt32Value(CFStringRef inKey, UInt32& outValue, UIn
{
// initialize the return value
outValue = inDefaultValue;
-
+
// get the raw value
CFTypeRef theValue = NULL;
CopyCFTypeValue(inKey, theValue, NULL);
-
+
// for this type, NULL is an invalid value
if(theValue != NULL)
{
@@ -190,7 +190,7 @@ void CASettingsStorage::CopyUInt32Value(CFStringRef inKey, UInt32& outValue, UIn
// get the return value from the CF object
CFNumberGetValue(static_cast<CFNumberRef>(theValue), kCFNumberSInt32Type, &outValue);
}
-
+
// release the value since we aren't returning it
CFRelease(theValue);
}
@@ -200,11 +200,11 @@ void CASettingsStorage::CopySInt64Value(CFStringRef inKey, SInt64& outValue, SIn
{
// initialize the return value
outValue = inDefaultValue;
-
+
// get the raw value
CFTypeRef theValue = NULL;
CopyCFTypeValue(inKey, theValue, NULL);
-
+
// for this type, NULL is an invalid value
if(theValue != NULL)
{
@@ -214,7 +214,7 @@ void CASettingsStorage::CopySInt64Value(CFStringRef inKey, SInt64& outValue, SIn
// get the return value from the CF object
CFNumberGetValue(static_cast<CFNumberRef>(theValue), kCFNumberSInt64Type, &outValue);
}
-
+
// release the value since we aren't returning it
CFRelease(theValue);
}
@@ -224,11 +224,11 @@ void CASettingsStorage::CopyUInt64Value(CFStringRef inKey, UInt64& outValue, UIn
{
// initialize the return value
outValue = inDefaultValue;
-
+
// get the raw value
CFTypeRef theValue = NULL;
CopyCFTypeValue(inKey, theValue, NULL);
-
+
// for this type, NULL is an invalid value
if(theValue != NULL)
{
@@ -238,7 +238,7 @@ void CASettingsStorage::CopyUInt64Value(CFStringRef inKey, UInt64& outValue, UIn
// get the return value from the CF object
CFNumberGetValue(static_cast<CFNumberRef>(theValue), kCFNumberSInt64Type, &outValue);
}
-
+
// release the value since we aren't returning it
CFRelease(theValue);
}
@@ -248,11 +248,11 @@ void CASettingsStorage::CopyFloat32Value(CFStringRef inKey, Float32& outValue, F
{
// initialize the return value
outValue = inDefaultValue;
-
+
// get the raw value
CFTypeRef theValue = NULL;
CopyCFTypeValue(inKey, theValue, NULL);
-
+
// for this type, NULL is an invalid value
if(theValue != NULL)
{
@@ -262,7 +262,7 @@ void CASettingsStorage::CopyFloat32Value(CFStringRef inKey, Float32& outValue, F
// get the return value from the CF object
CFNumberGetValue(static_cast<CFNumberRef>(theValue), kCFNumberFloat32Type, &outValue);
}
-
+
// release the value since we aren't returning it
CFRelease(theValue);
}
@@ -272,11 +272,11 @@ void CASettingsStorage::CopyFloat64Value(CFStringRef inKey, Float64& outValue, F
{
// initialize the return value
outValue = inDefaultValue;
-
+
// get the raw value
CFTypeRef theValue = NULL;
CopyCFTypeValue(inKey, theValue, NULL);
-
+
// for this type, NULL is an invalid value
if(theValue != NULL)
{
@@ -286,7 +286,7 @@ void CASettingsStorage::CopyFloat64Value(CFStringRef inKey, Float64& outValue, F
// get the return value from the CF object
CFNumberGetValue(static_cast<CFNumberRef>(theValue), kCFNumberFloat64Type, &outValue);
}
-
+
// release the value since we aren't returning it
CFRelease(theValue);
}
@@ -300,7 +300,7 @@ void CASettingsStorage::CopyNumberValue(CFStringRef inKey, CFNumberRef& outValue
// get the raw value
CFTypeRef theValue = NULL;
CopyCFTypeValue(inKey, theValue, inDefaultValue);
-
+
// for this type, NULL is a valid value, but requires less work
if(theValue != NULL)
{
@@ -314,16 +314,16 @@ void CASettingsStorage::CopyNumberValue(CFStringRef inKey, CFNumberRef& outValue
{
// release the value since we aren't returning it
CFRelease(theValue);
-
+
// set the return value to the default value
outValue = inDefaultValue;
-
+
// and retain it
CFRetain(outValue);
}
}
}
-
+
void CASettingsStorage::CopyStringValue(CFStringRef inKey, CFStringRef& outValue, CFStringRef inDefaultValue) const
{
// initialize the return value
@@ -332,7 +332,7 @@ void CASettingsStorage::CopyStringValue(CFStringRef inKey, CFStringRef& outValue
// get the raw value
CFTypeRef theValue = NULL;
CopyCFTypeValue(inKey, theValue, inDefaultValue);
-
+
// for this type, NULL is a valid value, but requires less work
if(theValue != NULL)
{
@@ -346,16 +346,16 @@ void CASettingsStorage::CopyStringValue(CFStringRef inKey, CFStringRef& outValue
{
// release the value since we aren't returning it
CFRelease(theValue);
-
+
// set the return value to the default value
outValue = inDefaultValue;
-
+
// and retain it
CFRetain(outValue);
}
}
}
-
+
void CASettingsStorage::CopyArrayValue(CFStringRef inKey, CFArrayRef& outValue, CFArrayRef inDefaultValue) const
{
// initialize the return value
@@ -364,7 +364,7 @@ void CASettingsStorage::CopyArrayValue(CFStringRef inKey, CFArrayRef& outValue,
// get the raw value
CFTypeRef theValue = NULL;
CopyCFTypeValue(inKey, theValue, inDefaultValue);
-
+
// for this type, NULL is a valid value, but requires less work
if(theValue != NULL)
{
@@ -378,16 +378,16 @@ void CASettingsStorage::CopyArrayValue(CFStringRef inKey, CFArrayRef& outValue,
{
// release the value since we aren't returning it
CFRelease(theValue);
-
+
// set the return value to the default value
outValue = inDefaultValue;
-
+
// and retain it
CFRetain(outValue);
}
}
}
-
+
void CASettingsStorage::CopyDictionaryValue(CFStringRef inKey, CFDictionaryRef& outValue, CFDictionaryRef inDefaultValue) const
{
// initialize the return value
@@ -396,7 +396,7 @@ void CASettingsStorage::CopyDictionaryValue(CFStringRef inKey, CFDictionaryRef&
// get the raw value
CFTypeRef theValue = NULL;
CopyCFTypeValue(inKey, theValue, inDefaultValue);
-
+
// for this type, NULL is a valid value, but requires less work
if(theValue != NULL)
{
@@ -410,16 +410,16 @@ void CASettingsStorage::CopyDictionaryValue(CFStringRef inKey, CFDictionaryRef&
{
// release the value since we aren't returning it
CFRelease(theValue);
-
+
// set the return value to the default value
outValue = inDefaultValue;
-
+
// and retain it
CFRetain(outValue);
}
}
}
-
+
void CASettingsStorage::CopyDataValue(CFStringRef inKey, CFDataRef& outValue, CFDataRef inDefaultValue) const
{
// initialize the return value
@@ -428,7 +428,7 @@ void CASettingsStorage::CopyDataValue(CFStringRef inKey, CFDataRef& outValue, CF
// get the raw value
CFTypeRef theValue = NULL;
CopyCFTypeValue(inKey, theValue, inDefaultValue);
-
+
// for this type, NULL is a valid value, but requires less work
if(theValue != NULL)
{
@@ -442,10 +442,10 @@ void CASettingsStorage::CopyDataValue(CFStringRef inKey, CFDataRef& outValue, CF
{
// release the value since we aren't returning it
CFRelease(theValue);
-
+
// set the return value to the default value
outValue = inDefaultValue;
-
+
// and retain it
CFRetain(outValue);
}
@@ -463,7 +463,7 @@ void CASettingsStorage::CopyCFTypeValue(CFStringRef inKey, CFTypeRef& outValue,
// the key wasn't in the cache, so return the default value
outValue = inDefaultValue;
}
-
+
// make sure we retain the return value
if(outValue != NULL)
{
@@ -536,10 +536,10 @@ void CASettingsStorage::SetCFTypeValue(CFStringRef inKey, CFTypeRef inValue)
{
// make sure our cache is up to date
RefreshSettings();
-
+
// add the new key/value to the dictionary
CFDictionarySetValue(mSettingsCache, inKey, inValue);
-
+
// write the settings to the file
SaveSettings();
}
@@ -548,10 +548,10 @@ void CASettingsStorage::RemoveValue(CFStringRef inKey)
{
// make sure our cache is up to date
RefreshSettings();
-
+
// remove the given key
CFDictionaryRemoveValue(mSettingsCache, inKey);
-
+
// write the settings to the file
SaveSettings();
}
@@ -560,10 +560,10 @@ void CASettingsStorage::RemoveAllValues()
{
// make sure our cache is up to date
RefreshSettings();
-
+
// remove the given key
CFDictionaryRemoveAllValues(mSettingsCache);
-
+
// write the settings to the file
SaveSettings();
}
@@ -593,11 +593,11 @@ void CASettingsStorage::RefreshSettings()
// telling us if the file exisits
struct stat theFileInfo;
int theStatError = stat(mSettingsFilePath, &theFileInfo);
-
+
// we use this boolean to make error recovery easier since we need a case for when there's no file anyway
bool theSettingsWereCached = false;
bool theSettingsNeedSaving = true;
-
+
if(theStatError == 0)
{
// stat says there is something there, only have to do work if we either don't have a cache or the cache is out of date
@@ -615,44 +615,44 @@ void CASettingsStorage::RefreshSettings()
fseek(theFile, 0, SEEK_END);
size_t theFileLength = static_cast<size_t>(ftell(theFile));
fseek(theFile, 0, SEEK_SET);
-
+
if(theFileLength > 0)
{
// allocate a block of memory to hold the data in the file
CAAutoFree<Byte> theRawFileData(theFileLength);
-
+
// read all the data in
fread(static_cast<Byte*>(theRawFileData), theFileLength, 1, theFile);
-
+
// release the lock
flock(fileno(theFile), LOCK_UN);
-
+
// put it into a CFData object
CACFData theRawFileDataCFData(static_cast<Byte*>(theRawFileData), static_cast<UInt32>(theFileLength));
-
+
// get rid of the existing cache
if(mSettingsCache != NULL)
{
CFRelease(mSettingsCache);
mSettingsCache = NULL;
}
-
+
// parse the data as a property list
mSettingsCache = (CFMutableDictionaryRef)CFPropertyListCreateWithData(NULL, theRawFileDataCFData.GetCFData(), kCFPropertyListMutableContainersAndLeaves, NULL, NULL);
-
+
// check to be sure we parsed a plist out of the file
if(mSettingsCache != NULL)
{
// save the date of the cache
mSettingsCacheTime = theFileInfo.st_mtimespec;
-
+
// mark that we're done
theSettingsWereCached = true;
theSettingsNeedSaving = false;
}
}
}
-
+
// close the file
fclose(theFile);
mSettingsCacheForceRefresh = false;
@@ -665,8 +665,8 @@ void CASettingsStorage::RefreshSettings()
theSettingsWereCached = true;
}
}
-
- // if there was a failure, we need to clean up
+
+ // if there was a failure, we need to clean up
if((theStatError != 0) || theSettingsNeedSaving || !theSettingsWereCached)
{
// we get here if either there isn't a file or something wacky happenned while parsing it
@@ -675,10 +675,10 @@ void CASettingsStorage::RefreshSettings()
{
mSettingsCache = CFDictionaryCreateMutable(NULL, 0, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks);
}
-
+
mSettingsCacheTime.tv_sec = 0;
mSettingsCacheTime.tv_nsec = 0;
-
+
if((theStatError != 0) || theSettingsNeedSaving)
{
SaveSettings();
@@ -693,7 +693,7 @@ void CASettingsStorage::SaveSettings()
{
// make a CFData that contains the new settings
CACFData theNewRawPrefsCFData(CFPropertyListCreateData(NULL, mSettingsCache, mSettingsCacheFormat, 0, NULL), true);
-
+
// open the file for writing
FILE* theFile = fopen(mSettingsFilePath, "w+");
if(theFile != NULL)
@@ -707,23 +707,23 @@ void CASettingsStorage::SaveSettings()
{
fchmod(fileno(theFile), mSettingsFileAccessMode);
}
-
+
// write the data
fwrite(theNewRawPrefsCFData.GetDataPtr(), theNewRawPrefsCFData.GetSize(), 1, theFile);
-
+
// flush the file to be sure it is all on disk
fflush(theFile);
-
+
// release the lock
flock(fileno(theFile), LOCK_UN);
-
+
// close the file
fclose(theFile);
-
+
// stat the file to get the mod date
struct stat theFileInfo;
stat(mSettingsFilePath, &theFileInfo);
-
+
// save the mod date
mSettingsCacheTime = theFileInfo.st_mtimespec;
}
diff --git a/libs/appleutility/CoreAudio/PublicUtility/CASettingsStorage.h b/libs/appleutility/CoreAudio/PublicUtility/CASettingsStorage.h
index d15f87dd16..33d0148197 100644
--- a/libs/appleutility/CoreAudio/PublicUtility/CASettingsStorage.h
+++ b/libs/appleutility/CoreAudio/PublicUtility/CASettingsStorage.h
@@ -2,14 +2,14 @@
File: CASettingsStorage.h
Abstract: Part of CoreAudio Utility Classes
Version: 1.1
-
+
Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple
Inc. ("Apple") in consideration of your agreement to the following
terms, and your use, installation, modification or redistribution of
this Apple software constitutes acceptance of these terms. If you do
not agree with these terms, please do not use, install, modify or
redistribute this Apple software.
-
+
In consideration of your agreement to abide by the following terms, and
subject to these terms, Apple grants you a personal, non-exclusive
license, under Apple's copyrights in this original Apple software (the
@@ -25,13 +25,13 @@
implied, are granted by Apple herein, including but not limited to any
patent rights that may be infringed by your derivative works or by other
works in which the Apple Software may be incorporated.
-
+
The Apple Software is provided by Apple on an "AS IS" basis. APPLE
MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND
OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
-
+
IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
@@ -40,9 +40,9 @@
AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),
STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
-
+
Copyright (C) 2014 Apple Inc. All Rights Reserved.
-
+
*/
#if !defined(__CASettingsStorage_h__)
#define __CASettingsStorage_h__
@@ -83,13 +83,13 @@ public:
void CopyUInt64Value(const CFStringRef inKey, UInt64& outValue, UInt64 inDefaultValue = 0) const;
void CopyFloat32Value(const CFStringRef inKey, Float32& outValue, Float32 inDefaultValue = 0) const;
void CopyFloat64Value(const CFStringRef inKey, Float64& outValue, Float64 inDefaultValue = 0) const;
- void CopyNumberValue(const CFStringRef inKey, CFNumberRef& outValue, CFNumberRef inDefaultValue = NULL) const;
- void CopyStringValue(const CFStringRef inKey, CFStringRef& outValue, CFStringRef inDefaultValue = NULL) const;
- void CopyArrayValue(const CFStringRef inKey, CFArrayRef& outValue, CFArrayRef inDefaultValue = NULL) const;
- void CopyDictionaryValue(const CFStringRef inKey, CFDictionaryRef& outValue, CFDictionaryRef inDefaultValue = NULL) const;
+ void CopyNumberValue(const CFStringRef inKey, CFNumberRef& outValue, CFNumberRef inDefaultValue = NULL) const;
+ void CopyStringValue(const CFStringRef inKey, CFStringRef& outValue, CFStringRef inDefaultValue = NULL) const;
+ void CopyArrayValue(const CFStringRef inKey, CFArrayRef& outValue, CFArrayRef inDefaultValue = NULL) const;
+ void CopyDictionaryValue(const CFStringRef inKey, CFDictionaryRef& outValue, CFDictionaryRef inDefaultValue = NULL) const;
void CopyDataValue(const CFStringRef inKey, CFDataRef& outValue, CFDataRef inDefaultValue = NULL) const;
void CopyCFTypeValue(const CFStringRef inKey, CFTypeRef& outValue, CFTypeRef inDefaultValue = NULL) const;
-
+
void SetSInt32Value(const CFStringRef inKey, SInt32 inValue);
void SetUInt32Value(const CFStringRef inKey, UInt32 inValue);
void SetSInt64Value(const CFStringRef inKey, SInt64 inValue);
@@ -102,10 +102,10 @@ public:
void SetDictionaryValue(const CFStringRef inKey, const CFDictionaryRef inValue);
void SetDataValue(const CFStringRef inKey, const CFDataRef inValue);
void SetCFTypeValue(const CFStringRef inKey, const CFTypeRef inValue);
-
+
void RemoveValue(const CFStringRef inKey);
void RemoveAllValues();
-
+
void SendNotification(const CFStringRef inName, CFDictionaryRef inData = NULL, bool inPostToAllSessions = true) const;
void ForceRefresh();
diff --git a/libs/appleutility/CoreAudio/PublicUtility/CASharedLibrary.cpp b/libs/appleutility/CoreAudio/PublicUtility/CASharedLibrary.cpp
index 0e39ac7e52..d463b4c3a6 100644
--- a/libs/appleutility/CoreAudio/PublicUtility/CASharedLibrary.cpp
+++ b/libs/appleutility/CoreAudio/PublicUtility/CASharedLibrary.cpp
@@ -2,14 +2,14 @@
File: CASharedLibrary.cpp
Abstract: CASharedLibrary.h
Version: 1.1
-
+
Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple
Inc. ("Apple") in consideration of your agreement to the following
terms, and your use, installation, modification or redistribution of
this Apple software constitutes acceptance of these terms. If you do
not agree with these terms, please do not use, install, modify or
redistribute this Apple software.
-
+
In consideration of your agreement to abide by the following terms, and
subject to these terms, Apple grants you a personal, non-exclusive
license, under Apple's copyrights in this original Apple software (the
@@ -25,13 +25,13 @@
implied, are granted by Apple herein, including but not limited to any
patent rights that may be infringed by your derivative works or by other
works in which the Apple Software may be incorporated.
-
+
The Apple Software is provided by Apple on an "AS IS" basis. APPLE
MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND
OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
-
+
IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
@@ -40,9 +40,9 @@
AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),
STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
-
+
Copyright (C) 2014 Apple Inc. All Rights Reserved.
-
+
*/
//=============================================================================
// Includes
@@ -84,7 +84,7 @@ void* CASharedLibrary::LoadLibraryAndGetRoutineAddress(const char* inRoutineName
// off when passed to dlsym
theRoutine = dlsym(theImage, &(inRoutineName[1]));
}
-
+
#endif
return theRoutine;
@@ -93,7 +93,7 @@ void* CASharedLibrary::LoadLibraryAndGetRoutineAddress(const char* inRoutineName
void* CASharedLibrary::GetRoutineAddressIfLibraryLoaded(const char* inRoutineName, const char* /*inLibraryName*/, const char* inLibraryPath)
{
void* theRoutine = 0;
-
+
#if CASharedLibrary_Use_DYLD
const struct mach_header* theImage = NSAddImage(inLibraryPath, NSADDIMAGE_OPTION_RETURN_ONLY_IF_LOADED);
if(theImage != 0)
diff --git a/libs/appleutility/CoreAudio/PublicUtility/CASharedLibrary.h b/libs/appleutility/CoreAudio/PublicUtility/CASharedLibrary.h
index d02e70e356..e183b1bb9c 100644
--- a/libs/appleutility/CoreAudio/PublicUtility/CASharedLibrary.h
+++ b/libs/appleutility/CoreAudio/PublicUtility/CASharedLibrary.h
@@ -2,14 +2,14 @@
File: CASharedLibrary.h
Abstract: Part of CoreAudio Utility Classes
Version: 1.1
-
+
Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple
Inc. ("Apple") in consideration of your agreement to the following
terms, and your use, installation, modification or redistribution of
this Apple software constitutes acceptance of these terms. If you do
not agree with these terms, please do not use, install, modify or
redistribute this Apple software.
-
+
In consideration of your agreement to abide by the following terms, and
subject to these terms, Apple grants you a personal, non-exclusive
license, under Apple's copyrights in this original Apple software (the
@@ -25,13 +25,13 @@
implied, are granted by Apple herein, including but not limited to any
patent rights that may be infringed by your derivative works or by other
works in which the Apple Software may be incorporated.
-
+
The Apple Software is provided by Apple on an "AS IS" basis. APPLE
MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND
OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
-
+
IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
@@ -40,9 +40,9 @@
AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),
STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
-
+
Copyright (C) 2014 Apple Inc. All Rights Reserved.
-
+
*/
#if !defined(__CASharedLibrary_h__)
#define __CASharedLibrary_h__
diff --git a/libs/appleutility/CoreAudio/PublicUtility/CASpectralProcessor.cpp b/libs/appleutility/CoreAudio/PublicUtility/CASpectralProcessor.cpp
index ffb2da8a83..85f14cb4ab 100644
--- a/libs/appleutility/CoreAudio/PublicUtility/CASpectralProcessor.cpp
+++ b/libs/appleutility/CoreAudio/PublicUtility/CASpectralProcessor.cpp
@@ -2,14 +2,14 @@
File: CASpectralProcessor.cpp
Abstract: CASpectralProcessor.h
Version: 1.1
-
+
Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple
Inc. ("Apple") in consideration of your agreement to the following
terms, and your use, installation, modification or redistribution of
this Apple software constitutes acceptance of these terms. If you do
not agree with these terms, please do not use, install, modify or
redistribute this Apple software.
-
+
In consideration of your agreement to abide by the following terms, and
subject to these terms, Apple grants you a personal, non-exclusive
license, under Apple's copyrights in this original Apple software (the
@@ -25,13 +25,13 @@
implied, are granted by Apple herein, including but not limited to any
patent rights that may be infringed by your derivative works or by other
works in which the Apple Software may be incorporated.
-
+
The Apple Software is provided by Apple on an "AS IS" basis. APPLE
MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND
OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
-
+
IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
@@ -40,11 +40,11 @@
AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),
STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
-
+
Copyright (C) 2014 Apple Inc. All Rights Reserved.
-
+
*/
-
+
//#include "AudioFormulas.h"
#include "CASpectralProcessor.h"
#include "CABitOperations.h"
@@ -57,23 +57,23 @@
CASpectralProcessor::CASpectralProcessor(UInt32 inFFTSize, UInt32 inHopSize, UInt32 inNumChannels, UInt32 inMaxFrames)
: mFFTSize(inFFTSize), mHopSize(inHopSize), mNumChannels(inNumChannels), mMaxFrames(inMaxFrames),
- mLog2FFTSize(Log2Ceil(mFFTSize)),
+ mLog2FFTSize(Log2Ceil(mFFTSize)),
mFFTMask(mFFTSize - 1),
mFFTByteSize(mFFTSize * sizeof(Float32)),
mIOBufSize(NextPowerOfTwo(mFFTSize + mMaxFrames)),
mIOMask(mIOBufSize - 1),
mInputSize(0),
- mInputPos(0), mOutputPos(-mFFTSize & mIOMask),
+ mInputPos(0), mOutputPos(-mFFTSize & mIOMask),
mInFFTPos(0), mOutFFTPos(0),
mSpectralFunction(0), mUserData(0)
{
mWindow.alloc(mFFTSize, false);
SineWindow(); // set default window.
-
+
mChannels.alloc(mNumChannels);
mSpectralBufferList.allocBytes(OFFSETOF(SpectralBufferList, mDSPSplitComplex[mNumChannels]), true);
mSpectralBufferList->mNumberSpectra = mNumChannels;
- for (UInt32 i = 0; i < mNumChannels; ++i)
+ for (UInt32 i = 0; i < mNumChannels; ++i)
{
mChannels[i].mInputBuf.alloc(mIOBufSize, true);
mChannels[i].mOutputBuf.alloc(mIOBufSize, true);
@@ -84,7 +84,7 @@ CASpectralProcessor::CASpectralProcessor(UInt32 inFFTSize, UInt32 inHopSize, UIn
}
mFFTSetup = vDSP_create_fftsetup (mLog2FFTSize, FFT_RADIX2);
-
+
}
CASpectralProcessor::~CASpectralProcessor()
@@ -101,8 +101,8 @@ void CASpectralProcessor::Reset()
mOutputPos = -mFFTSize & mIOMask;
mInFFTPos = 0;
mOutFFTPos = 0;
-
- for (UInt32 i = 0; i < mNumChannels; ++i)
+
+ for (UInt32 i = 0; i < mNumChannels; ++i)
{
memset(mChannels[i].mInputBuf(), 0, mIOBufSize * sizeof(Float32));
memset(mChannels[i].mOutputBuf(), 0, mIOBufSize * sizeof(Float32));
@@ -113,13 +113,13 @@ void CASpectralProcessor::Reset()
const double two_pi = 2. * M_PI;
void CASpectralProcessor::HanningWindow()
-{
+{
// this is also vector optimized
double w = two_pi / (double)(mFFTSize - 1);
for (UInt32 i = 0; i < mFFTSize; ++i)
{
- mWindow[i] = (0.5 - 0.5 * cos(w * (double)i));
+ mWindow[i] = (0.5 - 0.5 * cos(w * (double)i));
}
}
@@ -136,9 +136,9 @@ void CASpectralProcessor::Process(UInt32 inNumFrames, AudioBufferList* inInput,
{
// copy from buffer list to input buffer
CopyInput(inNumFrames, inInput);
-
+
// if enough input to process, then process.
- while (mInputSize >= mFFTSize)
+ while (mInputSize >= mFFTSize)
{
CopyInputToFFT(); // copy from input buffer to fft buffer
DoWindowing();
@@ -170,18 +170,18 @@ void CASpectralProcessor::CopyInput(UInt32 inNumFrames, AudioBufferList* inInput
{
UInt32 numBytes = inNumFrames * sizeof(Float32);
UInt32 firstPart = mIOBufSize - mInputPos;
-
+
if (firstPart < inNumFrames) {
UInt32 firstPartBytes = firstPart * sizeof(Float32);
UInt32 secondPartBytes = numBytes - firstPartBytes;
- for (UInt32 i=0; i<mNumChannels; ++i) {
+ for (UInt32 i=0; i<mNumChannels; ++i) {
memcpy(mChannels[i].mInputBuf + mInputPos, inInput->mBuffers[i].mData, firstPartBytes);
memcpy(mChannels[i].mInputBuf, (UInt8*)inInput->mBuffers[i].mData + firstPartBytes, secondPartBytes);
}
} else {
UInt32 numBytes = inNumFrames * sizeof(Float32);
- for (UInt32 i=0; i<mNumChannels; ++i) {
+ for (UInt32 i=0; i<mNumChannels; ++i) {
memcpy(mChannels[i].mInputBuf + mInputPos, inInput->mBuffers[i].mData, numBytes);
}
}
@@ -221,7 +221,7 @@ void CASpectralProcessor::PrintSpectralBufferList()
UInt32 half = mFFTSize >> 1;
for (UInt32 i=0; i<mNumChannels; ++i) {
DSPSplitComplex &freqData = mSpectralBufferList->mDSPSplitComplex[i];
-
+
for (UInt32 j=0; j<half; j++){
printf(" bin[%d]: %lf + %lfi\n", (int) j, freqData.realp[j], freqData.imagp[j]);
}
@@ -277,7 +277,7 @@ void CASpectralProcessor::DoFwdFFT()
{
//printf("->DoFwdFFT %g %g\n", mChannels[0].mFFTBuf()[0], mChannels[0].mFFTBuf()[200]);
UInt32 half = mFFTSize >> 1;
- for (UInt32 i=0; i<mNumChannels; ++i)
+ for (UInt32 i=0; i<mNumChannels; ++i)
{
vDSP_ctoz((DSPComplex*)mChannels[i].mFFTBuf(), 2, &mSpectralBufferList->mDSPSplitComplex[i], 1, half);
vDSP_fft_zrip(mFFTSetup, &mSpectralBufferList->mDSPSplitComplex[i], 1, mLog2FFTSize, FFT_FORWARD);
@@ -289,10 +289,10 @@ void CASpectralProcessor::DoInvFFT()
{
//printf("->DoInvFFT %g %g\n", mChannels[0].mFFTBuf()[0], mChannels[0].mFFTBuf()[200]);
UInt32 half = mFFTSize >> 1;
- for (UInt32 i=0; i<mNumChannels; ++i)
+ for (UInt32 i=0; i<mNumChannels; ++i)
{
vDSP_fft_zrip(mFFTSetup, &mSpectralBufferList->mDSPSplitComplex[i], 1, mLog2FFTSize, FFT_INVERSE);
- vDSP_ztoc(&mSpectralBufferList->mDSPSplitComplex[i], 1, (DSPComplex*)mChannels[i].mFFTBuf(), 2, half);
+ vDSP_ztoc(&mSpectralBufferList->mDSPSplitComplex[i], 1, (DSPComplex*)mChannels[i].mFFTBuf(), 2, half);
float scale = 0.5 / mFFTSize;
vDSP_vsmul(mChannels[i].mFFTBuf(), 1, &scale, mChannels[i].mFFTBuf(), 1, mFFTSize );
}
@@ -301,7 +301,7 @@ void CASpectralProcessor::DoInvFFT()
void CASpectralProcessor::SetSpectralFunction(SpectralFunction inFunction, void* inUserData)
{
- mSpectralFunction = inFunction;
+ mSpectralFunction = inFunction;
mUserData = inUserData;
}
@@ -313,29 +313,29 @@ void CASpectralProcessor::ProcessSpectrum(UInt32 inFFTSize, SpectralBufferList*
#pragma mark ___Utility___
-void CASpectralProcessor::GetMagnitude(AudioBufferList* list, Float32* min, Float32* max)
-{
- UInt32 half = mFFTSize >> 1;
+void CASpectralProcessor::GetMagnitude(AudioBufferList* list, Float32* min, Float32* max)
+{
+ UInt32 half = mFFTSize >> 1;
for (UInt32 i=0; i<mNumChannels; ++i) {
- DSPSplitComplex &freqData = mSpectralBufferList->mDSPSplitComplex[i];
-
+ DSPSplitComplex &freqData = mSpectralBufferList->mDSPSplitComplex[i];
+
Float32* b = (Float32*) list->mBuffers[i].mData;
-
- vDSP_zvabs(&freqData,1,b,1,half);
-
- vDSP_maxmgv(b, 1, &max[i], half);
- vDSP_minmgv(b, 1, &min[i], half);
-
- }
+
+ vDSP_zvabs(&freqData,1,b,1,half);
+
+ vDSP_maxmgv(b, 1, &max[i], half);
+ vDSP_minmgv(b, 1, &min[i], half);
+
+ }
}
void CASpectralProcessor::GetFrequencies(Float32* freqs, Float32 sampleRate)
{
- UInt32 half = mFFTSize >> 1;
+ UInt32 half = mFFTSize >> 1;
for (UInt32 i=0; i< half; i++){
- freqs[i] = ((Float32)(i))*sampleRate/((Float32)mFFTSize);
+ freqs[i] = ((Float32)(i))*sampleRate/((Float32)mFFTSize);
}
}
@@ -344,10 +344,10 @@ bool CASpectralProcessor::ProcessForwards(UInt32 inNumFrames, AudioBufferList* i
{
// copy from buffer list to input buffer
CopyInput(inNumFrames, inInput);
-
+
bool processed = false;
// if enough input to process, then process.
- while (mInputSize >= mFFTSize)
+ while (mInputSize >= mFFTSize)
{
CopyInputToFFT(); // copy from input buffer to fft buffer
DoWindowing();
@@ -355,21 +355,21 @@ bool CASpectralProcessor::ProcessForwards(UInt32 inNumFrames, AudioBufferList* i
ProcessSpectrum(mFFTSize, mSpectralBufferList()); // here you would copy the fft results out to a buffer indicated in mUserData, say for sonogram drawing
processed = true;
}
-
+
return processed;
}
bool CASpectralProcessor::ProcessBackwards(UInt32 inNumFrames, AudioBufferList* outOutput)
-{
-
+{
+
ProcessSpectrum(mFFTSize, mSpectralBufferList());
DoInvFFT();
DoWindowing();
- OverlapAddOutput();
-
+ OverlapAddOutput();
+
// copy from output buffer to buffer list
CopyOutput(inNumFrames, outOutput);
-
+
return true;
}
diff --git a/libs/appleutility/CoreAudio/PublicUtility/CASpectralProcessor.h b/libs/appleutility/CoreAudio/PublicUtility/CASpectralProcessor.h
index d7c285b6a9..7c8b1a7245 100644
--- a/libs/appleutility/CoreAudio/PublicUtility/CASpectralProcessor.h
+++ b/libs/appleutility/CoreAudio/PublicUtility/CASpectralProcessor.h
@@ -2,14 +2,14 @@
File: CASpectralProcessor.h
Abstract: Part of CoreAudio Utility Classes
Version: 1.1
-
+
Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple
Inc. ("Apple") in consideration of your agreement to the following
terms, and your use, installation, modification or redistribution of
this Apple software constitutes acceptance of these terms. If you do
not agree with these terms, please do not use, install, modify or
redistribute this Apple software.
-
+
In consideration of your agreement to abide by the following terms, and
subject to these terms, Apple grants you a personal, non-exclusive
license, under Apple's copyrights in this original Apple software (the
@@ -25,13 +25,13 @@
implied, are granted by Apple herein, including but not limited to any
patent rights that may be infringed by your derivative works or by other
works in which the Apple Software may be incorporated.
-
+
The Apple Software is provided by Apple on an "AS IS" basis. APPLE
MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND
OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
-
+
IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
@@ -40,13 +40,13 @@
AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),
STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
-
+
Copyright (C) 2014 Apple Inc. All Rights Reserved.
-
+
*/
#ifndef _SpectralProcesor_H_
#define _SpectralProcesor_H_
-
+
#if !defined(__COREAUDIO_USE_FLAT_INCLUDES__)
#include <CoreAudio/CoreAudioTypes.h>
#include <CoreFoundation/CoreFoundation.h>
@@ -65,39 +65,39 @@ struct SpectralBufferList
DSPSplitComplex mDSPSplitComplex[1];
};
-class CASpectralProcessor
+class CASpectralProcessor
{
public:
CASpectralProcessor(UInt32 inFFTSize, UInt32 inHopSize, UInt32 inNumChannels, UInt32 inMaxFrames);
virtual ~CASpectralProcessor();
-
+
void Reset();
-
+
void Process(UInt32 inNumFrames, AudioBufferList* inInput, AudioBufferList* outOutput);
-
+
typedef void (*SpectralFunction)(SpectralBufferList* inSpectra, void* inUserData);
-
+
void SetSpectralFunction(SpectralFunction inFunction, void* inUserData);
-
+
UInt32 FFTSize() const { return mFFTSize; }
UInt32 MaxFrames() const { return mMaxFrames; }
UInt32 NumChannels() const { return mNumChannels; }
UInt32 HopSize() const { return mHopSize; }
Float32* Window() const { return mWindow; }
-
-
+
+
void HanningWindow(); // set up a hanning window
void SineWindow();
-
+
void GetFrequencies(Float32* freqs, Float32 sampleRate); // only for processed forward
void GetMagnitude(AudioBufferList* inCopy, Float32* min, Float32* max); // only for processed forward
-
+
virtual bool ProcessForwards(UInt32 inNumFrames, AudioBufferList* inInput);
bool ProcessBackwards(UInt32 inNumFrames, AudioBufferList* outOutput);
void PrintSpectralBufferList();
-
+
protected:
void CopyInput(UInt32 inNumFrames, AudioBufferList* inInput);
void CopyInputToFFT();
@@ -107,14 +107,14 @@ protected:
void OverlapAddOutput();
void CopyOutput(UInt32 inNumFrames, AudioBufferList* inOutput);
void ProcessSpectrum(UInt32 inFFTSize, SpectralBufferList* inSpectra);
-
+
UInt32 mFFTSize;
UInt32 mHopSize;
UInt32 mNumChannels;
UInt32 mMaxFrames;
UInt32 mLog2FFTSize;
- UInt32 mFFTMask;
+ UInt32 mFFTMask;
UInt32 mFFTByteSize;
UInt32 mIOBufSize;
UInt32 mIOMask;
@@ -126,7 +126,7 @@ protected:
FFTSetup mFFTSetup;
CAAutoFree<Float32> mWindow;
- struct SpectralChannel
+ struct SpectralChannel
{
CAAutoFree<Float32> mInputBuf; // log2ceil(FFT size + max frames)
CAAutoFree<Float32> mOutputBuf; // log2ceil(FFT size + max frames)
@@ -136,10 +136,10 @@ protected:
CAAutoArrayDelete<SpectralChannel> mChannels;
CAAutoFree<SpectralBufferList> mSpectralBufferList;
-
+
SpectralFunction mSpectralFunction;
void *mUserData;
-
+
};
diff --git a/libs/appleutility/CoreAudio/PublicUtility/CAStreamBasicDescription.cpp b/libs/appleutility/CoreAudio/PublicUtility/CAStreamBasicDescription.cpp
index d56947ab59..432d513028 100644
--- a/libs/appleutility/CoreAudio/PublicUtility/CAStreamBasicDescription.cpp
+++ b/libs/appleutility/CoreAudio/PublicUtility/CAStreamBasicDescription.cpp
@@ -2,14 +2,14 @@
File: CAStreamBasicDescription.cpp
Abstract: CAStreamBasicDescription.h
Version: 1.1
-
+
Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple
Inc. ("Apple") in consideration of your agreement to the following
terms, and your use, installation, modification or redistribution of
this Apple software constitutes acceptance of these terms. If you do
not agree with these terms, please do not use, install, modify or
redistribute this Apple software.
-
+
In consideration of your agreement to abide by the following terms, and
subject to these terms, Apple grants you a personal, non-exclusive
license, under Apple's copyrights in this original Apple software (the
@@ -25,13 +25,13 @@
implied, are granted by Apple herein, including but not limited to any
patent rights that may be infringed by your derivative works or by other
works in which the Apple Software may be incorporated.
-
+
The Apple Software is provided by Apple on an "AS IS" basis. APPLE
MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND
OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
-
+
IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
@@ -40,9 +40,9 @@
AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),
STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
-
+
Copyright (C) 2014 Apple Inc. All Rights Reserved.
-
+
*/
#include "CAStreamBasicDescription.h"
#include "CAMath.h"
@@ -72,12 +72,12 @@ char *CAStringForOSType (OSType t, char *writeLocation, size_t bufsize)
q++;
}
q = u.str;
-
+
if (hasNonPrint)
p += snprintf (p, pend - p, "0x");
else if (p < pend)
*p++ = '\'';
-
+
for (int i = 0; i < 4 && p < pend; ++i) {
if (hasNonPrint) {
p += snprintf(p, pend - p, "%02X", *q++);
@@ -96,11 +96,11 @@ char *CAStringForOSType (OSType t, char *writeLocation, size_t bufsize)
const AudioStreamBasicDescription CAStreamBasicDescription::sEmpty = { 0.0, 0, 0, 0, 0, 0, 0, 0, 0 };
-CAStreamBasicDescription::CAStreamBasicDescription()
-{
- memset (this, 0, sizeof(AudioStreamBasicDescription));
+CAStreamBasicDescription::CAStreamBasicDescription()
+{
+ memset (this, 0, sizeof(AudioStreamBasicDescription));
}
-
+
CAStreamBasicDescription::CAStreamBasicDescription(const AudioStreamBasicDescription &desc)
{
SetFrom(desc);
@@ -165,15 +165,15 @@ char *CAStreamBasicDescription::AsString(char *buf, size_t _bufsize, bool brief
return theBuffer;
}
}
-
+
nc = snprintf(buf, static_cast<size_t>(bufsize), "%2d ch, %6.0f Hz, %s (0x%08X) ", (int)NumberChannels(), mSampleRate, formatID, (int)mFormatFlags);
buf += nc; if ((bufsize -= nc) <= 0) goto exit;
if (mFormatID == kAudioFormatLinearPCM) {
bool isInt = !(mFormatFlags & kLinearPCMFormatFlagIsFloat);
int wordSize = static_cast<int>(SampleWordSize());
- const char *endian = (wordSize > 1) ?
+ const char *endian = (wordSize > 1) ?
((mFormatFlags & kLinearPCMFormatFlagIsBigEndian) ? " big-endian" : " little-endian" ) : "";
- const char *sign = isInt ?
+ const char *sign = isInt ?
((mFormatFlags & kLinearPCMFormatFlagIsSignedInteger) ? " signed" : " unsigned") : "";
const char *floatInt = isInt ? "integer" : "float";
char packed[32];
@@ -195,9 +195,9 @@ char *CAStreamBasicDescription::AsString(char *buf, size_t _bufsize, bool brief
snprintf(bitdepth, sizeof(bitdepth), "%d.%d", (int)mBitsPerChannel - fracbits, fracbits);
else
snprintf(bitdepth, sizeof(bitdepth), "%d", (int)mBitsPerChannel);
-
+
/*nc =*/ snprintf(buf, static_cast<size_t>(bufsize), "%s-bit%s%s %s%s%s%s%s",
- bitdepth, endian, sign, floatInt,
+ bitdepth, endian, sign, floatInt,
commaSpace, packed, align, deinter);
// buf += nc; if ((bufsize -= nc) <= 0) goto exit;
} else if (mFormatID == kAudioFormatAppleLossless) {
@@ -226,7 +226,7 @@ char *CAStreamBasicDescription::AsString(char *buf, size_t _bufsize, bool brief
// buf += nc; if ((bufsize -= nc) <= 0) goto exit;
}
else
- /*nc =*/ snprintf(buf, static_cast<size_t>(bufsize), "%d bits/channel, %d bytes/packet, %d frames/packet, %d bytes/frame",
+ /*nc =*/ snprintf(buf, static_cast<size_t>(bufsize), "%d bits/channel, %d bytes/packet, %d frames/packet, %d bytes/frame",
(int)mBitsPerChannel, (int)mBytesPerPacket, (int)mFramesPerPacket, (int)mBytesPerFrame);
exit:
return theBuffer;
@@ -328,7 +328,7 @@ void CAStreamBasicDescription::GetSimpleName(const AudioStreamBasicDescription&
outName += theCharactersWritten;
inMaxNameLength -= static_cast<UInt32>(theCharactersWritten);
}
-
+
switch(inDescription.mFormatID)
{
case kAudioFormatLinearPCM:
@@ -346,7 +346,7 @@ void CAStreamBasicDescription::GetSimpleName(const AudioStreamBasicDescription&
theEndianString = "Little Endian";
#endif
}
-
+
const char* theKindString = NULL;
if((inDescription.mFormatFlags & kAudioFormatFlagIsFloat) != 0)
{
@@ -360,7 +360,7 @@ void CAStreamBasicDescription::GetSimpleName(const AudioStreamBasicDescription&
{
theKindString = (inAbbreviate ? "UInt" : "Unsigned Integer");
}
-
+
const char* thePackingString = NULL;
if((inDescription.mFormatFlags & kAudioFormatFlagIsPacked) == 0)
{
@@ -373,7 +373,7 @@ void CAStreamBasicDescription::GetSimpleName(const AudioStreamBasicDescription&
thePackingString = "Low";
}
}
-
+
const char* theMixabilityString = NULL;
if((inDescription.mFormatFlags & kIsNonMixableFlag) == 0)
{
@@ -383,7 +383,7 @@ void CAStreamBasicDescription::GetSimpleName(const AudioStreamBasicDescription&
{
theMixabilityString = "Unmixable";
}
-
+
if(inAbbreviate)
{
if(theEndianString != NULL)
@@ -436,15 +436,15 @@ void CAStreamBasicDescription::GetSimpleName(const AudioStreamBasicDescription&
}
}
break;
-
+
case kAudioFormatAC3:
strlcpy(outName, "AC-3", sizeof(outName));
break;
-
+
case kAudioFormat60958AC3:
strlcpy(outName, "AC-3 for SPDIF", sizeof(outName));
break;
-
+
default:
CACopy4CCToCString(outName, inDescription.mFormatID);
break;
@@ -471,9 +471,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)))
{
@@ -496,8 +496,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)))
{
@@ -512,7 +512,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)))
{
@@ -523,7 +523,7 @@ bool operator<(const AudioStreamBasicDescription& x, const AudioStreamBasicDescr
isDone = true;
}
}
-
+
// bit depth
if((!isDone) && ((x.mBitsPerChannel != 0) && (y.mBitsPerChannel != 0)))
{
@@ -534,7 +534,7 @@ bool operator<(const AudioStreamBasicDescription& x, const AudioStreamBasicDescr
isDone = true;
}
}
-
+
// sample rate
if((!isDone) && fnonzero(x.mSampleRate) && fnonzero(y.mSampleRate))
{
@@ -545,7 +545,7 @@ bool operator<(const AudioStreamBasicDescription& x, const AudioStreamBasicDescr
isDone = true;
}
}
-
+
// number of channels
if((!isDone) && ((x.mChannelsPerFrame != 0) && (y.mChannelsPerFrame != 0)))
{
@@ -556,7 +556,7 @@ bool operator<(const AudioStreamBasicDescription& x, const AudioStreamBasicDescr
//isDone = true;
}
}
-
+
return theAnswer;
}
@@ -569,24 +569,24 @@ void CAStreamBasicDescription::ModifyFormatFlagsForMatching(const AudioStreamBas
xFlags = yFlags = 0;
return;
}
-
+
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 & ~static_cast<UInt32>(kAudioFormatFlagIsAlignedHigh);
yFlags = yFlags & ~static_cast<UInt32>(kAudioFormatFlagIsAlignedHigh);
}
-
+
// if both kAudioFormatFlagIsFloat bits are set, then we don't care about the kAudioFormatFlagIsSignedInteger bit.
if (xFlags & yFlags & kAudioFormatFlagIsFloat) {
xFlags = xFlags & ~static_cast<UInt32>(kAudioFormatFlagIsSignedInteger);
yFlags = yFlags & ~static_cast<UInt32>(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))
{
@@ -596,13 +596,13 @@ void CAStreamBasicDescription::ModifyFormatFlagsForMatching(const AudioStreamBas
{
yFlags = yFlags & ~static_cast<UInt32>(kAudioFormatFlagIsBigEndian);
}
-
+
// if the number of channels is 1, we don't care about non-interleavedness
if (x.mChannelsPerFrame == 1 && y.mChannelsPerFrame == 1) {
xFlags &= ~static_cast<UInt32>(kLinearPCMFormatFlagIsNonInterleaved);
yFlags &= ~static_cast<UInt32>(kLinearPCMFormatFlagIsNonInterleaved);
}
-
+
if (converterOnly) {
CAStreamBasicDescription cas_x = CAStreamBasicDescription(x);
CAStreamBasicDescription cas_y = CAStreamBasicDescription(y);
@@ -625,7 +625,7 @@ static bool MatchFormatFlags(const AudioStreamBasicDescription& x, const AudioSt
{
UInt32 xFlags = x.mFormatFlags;
UInt32 yFlags = y.mFormatFlags;
-
+
CAStreamBasicDescription::ModifyFormatFlagsForMatching(x, y, xFlags, yFlags, false);
return xFlags == yFlags;
}
@@ -635,37 +635,37 @@ bool operator==(const AudioStreamBasicDescription& x, const AudioStreamBasicDesc
// the semantics for equality are:
// 1) Values must match exactly -- except for PCM format flags, see above.
// 2) wildcard's are ignored in the comparison
-
+
#define MATCH(name) ((x.name) == 0 || (y.name) == 0 || (x.name) == (y.name))
-
- return
+
+ return
// check all but the format flags
CAStreamBasicDescription::FlagIndependentEquivalence(x, y)
// check the format flags
- && MatchFormatFlags(x, y);
+ && MatchFormatFlags(x, y);
}
bool CAStreamBasicDescription::FlagIndependentEquivalence(const AudioStreamBasicDescription &x, const AudioStreamBasicDescription &y)
{
- return
+ return
// check the sample rate
(fiszero(x.mSampleRate) || fiszero(y.mSampleRate) || fequal(x.mSampleRate, y.mSampleRate))
-
+
// check the format ids
&& MATCH(mFormatID)
-
+
// check the bytes per packet
- && MATCH(mBytesPerPacket)
-
+ && MATCH(mBytesPerPacket)
+
// check the frames per packet
- && MATCH(mFramesPerPacket)
-
+ && MATCH(mFramesPerPacket)
+
// check the bytes per frame
- && MATCH(mBytesPerFrame)
-
+ && MATCH(mBytesPerFrame)
+
// check the channels per frame
- && MATCH(mChannelsPerFrame)
-
+ && MATCH(mChannelsPerFrame)
+
// check the channels per frame
&& MATCH(mBitsPerChannel) ;
}
@@ -679,15 +679,15 @@ bool CAStreamBasicDescription::IsEqual(const AudioStreamBasicDescription &other,
bool CAStreamBasicDescription::IsFunctionallyEquivalent(const AudioStreamBasicDescription &x, const AudioStreamBasicDescription &y)
{
- UInt32 xFlags = x.mFormatFlags, yFlags = y.mFormatFlags;
+ UInt32 xFlags = x.mFormatFlags, yFlags = y.mFormatFlags;
CAStreamBasicDescription::ModifyFormatFlagsForMatching(x, y, xFlags, yFlags, true);
-
+
return
// check all but the format flags
CAStreamBasicDescription::FlagIndependentEquivalence(x, y)
// check the format flags with converter focus
&& (xFlags == yFlags);
-
+
}
bool SanityCheck(const AudioStreamBasicDescription& x)
@@ -695,9 +695,9 @@ bool SanityCheck(const AudioStreamBasicDescription& x)
// This function returns false if there are sufficiently insane values in any field.
// It is very conservative so even some very unlikely values will pass.
// This is just meant to catch the case where the data from a file is corrupted.
-
- return
- (x.mSampleRate >= 0.)
+
+ return
+ (x.mSampleRate >= 0.)
&& (x.mSampleRate < 3e6) // SACD sample rate is 2.8224 MHz
&& (x.mBytesPerPacket < 1000000)
&& (x.mFramesPerPacket < 1000000)
@@ -711,7 +711,7 @@ bool SanityCheck(const AudioStreamBasicDescription& x)
bool CAStreamBasicDescription::FromText(const char *inTextDesc, AudioStreamBasicDescription &fmt)
{
const char *p = inTextDesc;
-
+
memset(&fmt, 0, sizeof(fmt));
bool isPCM = true; // until proven otherwise
@@ -764,18 +764,18 @@ bool CAStreamBasicDescription::FromText(const char *inTextDesc, AudioStreamBasic
p += 2;
}
}
-
+
if (strchr("-@/#", buf[3])) {
// further special-casing for 'aac'
buf[3] = ' ';
--p;
}
-
+
memcpy(&fmt.mFormatID, buf, 4);
fmt.mFormatID = CFSwapInt32BigToHost(fmt.mFormatID);
}
}
-
+
if (isPCM) {
fmt.mFormatID = kAudioFormatLinearPCM;
fmt.mFormatFlags = pcmFlags;
@@ -874,6 +874,6 @@ Bail:
return false;
}
-const char *CAStreamBasicDescription::sTextParsingUsageString =
+const char *CAStreamBasicDescription::sTextParsingUsageString =
"format[@sample_rate_hz][/format_flags][#frames_per_packet][:LHbytesPerFrame][,channelsDI].\n"
"Format for PCM is [-][BE|LE]{F|I|UI}{bitdepth}; else a 4-char format code (e.g. aac, alac).\n";
diff --git a/libs/appleutility/CoreAudio/PublicUtility/CAStreamBasicDescription.h b/libs/appleutility/CoreAudio/PublicUtility/CAStreamBasicDescription.h
index 8b81dba69a..6c6b7a1c98 100644
--- a/libs/appleutility/CoreAudio/PublicUtility/CAStreamBasicDescription.h
+++ b/libs/appleutility/CoreAudio/PublicUtility/CAStreamBasicDescription.h
@@ -2,14 +2,14 @@
File: CAStreamBasicDescription.h
Abstract: Part of CoreAudio Utility Classes
Version: 1.1
-
+
Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple
Inc. ("Apple") in consideration of your agreement to the following
terms, and your use, installation, modification or redistribution of
this Apple software constitutes acceptance of these terms. If you do
not agree with these terms, please do not use, install, modify or
redistribute this Apple software.
-
+
In consideration of your agreement to abide by the following terms, and
subject to these terms, Apple grants you a personal, non-exclusive
license, under Apple's copyrights in this original Apple software (the
@@ -25,13 +25,13 @@
implied, are granted by Apple herein, including but not limited to any
patent rights that may be infringed by your derivative works or by other
works in which the Apple Software may be incorporated.
-
+
The Apple Software is provided by Apple on an "AS IS" basis. APPLE
MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND
OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
-
+
IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
@@ -40,9 +40,9 @@
AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),
STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
-
+
Copyright (C) 2014 Apple Inc. All Rights Reserved.
-
+
*/
#ifndef __CAStreamBasicDescription_h__
#define __CAStreamBasicDescription_h__
@@ -90,14 +90,14 @@ enum {
// It adds a number of convenience routines, but otherwise adds nothing
// to the footprint of the original struct.
//=============================================================================
-class CAStreamBasicDescription :
+class CAStreamBasicDescription :
public AudioStreamBasicDescription
{
// Constants
public:
static const AudioStreamBasicDescription sEmpty;
-
+
enum CommonPCMFormat {
kPCMFormatOther = 0,
kPCMFormatFloat32 = 1,
@@ -105,13 +105,13 @@ public:
kPCMFormatFixed824 = 3,
kPCMFormatFloat64 = 4
};
-
+
// Construction/Destruction
public:
CAStreamBasicDescription();
-
+
CAStreamBasicDescription(const AudioStreamBasicDescription &desc);
-
+
CAStreamBasicDescription( double inSampleRate, UInt32 inFormatID,
UInt32 inBytesPerPacket, UInt32 inFramesPerPacket,
UInt32 inBytesPerFrame, UInt32 inChannelsPerFrame,
@@ -164,55 +164,55 @@ public:
{
memcpy(this, &desc, sizeof(AudioStreamBasicDescription));
}
-
+
bool FromText(const char *inTextDesc) { return FromText(inTextDesc, *this); }
static bool FromText(const char *inTextDesc, AudioStreamBasicDescription &outDesc);
// return true if parsing was successful
-
+
static const char *sTextParsingUsageString;
-
+
// _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
//
// 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 !(mFormatFlags & kAudioFormatFlagIsNonInterleaved);
}
-
+
bool IsSignedInteger() const
{
return IsPCM() && (mFormatFlags & kAudioFormatFlagIsSignedInteger);
}
-
+
bool IsFloat() const
{
return IsPCM() && (mFormatFlags & kAudioFormatFlagIsFloat);
}
-
+
bool IsNativeEndian() const
{
return (mFormatFlags & kAudioFormatFlagIsBigEndian) == kAudioFormatFlagsNativeEndian;
}
-
+
// 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 {
+ UInt32 SampleWordSize() const {
return (mBytesPerFrame > 0 && NumberInterleavedChannels()) ? mBytesPerFrame / NumberInterleavedChannels() : 0;
}
@@ -221,15 +221,15 @@ 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();
}
-
+
bool IdentifyCommonPCMFormat(CommonPCMFormat &outFormat, bool *outIsInterleaved=NULL) const
{ // return true if it's a valid PCM format.
-
+
outFormat = kPCMFormatOther;
// trap out patently invalid formats.
if (mFormatID != kAudioFormatLinearPCM || mFramesPerPacket != 1 || mBytesPerFrame != mBytesPerPacket || mBitsPerChannel/8 > mBytesPerFrame || mChannelsPerFrame == 0)
@@ -241,7 +241,7 @@ public:
if (wordsize % mChannelsPerFrame != 0) return false;
wordsize /= mChannelsPerFrame;
}
-
+
if ((mFormatFlags & kAudioFormatFlagIsBigEndian) == kAudioFormatFlagsNativeEndian
&& wordsize * 8 == mBitsPerChannel) {
// packed and native endian, good
@@ -281,11 +281,11 @@ public:
CommonPCMFormat fmt;
return IdentifyCommonPCMFormat(fmt, outIsInterleaved) && fmt == kPCMFormatInt16;
}
-
+
// _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
//
// manipulation
-
+
void SetCanonical(UInt32 nChannels, bool interleaved)
// note: leaves sample rate untouched
{
@@ -302,7 +302,7 @@ public:
mFormatFlags |= kAudioFormatFlagIsNonInterleaved;
}
}
-
+
bool IsCanonical() const
{
if (mFormatID != kAudioFormatLinearPCM) return false;
@@ -319,7 +319,7 @@ public:
&& mBytesPerFrame == reqFrameSize
&& mBytesPerPacket == reqFrameSize);
}
-
+
void SetAUCanonical(UInt32 nChannels, bool interleaved)
{
mFormatID = kAudioFormatLinearPCM;
@@ -338,7 +338,7 @@ public:
mFormatFlags |= kAudioFormatFlagIsNonInterleaved;
}
}
-
+
void ChangeNumberChannels(UInt32 nChannels, bool interleaved)
// alter an existing format
{
@@ -356,28 +356,28 @@ public:
mFormatFlags |= kAudioFormatFlagIsNonInterleaved;
}
}
-
+
// _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
//
// other
-
+
bool IsEqual(const AudioStreamBasicDescription &other, bool interpretingWildcards=true) const;
static bool FlagIndependentEquivalence(const AudioStreamBasicDescription &x, const AudioStreamBasicDescription &y);
static bool IsFunctionallyEquivalent(const AudioStreamBasicDescription &x, const AudioStreamBasicDescription &y);
-
+
void Print() const {
Print (stdout);
}
void Print(FILE* file) const {
- PrintFormat (file, "", "AudioStreamBasicDescription:");
+ PrintFormat (file, "", "AudioStreamBasicDescription:");
}
void PrintFormat(FILE *f, const char *indent, const char *name) const {
char buf[256];
fprintf(f, "%s%s %s\n", indent, name, AsString(buf, sizeof(buf)));
}
-
+
void PrintFormat2(FILE *f, const char *indent, const char *name) const { // no trailing newline
char buf[256];
fprintf(f, "%s%s %s", indent, name, AsString(buf, sizeof(buf)));
@@ -385,14 +385,14 @@ public:
char * AsString(char *buf, size_t bufsize, bool brief=false) const;
- static void Print (const AudioStreamBasicDescription &inDesc)
- {
+ static void Print (const AudioStreamBasicDescription &inDesc)
+ {
CAStreamBasicDescription desc(inDesc);
desc.Print ();
}
-
+
OSStatus Save(CFPropertyListRef *outData) const;
-
+
OSStatus Restore(CFPropertyListRef &inData);
// Operations
diff --git a/libs/appleutility/CoreAudio/PublicUtility/CAStreamRangedDescription.cpp b/libs/appleutility/CoreAudio/PublicUtility/CAStreamRangedDescription.cpp
index 9b72054101..99d3e0c159 100644
--- a/libs/appleutility/CoreAudio/PublicUtility/CAStreamRangedDescription.cpp
+++ b/libs/appleutility/CoreAudio/PublicUtility/CAStreamRangedDescription.cpp
@@ -2,14 +2,14 @@
File: CAStreamRangedDescription.cpp
Abstract: CAStreamRangedDescription.h
Version: 1.1
-
+
Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple
Inc. ("Apple") in consideration of your agreement to the following
terms, and your use, installation, modification or redistribution of
this Apple software constitutes acceptance of these terms. If you do
not agree with these terms, please do not use, install, modify or
redistribute this Apple software.
-
+
In consideration of your agreement to abide by the following terms, and
subject to these terms, Apple grants you a personal, non-exclusive
license, under Apple's copyrights in this original Apple software (the
@@ -25,13 +25,13 @@
implied, are granted by Apple herein, including but not limited to any
patent rights that may be infringed by your derivative works or by other
works in which the Apple Software may be incorporated.
-
+
The Apple Software is provided by Apple on an "AS IS" basis. APPLE
MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND
OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
-
+
IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
@@ -40,9 +40,9 @@
AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),
STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
-
+
Copyright (C) 2014 Apple Inc. All Rights Reserved.
-
+
*/
//==================================================================================================
// Includes
@@ -80,9 +80,9 @@ bool CAStreamRangedDescription::Sorter(const AudioStreamRangedDescription& x, co
{
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.mFormat.mFormatID != 0) && (y.mFormat.mFormatID != 0)))
{
@@ -105,8 +105,8 @@ bool CAStreamRangedDescription::Sorter(const AudioStreamRangedDescription& x, co
isDone = true;
}
}
-
-
+
+
// mixable is always better than non-mixable for linear PCM and should be the second order sort item
if((!isDone) && ((x.mFormat.mFormatID == kAudioFormatLinearPCM) && (y.mFormat.mFormatID == kAudioFormatLinearPCM)))
{
@@ -121,7 +121,7 @@ bool CAStreamRangedDescription::Sorter(const AudioStreamRangedDescription& x, co
isDone = true;
}
}
-
+
// floating point vs integer for linear PCM only
if((!isDone) && ((x.mFormat.mFormatID == kAudioFormatLinearPCM) && (y.mFormat.mFormatID == kAudioFormatLinearPCM)))
{
@@ -132,7 +132,7 @@ bool CAStreamRangedDescription::Sorter(const AudioStreamRangedDescription& x, co
isDone = true;
}
}
-
+
// bit depth
if((!isDone) && ((x.mFormat.mBitsPerChannel != 0) && (y.mFormat.mBitsPerChannel != 0)))
{
@@ -143,7 +143,7 @@ bool CAStreamRangedDescription::Sorter(const AudioStreamRangedDescription& x, co
isDone = true;
}
}
-
+
// sample rate range
if((!isDone) && fnonzero(x.mSampleRateRange.mMinimum) && fnonzero(x.mSampleRateRange.mMaximum) && fnonzero(y.mSampleRateRange.mMinimum) && fnonzero(y.mSampleRateRange.mMaximum))
{
@@ -154,7 +154,7 @@ bool CAStreamRangedDescription::Sorter(const AudioStreamRangedDescription& x, co
isDone = true;
}
}
-
+
// sample rate
if((!isDone) && fnonzero(x.mFormat.mSampleRate) && fnonzero(y.mFormat.mSampleRate))
{
@@ -165,7 +165,7 @@ bool CAStreamRangedDescription::Sorter(const AudioStreamRangedDescription& x, co
isDone = true;
}
}
-
+
// number of channels
if((!isDone) && ((x.mFormat.mChannelsPerFrame != 0) && (y.mFormat.mChannelsPerFrame != 0)))
{
@@ -177,7 +177,7 @@ bool CAStreamRangedDescription::Sorter(const AudioStreamRangedDescription& x, co
//isDone = true;
}
}
-
+
return theAnswer;
}
diff --git a/libs/appleutility/CoreAudio/PublicUtility/CAStreamRangedDescription.h b/libs/appleutility/CoreAudio/PublicUtility/CAStreamRangedDescription.h
index 7f8284dee0..2c439a5700 100644
--- a/libs/appleutility/CoreAudio/PublicUtility/CAStreamRangedDescription.h
+++ b/libs/appleutility/CoreAudio/PublicUtility/CAStreamRangedDescription.h
@@ -2,14 +2,14 @@
File: CAStreamRangedDescription.h
Abstract: Part of CoreAudio Utility Classes
Version: 1.1
-
+
Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple
Inc. ("Apple") in consideration of your agreement to the following
terms, and your use, installation, modification or redistribution of
this Apple software constitutes acceptance of these terms. If you do
not agree with these terms, please do not use, install, modify or
redistribute this Apple software.
-
+
In consideration of your agreement to abide by the following terms, and
subject to these terms, Apple grants you a personal, non-exclusive
license, under Apple's copyrights in this original Apple software (the
@@ -25,13 +25,13 @@
implied, are granted by Apple herein, including but not limited to any
patent rights that may be infringed by your derivative works or by other
works in which the Apple Software may be incorporated.
-
+
The Apple Software is provided by Apple on an "AS IS" basis. APPLE
MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND
OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
-
+
IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
@@ -40,9 +40,9 @@
AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),
STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
-
+
Copyright (C) 2014 Apple Inc. All Rights Reserved.
-
+
*/
#if !defined(__CAStreamRangedDescription_h__)
#define __CAStreamRangedDescription_h__
@@ -89,7 +89,7 @@ public:
};
-inline bool operator<(const AudioStreamRangedDescription& x, const AudioStreamRangedDescription& y) { return (x.mFormat.mFormatID == y.mFormat.mFormatID) ?
+inline bool operator<(const AudioStreamRangedDescription& x, const AudioStreamRangedDescription& y) { return (x.mFormat.mFormatID == y.mFormat.mFormatID) ?
(x.mFormat < y.mFormat) && (x.mSampleRateRange < y.mSampleRateRange) :
(x.mFormat.mFormatID == kAudioFormatLinearPCM) ? false : (x.mFormat.mFormatID < y.mFormat.mFormatID); }
inline bool operator==(const AudioStreamRangedDescription& x, const AudioStreamRangedDescription& y) { return (x.mFormat == y.mFormat) && (x.mSampleRateRange == y.mSampleRateRange); }
@@ -100,10 +100,10 @@ inline bool operator>=(const AudioStreamRangedDescription& x, const AudioStreamR
inline bool operator>(const AudioStreamRangedDescription& x, const AudioStreamRangedDescription& y) { return !((x < y) || (x == y)); }
#endif
-inline bool operator<(const AudioStreamBasicDescription& x, const AudioStreamRangedDescription& y) { return (x.mFormatID == y.mFormat.mFormatID) ?
+inline bool operator<(const AudioStreamBasicDescription& x, const AudioStreamRangedDescription& y) { return (x.mFormatID == y.mFormat.mFormatID) ?
(x < y.mFormat) && (x.mSampleRate < y.mSampleRateRange.mMinimum) :
(x.mFormatID == kAudioFormatLinearPCM) ? false : (x.mFormatID < y.mFormat.mFormatID); }
-inline bool operator<(const AudioStreamRangedDescription& x, const AudioStreamBasicDescription& y) { return (x.mFormat.mFormatID == y.mFormatID) ?
+inline bool operator<(const AudioStreamRangedDescription& x, const AudioStreamBasicDescription& y) { return (x.mFormat.mFormatID == y.mFormatID) ?
(x.mFormat < y) && (x.mSampleRateRange.mMinimum < y.mSampleRate) :
(x.mFormat.mFormatID == kAudioFormatLinearPCM) ? false : (x.mFormat.mFormatID < y.mFormatID); }
inline bool operator==(const AudioStreamBasicDescription& x, const AudioStreamRangedDescription& y) { return (x == y.mFormat) && CAAudioValueRange::ContainsValue(y.mSampleRateRange, x.mSampleRate); }
@@ -126,7 +126,7 @@ struct CAStreamRangedDescription_EqualToASBD
{
CAStreamRangedDescription_EqualToASBD(const AudioStreamBasicDescription& inFormat) : mFormat(inFormat) {}
bool operator()(const AudioStreamRangedDescription& x) const { return mFormat == x; }
-
+
AudioStreamBasicDescription mFormat;
};
diff --git a/libs/appleutility/CoreAudio/PublicUtility/CAThreadSafeList.h b/libs/appleutility/CoreAudio/PublicUtility/CAThreadSafeList.h
index d0b7391476..18c3a0dd51 100644
--- a/libs/appleutility/CoreAudio/PublicUtility/CAThreadSafeList.h
+++ b/libs/appleutility/CoreAudio/PublicUtility/CAThreadSafeList.h
@@ -2,14 +2,14 @@
File: CAThreadSafeList.h
Abstract: Part of CoreAudio Utility Classes
Version: 1.1
-
+
Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple
Inc. ("Apple") in consideration of your agreement to the following
terms, and your use, installation, modification or redistribution of
this Apple software constitutes acceptance of these terms. If you do
not agree with these terms, please do not use, install, modify or
redistribute this Apple software.
-
+
In consideration of your agreement to abide by the following terms, and
subject to these terms, Apple grants you a personal, non-exclusive
license, under Apple's copyrights in this original Apple software (the
@@ -25,13 +25,13 @@
implied, are granted by Apple herein, including but not limited to any
patent rights that may be infringed by your derivative works or by other
works in which the Apple Software may be incorporated.
-
+
The Apple Software is provided by Apple on an "AS IS" basis. APPLE
MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND
OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
-
+
IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
@@ -40,9 +40,9 @@
AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),
STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
-
+
Copyright (C) 2014 Apple Inc. All Rights Reserved.
-
+
*/
#ifndef __CAThreadSafeList_h__
#define __CAThreadSafeList_h__
@@ -60,7 +60,7 @@ private:
Node * mNext;
EEventType mEventType;
T mObject;
-
+
Node *& next() { return mNext; }
};
@@ -69,19 +69,19 @@ public:
public:
iterator() { }
iterator(Node *n) : mNode(n) { }
-
+
bool operator == (const iterator &other) const { return this->mNode == other.mNode; }
bool operator != (const iterator &other) const { return this->mNode != other.mNode; }
-
+
T & operator * () const { return mNode->mObject; }
-
+
iterator & operator ++ () { mNode = mNode->next(); return *this; } // preincrement
iterator operator ++ (int) { iterator tmp = *this; mNode = mNode->next(); return tmp; } // postincrement
-
+
private:
Node * mNode;
};
-
+
TThreadSafeList() { }
~TThreadSafeList()
{
@@ -89,9 +89,9 @@ public:
mPendingList.free_all();
mFreeList.free_all();
}
-
+
// These may be called on any thread
-
+
void deferred_add(const T &obj) // can be called on any thread
{
Node *node = AllocNode();
@@ -100,7 +100,7 @@ public:
mPendingList.push_atomic(node);
//mPendingList.dump("pending after add");
}
-
+
void deferred_remove(const T &obj) // can be called on any thread
{
Node *node = AllocNode();
@@ -109,22 +109,22 @@ public:
mPendingList.push_atomic(node);
//mPendingList.dump("pending after remove");
}
-
+
void deferred_clear() // can be called on any thread
{
Node *node = AllocNode();
node->mEventType = kClear;
mPendingList.push_atomic(node);
}
-
+
// These must be called from only one thread
-
+
void update() // must only be called from one thread
{
NodeStack reversed;
Node *event, *node, *next;
bool workDone = false;
-
+
// reverse the events so they are in order
event = mPendingList.pop_all();
while (event != NULL) {
@@ -136,7 +136,7 @@ public:
if (workDone) {
//reversed.dump("pending popped");
//mActiveList.dump("active before update");
-
+
// now process them
while ((event = reversed.pop_NA()) != NULL) {
switch (event->mEventType) {
@@ -190,14 +190,14 @@ public:
//mActiveList.dump("active after update");
}
}
-
+
iterator begin() const {
//mActiveList.dump("active at begin");
return iterator(mActiveList.head());
}
iterator end() const { return iterator(NULL); }
-
+
private:
Node * AllocNode()
{
@@ -206,7 +206,7 @@ private:
node = (Node *)CA_malloc(sizeof(Node));
return node;
}
-
+
void FreeNode(Node *node)
{
mFreeList.push_atomic(node);
@@ -220,7 +220,7 @@ private:
while ((node = this->pop_NA()) != NULL)
free(node);
}
-
+
Node ** phead() { return &this->mHead; }
Node * head() const { return this->mHead; }
};
diff --git a/libs/appleutility/CoreAudio/PublicUtility/CATink.h b/libs/appleutility/CoreAudio/PublicUtility/CATink.h
index f0829359a6..fa279c365c 100644
--- a/libs/appleutility/CoreAudio/PublicUtility/CATink.h
+++ b/libs/appleutility/CoreAudio/PublicUtility/CATink.h
@@ -2,14 +2,14 @@
File: CATink.h
Abstract: Part of CoreAudio Utility Classes
Version: 1.1
-
+
Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple
Inc. ("Apple") in consideration of your agreement to the following
terms, and your use, installation, modification or redistribution of
this Apple software constitutes acceptance of these terms. If you do
not agree with these terms, please do not use, install, modify or
redistribute this Apple software.
-
+
In consideration of your agreement to abide by the following terms, and
subject to these terms, Apple grants you a personal, non-exclusive
license, under Apple's copyrights in this original Apple software (the
@@ -25,13 +25,13 @@
implied, are granted by Apple herein, including but not limited to any
patent rights that may be infringed by your derivative works or by other
works in which the Apple Software may be incorporated.
-
+
The Apple Software is provided by Apple on an "AS IS" basis. APPLE
MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND
OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
-
+
IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
@@ -40,9 +40,9 @@
AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),
STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
-
+
Copyright (C) 2014 Apple Inc. All Rights Reserved.
-
+
*/
#if !defined(__CATink_h__)
#define __CATink_h__
@@ -74,7 +74,7 @@ class CATink
public:
CATink(F proc) { Set(proc); }
-
+
~CATink() { Set((F)0xDEADDEAD); } // jump to an obviously bad (odd) address if accessed after destruction
#if TARGET_CPU_PPC
@@ -97,7 +97,7 @@ public:
mCode[3] = 0x4E800420;
MakeDataExecutable(mCode, sizeof(mCode));
}
-
+
operator F () { return F(mCode); }
private:
@@ -107,7 +107,7 @@ private:
{
/*
<tink>: push $0x12345678
- <tink+5>: ret
+ <tink+5>: ret
<tink>: 0x34567868
<tink+4>: 0x00e8c312
*/
@@ -123,14 +123,14 @@ private:
UInt32 mCode[2];
#else
#warning: CPU not directly supported by CATink
-
+
// For other CPU's, just wrap the function pointer for now.
// this bypasses what we're trying to accomplish with the Tink
// (multiple unique "instances" of a function), but it will at
// least compile and run.
void Set(F proc) { mProcPtr = proc; }
-
+
operator F () { return mProcPtr; }
private:
F mProcPtr;
diff --git a/libs/appleutility/CoreAudio/PublicUtility/CATokenMap.h b/libs/appleutility/CoreAudio/PublicUtility/CATokenMap.h
index f85f393022..e1272b8a88 100644
--- a/libs/appleutility/CoreAudio/PublicUtility/CATokenMap.h
+++ b/libs/appleutility/CoreAudio/PublicUtility/CATokenMap.h
@@ -2,14 +2,14 @@
File: CATokenMap.h
Abstract: Part of CoreAudio Utility Classes
Version: 1.1
-
+
Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple
Inc. ("Apple") in consideration of your agreement to the following
terms, and your use, installation, modification or redistribution of
this Apple software constitutes acceptance of these terms. If you do
not agree with these terms, please do not use, install, modify or
redistribute this Apple software.
-
+
In consideration of your agreement to abide by the following terms, and
subject to these terms, Apple grants you a personal, non-exclusive
license, under Apple's copyrights in this original Apple software (the
@@ -25,13 +25,13 @@
implied, are granted by Apple herein, including but not limited to any
patent rights that may be infringed by your derivative works or by other
works in which the Apple Software may be incorporated.
-
+
The Apple Software is provided by Apple on an "AS IS" basis. APPLE
MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND
OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
-
+
IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
@@ -40,9 +40,9 @@
AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),
STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
-
+
Copyright (C) 2014 Apple Inc. All Rights Reserved.
-
+
*/
#if !defined(__CATokenMap_h__)
#define __CATokenMap_h__
@@ -88,7 +88,7 @@ public:
{
return mTokenMapMutex.Lock();
}
-
+
void Unlock()
{
mTokenMapMutex.Unlock();
@@ -109,7 +109,7 @@ public:
}
return theAnswer;
}
-
+
T* GetObject(UInt32 inToken) const
{
CAMutex::Locker theLocker(const_cast<CAMutex&>(mTokenMapMutex));
@@ -125,13 +125,13 @@ public:
return GetObject((UInt32)inToken);
#endif
}
-
+
UInt32 GetNumberObjects() const
{
CAMutex::Locker theLocker(const_cast<CAMutex&>(mTokenMapMutex));
return static_cast<UInt32>(mTokenMap.size());
}
-
+
T* GetObjectByIndex(UInt32 inIndex) const
{
T* theAnswer = NULL;
@@ -144,7 +144,7 @@ public:
}
return theAnswer;
}
-
+
void AddMapping(UInt32 inToken, T* inObject)
{
CAMutex::Locker theLocker(mTokenMapMutex);
@@ -158,7 +158,7 @@ public:
mTokenMap.insert(typename TokenMap::value_type(inToken, inObject));
}
}
-
+
void RemoveMapping(UInt32 inToken, T* /*inObject*/)
{
CAMutex::Locker theLocker(mTokenMapMutex);
@@ -168,12 +168,12 @@ public:
mTokenMap.erase(i);
}
}
-
+
UInt32 GetNextToken()
{
return mNextToken++;
}
-
+
UInt32 MapObject(T* inObject)
{
CAMutex::Locker theLocker(mTokenMapMutex);
@@ -181,7 +181,7 @@ public:
mTokenMap.insert(typename TokenMap::value_type(theToken, inObject));
return theToken;
}
-
+
void UnmapObject(T* inObject)
{
CAMutex::Locker theLocker(mTokenMapMutex);
@@ -202,7 +202,7 @@ public:
}
// Implementation
-private:
+private:
TokenMap mTokenMap;
UInt32 mNextToken;
CAMutex mTokenMapMutex;
diff --git a/libs/appleutility/CoreAudio/PublicUtility/CAVectorUnit.cpp b/libs/appleutility/CoreAudio/PublicUtility/CAVectorUnit.cpp
index 83bfb8c889..27378558ba 100644
--- a/libs/appleutility/CoreAudio/PublicUtility/CAVectorUnit.cpp
+++ b/libs/appleutility/CoreAudio/PublicUtility/CAVectorUnit.cpp
@@ -2,14 +2,14 @@
File: CAVectorUnit.cpp
Abstract: CAVectorUnit.h
Version: 1.1
-
+
Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple
Inc. ("Apple") in consideration of your agreement to the following
terms, and your use, installation, modification or redistribution of
this Apple software constitutes acceptance of these terms. If you do
not agree with these terms, please do not use, install, modify or
redistribute this Apple software.
-
+
In consideration of your agreement to abide by the following terms, and
subject to these terms, Apple grants you a personal, non-exclusive
license, under Apple's copyrights in this original Apple software (the
@@ -25,13 +25,13 @@
implied, are granted by Apple herein, including but not limited to any
patent rights that may be infringed by your derivative works or by other
works in which the Apple Software may be incorporated.
-
+
The Apple Software is provided by Apple on an "AS IS" basis. APPLE
MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND
OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
-
+
IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
@@ -40,9 +40,9 @@
AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),
STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
-
+
Copyright (C) 2014 Apple Inc. All Rights Reserved.
-
+
*/
#include "CAVectorUnit.h"
@@ -101,17 +101,17 @@ static bool IsCpuidAvailable()
{
SInt32 return_value = 0x0;
_asm{
- pushfd ; //push original EFLAGS
- pop eax ; //get original EFLAGS
- mov ecx, eax ; //save original EFLAGS
- xor eax, 200000h ; //flip ID bit in EFLAGS
- push eax ; //save new EFLAGS value on stack
- popfd ; //replace current EFLAGS value
- pushfd ; //get new EFLAGS
- pop eax ; //store new EFLAGS in EAX
- xor eax, ecx ;
+ pushfd ; //push original EFLAGS
+ pop eax ; //get original EFLAGS
+ mov ecx, eax ; //save original EFLAGS
+ xor eax, 200000h ; //flip ID bit in EFLAGS
+ push eax ; //save new EFLAGS value on stack
+ popfd ; //replace current EFLAGS value
+ pushfd ; //get new EFLAGS
+ pop eax ; //store new EFLAGS in EAX
+ xor eax, ecx ;
je end_cpuid_identify ; //can't toggle ID bit
- mov return_value, 0x1;
+ mov return_value, 0x1;
end_cpuid_identify:
nop;
}
@@ -123,9 +123,9 @@ end_cpuid_identify:
SInt32 CAVectorUnit_Examine()
{
int result = kVecNone;
-
+
#if TARGET_OS_WIN32
-#if HAS_IPP
+#if HAS_IPP
// Initialize the static IPP library! This needs to be done before
// any IPP function calls, otherwise we may have a performance penalty
int status = ippStaticInit();
@@ -156,7 +156,7 @@ SInt32 CAVectorUnit_Examine()
if (getenv("CA_NoVector")) {
fprintf(stderr, "CA_NoVector set; Vector unit optimized routines will be bypassed\n");
return result;
- }
+ }
else
#endif
{
diff --git a/libs/appleutility/CoreAudio/PublicUtility/CAVectorUnit.h b/libs/appleutility/CoreAudio/PublicUtility/CAVectorUnit.h
index cf3a16c7a9..604fe84f95 100644
--- a/libs/appleutility/CoreAudio/PublicUtility/CAVectorUnit.h
+++ b/libs/appleutility/CoreAudio/PublicUtility/CAVectorUnit.h
@@ -2,14 +2,14 @@
File: CAVectorUnit.h
Abstract: Part of CoreAudio Utility Classes
Version: 1.1
-
+
Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple
Inc. ("Apple") in consideration of your agreement to the following
terms, and your use, installation, modification or redistribution of
this Apple software constitutes acceptance of these terms. If you do
not agree with these terms, please do not use, install, modify or
redistribute this Apple software.
-
+
In consideration of your agreement to abide by the following terms, and
subject to these terms, Apple grants you a personal, non-exclusive
license, under Apple's copyrights in this original Apple software (the
@@ -25,13 +25,13 @@
implied, are granted by Apple herein, including but not limited to any
patent rights that may be infringed by your derivative works or by other
works in which the Apple Software may be incorporated.
-
+
The Apple Software is provided by Apple on an "AS IS" basis. APPLE
MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND
OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
-
+
IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
@@ -40,9 +40,9 @@
AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),
STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
-
+
Copyright (C) 2014 Apple Inc. All Rights Reserved.
-
+
*/
#ifndef __CAVectorUnit_h__
#define __CAVectorUnit_h__
diff --git a/libs/appleutility/CoreAudio/PublicUtility/CAVectorUnitTypes.h b/libs/appleutility/CoreAudio/PublicUtility/CAVectorUnitTypes.h
index 85ff837afe..2efb2e690b 100644
--- a/libs/appleutility/CoreAudio/PublicUtility/CAVectorUnitTypes.h
+++ b/libs/appleutility/CoreAudio/PublicUtility/CAVectorUnitTypes.h
@@ -2,14 +2,14 @@
File: CAVectorUnitTypes.h
Abstract: Part of CoreAudio Utility Classes
Version: 1.1
-
+
Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple
Inc. ("Apple") in consideration of your agreement to the following
terms, and your use, installation, modification or redistribution of
this Apple software constitutes acceptance of these terms. If you do
not agree with these terms, please do not use, install, modify or
redistribute this Apple software.
-
+
In consideration of your agreement to abide by the following terms, and
subject to these terms, Apple grants you a personal, non-exclusive
license, under Apple's copyrights in this original Apple software (the
@@ -25,13 +25,13 @@
implied, are granted by Apple herein, including but not limited to any
patent rights that may be infringed by your derivative works or by other
works in which the Apple Software may be incorporated.
-
+
The Apple Software is provided by Apple on an "AS IS" basis. APPLE
MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND
OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
-
+
IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
@@ -40,9 +40,9 @@
AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),
STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
-
+
Copyright (C) 2014 Apple Inc. All Rights Reserved.
-
+
*/
#ifndef __CAVectorUnitTypes_h__
#define __CAVectorUnitTypes_h__
diff --git a/libs/appleutility/CoreAudio/PublicUtility/CAVolumeCurve.cpp b/libs/appleutility/CoreAudio/PublicUtility/CAVolumeCurve.cpp
index bb6e70cb8e..5431d20db0 100644
--- a/libs/appleutility/CoreAudio/PublicUtility/CAVolumeCurve.cpp
+++ b/libs/appleutility/CoreAudio/PublicUtility/CAVolumeCurve.cpp
@@ -2,14 +2,14 @@
File: CAVolumeCurve.cpp
Abstract: CAVolumeCurve.h
Version: 1.1
-
+
Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple
Inc. ("Apple") in consideration of your agreement to the following
terms, and your use, installation, modification or redistribution of
this Apple software constitutes acceptance of these terms. If you do
not agree with these terms, please do not use, install, modify or
redistribute this Apple software.
-
+
In consideration of your agreement to abide by the following terms, and
subject to these terms, Apple grants you a personal, non-exclusive
license, under Apple's copyrights in this original Apple software (the
@@ -25,13 +25,13 @@
implied, are granted by Apple herein, including but not limited to any
patent rights that may be infringed by your derivative works or by other
works in which the Apple Software may be incorporated.
-
+
The Apple Software is provided by Apple on an "AS IS" basis. APPLE
MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND
OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
-
+
IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
@@ -40,9 +40,9 @@
AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),
STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
-
+
Copyright (C) 2014 Apple Inc. All Rights Reserved.
-
+
*/
//=============================================================================
// Includes
@@ -74,61 +74,61 @@ CAVolumeCurve::~CAVolumeCurve()
SInt32 CAVolumeCurve::GetMinimumRaw() const
{
SInt32 theAnswer = 0;
-
+
if(!mCurveMap.empty())
{
CurveMap::const_iterator theIterator = mCurveMap.begin();
theAnswer = theIterator->first.mMinimum;
}
-
+
return theAnswer;
}
SInt32 CAVolumeCurve::GetMaximumRaw() const
{
SInt32 theAnswer = 0;
-
+
if(!mCurveMap.empty())
{
CurveMap::const_iterator theIterator = mCurveMap.begin();
std::advance(theIterator, static_cast<int>(mCurveMap.size() - 1));
theAnswer = theIterator->first.mMaximum;
}
-
+
return theAnswer;
}
Float32 CAVolumeCurve::GetMinimumDB() const
{
Float32 theAnswer = 0;
-
+
if(!mCurveMap.empty())
{
CurveMap::const_iterator theIterator = mCurveMap.begin();
theAnswer = theIterator->second.mMinimum;
}
-
+
return theAnswer;
}
Float32 CAVolumeCurve::GetMaximumDB() const
{
Float32 theAnswer = 0;
-
+
if(!mCurveMap.empty())
{
CurveMap::const_iterator theIterator = mCurveMap.begin();
std::advance(theIterator, static_cast<int>(mCurveMap.size() - 1));
theAnswer = theIterator->second.mMaximum;
}
-
+
return theAnswer;
}
void CAVolumeCurve::SetTransferFunction(UInt32 inTransferFunction)
{
mTransferFunction = inTransferFunction;
-
+
// figure out the co-efficients
switch(inTransferFunction)
{
@@ -137,97 +137,97 @@ void CAVolumeCurve::SetTransferFunction(UInt32 inTransferFunction)
mRawToScalarExponentNumerator = 1.0f;
mRawToScalarExponentDenominator = 1.0f;
break;
-
+
case kPow1Over3Curve:
mIsApplyingTransferFunction = true;
mRawToScalarExponentNumerator = 1.0f;
mRawToScalarExponentDenominator = 3.0f;
break;
-
+
case kPow1Over2Curve:
mIsApplyingTransferFunction = true;
mRawToScalarExponentNumerator = 1.0f;
mRawToScalarExponentDenominator = 2.0f;
break;
-
+
case kPow3Over4Curve:
mIsApplyingTransferFunction = true;
mRawToScalarExponentNumerator = 3.0f;
mRawToScalarExponentDenominator = 4.0f;
break;
-
+
case kPow3Over2Curve:
mIsApplyingTransferFunction = true;
mRawToScalarExponentNumerator = 3.0f;
mRawToScalarExponentDenominator = 2.0f;
break;
-
+
case kPow2Over1Curve:
mIsApplyingTransferFunction = true;
mRawToScalarExponentNumerator = 2.0f;
mRawToScalarExponentDenominator = 1.0f;
break;
-
+
case kPow3Over1Curve:
mIsApplyingTransferFunction = true;
mRawToScalarExponentNumerator = 3.0f;
mRawToScalarExponentDenominator = 1.0f;
break;
-
+
case kPow4Over1Curve:
mIsApplyingTransferFunction = true;
mRawToScalarExponentNumerator = 4.0f;
mRawToScalarExponentDenominator = 1.0f;
break;
-
+
case kPow5Over1Curve:
mIsApplyingTransferFunction = true;
mRawToScalarExponentNumerator = 5.0f;
mRawToScalarExponentDenominator = 1.0f;
break;
-
+
case kPow6Over1Curve:
mIsApplyingTransferFunction = true;
mRawToScalarExponentNumerator = 6.0f;
mRawToScalarExponentDenominator = 1.0f;
break;
-
+
case kPow7Over1Curve:
mIsApplyingTransferFunction = true;
mRawToScalarExponentNumerator = 7.0f;
mRawToScalarExponentDenominator = 1.0f;
break;
-
+
case kPow8Over1Curve:
mIsApplyingTransferFunction = true;
mRawToScalarExponentNumerator = 8.0f;
mRawToScalarExponentDenominator = 1.0f;
break;
-
+
case kPow9Over1Curve:
mIsApplyingTransferFunction = true;
mRawToScalarExponentNumerator = 9.0f;
mRawToScalarExponentDenominator = 1.0f;
break;
-
+
case kPow10Over1Curve:
mIsApplyingTransferFunction = true;
mRawToScalarExponentNumerator = 10.0f;
mRawToScalarExponentDenominator = 1.0f;
break;
-
+
case kPow11Over1Curve:
mIsApplyingTransferFunction = true;
mRawToScalarExponentNumerator = 11.0f;
mRawToScalarExponentDenominator = 1.0f;
break;
-
+
case kPow12Over1Curve:
mIsApplyingTransferFunction = true;
mRawToScalarExponentNumerator = 12.0f;
mRawToScalarExponentDenominator = 1.0f;
break;
-
+
default:
mIsApplyingTransferFunction = true;
mRawToScalarExponentNumerator = 2.0f;
@@ -240,7 +240,7 @@ void CAVolumeCurve::AddRange(SInt32 inMinRaw, SInt32 inMaxRaw, Float32 inMinDB,
{
CARawPoint theRaw(inMinRaw, inMaxRaw);
CADBPoint theDB(inMinDB, inMaxDB);
-
+
bool isOverlapped = false;
bool isDone = false;
CurveMap::iterator theIterator = mCurveMap.begin();
@@ -248,13 +248,13 @@ void CAVolumeCurve::AddRange(SInt32 inMinRaw, SInt32 inMaxRaw, Float32 inMinDB,
{
isOverlapped = CARawPoint::Overlap(theRaw, theIterator->first);
isDone = theRaw >= theIterator->first;
-
+
if(!isOverlapped && !isDone)
{
std::advance(theIterator, 1);
}
}
-
+
if(!isOverlapped)
{
mCurveMap.insert(CurveMap::value_type(theRaw, theDB));
@@ -273,7 +273,7 @@ void CAVolumeCurve::ResetRange()
bool CAVolumeCurve::CheckForContinuity() const
{
bool theAnswer = true;
-
+
CurveMap::const_iterator theIterator = mCurveMap.begin();
if(theIterator != mCurveMap.end())
{
@@ -284,22 +284,22 @@ bool CAVolumeCurve::CheckForContinuity() const
SInt32 theRawMin = theIterator->first.mMinimum;
SInt32 theRawMax = theIterator->first.mMaximum;
SInt32 theRawRange = theRawMax - theRawMin;
-
+
Float32 theDBMin = theIterator->second.mMinimum;
Float32 theDBMax = theIterator->second.mMaximum;
Float32 theDBRange = theDBMax - theDBMin;
theAnswer = theRaw == theRawMin;
theAnswer = theAnswer && (theDB == theDBMin);
-
+
theRaw += theRawRange;
theDB += theDBRange;
-
+
std::advance(theIterator, 1);
}
while((theIterator != mCurveMap.end()) && theAnswer);
}
-
+
return theAnswer;
}
@@ -308,16 +308,16 @@ SInt32 CAVolumeCurve::ConvertDBToRaw(Float32 inDB) const
// clamp the value to the dB range
Float32 theOverallDBMin = GetMinimumDB();
Float32 theOverallDBMax = GetMaximumDB();
-
+
if(inDB < theOverallDBMin) inDB = theOverallDBMin;
if(inDB > theOverallDBMax) inDB = theOverallDBMax;
-
+
// get the first entry in the curve map;
CurveMap::const_iterator theIterator = mCurveMap.begin();
-
+
// initialize the answer to the minimum raw of the first item in the curve map
SInt32 theAnswer = theIterator->first.mMinimum;
-
+
// iterate through the curve map until we run out of dB
bool isDone = false;
while(!isDone && (theIterator != mCurveMap.end()))
@@ -325,13 +325,13 @@ SInt32 CAVolumeCurve::ConvertDBToRaw(Float32 inDB) const
SInt32 theRawMin = theIterator->first.mMinimum;
SInt32 theRawMax = theIterator->first.mMaximum;
SInt32 theRawRange = theRawMax - theRawMin;
-
+
Float32 theDBMin = theIterator->second.mMinimum;
Float32 theDBMax = theIterator->second.mMaximum;
Float32 theDBRange = theDBMax - theDBMin;
-
+
Float32 theDBPerRaw = theDBRange / static_cast<Float32>(theRawRange);
-
+
// figure out how many steps we are into this entry in the curve map
if(inDB > theDBMax)
{
@@ -344,44 +344,44 @@ SInt32 CAVolumeCurve::ConvertDBToRaw(Float32 inDB) const
// figure out how many steps it is
Float32 theNumberRawSteps = inDB - theDBMin;
theNumberRawSteps /= theDBPerRaw;
-
+
// only move in whole steps
theNumberRawSteps = roundf(theNumberRawSteps);
-
+
// add this many steps to the answer
theAnswer += static_cast<SInt32>(theNumberRawSteps);
-
+
// mark that we are done
isDone = true;
}
-
+
// go to the next entry in the curve map
std::advance(theIterator, 1);
}
-
+
return theAnswer;
}
Float32 CAVolumeCurve::ConvertRawToDB(SInt32 inRaw) const
{
Float32 theAnswer = 0;
-
+
// clamp the raw value
SInt32 theOverallRawMin = GetMinimumRaw();
SInt32 theOverallRawMax = GetMaximumRaw();
-
+
if(inRaw < theOverallRawMin) inRaw = theOverallRawMin;
if(inRaw > theOverallRawMax) inRaw = theOverallRawMax;
-
+
// figure out how many raw steps need to be taken from the first one
SInt32 theNumberRawSteps = inRaw - theOverallRawMin;
// get the first item in the curve map
CurveMap::const_iterator theIterator = mCurveMap.begin();
-
+
// initialize the answer to the minimum dB of the first item in the curve map
theAnswer = theIterator->second.mMinimum;
-
+
// iterate through the curve map until we run out of steps
while((theNumberRawSteps > 0) && (theIterator != mCurveMap.end()))
{
@@ -389,26 +389,26 @@ Float32 CAVolumeCurve::ConvertRawToDB(SInt32 inRaw) const
SInt32 theRawMin = theIterator->first.mMinimum;
SInt32 theRawMax = theIterator->first.mMaximum;
SInt32 theRawRange = theRawMax - theRawMin;
-
+
Float32 theDBMin = theIterator->second.mMinimum;
Float32 theDBMax = theIterator->second.mMaximum;
Float32 theDBRange = theDBMax - theDBMin;
-
+
Float32 theDBPerRaw = theDBRange / static_cast<Float32>(theRawRange);
-
+
// there might be more steps than the current map entry accounts for
SInt32 theRawStepsToAdd = std::min(theRawRange, theNumberRawSteps);
-
+
// add this many steps worth of db to the answer;
theAnswer += theRawStepsToAdd * theDBPerRaw;
-
+
// figure out how many steps are left
theNumberRawSteps -= theRawStepsToAdd;
-
+
// go to the next map entry
std::advance(theIterator, 1);
}
-
+
return theAnswer;
}
@@ -421,7 +421,7 @@ Float32 CAVolumeCurve::ConvertRawToScalar(SInt32 inRaw) const
SInt32 theRawMin = GetMinimumRaw();
SInt32 theRawMax = GetMaximumRaw();
SInt32 theRawRange = theRawMax - theRawMin;
-
+
// range the raw value
if(inRaw < theRawMin) inRaw = theRawMin;
if(inRaw > theRawMax) inRaw = theRawMax;
@@ -449,7 +449,7 @@ SInt32 CAVolumeCurve::ConvertScalarToRaw(Float32 inScalar) const
{
// range the scalar value
inScalar = std::min(1.0f, std::max(0.0f, inScalar));
-
+
// get some important values
Float32 theDBMin = GetMinimumDB();
Float32 theDBMax = GetMaximumDB();
@@ -457,20 +457,20 @@ SInt32 CAVolumeCurve::ConvertScalarToRaw(Float32 inScalar) const
SInt32 theRawMin = GetMinimumRaw();
SInt32 theRawMax = GetMaximumRaw();
SInt32 theRawRange = theRawMax - theRawMin;
-
+
// have to undo the curve if the dB range is greater than 30
if(mIsApplyingTransferFunction && (theDBRange > 30.0f))
{
inScalar = powf(inScalar, mRawToScalarExponentDenominator / mRawToScalarExponentNumerator);
}
-
+
// now we can figure out how many raw steps this is
Float32 theNumberRawSteps = inScalar * static_cast<Float32>(theRawRange);
theNumberRawSteps = roundf(theNumberRawSteps);
-
+
// the answer is the minimum raw value plus the number of raw steps
SInt32 theAnswer = theRawMin + static_cast<SInt32>(theNumberRawSteps);
-
+
return theAnswer;
}
diff --git a/libs/appleutility/CoreAudio/PublicUtility/CAVolumeCurve.h b/libs/appleutility/CoreAudio/PublicUtility/CAVolumeCurve.h
index 4f9544682a..c8ac3f6867 100644
--- a/libs/appleutility/CoreAudio/PublicUtility/CAVolumeCurve.h
+++ b/libs/appleutility/CoreAudio/PublicUtility/CAVolumeCurve.h
@@ -2,14 +2,14 @@
File: CAVolumeCurve.h
Abstract: Part of CoreAudio Utility Classes
Version: 1.1
-
+
Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple
Inc. ("Apple") in consideration of your agreement to the following
terms, and your use, installation, modification or redistribution of
this Apple software constitutes acceptance of these terms. If you do
not agree with these terms, please do not use, install, modify or
redistribute this Apple software.
-
+
In consideration of your agreement to abide by the following terms, and
subject to these terms, Apple grants you a personal, non-exclusive
license, under Apple's copyrights in this original Apple software (the
@@ -25,13 +25,13 @@
implied, are granted by Apple herein, including but not limited to any
patent rights that may be infringed by your derivative works or by other
works in which the Apple Software may be incorporated.
-
+
The Apple Software is provided by Apple on an "AS IS" basis. APPLE
MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND
OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
-
+
IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
@@ -40,9 +40,9 @@
AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),
STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
-
+
Copyright (C) 2014 Apple Inc. All Rights Reserved.
-
+
*/
#if !defined(__CAVolumeCurve_h__)
#define __CAVolumeCurve_h__
@@ -66,12 +66,12 @@ struct CARawPoint
{
SInt32 mMinimum;
SInt32 mMaximum;
-
+
CARawPoint() : mMinimum(0), mMaximum(0) {}
CARawPoint(const CARawPoint& inPoint) : mMinimum(inPoint.mMinimum), mMaximum(inPoint.mMaximum) {}
CARawPoint(SInt32 inMinimum, SInt32 inMaximum) : mMinimum(inMinimum), mMaximum(inMaximum) {}
CARawPoint& operator=(const CARawPoint& inPoint) { mMinimum = inPoint.mMinimum; mMaximum = inPoint.mMaximum; return *this; }
-
+
static bool Overlap(const CARawPoint& x, const CARawPoint& y) { return (x.mMinimum < y.mMaximum) && (x.mMaximum > y.mMinimum); }
};
@@ -86,12 +86,12 @@ struct CADBPoint
{
Float32 mMinimum;
Float32 mMaximum;
-
+
CADBPoint() : mMinimum(0), mMaximum(0) {}
CADBPoint(const CADBPoint& inPoint) : mMinimum(inPoint.mMinimum), mMaximum(inPoint.mMaximum) {}
CADBPoint(Float32 inMinimum, Float32 inMaximum) : mMinimum(inMinimum), mMaximum(inMaximum) {}
CADBPoint& operator=(const CADBPoint& inPoint) { mMinimum = inPoint.mMinimum; mMaximum = inPoint.mMaximum; return *this; }
-
+
static bool Overlap(const CADBPoint& x, const CADBPoint& y) { return (x.mMinimum < y.mMaximum) && (x.mMaximum >= y.mMinimum); }
};
@@ -144,7 +144,7 @@ public:
SInt32 GetMaximumRaw() const;
Float32 GetMinimumDB() const;
Float32 GetMaximumDB() const;
-
+
void SetIsApplyingTransferFunction(bool inIsApplyingTransferFunction) { mIsApplyingTransferFunction = inIsApplyingTransferFunction; }
UInt32 GetTransferFunction() const { return mTransferFunction; }
void SetTransferFunction(UInt32 inTransferFunction);
@@ -154,7 +154,7 @@ public:
void AddRange(SInt32 mMinRaw, SInt32 mMaxRaw, Float32 inMinDB, Float32 inMaxDB);
void ResetRange();
bool CheckForContinuity() const;
-
+
SInt32 ConvertDBToRaw(Float32 inDB) const;
Float32 ConvertRawToDB(SInt32 inRaw) const;
Float32 ConvertRawToScalar(SInt32 inRaw) const;
@@ -165,7 +165,7 @@ public:
// Implementation
private:
typedef std::map<CARawPoint, CADBPoint> CurveMap;
-
+
UInt32 mTag;
CurveMap mCurveMap;
bool mIsApplyingTransferFunction;
diff --git a/libs/appleutility/CoreAudio/PublicUtility/CAXException.cpp b/libs/appleutility/CoreAudio/PublicUtility/CAXException.cpp
index c2dbac5d60..2b83bd406b 100644
--- a/libs/appleutility/CoreAudio/PublicUtility/CAXException.cpp
+++ b/libs/appleutility/CoreAudio/PublicUtility/CAXException.cpp
@@ -2,14 +2,14 @@
File: CAXException.cpp
Abstract: CAXException.h
Version: 1.1
-
+
Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple
Inc. ("Apple") in consideration of your agreement to the following
terms, and your use, installation, modification or redistribution of
this Apple software constitutes acceptance of these terms. If you do
not agree with these terms, please do not use, install, modify or
redistribute this Apple software.
-
+
In consideration of your agreement to abide by the following terms, and
subject to these terms, Apple grants you a personal, non-exclusive
license, under Apple's copyrights in this original Apple software (the
@@ -25,13 +25,13 @@
implied, are granted by Apple herein, including but not limited to any
patent rights that may be infringed by your derivative works or by other
works in which the Apple Software may be incorporated.
-
+
The Apple Software is provided by Apple on an "AS IS" basis. APPLE
MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND
OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
-
+
IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
@@ -40,9 +40,9 @@
AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),
STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
-
+
Copyright (C) 2014 Apple Inc. All Rights Reserved.
-
+
*/
#include "CAXException.h"
diff --git a/libs/appleutility/CoreAudio/PublicUtility/CAXException.h b/libs/appleutility/CoreAudio/PublicUtility/CAXException.h
index 90dabe97de..0f174e0c80 100644
--- a/libs/appleutility/CoreAudio/PublicUtility/CAXException.h
+++ b/libs/appleutility/CoreAudio/PublicUtility/CAXException.h
@@ -2,14 +2,14 @@
File: CAXException.h
Abstract: Part of CoreAudio Utility Classes
Version: 1.1
-
+
Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple
Inc. ("Apple") in consideration of your agreement to the following
terms, and your use, installation, modification or redistribution of
this Apple software constitutes acceptance of these terms. If you do
not agree with these terms, please do not use, install, modify or
redistribute this Apple software.
-
+
In consideration of your agreement to abide by the following terms, and
subject to these terms, Apple grants you a personal, non-exclusive
license, under Apple's copyrights in this original Apple software (the
@@ -25,13 +25,13 @@
implied, are granted by Apple herein, including but not limited to any
patent rights that may be infringed by your derivative works or by other
works in which the Apple Software may be incorporated.
-
+
The Apple Software is provided by Apple on an "AS IS" basis. APPLE
MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND
OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
-
+
IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
@@ -40,9 +40,9 @@
AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),
STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
-
+
Copyright (C) 2014 Apple Inc. All Rights Reserved.
-
+
*/
#ifndef __CAXException_h__
#define __CAXException_h__
@@ -118,31 +118,31 @@ public:
strlcpy(mOperation, operation, sizeof(mOperation));
}
-
+
char *FormatError(char *str, size_t strsize) const
{
return FormatError(str, strsize, mError);
}
-
+
char mOperation[256];
const OSStatus mError;
-
+
// -------------------------------------------------
-
+
typedef void (*WarningHandler)(const char *msg, OSStatus err);
-
+
static char *FormatError(char *str, size_t strsize, OSStatus error)
{
strlcpy(str, CAX4CCString(error), strsize);
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;
@@ -178,7 +178,7 @@ private:
goto label; \
} \
} while (0)
-
+
#define XAssert(assertion) \
do { \
if (!(assertion)) { \
@@ -186,7 +186,7 @@ private:
__ASSERT_STOP; \
} \
} while (0)
-
+
#define XAssertNoError(error) \
do { \
OSStatus __err = error; \
@@ -271,7 +271,7 @@ private:
__LINE__); \
} \
} while ( 0 )
-
+
#else
#define XThrowIfError(error, operation) \
do { \
diff --git a/libs/appleutility/CoreAudio/PublicUtility/MatrixMixerVolumes.cpp b/libs/appleutility/CoreAudio/PublicUtility/MatrixMixerVolumes.cpp
index 98d868eb73..f3d106a536 100644
--- a/libs/appleutility/CoreAudio/PublicUtility/MatrixMixerVolumes.cpp
+++ b/libs/appleutility/CoreAudio/PublicUtility/MatrixMixerVolumes.cpp
@@ -2,14 +2,14 @@
File: MatrixMixerVolumes.cpp
Abstract: MatrixMixerVolumes.h
Version: 1.1
-
+
Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple
Inc. ("Apple") in consideration of your agreement to the following
terms, and your use, installation, modification or redistribution of
this Apple software constitutes acceptance of these terms. If you do
not agree with these terms, please do not use, install, modify or
redistribute this Apple software.
-
+
In consideration of your agreement to abide by the following terms, and
subject to these terms, Apple grants you a personal, non-exclusive
license, under Apple's copyrights in this original Apple software (the
@@ -25,13 +25,13 @@
implied, are granted by Apple herein, including but not limited to any
patent rights that may be infringed by your derivative works or by other
works in which the Apple Software may be incorporated.
-
+
The Apple Software is provided by Apple on an "AS IS" basis. APPLE
MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND
OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
-
+
IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
@@ -40,9 +40,9 @@
AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),
STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
-
+
Copyright (C) 2014 Apple Inc. All Rights Reserved.
-
+
*/
#include "MatrixMixerVolumes.h"
#include "CAXException.h"
@@ -59,9 +59,9 @@ OSStatus PrintBuses (FILE* file, const char* str, AudioUnit au, AudioUnitScope i
UInt32 busCount;
UInt32 theSize = sizeof(busCount);
- ca_require_noerr (result = AudioUnitGetProperty (au, kAudioUnitProperty_ElementCount,
+ ca_require_noerr (result = AudioUnitGetProperty (au, kAudioUnitProperty_ElementCount,
inScope, 0, &busCount, &theSize), home);
-
+
fprintf (file, "\t%s Elements:\n\t\t", str);
for (UInt32 i = 0; i < busCount; ++i) {
Float32 val;
@@ -83,16 +83,16 @@ void PrintMatrixMixerVolumes (FILE* file, AudioUnit au)
UInt32 theSize = sizeof(UInt32) * 2;
Float32 *theVols = NULL;
OSStatus result;
-
-// this call will fail if the unit is NOT initialized as it would present an incomplete state
- ca_require_noerr (result = AudioUnitGetProperty (au, kAudioUnitProperty_MatrixDimensions,
+
+// this call will fail if the unit is NOT initialized as it would present an incomplete state
+ ca_require_noerr (result = AudioUnitGetProperty (au, kAudioUnitProperty_MatrixDimensions,
kAudioUnitScope_Global, 0, dims, &theSize), home);
theSize = ((dims[0] + 1) * (dims[1] + 1)) * sizeof(Float32);
-
+
theVols = static_cast<Float32*> (malloc (theSize));
-
- ca_require_noerr (result = AudioUnitGetProperty (au, kAudioUnitProperty_MatrixLevels,
+
+ ca_require_noerr (result = AudioUnitGetProperty (au, kAudioUnitProperty_MatrixLevels,
kAudioUnitScope_Global, 0, theVols, &theSize), home);
home:
@@ -101,9 +101,9 @@ home:
free(theVols);
return;
}
-
+
theSize /= sizeof(Float32);
-
+
unsigned int inputs = dims[0];
unsigned int outputs = dims[1];
@@ -114,7 +114,7 @@ home:
for (unsigned int i = 0; i < (inputs + 1); ++i) {
if (i < inputs) {
fprintf (file, "\t%.3f ", theVols[(i + 1) * (outputs + 1) - 1]);
-
+
for (unsigned int j = 0; j < outputs; ++j)
fprintf (file, "(%.3f) ", theVols[(i * (outputs + 1)) + j]);
} else {
@@ -141,7 +141,7 @@ OSStatus NumberChannels (AudioUnit au,
AudioStreamBasicDescription desc;
UInt32 dataSize = sizeof (AudioStreamBasicDescription);
OSStatus result = AudioUnitGetProperty (au, kAudioUnitProperty_StreamFormat,
- inScope, inEl,
+ inScope, inEl,
&desc, &dataSize);
if (!result)
outChans = desc.mChannelsPerFrame;
diff --git a/libs/appleutility/CoreAudio/PublicUtility/MatrixMixerVolumes.h b/libs/appleutility/CoreAudio/PublicUtility/MatrixMixerVolumes.h
index 06854f0774..aa47ef09ff 100644
--- a/libs/appleutility/CoreAudio/PublicUtility/MatrixMixerVolumes.h
+++ b/libs/appleutility/CoreAudio/PublicUtility/MatrixMixerVolumes.h
@@ -2,14 +2,14 @@
File: MatrixMixerVolumes.h
Abstract: Part of CoreAudio Utility Classes
Version: 1.1
-
+
Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple
Inc. ("Apple") in consideration of your agreement to the following
terms, and your use, installation, modification or redistribution of
this Apple software constitutes acceptance of these terms. If you do
not agree with these terms, please do not use, install, modify or
redistribute this Apple software.
-
+
In consideration of your agreement to abide by the following terms, and
subject to these terms, Apple grants you a personal, non-exclusive
license, under Apple's copyrights in this original Apple software (the
@@ -25,13 +25,13 @@
implied, are granted by Apple herein, including but not limited to any
patent rights that may be infringed by your derivative works or by other
works in which the Apple Software may be incorporated.
-
+
The Apple Software is provided by Apple on an "AS IS" basis. APPLE
MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND
OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
-
+
IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
@@ -40,9 +40,9 @@
AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),
STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
-
+
Copyright (C) 2014 Apple Inc. All Rights Reserved.
-
+
*/
#ifndef __MatrixMixerVolumes_h__
#define __MatrixMixerVolumes_h__
@@ -59,10 +59,10 @@ extern "C"
#endif
// prints the matrix mixer volumes of a specific audio unit to the given file
-void PrintMatrixMixerVolumes (FILE* file, AudioUnit au);
+void PrintMatrixMixerVolumes (FILE* file, AudioUnit au);
// prints the mixer volumes for the specific scope of the audio unit
-// results will be printed to the speficied file "file" with identifiying string tag "str"
+// results will be printed to the speficied file "file" with identifiying string tag "str"
OSStatus PrintBuses (FILE* file, char* str, AudioUnit au, AudioUnitScope inScope);
#if defined(__cplusplus)
}