summaryrefslogtreecommitdiff
path: root/libs/appleutility
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2015-10-26 14:35:06 -0400
committerPaul Davis <paul@linuxaudiosystems.com>2016-02-22 15:31:24 -0500
commitbc487bb4b02a9780938d6cf8528c888e59161aa9 (patch)
tree967703b895cafc301d3a0d4876c343370760fef2 /libs/appleutility
parent589f2a1ab83e4498920faa2f0ef37c1632eaf914 (diff)
replicate the remove-all-trailing whitespace commit(s) in master
Diffstat (limited to 'libs/appleutility')
-rw-r--r--libs/appleutility/CoreAudio/AudioCodecs/ACPublic/ACBaseCodec.cpp96
-rw-r--r--libs/appleutility/CoreAudio/AudioCodecs/ACPublic/ACBaseCodec.h28
-rw-r--r--libs/appleutility/CoreAudio/AudioCodecs/ACPublic/ACCodec.cpp62
-rw-r--r--libs/appleutility/CoreAudio/AudioCodecs/ACPublic/ACCodec.h18
-rw-r--r--libs/appleutility/CoreAudio/AudioCodecs/ACPublic/ACCodecDispatchTypes.h12
-rw-r--r--libs/appleutility/CoreAudio/AudioCodecs/ACPublic/ACConditionalMacros.h12
-rw-r--r--libs/appleutility/CoreAudio/AudioCodecs/ACPublic/ACPlugInDispatch.cpp24
-rw-r--r--libs/appleutility/CoreAudio/AudioCodecs/ACPublic/ACPlugInDispatch.h12
-rw-r--r--libs/appleutility/CoreAudio/AudioCodecs/ACPublic/ACSimpleCodec.cpp116
-rw-r--r--libs/appleutility/CoreAudio/AudioCodecs/ACPublic/ACSimpleCodec.h20
-rw-r--r--libs/appleutility/CoreAudio/AudioCodecs/ACPublic/GetCodecBundle.cpp14
-rw-r--r--libs/appleutility/CoreAudio/AudioCodecs/ACPublic/GetCodecBundle.h12
-rw-r--r--libs/appleutility/CoreAudio/AudioFile/AFPublic/AudioFileComponentBase.cpp270
-rw-r--r--libs/appleutility/CoreAudio/AudioFile/AFPublic/AudioFileComponentBase.h150
-rw-r--r--libs/appleutility/CoreAudio/AudioFile/AFPublic/AudioFileFormat.cpp16
-rw-r--r--libs/appleutility/CoreAudio/AudioFile/AFPublic/AudioFileFormat.h38
-rw-r--r--libs/appleutility/CoreAudio/AudioFile/AFPublic/AudioFileObject.cpp604
-rw-r--r--libs/appleutility/CoreAudio/AudioFile/AFPublic/AudioFileObject.h248
-rw-r--r--libs/appleutility/CoreAudio/AudioFile/AFPublic/CompressedPacketTable.cpp48
-rw-r--r--libs/appleutility/CoreAudio/AudioFile/AFPublic/CompressedPacketTable.h58
-rw-r--r--libs/appleutility/CoreAudio/AudioFile/AFPublic/DataSource.cpp228
-rw-r--r--libs/appleutility/CoreAudio/AudioFile/AFPublic/DataSource.h236
-rw-r--r--libs/appleutility/CoreAudio/AudioUnits/AUPublic/AUBase/AUBase.cpp404
-rw-r--r--libs/appleutility/CoreAudio/AudioUnits/AUPublic/AUBase/AUBase.h260
-rw-r--r--libs/appleutility/CoreAudio/AudioUnits/AUPublic/AUBase/AUDispatch.cpp66
-rw-r--r--libs/appleutility/CoreAudio/AudioUnits/AUPublic/AUBase/AUDispatch.h12
-rw-r--r--libs/appleutility/CoreAudio/AudioUnits/AUPublic/AUBase/AUInputElement.cpp24
-rw-r--r--libs/appleutility/CoreAudio/AudioUnits/AUPublic/AUBase/AUInputElement.h16
-rw-r--r--libs/appleutility/CoreAudio/AudioUnits/AUPublic/AUBase/AUOutputElement.cpp14
-rw-r--r--libs/appleutility/CoreAudio/AudioUnits/AUPublic/AUBase/AUOutputElement.h12
-rw-r--r--libs/appleutility/CoreAudio/AudioUnits/AUPublic/AUBase/AUPlugInDispatch.cpp72
-rw-r--r--libs/appleutility/CoreAudio/AudioUnits/AUPublic/AUBase/AUPlugInDispatch.h12
-rw-r--r--libs/appleutility/CoreAudio/AudioUnits/AUPublic/AUBase/AUScopeElement.cpp108
-rw-r--r--libs/appleutility/CoreAudio/AudioUnits/AUPublic/AUBase/AUScopeElement.h134
-rw-r--r--libs/appleutility/CoreAudio/AudioUnits/AUPublic/AUBase/ComponentBase.cpp56
-rw-r--r--libs/appleutility/CoreAudio/AudioUnits/AUPublic/AUBase/ComponentBase.h68
-rw-r--r--libs/appleutility/CoreAudio/AudioUnits/AUPublic/AUCarbonViewBase/AUCarbonViewBase.cpp90
-rw-r--r--libs/appleutility/CoreAudio/AudioUnits/AUPublic/AUCarbonViewBase/AUCarbonViewBase.h38
-rw-r--r--libs/appleutility/CoreAudio/AudioUnits/AUPublic/AUCarbonViewBase/AUCarbonViewControl.cpp222
-rw-r--r--libs/appleutility/CoreAudio/AudioUnits/AUPublic/AUCarbonViewBase/AUCarbonViewControl.h70
-rw-r--r--libs/appleutility/CoreAudio/AudioUnits/AUPublic/AUCarbonViewBase/AUCarbonViewDispatch.cpp18
-rw-r--r--libs/appleutility/CoreAudio/AudioUnits/AUPublic/AUCarbonViewBase/AUControlGroup.cpp120
-rw-r--r--libs/appleutility/CoreAudio/AudioUnits/AUPublic/AUCarbonViewBase/AUControlGroup.h38
-rw-r--r--libs/appleutility/CoreAudio/AudioUnits/AUPublic/AUCarbonViewBase/CarbonEventHandler.cpp20
-rw-r--r--libs/appleutility/CoreAudio/AudioUnits/AUPublic/AUCarbonViewBase/CarbonEventHandler.h14
-rw-r--r--libs/appleutility/CoreAudio/AudioUnits/AUPublic/AUInstrumentBase/AUInstrumentBase.cpp140
-rw-r--r--libs/appleutility/CoreAudio/AudioUnits/AUPublic/AUInstrumentBase/AUInstrumentBase.h100
-rw-r--r--libs/appleutility/CoreAudio/AudioUnits/AUPublic/AUInstrumentBase/LockFreeFIFO.h54
-rw-r--r--libs/appleutility/CoreAudio/AudioUnits/AUPublic/AUInstrumentBase/MIDIControlHandler.h18
-rw-r--r--libs/appleutility/CoreAudio/AudioUnits/AUPublic/AUInstrumentBase/SynthElement.cpp50
-rw-r--r--libs/appleutility/CoreAudio/AudioUnits/AUPublic/AUInstrumentBase/SynthElement.h62
-rw-r--r--libs/appleutility/CoreAudio/AudioUnits/AUPublic/AUInstrumentBase/SynthEvent.h44
-rw-r--r--libs/appleutility/CoreAudio/AudioUnits/AUPublic/AUInstrumentBase/SynthNote.cpp42
-rw-r--r--libs/appleutility/CoreAudio/AudioUnits/AUPublic/AUInstrumentBase/SynthNote.h38
-rw-r--r--libs/appleutility/CoreAudio/AudioUnits/AUPublic/AUInstrumentBase/SynthNoteList.cpp20
-rw-r--r--libs/appleutility/CoreAudio/AudioUnits/AUPublic/AUInstrumentBase/SynthNoteList.h48
-rw-r--r--libs/appleutility/CoreAudio/AudioUnits/AUPublic/AUViewBase/AUViewLocalizedStringKeys.h28
-rw-r--r--libs/appleutility/CoreAudio/AudioUnits/AUPublic/OtherBases/AUEffectBase.cpp80
-rw-r--r--libs/appleutility/CoreAudio/AudioUnits/AUPublic/OtherBases/AUEffectBase.h90
-rw-r--r--libs/appleutility/CoreAudio/AudioUnits/AUPublic/OtherBases/AUMIDIBase.cpp96
-rw-r--r--libs/appleutility/CoreAudio/AudioUnits/AUPublic/OtherBases/AUMIDIBase.h62
-rw-r--r--libs/appleutility/CoreAudio/AudioUnits/AUPublic/OtherBases/AUMIDIEffectBase.cpp34
-rw-r--r--libs/appleutility/CoreAudio/AudioUnits/AUPublic/OtherBases/AUMIDIEffectBase.h14
-rw-r--r--libs/appleutility/CoreAudio/AudioUnits/AUPublic/OtherBases/AUOutputBase.cpp16
-rw-r--r--libs/appleutility/CoreAudio/AudioUnits/AUPublic/OtherBases/AUOutputBase.h14
-rw-r--r--libs/appleutility/CoreAudio/AudioUnits/AUPublic/OtherBases/AUPannerBase.cpp164
-rw-r--r--libs/appleutility/CoreAudio/AudioUnits/AUPublic/OtherBases/AUPannerBase.h48
-rw-r--r--libs/appleutility/CoreAudio/AudioUnits/AUPublic/OtherBases/MusicDeviceBase.cpp52
-rw-r--r--libs/appleutility/CoreAudio/AudioUnits/AUPublic/OtherBases/MusicDeviceBase.h28
-rw-r--r--libs/appleutility/CoreAudio/AudioUnits/AUPublic/Utility/AUBaseHelper.cpp28
-rw-r--r--libs/appleutility/CoreAudio/AudioUnits/AUPublic/Utility/AUBaseHelper.h12
-rw-r--r--libs/appleutility/CoreAudio/AudioUnits/AUPublic/Utility/AUBuffer.cpp20
-rw-r--r--libs/appleutility/CoreAudio/AudioUnits/AUPublic/Utility/AUBuffer.h46
-rw-r--r--libs/appleutility/CoreAudio/AudioUnits/AUPublic/Utility/AUInputFormatConverter.h26
-rw-r--r--libs/appleutility/CoreAudio/AudioUnits/AUPublic/Utility/AUMIDIDefs.h22
-rw-r--r--libs/appleutility/CoreAudio/AudioUnits/AUPublic/Utility/AUSilentTimeout.h16
-rw-r--r--libs/appleutility/CoreAudio/AudioUnits/AUPublic/Utility/AUTimestampGenerator.cpp38
-rw-r--r--libs/appleutility/CoreAudio/AudioUnits/AUPublic/Utility/AUTimestampGenerator.h44
-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
195 files changed, 5542 insertions, 5542 deletions
diff --git a/libs/appleutility/CoreAudio/AudioCodecs/ACPublic/ACBaseCodec.cpp b/libs/appleutility/CoreAudio/AudioCodecs/ACPublic/ACBaseCodec.cpp
index f1ffdf7f1b..f545edd365 100644
--- a/libs/appleutility/CoreAudio/AudioCodecs/ACPublic/ACBaseCodec.cpp
+++ b/libs/appleutility/CoreAudio/AudioCodecs/ACPublic/ACBaseCodec.cpp
@@ -2,14 +2,14 @@
File: ACBaseCodec.cpp
Abstract: ACBaseCodec.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,27 +93,27 @@ void ACBaseCodec::GetPropertyInfo(AudioCodecPropertyID inPropertyID, UInt32& out
outPropertyDataSize = SizeOf32(CFStringRef);
outWritable = false;
break;
-
+
case kAudioCodecPropertyManufacturerCFString:
outPropertyDataSize = SizeOf32(CFStringRef);
outWritable = false;
break;
-
+
case kAudioCodecPropertyFormatCFString:
outPropertyDataSize = SizeOf32(CFStringRef);
outWritable = false;
- break;
+ break;
#endif
case kAudioCodecPropertyRequiresPacketDescription:
outPropertyDataSize = SizeOf32(UInt32);
outWritable = false;
break;
-
+
case kAudioCodecPropertyMinimumNumberInputPackets :
outPropertyDataSize = SizeOf32(UInt32);
outWritable = false;
break;
-
+
case kAudioCodecPropertyMinimumNumberOutputPackets :
outPropertyDataSize = SizeOf32(UInt32);
outWritable = false;
@@ -123,39 +123,39 @@ void ACBaseCodec::GetPropertyInfo(AudioCodecPropertyID inPropertyID, UInt32& out
outPropertyDataSize = SizeOf32(AudioStreamBasicDescription);
outWritable = true;
break;
-
+
case kAudioCodecPropertySupportedInputFormats:
case kAudioCodecPropertyInputFormatsForOutputFormat:
outPropertyDataSize = GetNumberSupportedInputFormats() * SizeOf32(AudioStreamBasicDescription);
outWritable = false;
break;
-
+
case kAudioCodecPropertyCurrentOutputFormat:
outPropertyDataSize = SizeOf32(AudioStreamBasicDescription);
outWritable = true;
break;
-
+
case kAudioCodecPropertySupportedOutputFormats:
case kAudioCodecPropertyOutputFormatsForInputFormat:
outPropertyDataSize = GetNumberSupportedOutputFormats() * SizeOf32(AudioStreamBasicDescription);
outWritable = false;
break;
-
+
case kAudioCodecPropertyMagicCookie:
outPropertyDataSize = GetMagicCookieByteSize();
outWritable = true;
break;
-
+
case kAudioCodecPropertyInputBufferSize:
outPropertyDataSize = SizeOf32(UInt32);
outWritable = false;
break;
-
+
case kAudioCodecPropertyUsedInputBufferSize:
outPropertyDataSize = SizeOf32(UInt32);
outWritable = false;
break;
-
+
case kAudioCodecPropertyIsInitialized:
outPropertyDataSize = SizeOf32(UInt32);
outWritable = false;
@@ -165,7 +165,7 @@ void ACBaseCodec::GetPropertyInfo(AudioCodecPropertyID inPropertyID, UInt32& out
outPropertyDataSize = SizeOf32(UInt32) * 2; // Mono, stereo
outWritable = false;
break;
-
+
case kAudioCodecPropertyPrimeMethod:
outPropertyDataSize = SizeOf32(UInt32);
outWritable = false;
@@ -184,35 +184,35 @@ void ACBaseCodec::GetPropertyInfo(AudioCodecPropertyID inPropertyID, UInt32& out
default:
CODEC_THROW(kAudioCodecUnknownPropertyError);
break;
-
+
};
}
void ACBaseCodec::GetProperty(AudioCodecPropertyID inPropertyID, UInt32& ioPropertyDataSize, void* outPropertyData)
{
UInt32 thePacketsToGet;
-
+
switch(inPropertyID)
{
#if !BUILD_ADEC_LIB
case kAudioCodecPropertyNameCFString:
{
if (ioPropertyDataSize != SizeOf32(CFStringRef)) CODEC_THROW(kAudioCodecBadPropertySizeError);
-
+
CABundleLocker lock;
CFStringRef name = CFCopyLocalizedStringFromTableInBundle(CFSTR("unknown codec"), CFSTR("CodecNames"), GetCodecBundle(), CFSTR(""));
*(CFStringRef*)outPropertyData = name;
- break;
+ break;
}
-
+
case kAudioCodecPropertyManufacturerCFString:
{
if (ioPropertyDataSize != SizeOf32(CFStringRef)) CODEC_THROW(kAudioCodecBadPropertySizeError);
-
+
CABundleLocker lock;
CFStringRef name = CFCopyLocalizedStringFromTableInBundle(CFSTR("Apple, Inc."), CFSTR("CodecNames"), GetCodecBundle(), CFSTR(""));
*(CFStringRef*)outPropertyData = name;
- break;
+ break;
}
#else
// If called on the device these should return nothing but 0
@@ -226,24 +226,24 @@ void ACBaseCodec::GetProperty(AudioCodecPropertyID inPropertyID, UInt32& ioPrope
case kAudioCodecPropertyRequiresPacketDescription:
if(ioPropertyDataSize == SizeOf32(UInt32))
{
- *reinterpret_cast<UInt32*>(outPropertyData) = 0;
+ *reinterpret_cast<UInt32*>(outPropertyData) = 0;
}
else
{
CODEC_THROW(kAudioCodecBadPropertySizeError);
}
break;
-
+
case kAudioCodecPropertyMinimumNumberInputPackets :
if(ioPropertyDataSize != SizeOf32(UInt32)) CODEC_THROW(kAudioCodecBadPropertySizeError);
*(UInt32*)outPropertyData = 1;
break;
-
+
case kAudioCodecPropertyMinimumNumberOutputPackets :
if(ioPropertyDataSize != SizeOf32(UInt32)) CODEC_THROW(kAudioCodecBadPropertySizeError);
*(UInt32*)outPropertyData = 1;
break;
-
+
case kAudioCodecPropertyCurrentInputFormat:
if(ioPropertyDataSize == SizeOf32(AudioStreamBasicDescription))
{
@@ -254,14 +254,14 @@ void ACBaseCodec::GetProperty(AudioCodecPropertyID inPropertyID, UInt32& ioPrope
CODEC_THROW(kAudioCodecBadPropertySizeError);
}
break;
-
+
case kAudioCodecPropertySupportedInputFormats:
case kAudioCodecPropertyInputFormatsForOutputFormat:
thePacketsToGet = ioPropertyDataSize / SizeOf32(AudioStreamBasicDescription);
GetSupportedInputFormats(reinterpret_cast<AudioStreamBasicDescription*>(outPropertyData), thePacketsToGet);
ioPropertyDataSize = thePacketsToGet * SizeOf32(AudioStreamBasicDescription);
break;
-
+
case kAudioCodecPropertyCurrentOutputFormat:
if(ioPropertyDataSize == SizeOf32(AudioStreamBasicDescription))
{
@@ -272,14 +272,14 @@ void ACBaseCodec::GetProperty(AudioCodecPropertyID inPropertyID, UInt32& ioPrope
CODEC_THROW(kAudioCodecBadPropertySizeError);
}
break;
-
+
case kAudioCodecPropertySupportedOutputFormats:
case kAudioCodecPropertyOutputFormatsForInputFormat:
thePacketsToGet = ioPropertyDataSize / SizeOf32(AudioStreamBasicDescription);
GetSupportedOutputFormats(reinterpret_cast<AudioStreamBasicDescription*>(outPropertyData), thePacketsToGet);
ioPropertyDataSize = thePacketsToGet * SizeOf32(AudioStreamBasicDescription);
break;
-
+
case kAudioCodecPropertyMagicCookie:
if(ioPropertyDataSize >= GetMagicCookieByteSize())
{
@@ -290,7 +290,7 @@ void ACBaseCodec::GetProperty(AudioCodecPropertyID inPropertyID, UInt32& ioPrope
CODEC_THROW(kAudioCodecBadPropertySizeError);
}
break;
-
+
case kAudioCodecPropertyInputBufferSize:
if(ioPropertyDataSize == SizeOf32(UInt32))
{
@@ -301,7 +301,7 @@ void ACBaseCodec::GetProperty(AudioCodecPropertyID inPropertyID, UInt32& ioPrope
CODEC_THROW(kAudioCodecBadPropertySizeError);
}
break;
-
+
case kAudioCodecPropertyUsedInputBufferSize:
if(ioPropertyDataSize == SizeOf32(UInt32))
{
@@ -312,7 +312,7 @@ void ACBaseCodec::GetProperty(AudioCodecPropertyID inPropertyID, UInt32& ioPrope
CODEC_THROW(kAudioCodecBadPropertySizeError);
}
break;
-
+
case kAudioCodecPropertyIsInitialized:
if(ioPropertyDataSize == SizeOf32(UInt32))
{
@@ -323,7 +323,7 @@ void ACBaseCodec::GetProperty(AudioCodecPropertyID inPropertyID, UInt32& ioPrope
CODEC_THROW(kAudioCodecBadPropertySizeError);
}
break;
-
+
case kAudioCodecPropertyAvailableNumberChannels:
if(ioPropertyDataSize == SizeOf32(UInt32) * 2)
{
@@ -373,7 +373,7 @@ void ACBaseCodec::GetProperty(AudioCodecPropertyID inPropertyID, UInt32& ioPrope
default:
CODEC_THROW(kAudioCodecUnknownPropertyError);
break;
-
+
};
}
@@ -384,7 +384,7 @@ void ACBaseCodec::SetProperty(AudioCodecPropertyID inPropertyID, UInt32 inProper
{
CODEC_THROW(kAudioCodecIllegalOperationError);
}
-
+
switch(inPropertyID)
{
case kAudioCodecPropertyCurrentInputFormat:
@@ -397,7 +397,7 @@ void ACBaseCodec::SetProperty(AudioCodecPropertyID inPropertyID, UInt32 inProper
CODEC_THROW(kAudioCodecBadPropertySizeError);
}
break;
-
+
case kAudioCodecPropertyCurrentOutputFormat:
if(inPropertyDataSize == SizeOf32(AudioStreamBasicDescription))
{
@@ -408,11 +408,11 @@ void ACBaseCodec::SetProperty(AudioCodecPropertyID inPropertyID, UInt32 inProper
CODEC_THROW(kAudioCodecBadPropertySizeError);
}
break;
-
+
case kAudioCodecPropertyMagicCookie:
SetMagicCookie(inPropertyData, inPropertyDataSize);
break;
-
+
case kAudioCodecPropertyMinimumNumberOutputPackets :
case kAudioCodecPropertyMinimumNumberInputPackets :
case kAudioCodecPropertyInputBufferSize:
@@ -432,7 +432,7 @@ void ACBaseCodec::SetProperty(AudioCodecPropertyID inPropertyID, UInt32 inProper
case kAudioCodecPropertyRequiresPacketDescription:
CODEC_THROW(kAudioCodecIllegalOperationError);
break;
-
+
default:
CODEC_THROW(kAudioCodecUnknownPropertyError);
break;
@@ -462,13 +462,13 @@ void ACBaseCodec::GetSupportedInputFormats(AudioStreamBasicDescription* outInput
{
UInt32 theNumberFormats = (UInt32)mInputFormatList.size();
ioNumberInputFormats = (theNumberFormats < ioNumberInputFormats) ? theNumberFormats : ioNumberInputFormats;
-
+
FormatList::const_iterator theIterator = mInputFormatList.begin();
theNumberFormats = ioNumberInputFormats;
while((theNumberFormats > 0) && (theIterator != mInputFormatList.end()))
{
*outInputFormats = *theIterator;
-
+
++outInputFormats;
--theNumberFormats;
std::advance(theIterator, 1);
@@ -501,13 +501,13 @@ void ACBaseCodec::GetSupportedOutputFormats(AudioStreamBasicDescription* outOutp
{
UInt32 theNumberFormats = (UInt32)mOutputFormatList.size();
ioNumberOutputFormats = (theNumberFormats < ioNumberOutputFormats) ? theNumberFormats : ioNumberOutputFormats;
-
+
FormatList::const_iterator theIterator = mOutputFormatList.begin();
theNumberFormats = ioNumberOutputFormats;
while((theNumberFormats > 0) && (theIterator != mOutputFormatList.end()))
{
*outOutputFormats = *theIterator;
-
+
++outOutputFormats;
--theNumberFormats;
std::advance(theIterator, 1);
diff --git a/libs/appleutility/CoreAudio/AudioCodecs/ACPublic/ACBaseCodec.h b/libs/appleutility/CoreAudio/AudioCodecs/ACPublic/ACBaseCodec.h
index 6689d91fbe..2329d94ec2 100644
--- a/libs/appleutility/CoreAudio/AudioCodecs/ACPublic/ACBaseCodec.h
+++ b/libs/appleutility/CoreAudio/AudioCodecs/ACPublic/ACBaseCodec.h
@@ -2,14 +2,14 @@
File: ACBaseCodec.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(__ACBaseCodec_h__)
#define __ACBaseCodec_h__
@@ -92,7 +92,7 @@ public:
protected:
virtual void ReallocateInputBuffer(UInt32 inInputBufferByteSize) = 0;
-
+
bool mIsInitialized;
// Format Management
@@ -102,13 +102,13 @@ public:
void GetCurrentInputFormat(AudioStreamBasicDescription& outInputFormat);
virtual void SetCurrentInputFormat(const AudioStreamBasicDescription& inInputFormat);
-
+
UInt32 GetNumberSupportedOutputFormats() const;
void GetSupportedOutputFormats(AudioStreamBasicDescription* outOutputFormats, UInt32& ioNumberOutputFormats) const;
-
+
void GetCurrentOutputFormat(AudioStreamBasicDescription& outOutputFormat);
virtual void SetCurrentOutputFormat(const AudioStreamBasicDescription& inOutputFormat);
-
+
virtual UInt32 GetMagicCookieByteSize() const;
virtual void GetMagicCookie(void* outMagicCookieData, UInt32& ioMagicCookieDataByteSize) const;
virtual void SetMagicCookie(const void* outMagicCookieData, UInt32 inMagicCookieDataByteSize);
@@ -119,11 +119,11 @@ public:
protected:
void AddInputFormat(const AudioStreamBasicDescription& inInputFormat);
void AddOutputFormat(const AudioStreamBasicDescription& inOutputFormat);
-
+
OSType GetSubType();
-
+
typedef std::vector<CAStreamBasicDescription> FormatList;
-
+
FormatList mInputFormatList;
#if TARGET_OS_WIN32
// VC 2005 screws up if this is not aligned to 8-byte boundaries
@@ -131,7 +131,7 @@ protected:
#else
CAStreamBasicDescription mInputFormat;
#endif
-
+
FormatList mOutputFormatList;
#if TARGET_OS_WIN32
// VC 2005 screws up if this is not aligned to 8-byte boundaries
diff --git a/libs/appleutility/CoreAudio/AudioCodecs/ACPublic/ACCodec.cpp b/libs/appleutility/CoreAudio/AudioCodecs/ACPublic/ACCodec.cpp
index 512f93842a..19cc0cd3da 100644
--- a/libs/appleutility/CoreAudio/AudioCodecs/ACPublic/ACCodec.cpp
+++ b/libs/appleutility/CoreAudio/AudioCodecs/ACPublic/ACCodec.cpp
@@ -2,14 +2,14 @@
File: ACCodec.cpp
Abstract: ACCodec.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,18 +83,18 @@ ACCodec::~ACCodec()
OSStatus ACCodec::ComponentEntryDispatch(ComponentParameters *inParameters, ACCodec *inThis)
{
OSStatus theError = kAudioCodecNoError;
-
+
try
{
switch (inParameters->what)
{
// these selectors don't use the object pointer
-
+
case kComponentOpenSelect:
case kComponentCloseSelect:
theError = ComponentBase::ComponentEntryDispatch(inParameters, inThis);
break;
-
+
case kComponentCanDoSelect:
{
switch (GetSelectorForCanDo(inParameters))
@@ -115,7 +115,7 @@ OSStatus ACCodec::ComponentEntryDispatch(ComponentParameters *inParameters, ACCo
}
}
break;
-
+
default:
// these selectors use the object pointer
if(inThis != NULL)
@@ -125,16 +125,16 @@ OSStatus ACCodec::ComponentEntryDispatch(ComponentParameters *inParameters, ACCo
case kComponentVersionSelect:
theError = inThis->Version();
break;
-
+
case kAudioCodecGetPropertyInfoSelect:
{
PARAM(AudioCodecPropertyID, inPropertyID, 0, 3);
PARAM(UInt32 *, outSize, 1, 3);
PARAM(Boolean *, outWritable, 2, 3);
-
+
UInt32 theSize = 0;
Boolean isWritable = false;
-
+
inThis->GetPropertyInfo(inPropertyID, theSize, isWritable);
if(outSize != NULL)
{
@@ -146,13 +146,13 @@ OSStatus ACCodec::ComponentEntryDispatch(ComponentParameters *inParameters, ACCo
}
}
break;
-
+
case kAudioCodecGetPropertySelect:
{
PARAM(AudioCodecPropertyID, inPropertyID, 0, 3);
PARAM(UInt32 *, ioPropertyDataSize, 1, 3);
PARAM(void *, outPropertyData, 2, 3);
-
+
if((ioPropertyDataSize != NULL) && (outPropertyData != NULL))
{
inThis->GetProperty(inPropertyID, *ioPropertyDataSize, outPropertyData);
@@ -163,13 +163,13 @@ OSStatus ACCodec::ComponentEntryDispatch(ComponentParameters *inParameters, ACCo
}
}
break;
-
+
case kAudioCodecSetPropertySelect:
{
PARAM(AudioCodecPropertyID, inPropertyID, 0, 3);
PARAM(UInt32, inPropertyDataSize, 1, 3);
PARAM(const void *, inPropertyData, 2, 3);
-
+
if(inPropertyData != NULL)
{
inThis->SetProperty(inPropertyID, inPropertyDataSize, inPropertyData);
@@ -180,31 +180,31 @@ OSStatus ACCodec::ComponentEntryDispatch(ComponentParameters *inParameters, ACCo
}
}
break;
-
+
case kAudioCodecInitializeSelect:
{
PARAM(const AudioStreamBasicDescription *, inInputFormat, 0, 4);
PARAM(const AudioStreamBasicDescription *, inOutputFormat, 1, 4);
PARAM(const void *, inMagicCookie, 2, 4);
PARAM(UInt32, inMagicCookieByteSize, 3, 4);
-
+
inThis->Initialize(inInputFormat, inOutputFormat, inMagicCookie, inMagicCookieByteSize);
}
break;
-
+
case kAudioCodecUninitializeSelect:
{
inThis->Uninitialize();
}
break;
-
+
case kAudioCodecAppendInputDataSelect:
{
PARAM(const void *, inInputData, 0, 4);
PARAM(UInt32 *, ioInputDataByteSize, 1, 4);
PARAM(UInt32 *, ioNumberPackets, 2, 4);
PARAM(const AudioStreamPacketDescription *, inPacketDescription, 3, 4);
-
+
if((inInputData != NULL) && (ioInputDataByteSize != NULL))
{
if(ioNumberPackets != NULL)
@@ -223,7 +223,7 @@ OSStatus ACCodec::ComponentEntryDispatch(ComponentParameters *inParameters, ACCo
}
}
break;
-
+
case kAudioCodecProduceOutputDataSelect:
{
PARAM(void *, outOutputData, 0, 5);
@@ -231,7 +231,7 @@ OSStatus ACCodec::ComponentEntryDispatch(ComponentParameters *inParameters, ACCo
PARAM(UInt32 *, ioNumberPackets, 2, 5);
PARAM(AudioStreamPacketDescription *, outPacketDescription, 3, 5);
PARAM(UInt32 *, outStatus, 4, 5);
-
+
if((outOutputData != NULL) && (ioOutputDataByteSize != NULL) && (ioNumberPackets != NULL) && (outStatus != NULL))
{
*outStatus = inThis->ProduceOutputPackets(outOutputData, *ioOutputDataByteSize, *ioNumberPackets, outPacketDescription);
@@ -246,7 +246,7 @@ OSStatus ACCodec::ComponentEntryDispatch(ComponentParameters *inParameters, ACCo
}
}
break;
-
+
#if AC_NON_INTERLEAVED_SUPPORT
case kAudioCodecAppendInputBufferListSelect:
{
@@ -254,7 +254,7 @@ OSStatus ACCodec::ComponentEntryDispatch(ComponentParameters *inParameters, ACCo
PARAM(UInt32 *, ioNumberPackets, 1, 4);
PARAM(const AudioStreamPacketDescription *, inPacketDescription, 2, 4);
PARAM(UInt32 *, outBytesConsumed, 3, 4);
-
+
if((inBufferList != NULL) && (outBytesConsumed != NULL))
{
if(ioNumberPackets != NULL)
@@ -273,14 +273,14 @@ OSStatus ACCodec::ComponentEntryDispatch(ComponentParameters *inParameters, ACCo
}
}
break;
-
+
case kAudioCodecProduceOutputBufferListSelect:
{
PARAM(AudioBufferList *, ioBufferList, 0, 4);
PARAM(UInt32 *, ioNumberPackets, 1, 4);
PARAM(AudioStreamPacketDescription *, outPacketDescription, 2, 4);
PARAM(UInt32 *, outStatus, 3, 4);
-
+
if((ioBufferList != NULL) && (ioNumberPackets != NULL) && (outStatus != NULL))
{
*outStatus = inThis->ProduceOutputBufferList(ioBufferList, *ioNumberPackets, outPacketDescription);
@@ -296,13 +296,13 @@ OSStatus ACCodec::ComponentEntryDispatch(ComponentParameters *inParameters, ACCo
}
break;
#endif // AC_NON_INTERLEAVED_SUPPORT
-
+
case kAudioCodecResetSelect:
{
inThis->Reset();
}
break;
-
+
default:
theError = badComponentSelector;
break;
@@ -323,7 +323,7 @@ OSStatus ACCodec::ComponentEntryDispatch(ComponentParameters *inParameters, ACCo
{
theError = kAudioCodecUnspecifiedError;
}
-
+
return theError;
}
#endif // !CA_USE_AUDIO_PLUGIN_ONLY && !TARGET_OS_IPHONE
diff --git a/libs/appleutility/CoreAudio/AudioCodecs/ACPublic/ACCodec.h b/libs/appleutility/CoreAudio/AudioCodecs/ACPublic/ACCodec.h
index b0d93165ab..9b7fecdb07 100644
--- a/libs/appleutility/CoreAudio/AudioCodecs/ACPublic/ACCodec.h
+++ b/libs/appleutility/CoreAudio/AudioCodecs/ACPublic/ACCodec.h
@@ -2,14 +2,14 @@
File: ACCodec.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(__ACCodec_h__)
#define __ACCodec_h__
@@ -75,7 +75,7 @@ class ACCodec : public ComponentBase
public:
ACCodec(AudioComponentInstance inInstance);
virtual ~ACCodec();
-
+
#if !CA_USE_AUDIO_PLUGIN_ONLY && !TARGET_OS_IPHONE
static OSStatus ComponentEntryDispatch(ComponentParameters *p, ACCodec *This);
#endif
@@ -91,10 +91,10 @@ public:
virtual void Initialize(const AudioStreamBasicDescription* inInputFormat, const AudioStreamBasicDescription* inOutputFormat, const void* inMagicCookie, UInt32 inMagicCookieByteSize) = 0;
virtual void Uninitialize() = 0;
virtual void Reset() = 0;
-
+
virtual void AppendInputData(const void* inInputData, UInt32& ioInputDataByteSize, UInt32& ioNumberPackets, const AudioStreamPacketDescription* inPacketDescription) = 0;
virtual void AppendInputBufferList(const AudioBufferList *ioBufferList, UInt32& ioNumberPackets, const AudioStreamPacketDescription *inPacketDescription, UInt32 *outBytesConsumed) = 0;
-
+
virtual UInt32 ProduceOutputPackets(void* outOutputData, UInt32& ioOutputDataByteSize, UInt32& ioNumberPackets, AudioStreamPacketDescription* outPacketDescription) = 0;
virtual UInt32 ProduceOutputBufferList(AudioBufferList *ioBufferList, UInt32& ioNumberPackets, AudioStreamPacketDescription *outPacketDescription) = 0;
diff --git a/libs/appleutility/CoreAudio/AudioCodecs/ACPublic/ACCodecDispatchTypes.h b/libs/appleutility/CoreAudio/AudioCodecs/ACPublic/ACCodecDispatchTypes.h
index 42c2bc5ba6..1969d744da 100644
--- a/libs/appleutility/CoreAudio/AudioCodecs/ACPublic/ACCodecDispatchTypes.h
+++ b/libs/appleutility/CoreAudio/AudioCodecs/ACPublic/ACCodecDispatchTypes.h
@@ -2,14 +2,14 @@
File: ACCodecDispatchTypes.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(__ACCodecDispatchTypes_h__)
#define __ACCodecDispatchTypes_h__
diff --git a/libs/appleutility/CoreAudio/AudioCodecs/ACPublic/ACConditionalMacros.h b/libs/appleutility/CoreAudio/AudioCodecs/ACPublic/ACConditionalMacros.h
index 2cff483fde..8d82d12390 100644
--- a/libs/appleutility/CoreAudio/AudioCodecs/ACPublic/ACConditionalMacros.h
+++ b/libs/appleutility/CoreAudio/AudioCodecs/ACPublic/ACConditionalMacros.h
@@ -2,14 +2,14 @@
File: ACConditionalMacros.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(__ACConditionalMacros_h__)
#define __ACConditionalMacros_h__
diff --git a/libs/appleutility/CoreAudio/AudioCodecs/ACPublic/ACPlugInDispatch.cpp b/libs/appleutility/CoreAudio/AudioCodecs/ACPublic/ACPlugInDispatch.cpp
index de9599b186..e2204b8be8 100644
--- a/libs/appleutility/CoreAudio/AudioCodecs/ACPublic/ACPlugInDispatch.cpp
+++ b/libs/appleutility/CoreAudio/AudioCodecs/ACPublic/ACPlugInDispatch.cpp
@@ -2,14 +2,14 @@
File: ACPlugInDispatch.cpp
Abstract: ACPlugInDispatch.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.
-
+
*/
#if AUDIOCODECS_SUPPORT_PLUGINS
#include "ACPlugInDispatch.h"
@@ -242,10 +242,10 @@ AudioComponentMethod AudioCodecNonInterleavedEncoderLookup::Lookup (SInt16 selec
AudioComponentMethod method = AudioCodecLookup::Lookup(selector);
if (method)
return method;
-
+
if (selector == kAudioCodecAppendInputBufferListSelect)
return (AudioComponentMethod)AppendInputBufferList;
-
+
return NULL;
}
@@ -254,10 +254,10 @@ AudioComponentMethod AudioCodecNonInterleavedDecoderLookup::Lookup (SInt16 selec
AudioComponentMethod method = AudioCodecLookup::Lookup(selector);
if (method)
return method;
-
+
if (selector == kAudioCodecProduceOutputBufferListSelect)
return (AudioComponentMethod)ProduceOutputBufferList;
-
+
return NULL;
}
#endif
@@ -269,14 +269,14 @@ AudioComponentMethod AudioCodecHWCodecLookup::Lookup (SInt16 selector)
{
AudioComponentMethod method = AudioCodecLookup::Lookup(selector);
if (method) return method;
-
+
switch (selector) {
case kAudioCodecAcquireHardwareSelect: return (AudioComponentMethod)AcquireHardware;
case kAudioCodecReleaseHardwareSelect: return (AudioComponentMethod)ReleaseHardware;
default:
break;
}
- return NULL;
+ return NULL;
}
#endif // TARGET_OS_IPHONE && AUDIOCONV_HAVE_AMC
diff --git a/libs/appleutility/CoreAudio/AudioCodecs/ACPublic/ACPlugInDispatch.h b/libs/appleutility/CoreAudio/AudioCodecs/ACPublic/ACPlugInDispatch.h
index 252a4af0aa..7c84cac70a 100644
--- a/libs/appleutility/CoreAudio/AudioCodecs/ACPublic/ACPlugInDispatch.h
+++ b/libs/appleutility/CoreAudio/AudioCodecs/ACPublic/ACPlugInDispatch.h
@@ -2,14 +2,14 @@
File: ACPlugInDispatch.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 __ACPlugInDispatch_h__
#define __ACPlugInDispatch_h__
diff --git a/libs/appleutility/CoreAudio/AudioCodecs/ACPublic/ACSimpleCodec.cpp b/libs/appleutility/CoreAudio/AudioCodecs/ACPublic/ACSimpleCodec.cpp
index b10add9dac..bc78a15b67 100644
--- a/libs/appleutility/CoreAudio/AudioCodecs/ACPublic/ACSimpleCodec.cpp
+++ b/libs/appleutility/CoreAudio/AudioCodecs/ACPublic/ACSimpleCodec.cpp
@@ -2,14 +2,14 @@
File: ACSimpleCodec.cpp
Abstract: ACSimpleCodec.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,8 +81,8 @@ void ACSimpleCodec::Initialize(const AudioStreamBasicDescription* inInputFormat,
if (mInputFormat.mBytesPerPacket == 0)
{
CODEC_THROW(kAudioCodecUnsupportedFormatError);
- }
-
+ }
+
ACBaseCodec::Initialize(inInputFormat, inOutputFormat, inMagicCookie, inMagicCookieByteSize);
}
@@ -91,11 +91,11 @@ void ACSimpleCodec::Uninitialize()
// get rid of the buffer
delete[] mInputBuffer;
mInputBuffer = NULL;
-
+
// reset the ring buffer state
mInputBufferStart = 0;
mInputBufferEnd = 0;
-
+
ACBaseCodec::Uninitialize();
}
@@ -105,11 +105,11 @@ void ACSimpleCodec::Reset()
if (mInputBuffer) { // could be called before allocated.
memset(mInputBuffer, 0, mInputBufferByteSize);
}
-
+
// reset the ring buffer state
mInputBufferStart = 0;
mInputBufferEnd = 0;
-
+
ACBaseCodec::Reset();
}
@@ -121,7 +121,7 @@ UInt32 ACSimpleCodec::GetInputBufferByteSize() const
UInt32 ACSimpleCodec::GetUsedInputBufferByteSize() const
{
UInt32 theAnswer = 0;
-
+
// this object uses a ring buffer
if(mInputBufferStart <= mInputBufferEnd)
{
@@ -130,10 +130,10 @@ UInt32 ACSimpleCodec::GetUsedInputBufferByteSize() const
}
else
{
- // the active region wraps around
+ // the active region wraps around
theAnswer = (mInputBufferByteSize - mInputBufferStart) + mInputBufferEnd;
}
-
+
return theAnswer;
}
@@ -142,7 +142,7 @@ void ACSimpleCodec::AppendInputData(const void* inInputData, UInt32& ioInputData
{
// this buffer handling code doesn't care about such things as the packet descriptions
if(!mIsInitialized) CODEC_THROW(kAudioCodecStateError);
-
+
// this is a ring buffer we're dealing with, so we need to set up a few things
UInt32 theUsedByteSize = GetUsedInputBufferByteSize();
UInt32 theAvailableByteSize = GetInputBufferByteSize() - theUsedByteSize;
@@ -150,51 +150,51 @@ void ACSimpleCodec::AppendInputData(const void* inInputData, UInt32& ioInputData
UInt32 theMaxAvailableInputBytes = ioInputDataByteSize; // we can't consume more than we get
const Byte* theInputData = static_cast<const Byte*>(inInputData);
-
+
// >>jamesmcc: added this because ioNumberPackets was not being updated if less was taken than given.
// THIS ASSUMES CBR!
UInt32 bytesPerPacketOfInput = mInputFormat.mBytesPerPacket;
UInt32 theAvailablePacketSize = theAvailableByteSize / bytesPerPacketOfInput;
-
+
UInt32 minPacketSize = ioNumberPackets < theAvailablePacketSize ? ioNumberPackets : theAvailablePacketSize;
UInt32 minByteSize = minPacketSize * bytesPerPacketOfInput;
-
+
// we can copy only as much data as there is or up to how much space is availiable
ioNumberPackets = minPacketSize;
ioInputDataByteSize = minByteSize;
-
+
// ioInputDataByteSize had better be <= to theMaxAvailableInputBytes or we're screwed
if (ioInputDataByteSize > theMaxAvailableInputBytes)
{
CODEC_THROW(kAudioCodecStateError);
}
- // <<jamesmcc
-
+ // <<jamesmcc
+
// now we have to copy the data taking into account the wrap around and where the start is
if(mInputBufferEnd + ioInputDataByteSize < mInputBufferByteSize)
{
// no wrap around here
memcpy(mInputBuffer + mInputBufferEnd, theInputData, ioInputDataByteSize);
-
+
// adjust the end point
mInputBufferEnd += ioInputDataByteSize;
}
else
{
// the copy will wrap
-
+
// copy the first part
UInt32 theBeforeWrapByteSize = mInputBufferByteSize - mInputBufferEnd;
memcpy(mInputBuffer + mInputBufferEnd, theInputData, theBeforeWrapByteSize);
-
+
// and the rest
UInt32 theAfterWrapByteSize = ioInputDataByteSize - theBeforeWrapByteSize;
memcpy(mInputBuffer, theInputData + theBeforeWrapByteSize, theAfterWrapByteSize);
-
+
// adjust the end point
mInputBufferEnd = theAfterWrapByteSize;
}
-
+
}
@@ -202,46 +202,46 @@ void ACSimpleCodec::ZeroPadInputData(UInt32& ioNumberPackets, const AudioStreamP
{
// this buffer handling code doesn't care about such things as the packet descriptions
if(!mIsInitialized) CODEC_THROW(kAudioCodecStateError);
-
-
+
+
// this is a ring buffer we're dealing with, so we need to set up a few things
UInt32 theUsedByteSize = GetUsedInputBufferByteSize();
UInt32 theAvailableByteSize = GetInputBufferByteSize() - theUsedByteSize;
-
+
// >>jamesmcc: added this because ioNumberPackets was not being updated if less was taken than given.
// THIS ASSUMES CBR!
UInt32 bytesPerPacketOfInput = mInputFormat.mBytesPerPacket;
UInt32 theAvailablePacketSize = theAvailableByteSize / bytesPerPacketOfInput;
-
+
UInt32 minPacketSize = ioNumberPackets < theAvailablePacketSize ? ioNumberPackets : theAvailablePacketSize;
UInt32 minByteSize = minPacketSize * bytesPerPacketOfInput;
-
+
// we can copy only as much data as there is or up to how much space is availiable
ioNumberPackets = minPacketSize;
-
- // <<jamesmcc
-
+
+ // <<jamesmcc
+
// now we have to copy the data taking into account the wrap around and where the start is
if(mInputBufferEnd + minByteSize < mInputBufferByteSize)
{
// no wrap around here
memset(mInputBuffer + mInputBufferEnd, 0, minByteSize);
-
+
// adjust the end point
mInputBufferEnd += minByteSize;
}
else
{
// the copy will wrap
-
+
// copy the first part
UInt32 theBeforeWrapByteSize = mInputBufferByteSize - mInputBufferEnd;
memset(mInputBuffer + mInputBufferEnd, 0, theBeforeWrapByteSize);
-
+
// and the rest
UInt32 theAfterWrapByteSize = minByteSize - theBeforeWrapByteSize;
memset(mInputBuffer, 0, theAfterWrapByteSize);
-
+
// adjust the end point
mInputBufferEnd = theAfterWrapByteSize;
}
@@ -252,32 +252,32 @@ void ACSimpleCodec::ConsumeInputData(UInt32 inConsumedByteSize)
{
// this is a convenience routine to make maintaining the ring buffer state easy
UInt32 theContiguousRange = GetInputBufferContiguousByteSize();
-
+
if(inConsumedByteSize > GetUsedInputBufferByteSize()) CODEC_THROW(kAudioCodecUnspecifiedError);
-
+
if(inConsumedByteSize <= theContiguousRange)
{
// the region to consume doesn't wrap
-
+
// figure out how much to consume
inConsumedByteSize = (theContiguousRange < inConsumedByteSize) ? theContiguousRange : inConsumedByteSize;
-
+
// clear the consumed bits
memset(mInputBuffer + mInputBufferStart, 0, inConsumedByteSize);
-
+
// adjust the start
mInputBufferStart += inConsumedByteSize;
}
else
{
// the region to consume will wrap
-
+
// clear the bits to the end of the buffer
memset(mInputBuffer + mInputBufferStart, 0, theContiguousRange);
-
+
// now clear the bits left from the start
memset(mInputBuffer, 0, inConsumedByteSize - theContiguousRange);
-
+
// adjust the start
mInputBufferStart = inConsumedByteSize - theContiguousRange;
}
@@ -287,24 +287,24 @@ void ACSimpleCodec::ConsumeInputData(UInt32 inConsumedByteSize)
Byte* ACSimpleCodec::GetBytes(UInt32& ioNumberBytes) const
{
// if a client's algorithm has to have contiguous data and mInputBuffer wraps, then someone has to make a copy.
- // I can do it more efficiently than the client.
-
+ // I can do it more efficiently than the client.
+
if(!mIsInitialized) CODEC_THROW(kAudioCodecStateError);
UInt32 theUsedByteSize = GetUsedInputBufferByteSize();
//UInt32 theAvailableByteSize = GetInputBufferByteSize() - theUsedByteSize;
-
+
if (ioNumberBytes > theUsedByteSize) ioNumberBytes = theUsedByteSize;
-
+
SInt32 leftOver = mInputBufferStart + ioNumberBytes - mInputBufferByteSize;
-
+
if(leftOver > 0)
{
- // need to copy beginning of buffer to the end.
+ // need to copy beginning of buffer to the end.
// We cleverly over allocated our buffer space to make this possible.
memmove(mInputBuffer + mInputBufferByteSize, mInputBuffer, leftOver);
}
-
+
return GetInputBufferStart();
}
@@ -312,17 +312,17 @@ Byte* ACSimpleCodec::GetBytes(UInt32& ioNumberBytes) const
void ACSimpleCodec::ReallocateInputBuffer(UInt32 inInputBufferByteSize)
{
mInputBufferByteSize = inInputBufferByteSize + kBufferPad;
-
+
// toss the old buffer
delete[] mInputBuffer;
mInputBuffer = NULL;
-
+
// allocate the new one
// allocate extra in order to allow making contiguous data.
UInt32 allocSize = 2*inInputBufferByteSize + kBufferPad;
mInputBuffer = new Byte[allocSize];
memset(mInputBuffer, 0, allocSize);
-
+
// reset the ring buffer state
mInputBufferStart = 0;
mInputBufferEnd = 0;
@@ -359,6 +359,6 @@ void ACSimpleCodec::SetProperty(AudioCodecPropertyID inPropertyID, UInt32 inProp
break;
default:
ACBaseCodec::SetProperty(inPropertyID, inPropertyDataSize, inPropertyData);
- break;
+ break;
}
}
diff --git a/libs/appleutility/CoreAudio/AudioCodecs/ACPublic/ACSimpleCodec.h b/libs/appleutility/CoreAudio/AudioCodecs/ACPublic/ACSimpleCodec.h
index f41fe54b93..f8b5d0f0be 100644
--- a/libs/appleutility/CoreAudio/AudioCodecs/ACPublic/ACSimpleCodec.h
+++ b/libs/appleutility/CoreAudio/AudioCodecs/ACPublic/ACSimpleCodec.h
@@ -2,14 +2,14 @@
File: ACSimpleCodec.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(__ACSimpleCodec_h__)
#define __ACSimpleCodec_h__
@@ -84,17 +84,17 @@ public:
virtual void SetProperty(AudioCodecPropertyID inPropertyID, UInt32 inPropertyDataSize, const void* inPropertyData);
protected:
- void ConsumeInputData(UInt32 inConsumedByteSize);
+ void ConsumeInputData(UInt32 inConsumedByteSize);
Byte* GetInputBufferStart() const { return mInputBuffer + mInputBufferStart; }
UInt32 GetInputBufferContiguousByteSize() const { return (mInputBufferStart <= mInputBufferEnd) ? (mInputBufferEnd - mInputBufferStart) : (mInputBufferByteSize - mInputBufferStart); }
virtual void ReallocateInputBuffer(UInt32 inInputBufferByteSize);
-
- // returns a pointer to contiguous bytes.
+
+ // returns a pointer to contiguous bytes.
// will do some copying if the request wraps around the internal buffer.
// request must be less than available bytes
Byte* GetBytes(UInt32& ioNumberBytes) const;
-private:
+private:
Byte* mInputBuffer;
UInt32 mInputBufferByteSize;
UInt32 mInputBufferStart;
diff --git a/libs/appleutility/CoreAudio/AudioCodecs/ACPublic/GetCodecBundle.cpp b/libs/appleutility/CoreAudio/AudioCodecs/ACPublic/GetCodecBundle.cpp
index 8954c8dd56..f0b0ef9b15 100644
--- a/libs/appleutility/CoreAudio/AudioCodecs/ACPublic/GetCodecBundle.cpp
+++ b/libs/appleutility/CoreAudio/AudioCodecs/ACPublic/GetCodecBundle.cpp
@@ -2,14 +2,14 @@
File: GetCodecBundle.cpp
Abstract: GetCodecBundle.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 "GetCodecBundle.h"
@@ -59,7 +59,7 @@ const CFStringRef kCodecBundleID = CFSTR("com.apple.audio.codecs.Components");
CFBundleRef GetCodecBundle()
{
static CFBundleRef sAudioCodecBundle = 0;
- if (!sAudioCodecBundle)
+ if (!sAudioCodecBundle)
{
#if TARGET_OS_WIN32
sAudioCodecBundle = CFBundleGetBundleWithIdentifier(CFSTR(kCodecBundleID));
diff --git a/libs/appleutility/CoreAudio/AudioCodecs/ACPublic/GetCodecBundle.h b/libs/appleutility/CoreAudio/AudioCodecs/ACPublic/GetCodecBundle.h
index 96e3d9e2b4..f6c501a347 100644
--- a/libs/appleutility/CoreAudio/AudioCodecs/ACPublic/GetCodecBundle.h
+++ b/libs/appleutility/CoreAudio/AudioCodecs/ACPublic/GetCodecBundle.h
@@ -2,14 +2,14 @@
File: GetCodecBundle.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 _GetCodecBundle_
#define _GetCodecBundle_
diff --git a/libs/appleutility/CoreAudio/AudioFile/AFPublic/AudioFileComponentBase.cpp b/libs/appleutility/CoreAudio/AudioFile/AFPublic/AudioFileComponentBase.cpp
index 053da0a5d0..4bbc0d6529 100644
--- a/libs/appleutility/CoreAudio/AudioFile/AFPublic/AudioFileComponentBase.cpp
+++ b/libs/appleutility/CoreAudio/AudioFile/AFPublic/AudioFileComponentBase.cpp
@@ -2,14 +2,14 @@
File: AudioFileComponentBase.cpp
Abstract: AudioFileComponentBase.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.
-
+
*/
#if !defined(__COREAUDIO_USE_FLAT_INCLUDES__)
#include <AudioToolbox/AudioFileComponent.h>
@@ -84,8 +84,8 @@ static OSStatus CreateURL(
static OSStatus OpenURL(
void * self,
- CFURLRef inFileRef,
- SInt8 inPermissions,
+ CFURLRef inFileRef,
+ SInt8 inPermissions,
int inFileDescriptor)
{
return AFC->AFAPI_OpenURL(inFileRef, inPermissions, inFileDescriptor);
@@ -93,9 +93,9 @@ static OSStatus OpenURL(
static OSStatus OpenWithCallbacks(
void * self,
- void * inRefCon,
- AudioFile_ReadProc inReadFunc,
- AudioFile_WriteProc inWriteFunc,
+ void * inRefCon,
+ AudioFile_ReadProc inReadFunc,
+ AudioFile_WriteProc inWriteFunc,
AudioFile_GetSizeProc inGetSizeFunc,
AudioFile_SetSizeProc inSetSizeFunc)
{
@@ -104,9 +104,9 @@ static OSStatus OpenWithCallbacks(
static OSStatus InitializeWithCallbacks(
void * self,
- void * inRefCon,
- AudioFile_ReadProc inReadFunc,
- AudioFile_WriteProc inWriteFunc,
+ void * inRefCon,
+ AudioFile_ReadProc inReadFunc,
+ AudioFile_WriteProc inWriteFunc,
AudioFile_GetSizeProc inGetSizeFunc,
AudioFile_SetSizeProc inSetSizeFunc,
UInt32 inFileType,
@@ -131,8 +131,8 @@ static OSStatus Optimize(
static OSStatus ReadBytes(
void * self,
Boolean inUseCache,
- SInt64 inStartingByte,
- UInt32 *ioNumBytes,
+ SInt64 inStartingByte,
+ UInt32 *ioNumBytes,
void *outBuffer)
{
return AFC->AFAPI_ReadBytes(inUseCache, inStartingByte, ioNumBytes, outBuffer);
@@ -142,8 +142,8 @@ static OSStatus ReadBytes(
static OSStatus WriteBytes(
void * self,
Boolean inUseCache,
- SInt64 inStartingByte,
- UInt32 *ioNumBytes,
+ SInt64 inStartingByte,
+ UInt32 *ioNumBytes,
const void *inBuffer)
{
return AFC->AFAPI_WriteBytes(inUseCache, inStartingByte, ioNumBytes, inBuffer);
@@ -155,11 +155,11 @@ static OSStatus ReadPackets(
Boolean inUseCache,
UInt32 *outNumBytes,
AudioStreamPacketDescription *outPacketDescriptions,
- SInt64 inStartingPacket,
- UInt32 *ioNumPackets,
+ SInt64 inStartingPacket,
+ UInt32 *ioNumPackets,
void *outBuffer)
{
- return AFC->AFAPI_ReadPackets(inUseCache, outNumBytes, outPacketDescriptions,
+ return AFC->AFAPI_ReadPackets(inUseCache, outNumBytes, outPacketDescriptions,
inStartingPacket, ioNumPackets, outBuffer);
}
@@ -168,11 +168,11 @@ static OSStatus ReadPacketData(
Boolean inUseCache,
UInt32 *ioNumBytes,
AudioStreamPacketDescription *outPacketDescriptions,
- SInt64 inStartingPacket,
- UInt32 *ioNumPackets,
+ SInt64 inStartingPacket,
+ UInt32 *ioNumPackets,
void *outBuffer)
{
- return AFC->AFAPI_ReadPacketData(inUseCache, ioNumBytes, outPacketDescriptions,
+ return AFC->AFAPI_ReadPacketData(inUseCache, ioNumBytes, outPacketDescriptions,
inStartingPacket, ioNumPackets, outBuffer);
}
@@ -182,8 +182,8 @@ static OSStatus WritePackets(
Boolean inUseCache,
UInt32 inNumBytes,
AudioStreamPacketDescription *inPacketDescriptions,
- SInt64 inStartingPacket,
- UInt32 *ioNumPackets,
+ SInt64 inStartingPacket,
+ UInt32 *ioNumPackets,
const void *inBuffer)
#else
static OSStatus WritePackets(
@@ -191,12 +191,12 @@ static OSStatus WritePackets(
Boolean inUseCache,
UInt32 inNumBytes,
const AudioStreamPacketDescription *inPacketDescriptions,
- SInt64 inStartingPacket,
- UInt32 *ioNumPackets,
+ SInt64 inStartingPacket,
+ UInt32 *ioNumPackets,
const void *inBuffer)
#endif
{
- return AFC->AFAPI_WritePackets(inUseCache, inNumBytes,
+ return AFC->AFAPI_WritePackets(inUseCache, inNumBytes,
(const AudioStreamPacketDescription *)inPacketDescriptions, // this should be const (and is in 10.5 headers)
inStartingPacket, ioNumPackets, inBuffer);
}
@@ -281,7 +281,7 @@ static OSStatus ExtensionIsThisFormat(
{
AudioFileFormatBase* aff = AFC->GetAudioFileFormatBase();
if (!aff) return kAudio_ParamError;
-
+
UInt32 res = aff->ExtensionIsThisFormat(inExtension);
if (outResult) *outResult = res;
return noErr;
@@ -289,13 +289,13 @@ static OSStatus ExtensionIsThisFormat(
static OSStatus FileDataIsThisFormat(
void * self,
- UInt32 inDataByteSize,
+ UInt32 inDataByteSize,
const void* inData,
UInt32 *outResult)
{
AudioFileFormatBase* aff = AFC->GetAudioFileFormatBase();
if (!aff) return kAudio_ParamError;
-
+
UncertainResult res = aff->FileDataIsThisFormat(inDataByteSize, inData);
if (outResult) *outResult = res;
return noErr;
@@ -346,33 +346,33 @@ AudioFileObjectComponentBase::~AudioFileObjectComponentBase()
}
OSStatus AudioFileObjectComponentBase::AFAPI_CreateURL(
- CFURLRef inFileRef,
+ CFURLRef inFileRef,
const AudioStreamBasicDescription *inFormat,
UInt32 inFlags)
{
if (!mAudioFileObject) return kAudio_ParamError;
-
+
OSStatus result = mAudioFileObject->DoCreate (inFileRef, inFormat, inFlags);
return result;
}
-
+
OSStatus AudioFileObjectComponentBase::AFAPI_OpenURL(
- CFURLRef inFileRef,
+ CFURLRef inFileRef,
SInt8 inPermissions,
int inFD)
{
if (!mAudioFileObject) return kAudio_ParamError;
-
+
OSStatus result = mAudioFileObject->DoOpen(inFileRef, inPermissions, inFD);
return result;
}
OSStatus AudioFileObjectComponentBase::AFAPI_OpenWithCallbacks(
- void * inRefCon,
- AudioFile_ReadProc inReadFunc,
- AudioFile_WriteProc inWriteFunc,
+ void * inRefCon,
+ AudioFile_ReadProc inReadFunc,
+ AudioFile_WriteProc inWriteFunc,
AudioFile_GetSizeProc inGetSizeFunc,
AudioFile_SetSizeProc inSetSizeFunc)
{
@@ -382,9 +382,9 @@ OSStatus AudioFileObjectComponentBase::AFAPI_OpenWithCallbacks(
OSStatus AudioFileObjectComponentBase::AFAPI_InitializeWithCallbacks(
- void * inRefCon,
- AudioFile_ReadProc inReadFunc,
- AudioFile_WriteProc inWriteFunc,
+ void * inRefCon,
+ AudioFile_ReadProc inReadFunc,
+ AudioFile_WriteProc inWriteFunc,
AudioFile_GetSizeProc inGetSizeFunc,
AudioFile_SetSizeProc inSetSizeFunc,
UInt32 inFileType,
@@ -392,11 +392,11 @@ OSStatus AudioFileObjectComponentBase::AFAPI_InitializeWithCallbacks(
UInt32 inFlags)
{
if (!mAudioFileObject) return kAudio_ParamError;
- return mAudioFileObject->DoInitializeWithCallbacks(inRefCon, inReadFunc, inWriteFunc, inGetSizeFunc, inSetSizeFunc,
+ return mAudioFileObject->DoInitializeWithCallbacks(inRefCon, inReadFunc, inWriteFunc, inGetSizeFunc, inSetSizeFunc,
inFileType, inFormat, inFlags);
}
-
+
OSStatus AudioFileObjectComponentBase::AFAPI_Close()
{
if (!mAudioFileObject) return kAudio_ParamError;
@@ -409,10 +409,10 @@ OSStatus AudioFileObjectComponentBase::AFAPI_Optimize()
return mAudioFileObject->DoOptimize();
}
-OSStatus AudioFileObjectComponentBase::AFAPI_ReadBytes(
+OSStatus AudioFileObjectComponentBase::AFAPI_ReadBytes(
Boolean inUseCache,
- SInt64 inStartingByte,
- UInt32 *ioNumBytes,
+ SInt64 inStartingByte,
+ UInt32 *ioNumBytes,
void *outBuffer)
{
if (!mAudioFileObject) return kAudio_ParamError;
@@ -420,10 +420,10 @@ OSStatus AudioFileObjectComponentBase::AFAPI_ReadBytes(
}
-OSStatus AudioFileObjectComponentBase::AFAPI_WriteBytes(
+OSStatus AudioFileObjectComponentBase::AFAPI_WriteBytes(
Boolean inUseCache,
- SInt64 inStartingByte,
- UInt32 *ioNumBytes,
+ SInt64 inStartingByte,
+ UInt32 *ioNumBytes,
const void *inBuffer)
{
if (!mAudioFileObject) return kAudio_ParamError;
@@ -433,12 +433,12 @@ OSStatus AudioFileObjectComponentBase::AFAPI_WriteBytes(
-OSStatus AudioFileObjectComponentBase::AFAPI_ReadPackets(
+OSStatus AudioFileObjectComponentBase::AFAPI_ReadPackets(
Boolean inUseCache,
UInt32 *outNumBytes,
AudioStreamPacketDescription *outPacketDescriptions,
- SInt64 inStartingPacket,
- UInt32 *ioNumPackets,
+ SInt64 inStartingPacket,
+ UInt32 *ioNumPackets,
void *outBuffer)
{
if (!mAudioFileObject) return kAudio_ParamError;
@@ -446,12 +446,12 @@ OSStatus AudioFileObjectComponentBase::AFAPI_ReadPackets(
inStartingPacket, ioNumPackets, outBuffer);
}
-OSStatus AudioFileObjectComponentBase::AFAPI_ReadPacketData(
+OSStatus AudioFileObjectComponentBase::AFAPI_ReadPacketData(
Boolean inUseCache,
UInt32 *ioNumBytes,
AudioStreamPacketDescription *outPacketDescriptions,
- SInt64 inStartingPacket,
- UInt32 *ioNumPackets,
+ SInt64 inStartingPacket,
+ UInt32 *ioNumPackets,
void *outBuffer)
{
if (!mAudioFileObject) return kAudio_ParamError;
@@ -459,13 +459,13 @@ OSStatus AudioFileObjectComponentBase::AFAPI_ReadPacketData(
inStartingPacket, ioNumPackets, outBuffer);
}
-
-OSStatus AudioFileObjectComponentBase::AFAPI_WritePackets(
+
+OSStatus AudioFileObjectComponentBase::AFAPI_WritePackets(
Boolean inUseCache,
UInt32 inNumBytes,
const AudioStreamPacketDescription *inPacketDescriptions,
- SInt64 inStartingPacket,
- UInt32 *ioNumPackets,
+ SInt64 inStartingPacket,
+ UInt32 *ioNumPackets,
const void *inBuffer)
{
if (!mAudioFileObject) return kAudio_ParamError;
@@ -474,8 +474,8 @@ OSStatus AudioFileObjectComponentBase::AFAPI_WritePackets(
}
-
-OSStatus AudioFileObjectComponentBase::AFAPI_GetPropertyInfo(
+
+OSStatus AudioFileObjectComponentBase::AFAPI_GetPropertyInfo(
AudioFilePropertyID inPropertyID,
UInt32 *outDataSize,
UInt32 *isWritable)
@@ -484,23 +484,23 @@ OSStatus AudioFileObjectComponentBase::AFAPI_GetPropertyInfo(
return mAudioFileObject->GetPropertyInfo(inPropertyID, outDataSize, isWritable);
}
-
-OSStatus AudioFileObjectComponentBase::AFAPI_GetProperty(
+
+OSStatus AudioFileObjectComponentBase::AFAPI_GetProperty(
AudioFilePropertyID inPropertyID,
UInt32 *ioPropertySize,
void *ioPropertyData)
{
OSStatus err = noErr;
-
+
if (!ioPropertyData) return kAudio_ParamError;
-
+
if (!mAudioFileObject) return kAudio_ParamError;
err = mAudioFileObject->GetProperty(inPropertyID, ioPropertySize, ioPropertyData);
return err;
}
-
-OSStatus AudioFileObjectComponentBase::AFAPI_SetProperty(
+
+OSStatus AudioFileObjectComponentBase::AFAPI_SetProperty(
AudioFilePropertyID inPropertyID,
UInt32 inPropertySize,
const void *inPropertyData)
@@ -510,7 +510,7 @@ OSStatus AudioFileObjectComponentBase::AFAPI_SetProperty(
}
-OSStatus AudioFileObjectComponentBase::AFAPI_CountUserData(
+OSStatus AudioFileObjectComponentBase::AFAPI_CountUserData(
UInt32 inUserDataID,
UInt32 *outNumberItems)
{
@@ -518,7 +518,7 @@ OSStatus AudioFileObjectComponentBase::AFAPI_CountUserData(
return mAudioFileObject->CountUserData(inUserDataID, outNumberItems);
}
-OSStatus AudioFileObjectComponentBase::AFAPI_GetUserDataSize(
+OSStatus AudioFileObjectComponentBase::AFAPI_GetUserDataSize(
UInt32 inUserDataID,
UInt32 inIndex,
UInt32 *outUserDataSize)
@@ -527,7 +527,7 @@ OSStatus AudioFileObjectComponentBase::AFAPI_GetUserDataSize(
return mAudioFileObject->GetUserDataSize(inUserDataID, inIndex, outUserDataSize);
}
-OSStatus AudioFileObjectComponentBase::AFAPI_GetUserData(
+OSStatus AudioFileObjectComponentBase::AFAPI_GetUserData(
UInt32 inUserDataID,
UInt32 inIndex,
UInt32 *ioUserDataSize,
@@ -537,7 +537,7 @@ OSStatus AudioFileObjectComponentBase::AFAPI_GetUserData(
return mAudioFileObject->GetUserData(inUserDataID, inIndex, ioUserDataSize, outUserData);
}
-OSStatus AudioFileObjectComponentBase::AFAPI_SetUserData(
+OSStatus AudioFileObjectComponentBase::AFAPI_SetUserData(
UInt32 inUserDataID,
UInt32 inIndex,
UInt32 inUserDataSize,
@@ -547,7 +547,7 @@ OSStatus AudioFileObjectComponentBase::AFAPI_SetUserData(
return mAudioFileObject->SetUserData(inUserDataID, inIndex, inUserDataSize, inUserData);
}
-OSStatus AudioFileObjectComponentBase::AFAPI_RemoveUserData(
+OSStatus AudioFileObjectComponentBase::AFAPI_RemoveUserData(
UInt32 inUserDataID,
UInt32 inIndex)
{
@@ -556,14 +556,14 @@ OSStatus AudioFileObjectComponentBase::AFAPI_RemoveUserData(
}
-OSStatus AudioFileComponentBase::AFAPI_GetGlobalInfoSize(
+OSStatus AudioFileComponentBase::AFAPI_GetGlobalInfoSize(
AudioFilePropertyID inPropertyID,
UInt32 inSpecifierSize,
const void* inSpecifier,
UInt32 *outPropertySize)
{
OSStatus err = noErr;
-
+
switch (inPropertyID)
{
case kAudioFileComponent_CanRead :
@@ -578,15 +578,15 @@ OSStatus AudioFileComponentBase::AFAPI_GetGlobalInfoSize(
case kAudioFileComponent_ExtensionsForType :
*outPropertySize = sizeof(CFArrayRef);
break;
-
+
case kAudioFileComponent_UTIsForType :
*outPropertySize = sizeof(CFArrayRef);
break;
-
+
case kAudioFileComponent_MIMETypesForType :
*outPropertySize = sizeof(CFArrayRef);
break;
-
+
case kAudioFileComponent_AvailableFormatIDs :
{
UInt32 size = 0xFFFFFFFF;
@@ -608,7 +608,7 @@ OSStatus AudioFileComponentBase::AFAPI_GetGlobalInfoSize(
err = GetAudioFileFormatBase()->GetAvailableStreamDescriptions(inFormatID, outPropertySize, NULL);
}
break;
-
+
default:
err = kAudioFileUnsupportedPropertyError;
}
@@ -616,7 +616,7 @@ OSStatus AudioFileComponentBase::AFAPI_GetGlobalInfoSize(
}
-OSStatus AudioFileComponentBase::AFAPI_GetGlobalInfo(
+OSStatus AudioFileComponentBase::AFAPI_GetGlobalInfo(
AudioFilePropertyID inPropertyID,
UInt32 inSpecifierSize,
const void* inSpecifier,
@@ -624,9 +624,9 @@ OSStatus AudioFileComponentBase::AFAPI_GetGlobalInfo(
void *ioPropertyData)
{
OSStatus err = noErr;
-
+
if (!ioPropertyData || !ioPropertySize) return kAudio_ParamError;
-
+
switch (inPropertyID)
{
case kAudioFileComponent_CanRead :
@@ -636,7 +636,7 @@ OSStatus AudioFileComponentBase::AFAPI_GetGlobalInfo(
*flag = GetAudioFileFormatBase()->CanRead();
}
break;
-
+
case kAudioFileComponent_CanWrite :
{
if (*ioPropertySize != sizeof(UInt32)) return kAudioFileBadPropertySizeError;
@@ -644,7 +644,7 @@ OSStatus AudioFileComponentBase::AFAPI_GetGlobalInfo(
*flag = GetAudioFileFormatBase()->CanWrite();
}
break;
-
+
case kAudioFileComponent_FileTypeName :
{
if (*ioPropertySize != sizeof(CFStringRef)) return kAudioFileBadPropertySizeError;
@@ -682,21 +682,21 @@ OSStatus AudioFileComponentBase::AFAPI_GetGlobalInfo(
err = GetAudioFileFormatBase()->GetHFSCodes(ioPropertySize, ioPropertyData);
}
break;
-
+
case kAudioFileComponent_AvailableFormatIDs :
{
err = GetAudioFileFormatBase()->GetAvailableFormatIDs(ioPropertySize, ioPropertyData);
}
break;
-
+
case kAudioFileComponent_AvailableStreamDescriptionsForFormat :
{
if (inSpecifierSize != sizeof(UInt32)) return kAudioFileBadPropertySizeError;
- UInt32 inFormatID = *(UInt32*)inSpecifier;
+ UInt32 inFormatID = *(UInt32*)inSpecifier;
err = GetAudioFileFormatBase()->GetAvailableStreamDescriptions(inFormatID, ioPropertySize, ioPropertyData);
}
break;
-
+
default:
err = kAudioFileUnsupportedPropertyError;
}
@@ -709,11 +709,11 @@ OSStatus AudioFileComponentBase::ComponentEntryDispatch(ComponentParameters* par
{
OSStatus result = noErr;
if (inThis == NULL) return kAudio_ParamError;
-
+
try
{
switch (params->what)
- {
+ {
case kComponentCanDoSelect:
switch (GetSelectorForCanDo(params))
{
@@ -734,7 +734,7 @@ OSStatus AudioFileComponentBase::ComponentEntryDispatch(ComponentParameters* par
case kAudioFileFileDataIsThisFormatSelect:
case kAudioFileGetGlobalInfoSizeSelect:
case kAudioFileGetGlobalInfoSelect:
-
+
case kAudioFileCountUserDataSelect:
case kAudioFileGetUserDataSizeSelect:
case kAudioFileGetUserDataSelect:
@@ -756,7 +756,7 @@ OSStatus AudioFileComponentBase::ComponentEntryDispatch(ComponentParameters* par
PARAM(CFURLRef, inFileRef, 0, 3);
PARAM(const AudioStreamBasicDescription*, inFormat, 1, 3);
PARAM(UInt32, inFlags, 2, 3);
-
+
result = inThis->AFAPI_CreateURL(inFileRef, inFormat, inFlags);
}
break;
@@ -765,7 +765,7 @@ OSStatus AudioFileComponentBase::ComponentEntryDispatch(ComponentParameters* par
PARAM(CFURLRef, inFileRef, 0, 3);
PARAM(SInt32, inPermissions, 1, 3);
PARAM(int, inFileDescriptor, 2, 3);
-
+
result = inThis->AFAPI_OpenURL(inFileRef, inPermissions, inFileDescriptor);
}
break;
@@ -776,8 +776,8 @@ OSStatus AudioFileComponentBase::ComponentEntryDispatch(ComponentParameters* par
PARAM(AudioFile_WriteProc, inWriteFunc, 2, 5);
PARAM(AudioFile_GetSizeProc, inGetSizeFunc, 3, 5);
PARAM(AudioFile_SetSizeProc, inSetSizeFunc, 4, 5);
-
- result = inThis->AFAPI_OpenWithCallbacks(inRefCon, inReadFunc, inWriteFunc,
+
+ result = inThis->AFAPI_OpenWithCallbacks(inRefCon, inReadFunc, inWriteFunc,
inGetSizeFunc, inSetSizeFunc);
}
break;
@@ -791,8 +791,8 @@ OSStatus AudioFileComponentBase::ComponentEntryDispatch(ComponentParameters* par
PARAM(UInt32, inFileType, 5, 8);
PARAM(const AudioStreamBasicDescription*, inFormat, 6, 8);
PARAM(UInt32, inFlags, 7, 8);
-
- result = inThis->AFAPI_InitializeWithCallbacks(inRefCon, inReadFunc, inWriteFunc,
+
+ result = inThis->AFAPI_InitializeWithCallbacks(inRefCon, inReadFunc, inWriteFunc,
inGetSizeFunc, inSetSizeFunc,
inFileType, inFormat, inFlags);
}
@@ -813,7 +813,7 @@ OSStatus AudioFileComponentBase::ComponentEntryDispatch(ComponentParameters* par
PARAM(SInt64*, inStartingByte, 1, 4);
PARAM(UInt32*, ioNumBytes, 2, 4);
PARAM(void*, outBuffer, 3, 4);
-
+
result = inThis->AFAPI_ReadBytes(inUseCache, *inStartingByte, ioNumBytes,
outBuffer);
}
@@ -824,7 +824,7 @@ OSStatus AudioFileComponentBase::ComponentEntryDispatch(ComponentParameters* par
PARAM(SInt64*, inStartingByte, 1, 4);
PARAM(UInt32*, ioNumBytes, 2, 4);
PARAM(const void*, inBuffer, 3, 4);
-
+
result = inThis->AFAPI_WriteBytes(inUseCache, *inStartingByte, ioNumBytes,
inBuffer);
}
@@ -837,8 +837,8 @@ OSStatus AudioFileComponentBase::ComponentEntryDispatch(ComponentParameters* par
PARAM(SInt64*, inStartingPacket, 3, 6);
PARAM(UInt32*, ioNumPackets, 4, 6);
PARAM(void*, outBuffer, 5, 6);
-
- result = inThis->AFAPI_ReadPackets(inUseCache, outNumBytes, outPacketDescriptions,
+
+ result = inThis->AFAPI_ReadPackets(inUseCache, outNumBytes, outPacketDescriptions,
*inStartingPacket, ioNumPackets, outBuffer);
}
break;
@@ -850,28 +850,28 @@ OSStatus AudioFileComponentBase::ComponentEntryDispatch(ComponentParameters* par
PARAM(SInt64*, inStartingPacket, 3, 6);
PARAM(UInt32*, ioNumPackets, 4, 6);
PARAM(const void*, inBuffer, 5, 6);
-
- result = inThis->AFAPI_WritePackets(inUseCache, inNumBytes, inPacketDescriptions,
+
+ result = inThis->AFAPI_WritePackets(inUseCache, inNumBytes, inPacketDescriptions,
*inStartingPacket, ioNumPackets, inBuffer);
}
break;
-
+
case kAudioFileGetPropertyInfoSelect:
{
PARAM(AudioFileComponentPropertyID, inPropertyID, 0, 3);
PARAM(UInt32*, outPropertySize, 1, 3);
PARAM(UInt32*, outWritable, 2, 3);
-
+
result = inThis->AFAPI_GetPropertyInfo(inPropertyID, outPropertySize, outWritable);
}
break;
-
+
case kAudioFileGetPropertySelect:
{
PARAM(AudioFileComponentPropertyID, inPropertyID, 0, 3);
PARAM(UInt32*, ioPropertyDataSize, 1, 3);
PARAM(void*, outPropertyData, 2, 3);
-
+
result = inThis->AFAPI_GetProperty(inPropertyID, ioPropertyDataSize, outPropertyData);
}
break;
@@ -880,18 +880,18 @@ OSStatus AudioFileComponentBase::ComponentEntryDispatch(ComponentParameters* par
PARAM(AudioFileComponentPropertyID, inPropertyID, 0, 3);
PARAM(UInt32, inPropertyDataSize, 1, 3);
PARAM(const void*, inPropertyData, 2, 3);
-
+
result = inThis->AFAPI_SetProperty(inPropertyID, inPropertyDataSize, inPropertyData);
}
break;
-
+
case kAudioFileGetGlobalInfoSizeSelect:
{
PARAM(AudioFileComponentPropertyID, inPropertyID, 0, 4);
PARAM(UInt32, inSpecifierSize, 1, 4);
PARAM(const void*, inSpecifier, 2, 4);
PARAM(UInt32*, outPropertyDataSize, 3, 4);
-
+
result = inThis->AFAPI_GetGlobalInfoSize(inPropertyID, inSpecifierSize, inSpecifier,
outPropertyDataSize);
}
@@ -903,34 +903,34 @@ OSStatus AudioFileComponentBase::ComponentEntryDispatch(ComponentParameters* par
PARAM(const void*, inSpecifier, 2, 5);
PARAM(UInt32*, ioPropertyDataSize, 3, 5);
PARAM(void*, outPropertyData, 4, 5);
-
+
result = inThis->AFAPI_GetGlobalInfo(inPropertyID, inSpecifierSize, inSpecifier,
ioPropertyDataSize, outPropertyData);
}
break;
-
+
case kAudioFileExtensionIsThisFormatSelect:
{
PARAM(CFStringRef, inExtension, 0, 2);
PARAM(UInt32*, outResult, 1, 2);
-
+
AudioFileFormatBase* aff = inThis->GetAudioFileFormatBase();
if (!aff) return kAudio_ParamError;
-
+
UInt32 res = aff->ExtensionIsThisFormat(inExtension);
if (outResult) *outResult = res;
}
break;
-
+
case kAudioFileFileDataIsThisFormatSelect:
{
PARAM(UInt32, inDataByteSize, 0, 3);
PARAM(const void*, inData, 1, 3);
PARAM(UInt32*, outResult, 2, 3);
-
+
AudioFileFormatBase* aff = inThis->GetAudioFileFormatBase();
if (!aff) return kAudio_ParamError;
-
+
UncertainResult res = aff->FileDataIsThisFormat(inDataByteSize, inData);
if (outResult) *outResult = res;
}
@@ -940,55 +940,55 @@ OSStatus AudioFileComponentBase::ComponentEntryDispatch(ComponentParameters* par
{
PARAM(UInt32, inUserDataID, 0, 2);
PARAM(UInt32*, outNumberItems, 1, 2);
-
+
result = inThis->AFAPI_CountUserData(inUserDataID, outNumberItems);
}
break;
-
+
case kAudioFileGetUserDataSizeSelect:
{
PARAM(UInt32, inUserDataID, 0, 3);
PARAM(UInt32, inIndex, 1, 3);
PARAM(UInt32*, outUserDataSize, 2, 3);
-
+
result = inThis->AFAPI_GetUserDataSize(inUserDataID, inIndex, outUserDataSize);
}
break;
-
+
case kAudioFileGetUserDataSelect:
{
PARAM(UInt32, inUserDataID, 0, 4);
PARAM(UInt32, inIndex, 1, 4);
PARAM(UInt32*, ioUserDataSize, 2, 4);
PARAM(void*, outUserData, 3, 4);
-
- result = inThis->AFAPI_GetUserData(inUserDataID, inIndex,
+
+ result = inThis->AFAPI_GetUserData(inUserDataID, inIndex,
ioUserDataSize, outUserData);
}
break;
-
+
case kAudioFileSetUserDataSelect:
{
PARAM(UInt32, inUserDataID, 0, 4);
PARAM(UInt32, inIndex, 1, 4);
PARAM(UInt32, inUserDataSize, 2, 4);
PARAM(const void*, inUserData, 3, 4);
-
- result = inThis->AFAPI_SetUserData(inUserDataID, inIndex,
+
+ result = inThis->AFAPI_SetUserData(inUserDataID, inIndex,
inUserDataSize, inUserData);
}
break;
-
+
case kAudioFileRemoveUserDataSelect:
{
PARAM(UInt32, inUserDataID, 0, 2);
PARAM(UInt32, inIndex, 1, 2);
-
+
result = inThis->AFAPI_RemoveUserData(inUserDataID, inIndex);
}
break;
-
-
+
+
default:
result = ComponentBase::ComponentEntryDispatch(params, inThis);
break;
@@ -996,13 +996,13 @@ OSStatus AudioFileComponentBase::ComponentEntryDispatch(ComponentParameters* par
}
COMPONENT_CATCH
return result;
-}
+}
#endif
AudioComponentMethod AudioFileComponentLookup::Lookup (SInt16 selector)
{
switch (selector) {
-
+
#define DefCase(NAME) case kAudioFile##NAME##Select: return (AudioComponentMethod)NAME
DefCase(OpenWithCallbacks);
@@ -1016,7 +1016,7 @@ AudioComponentMethod AudioFileComponentLookup::Lookup (SInt16 selector)
DefCase(GetPropertyInfo);
DefCase(GetProperty);
DefCase(SetProperty);
-
+
DefCase(ExtensionIsThisFormat);
DefCase(GetGlobalInfoSize);
DefCase(GetGlobalInfo);
@@ -1030,7 +1030,7 @@ AudioComponentMethod AudioFileComponentLookup::Lookup (SInt16 selector)
DefCase(OpenURL);
DefCase(FileDataIsThisFormat);
DefCase(ReadPacketData);
-
+
// These selectors are deprecated and do not appear: Create, Open, Initialize, FileIsThisFormat, DataIsThisFormat.
default:
diff --git a/libs/appleutility/CoreAudio/AudioFile/AFPublic/AudioFileComponentBase.h b/libs/appleutility/CoreAudio/AudioFile/AFPublic/AudioFileComponentBase.h
index 5a11934e76..50e0627a6d 100644
--- a/libs/appleutility/CoreAudio/AudioFile/AFPublic/AudioFileComponentBase.h
+++ b/libs/appleutility/CoreAudio/AudioFile/AFPublic/AudioFileComponentBase.h
@@ -2,14 +2,14 @@
File: AudioFileComponentBase.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 __AudioFileComponentBase_h__
#define __AudioFileComponentBase_h__
@@ -67,7 +67,7 @@ public:
virtual ~AudioFileComponentBase();
virtual AudioFileFormatBase* GetAudioFileFormatBase() const = 0;
-
+
/* Public API Function Support */
virtual OSStatus AFAPI_CreateURL(
CFURLRef inFileRef,
@@ -75,96 +75,96 @@ public:
UInt32 inFlags) { return kAudio_UnimplementedError; }
virtual OSStatus AFAPI_OpenURL(
- CFURLRef inFileRef,
+ CFURLRef inFileRef,
SInt8 inPermissions,
int inFD) { return kAudio_UnimplementedError; }
-
+
virtual OSStatus AFAPI_Create(
- const FSRef *inParentRef,
+ const FSRef *inParentRef,
CFStringRef inFileName,
const AudioStreamBasicDescription *inFormat,
UInt32 inFlags,
FSRef *outNewFileRef) { return kAudio_UnimplementedError; }
-
+
virtual OSStatus AFAPI_Initialize(
const FSRef *inFileRef,
const AudioStreamBasicDescription *inFormat,
UInt32 inFlags) { return kAudio_UnimplementedError; }
-
+
virtual OSStatus AFAPI_Open(
- const FSRef *inFileRef,
+ const FSRef *inFileRef,
SInt8 inPermissions,
SInt16 inRefNum) { return kAudio_UnimplementedError; }
virtual OSStatus AFAPI_OpenWithCallbacks(
- void * inRefCon,
- AudioFile_ReadProc inReadFunc,
- AudioFile_WriteProc inWriteFunc,
+ void * inRefCon,
+ AudioFile_ReadProc inReadFunc,
+ AudioFile_WriteProc inWriteFunc,
AudioFile_GetSizeProc inGetSizeFunc,
AudioFile_SetSizeProc inSetSizeFunc)=0;
virtual OSStatus AFAPI_InitializeWithCallbacks(
- void * inRefCon,
- AudioFile_ReadProc inReadFunc,
- AudioFile_WriteProc inWriteFunc,
+ void * inRefCon,
+ AudioFile_ReadProc inReadFunc,
+ AudioFile_WriteProc inWriteFunc,
AudioFile_GetSizeProc inGetSizeFunc,
AudioFile_SetSizeProc inSetSizeFunc,
UInt32 inFileType,
const AudioStreamBasicDescription *inFormat,
UInt32 inFlags)=0;
-
+
virtual OSStatus AFAPI_Close()=0;
virtual OSStatus AFAPI_Optimize()=0;
virtual OSStatus AFAPI_ReadBytes( Boolean inUseCache,
- SInt64 inStartingByte,
- UInt32 *ioNumBytes,
+ SInt64 inStartingByte,
+ UInt32 *ioNumBytes,
void *outBuffer)=0;
-
+
virtual OSStatus AFAPI_WriteBytes( Boolean inUseCache,
- SInt64 inStartingByte,
- UInt32 *ioNumBytes,
+ SInt64 inStartingByte,
+ UInt32 *ioNumBytes,
const void *inBuffer)=0;
-
+
virtual OSStatus AFAPI_ReadPackets( Boolean inUseCache,
UInt32 *outNumBytes,
AudioStreamPacketDescription *outPacketDescriptions,
- SInt64 inStartingPacket,
- UInt32 *ioNumPackets,
+ SInt64 inStartingPacket,
+ UInt32 *ioNumPackets,
void *outBuffer)=0;
-
+
virtual OSStatus AFAPI_ReadPacketData( Boolean inUseCache,
UInt32 *ioNumBytes,
AudioStreamPacketDescription *outPacketDescriptions,
- SInt64 inStartingPacket,
- UInt32 *ioNumPackets,
+ SInt64 inStartingPacket,
+ UInt32 *ioNumPackets,
void *outBuffer)=0;
-
+
virtual OSStatus AFAPI_WritePackets( Boolean inUseCache,
UInt32 inNumBytes,
const AudioStreamPacketDescription *inPacketDescriptions,
- SInt64 inStartingPacket,
- UInt32 *ioNumPackets,
+ SInt64 inStartingPacket,
+ UInt32 *ioNumPackets,
const void *inBuffer)=0;
-
+
virtual OSStatus AFAPI_GetPropertyInfo( AudioFilePropertyID inPropertyID,
UInt32 *outDataSize,
UInt32 *isWritable)=0;
-
+
virtual OSStatus AFAPI_GetProperty( AudioFilePropertyID inPropertyID,
UInt32 *ioDataSize,
void *ioPropertyData)=0;
-
+
virtual OSStatus AFAPI_SetProperty( AudioFilePropertyID inPropertyID,
UInt32 inDataSize,
const void *inPropertyData)=0;
- virtual OSStatus AFAPI_GetGlobalInfoSize(
+ virtual OSStatus AFAPI_GetGlobalInfoSize(
AudioFilePropertyID inPropertyID,
UInt32 inSpecifierSize,
const void* inSpecifier,
UInt32 *outPropertySize);
- virtual OSStatus AFAPI_GetGlobalInfo(
+ virtual OSStatus AFAPI_GetGlobalInfo(
AudioFilePropertyID inPropertyID,
UInt32 inSpecifierSize,
const void* inSpecifier,
@@ -173,21 +173,21 @@ public:
virtual OSStatus AFAPI_CountUserData( UInt32 inUserDataID,
UInt32 *outNumberItems)=0;
-
+
virtual OSStatus AFAPI_GetUserDataSize( UInt32 inUserDataID,
UInt32 inIndex,
UInt32 *outDataSize)=0;
-
+
virtual OSStatus AFAPI_GetUserData( UInt32 inUserDataID,
UInt32 inIndex,
UInt32 *ioDataSize,
void *ioUserData)=0;
-
+
virtual OSStatus AFAPI_SetUserData( UInt32 inUserDataID,
UInt32 inIndex,
UInt32 inDataSize,
const void *inUserData)=0;
-
+
virtual OSStatus AFAPI_RemoveUserData( UInt32 inUserDataID,
UInt32 inIndex)=0;
#if !CA_USE_AUDIO_PLUGIN_ONLY
@@ -207,9 +207,9 @@ public:
virtual AudioFileFormat* GetAudioFormat() const = 0;
virtual AudioFileFormatBase* GetAudioFileFormatBase() const { return GetAudioFormat(); }
-
+
void SetAudioFileObject(AudioFileObject* inObject) { mAudioFileObject = inObject; }
-
+
/* Public API Function Support */
virtual OSStatus AFAPI_CreateURL(
@@ -218,92 +218,92 @@ public:
UInt32 inFlags);
virtual OSStatus AFAPI_OpenURL(
- CFURLRef inFileRef,
+ CFURLRef inFileRef,
SInt8 inPermissions,
int inFD);
virtual OSStatus AFAPI_OpenWithCallbacks(
- void * inRefCon,
- AudioFile_ReadProc inReadFunc,
- AudioFile_WriteProc inWriteFunc,
+ void * inRefCon,
+ AudioFile_ReadProc inReadFunc,
+ AudioFile_WriteProc inWriteFunc,
AudioFile_GetSizeProc inGetSizeFunc,
AudioFile_SetSizeProc inSetSizeFunc);
virtual OSStatus AFAPI_InitializeWithCallbacks(
- void * inRefCon,
- AudioFile_ReadProc inReadFunc,
- AudioFile_WriteProc inWriteFunc,
+ void * inRefCon,
+ AudioFile_ReadProc inReadFunc,
+ AudioFile_WriteProc inWriteFunc,
AudioFile_GetSizeProc inGetSizeFunc,
AudioFile_SetSizeProc inSetSizeFunc,
UInt32 inFileType,
const AudioStreamBasicDescription *inFormat,
UInt32 inFlags);
-
+
virtual OSStatus AFAPI_Close();
virtual OSStatus AFAPI_Optimize();
virtual OSStatus AFAPI_ReadBytes( Boolean inUseCache,
- SInt64 inStartingByte,
- UInt32 *ioNumBytes,
+ SInt64 inStartingByte,
+ UInt32 *ioNumBytes,
void *outBuffer);
-
+
virtual OSStatus AFAPI_WriteBytes( Boolean inUseCache,
- SInt64 inStartingByte,
- UInt32 *ioNumBytes,
+ SInt64 inStartingByte,
+ UInt32 *ioNumBytes,
const void *inBuffer);
-
+
virtual OSStatus AFAPI_ReadPackets( Boolean inUseCache,
UInt32 *outNumBytes,
AudioStreamPacketDescription *outPacketDescriptions,
- SInt64 inStartingPacket,
- UInt32 *ioNumPackets,
+ SInt64 inStartingPacket,
+ UInt32 *ioNumPackets,
void *outBuffer);
-
+
virtual OSStatus AFAPI_ReadPacketData( Boolean inUseCache,
UInt32 *ioNumBytes,
AudioStreamPacketDescription *outPacketDescriptions,
- SInt64 inStartingPacket,
- UInt32 *ioNumPackets,
+ SInt64 inStartingPacket,
+ UInt32 *ioNumPackets,
void *outBuffer);
-
+
virtual OSStatus AFAPI_WritePackets( Boolean inUseCache,
UInt32 inNumBytes,
const AudioStreamPacketDescription *inPacketDescriptions,
- SInt64 inStartingPacket,
- UInt32 *ioNumPackets,
+ SInt64 inStartingPacket,
+ UInt32 *ioNumPackets,
const void *inBuffer);
-
+
virtual OSStatus AFAPI_GetPropertyInfo( AudioFilePropertyID inPropertyID,
UInt32 *outDataSize,
UInt32 *isWritable);
-
+
virtual OSStatus AFAPI_GetProperty( AudioFilePropertyID inPropertyID,
UInt32 *ioDataSize,
void *ioPropertyData);
-
+
virtual OSStatus AFAPI_SetProperty( AudioFilePropertyID inPropertyID,
UInt32 inDataSize,
const void *inPropertyData);
virtual OSStatus AFAPI_CountUserData( UInt32 inUserDataID,
UInt32 *outNumberItems);
-
+
virtual OSStatus AFAPI_GetUserDataSize( UInt32 inUserDataID,
UInt32 inIndex,
UInt32 *outDataSize);
-
+
virtual OSStatus AFAPI_GetUserData( UInt32 inUserDataID,
UInt32 inIndex,
UInt32 *ioDataSize,
void *ioUserData);
-
+
virtual OSStatus AFAPI_SetUserData( UInt32 inUserDataID,
UInt32 inIndex,
UInt32 inDataSize,
const void *inUserData);
-
+
virtual OSStatus AFAPI_RemoveUserData( UInt32 inUserDataID,
UInt32 inIndex);
-
+
protected:
AudioFileObject* mAudioFileObject;
};
diff --git a/libs/appleutility/CoreAudio/AudioFile/AFPublic/AudioFileFormat.cpp b/libs/appleutility/CoreAudio/AudioFile/AFPublic/AudioFileFormat.cpp
index ee6bedd593..36a2bee9de 100644
--- a/libs/appleutility/CoreAudio/AudioFile/AFPublic/AudioFileFormat.cpp
+++ b/libs/appleutility/CoreAudio/AudioFile/AFPublic/AudioFileFormat.cpp
@@ -2,14 +2,14 @@
File: AudioFileFormat.cpp
Abstract: AudioFileFormat.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,14 +40,14 @@
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 "AudioFileFormat.h"
#include "DataSource.h"
-AudioFileFormatBase::AudioFileFormatBase(UInt32 inFileType)
+AudioFileFormatBase::AudioFileFormatBase(UInt32 inFileType)
: mFileType(inFileType)
{
}
@@ -61,7 +61,7 @@ OSStatus AudioFileFormatBase::GetHFSCodes(UInt32* ioDataSize, void* outPropertyD
return kAudioFileUnsupportedPropertyError;
}
-AudioFileFormat::AudioFileFormat(UInt32 inFileType)
+AudioFileFormat::AudioFileFormat(UInt32 inFileType)
: AudioFileFormatBase(inFileType)
{
}
diff --git a/libs/appleutility/CoreAudio/AudioFile/AFPublic/AudioFileFormat.h b/libs/appleutility/CoreAudio/AudioFile/AFPublic/AudioFileFormat.h
index 9436199569..06ff8573d4 100644
--- a/libs/appleutility/CoreAudio/AudioFile/AFPublic/AudioFileFormat.h
+++ b/libs/appleutility/CoreAudio/AudioFile/AFPublic/AudioFileFormat.h
@@ -2,14 +2,14 @@
File: AudioFileFormat.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,18 +40,18 @@
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 _AudioFileFormat_H_
#define _AudioFileFormat_H_
#include "AudioFileObject.h"
-// AudioFileFormat is a factory class for AudioFileObjects.
+// AudioFileFormat is a factory class for AudioFileObjects.
-// UncertainResult is needed for DataIsThisFormat.
+// UncertainResult is needed for DataIsThisFormat.
// In the case of SoundDesigner 2 we can't determine if the data is SoundDesigner 2 or not.
typedef int UncertainResult;
@@ -71,23 +71,23 @@ class AudioFileFormatBase
public:
AudioFileFormatBase(UInt32 inFileType);
virtual ~AudioFileFormatBase();
-
+
// return true if extension is of this format type
virtual Boolean ExtensionIsThisFormat(CFStringRef inExtension) = 0;
-
+
virtual UncertainResult FileDataIsThisFormat(
UInt32 /*inDataByteSize*/,
const void* /*inData*/) = 0;
-
+
// support SoundDesigner II files while minimizing opening and closing files.
virtual Boolean ResourceIsThisFormat(const FSRef* /*inRef*/) { return false; }
UInt32 GetFileType() const { return mFileType; }
-
+
virtual UInt32 CanRead() const { return 1; }
virtual UInt32 CanWrite() const { return 1; }
virtual UInt32 HasResourceFork() const { return 0; }
-
+
virtual void GetExtensions(CFArrayRef *outArray) = 0;
virtual void GetUTIs(CFArrayRef *outArray) {}
virtual void GetMIMETypes(CFArrayRef *outArray) {}
@@ -95,10 +95,10 @@ public:
virtual OSStatus GetAvailableFormatIDs(UInt32* ioDataSize, void* outPropertyData) = 0;
virtual OSStatus GetAvailableStreamDescriptions(UInt32 inFormatID, UInt32* ioDataSize, void* outPropertyData) = 0;
virtual OSStatus GetHFSCodes(UInt32* ioDataSize, void* outPropertyData);
-
+
virtual AudioFileFormat* AsAudioFileFormat() { return NULL; }
virtual AudioFileFormatComponent* AsAudioFileFormatComponent() { return NULL; }
-
+
private:
UInt32 mFileType;
};
@@ -110,13 +110,13 @@ class AudioFileFormat : public AudioFileFormatBase
public:
AudioFileFormat(UInt32 inFileType);
virtual ~AudioFileFormat();
-
+
// create an AudioFileObject for this format type.
- virtual AudioFileObject* New() = 0;
+ virtual AudioFileObject* New() = 0;
virtual AudioFileStreamObject* NewStream() { return NULL; }
-
+
// return true if file is of this format type
- virtual UncertainResult FileDataIsThisFormat(UInt32 inDataByteSize, const void* inData) = 0;
+ virtual UncertainResult FileDataIsThisFormat(UInt32 inDataByteSize, const void* inData) = 0;
virtual AudioFileFormat* AsAudioFileFormat() { return this; }
};
diff --git a/libs/appleutility/CoreAudio/AudioFile/AFPublic/AudioFileObject.cpp b/libs/appleutility/CoreAudio/AudioFile/AFPublic/AudioFileObject.cpp
index 1a00f96251..b823147604 100644
--- a/libs/appleutility/CoreAudio/AudioFile/AFPublic/AudioFileObject.cpp
+++ b/libs/appleutility/CoreAudio/AudioFile/AFPublic/AudioFileObject.cpp
@@ -2,14 +2,14 @@
File: AudioFileObject.cpp
Abstract: AudioFileObject.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 "AudioFileObject.h"
#include "CADebugMacros.h"
@@ -64,7 +64,7 @@ AudioFileObject::~AudioFileObject()
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-OSStatus AudioFileObject::DoCreate(
+OSStatus AudioFileObject::DoCreate(
CFURLRef inFileRef,
const AudioStreamBasicDescription *inFormat,
UInt32 inFlags)
@@ -73,27 +73,27 @@ OSStatus AudioFileObject::DoCreate(
if (!IsDataFormatValid(inFormat))
return kAudioFileUnsupportedDataFormatError;
- if (!IsDataFormatSupported(inFormat))
+ if (!IsDataFormatSupported(inFormat))
return kAudioFileUnsupportedDataFormatError;
SetPermissions(kAudioFileReadWritePermission);
-
+
SetAlignDataWithFillerChunks(!(inFlags & 2 /* kAudioFileFlags_DontPageAlignAudioData */ ));
-
+
// call virtual method for particular format.
return Create(inFileRef, inFormat);
}
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-OSStatus AudioFileObject::Create(
+
+OSStatus AudioFileObject::Create(
CFURLRef inFileRef,
const AudioStreamBasicDescription *inFormat)
{
int fileD;
OSStatus err = CreateDataFile (inFileRef, fileD);
FailIf (err != noErr, Bail, "CreateDataFile failed");
-
+
SetURL (inFileRef);
err = OpenFile(kAudioFileReadWritePermission, fileD);
@@ -101,23 +101,23 @@ OSStatus AudioFileObject::Create(
err = SetDataFormat(inFormat);
FailIf (err != noErr, Bail, "SetDataFormat failed");
-
+
mIsInitialized = false;
-
+
Bail:
return err;
}
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-OSStatus AudioFileObject::DoOpen(
- CFURLRef inFileRef,
+OSStatus AudioFileObject::DoOpen(
+ CFURLRef inFileRef,
SInt8 inPermissions,
int inFD)
-{
+{
OSStatus err = noErr;
SetPermissions(inPermissions);
-
+
err = Open(inFileRef, inPermissions, inFD);
FailIf (err != noErr, Bail, "Open failed");
@@ -130,22 +130,22 @@ Bail:
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-OSStatus AudioFileObject::Open(
- CFURLRef inFileRef,
+OSStatus AudioFileObject::Open(
+ CFURLRef inFileRef,
SInt8 inPermissions,
int inFD)
-{
+{
if (!(inPermissions & kAudioFileReadPermission))
return kAudioFilePermissionsError; // file must have read permissions
-
+
SetURL(inFileRef);
-
+
OSStatus err = OpenFile(inPermissions, inFD);
FailIf (err != noErr, Bail, "OpenFile failed");
-
+
err = OpenFromDataSource();
FailIf (err != noErr, Bail, "OpenFromDataSource failed");
-
+
Bail:
return err;
}
@@ -154,17 +154,17 @@ Bail:
OSStatus AudioFileObject::ValidateFormatAndData()
{
-
+
AudioStreamBasicDescription asbd = GetDataFormat();
if (!IsDataFormatValid(&asbd))
return kAudioFileInvalidFileError;
- if (asbd.mFormatID == kAudioFormatLinearPCM)
+ if (asbd.mFormatID == kAudioFormatLinearPCM)
{
SInt64 maxPackets = GetNumBytes() / asbd.mBytesPerPacket;
- if (GetNumPackets() > maxPackets)
+ if (GetNumPackets() > maxPackets)
return kAudioFileInvalidFileError;
}
return noErr;
@@ -173,24 +173,24 @@ OSStatus AudioFileObject::ValidateFormatAndData()
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
OSStatus AudioFileObject::DoOpenWithCallbacks(
- void * inRefCon,
- AudioFile_ReadProc inReadFunc,
- AudioFile_WriteProc inWriteFunc,
+ void * inRefCon,
+ AudioFile_ReadProc inReadFunc,
+ AudioFile_WriteProc inWriteFunc,
AudioFile_GetSizeProc inGetSizeFunc,
AudioFile_SetSizeProc inSetSizeFunc)
{
SInt8 perms = (inSetSizeFunc || inWriteFunc) ? kAudioFileReadWritePermission : kAudioFileReadPermission;
SetPermissions(perms);
-
+
DataSource* dataSource = new Seekable_DataSource(inRefCon, inReadFunc, inWriteFunc, inGetSizeFunc, inSetSizeFunc);
SetDataSource(dataSource);
return OpenFromDataSource();
}
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
+
OSStatus AudioFileObject::OpenFromDataSource(void)
-{
+{
return noErr;
}
@@ -198,15 +198,15 @@ OSStatus AudioFileObject::OpenFromDataSource(void)
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
OSStatus AudioFileObject::DoInitializeWithCallbacks(
- void * inRefCon,
- AudioFile_ReadProc inReadFunc,
- AudioFile_WriteProc inWriteFunc,
+ void * inRefCon,
+ AudioFile_ReadProc inReadFunc,
+ AudioFile_WriteProc inWriteFunc,
AudioFile_GetSizeProc inGetSizeFunc,
AudioFile_SetSizeProc inSetSizeFunc,
UInt32 inFileType,
const AudioStreamBasicDescription *inFormat,
UInt32 inFlags)
-{
+{
DataSource* dataSource = new Seekable_DataSource(inRefCon, inReadFunc, inWriteFunc, inGetSizeFunc, inSetSizeFunc);
if (!dataSource->CanWrite()) return -54/*permErr*/;
dataSource->SetSize(0);
@@ -217,13 +217,13 @@ OSStatus AudioFileObject::DoInitializeWithCallbacks(
OSStatus err = SetDataFormat(inFormat);
if (err) return err;
-
+
return InitializeDataSource(inFormat, inFlags);
}
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-OSStatus AudioFileObject::DoInitialize(
+
+OSStatus AudioFileObject::DoInitialize(
CFURLRef inFileRef,
const AudioStreamBasicDescription *inFormat,
UInt32 inFlags)
@@ -236,15 +236,15 @@ OSStatus AudioFileObject::DoInitialize(
return Initialize(inFileRef, inFormat, inFlags);
}
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-OSStatus AudioFileObject::Initialize(
+
+OSStatus AudioFileObject::Initialize(
CFURLRef inFileRef,
const AudioStreamBasicDescription *inFormat,
UInt32 inFlags)
{
OSStatus err = noErr;
-
- UInt8 fPath[FILENAME_MAX];
+
+ UInt8 fPath[FILENAME_MAX];
if (!CFURLGetFileSystemRepresentation (inFileRef, true, fPath, FILENAME_MAX))
return kAudio_FileNotFoundError;
@@ -259,10 +259,10 @@ OSStatus AudioFileObject::Initialize(
int fileD = open((const char*)fPath, flags, filePerms);
if (fileD < 0)
return AudioFileTranslateErrno(errno);
-
+
err = OpenFile(kAudioFileReadWritePermission, fileD);
FailIf (err != noErr, Bail, "OpenFile failed");
-
+
// don't need to do this as open has an option to truncate the file
// GetDataSource()->SetSize(0);
@@ -270,15 +270,15 @@ OSStatus AudioFileObject::Initialize(
FailIf (err != noErr, Bail, "SetDataFormat failed");
InitializeDataSource(inFormat, inFlags);
-
-Bail:
+
+Bail:
return err;
}
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
+
OSStatus AudioFileObject::InitializeDataSource(const AudioStreamBasicDescription *inFormat, UInt32 /*inFlags*/)
-{
+{
return noErr;
}
@@ -288,7 +288,7 @@ OSStatus AudioFileObject::DoClose()
{
OSStatus err = UpdateSizeIfNeeded();
if (err) return err;
-
+
return Close();
}
@@ -313,7 +313,7 @@ OSStatus AudioFileObject::Close()
OSStatus AudioFileObject::Optimize()
{
// default is that nothing needs to be done. This happens to be true for Raw, SD2 and NeXT/Sun types.
- SetIsOptimized(true);
+ SetIsOptimized(true);
return noErr;
}
@@ -326,7 +326,7 @@ OSStatus AudioFileObject::DoOptimize()
OSStatus err = UpdateSizeIfNeeded();
if (err) return err;
-
+
if (IsOptimized()) return noErr;
err = Optimize();
@@ -335,12 +335,12 @@ OSStatus AudioFileObject::DoOptimize()
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-OSStatus AudioFileObject::UpdateNumBytes(SInt64 inNumBytes)
+OSStatus AudioFileObject::UpdateNumBytes(SInt64 inNumBytes)
{
OSStatus err = noErr;
if (inNumBytes != GetNumBytes()) {
SetNumBytes(inNumBytes);
-
+
// #warning " this will not work for vbr formats"
SetNumPackets(GetNumBytes() / mDataFormat.mBytesPerPacket);
SizeChanged();
@@ -350,7 +350,7 @@ OSStatus AudioFileObject::UpdateNumBytes(SInt64 inNumBytes)
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-OSStatus AudioFileObject::UpdateNumPackets(SInt64 inNumPackets)
+OSStatus AudioFileObject::UpdateNumPackets(SInt64 inNumPackets)
{
OSStatus err = noErr;
if (inNumPackets != GetNumPackets()) {
@@ -358,7 +358,7 @@ OSStatus AudioFileObject::UpdateNumPackets(SInt64 inNumPackets)
SetNeedsSizeUpdate(true);
UpdateSizeIfNeeded();
SetNumPackets(inNumPackets);
-
+
// #warning " this will not work for vbr formats"
SetNumBytes(GetNumPackets() * mDataFormat.mBytesPerFrame);
SizeChanged();
@@ -375,19 +375,19 @@ OSStatus AudioFileObject::PacketToFrame(SInt64 inPacket, SInt64& outFirstFrameIn
{
OSStatus err = ScanForPackets(inPacket+1); // the packet count must be one greater than the packet index
if (err) return err;
-
+
SInt64 packetTableSize = GetPacketTableSize();
-
+
if (mPacketTable && inPacket >= packetTableSize)
return kAudioFileEndOfFileError;
-
+
CompressedPacketTable* packetTable = GetPacketTable();
if (!packetTable)
return kAudioFileInvalidPacketOffsetError;
-
+
if (inPacket < 0 || inPacket >= packetTableSize)
return kAudioFileInvalidPacketOffsetError;
-
+
outFirstFrameInPacket = (*packetTable)[(size_t)inPacket].mFrameOffset;
}
else
@@ -406,18 +406,18 @@ OSStatus AudioFileObject::FrameToPacket(SInt64 inFrame, SInt64& outPacket, UInt3
CompressedPacketTable* packetTable = GetPacketTable();
if (!packetTable)
return kAudioFileInvalidPacketOffsetError;
-
+
// search packet table
AudioStreamPacketDescriptionExtended pext;
memset(&pext, 0, sizeof(pext));
pext.mFrameOffset = inFrame;
CompressedPacketTable::iterator iter = std::lower_bound(packetTable->begin(), packetTable->end(), pext);
-
+
if (iter == packetTable->end())
return kAudioFileInvalidPacketOffsetError;
-
+
if (iter > packetTable->begin()) --iter;
-
+
outPacket = iter - packetTable->begin();
outFrameOffsetInPacket = (UInt32)(inFrame - iter->mFrameOffset);
}
@@ -435,21 +435,21 @@ OSStatus AudioFileObject::PacketToByte(AudioBytePacketTranslation* abpt)
{
if (abpt->mPacket < 0)
return kAudioFileInvalidPacketOffsetError;
-
+
if (mDataFormat.mBytesPerPacket == 0)
{
CompressedPacketTable* packetTable = GetPacketTable();
if (!packetTable)
return kAudioFileInvalidPacketOffsetError;
-
+
if (abpt->mPacket < GetPacketTableSize()) {
abpt->mByte = (*packetTable)[(int)abpt->mPacket].mStartOffset;
abpt->mFlags = 0;
} else {
SInt64 numPackets = packetTable->size();
- if (numPackets < 8)
+ if (numPackets < 8)
return 'more' /*kAudioFileStreamError_DataUnavailable*/ ;
-
+
const AudioStreamPacketDescriptionExtended lastPacket = (*packetTable)[numPackets - 1];
SInt64 bytesReadSoFar = lastPacket.mStartOffset + lastPacket.mDataByteSize;
double averageBytesPerPacket = (double)(bytesReadSoFar - GetDataOffset()) / (double)numPackets;
@@ -487,21 +487,21 @@ OSStatus AudioFileObject::ByteToPacket(AudioBytePacketTranslation* abpt)
memset(&pext, 0, sizeof(pext));
pext.mStartOffset = abpt->mByte;
CompressedPacketTable::iterator iter = std::lower_bound(packetTable->begin(), packetTable->end(), pext, byte_less_than);
-
+
if (iter == packetTable->end()) {
SInt64 numPackets = packetTable->size();
- if (numPackets < 8)
+ if (numPackets < 8)
return 'more' /*kAudioFileStreamError_DataUnavailable*/ ;
-
+
const AudioStreamPacketDescriptionExtended lastPacket = (*packetTable)[numPackets - 1];
SInt64 bytesReadSoFar = lastPacket.mStartOffset + lastPacket.mDataByteSize;
double averageBytesPerPacket = (double)(bytesReadSoFar - GetDataOffset()) / (double)numPackets;
-
+
double fpacket = (double)abpt->mByte / averageBytesPerPacket;
abpt->mPacket = (SInt64)floor(fpacket);
abpt->mByteOffsetInPacket = (UInt32)floor((fpacket - (double)abpt->mPacket) * averageBytesPerPacket);
abpt->mFlags = kBytePacketTranslationFlag_IsEstimate;
-
+
} else {
if (iter > packetTable->begin()) --iter;
abpt->mPacket = iter - packetTable->begin();
@@ -523,29 +523,29 @@ OSStatus AudioFileObject::ByteToPacket(AudioBytePacketTranslation* abpt)
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-OSStatus AudioFileObject::ReadBytes(
+OSStatus AudioFileObject::ReadBytes(
Boolean inUseCache,
- SInt64 inStartingByte,
- UInt32 *ioNumBytes,
+ SInt64 inStartingByte,
+ UInt32 *ioNumBytes,
void *outBuffer)
{
OSStatus err = noErr;
UInt16 mode = SEEK_SET;
SInt64 fileOffset = mDataOffset + inStartingByte;
bool readingPastEnd = false;
-
- FailWithAction((ioNumBytes == NULL) || (outBuffer == NULL), err = kAudio_ParamError,
+
+ FailWithAction((ioNumBytes == NULL) || (outBuffer == NULL), err = kAudio_ParamError,
Bail, "invalid num bytes parameter");
//printf("inStartingByte %lld GetNumBytes %lld\n", inStartingByte, GetNumBytes());
- if (inStartingByte >= GetNumBytes())
+ if (inStartingByte >= GetNumBytes())
{
*ioNumBytes = 0;
return kAudioFileEndOfFileError;
}
- if ((fileOffset + *ioNumBytes) > (GetNumBytes() + mDataOffset))
+ if ((fileOffset + *ioNumBytes) > (GetNumBytes() + mDataOffset))
{
*ioNumBytes = (UInt32)(GetNumBytes() + mDataOffset - fileOffset);
readingPastEnd = true;
@@ -554,9 +554,9 @@ OSStatus AudioFileObject::ReadBytes(
if (!inUseCache)
mode |= kAudioFileNoCacheMask;
-
+
err = GetDataSource()->ReadBytes(mode, fileOffset, *ioNumBytes, outBuffer, ioNumBytes);
-
+
if (readingPastEnd && err == noErr)
err = kAudioFileEndOfFileError;
@@ -567,10 +567,10 @@ Bail:
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-OSStatus AudioFileObject::WriteBytes(
+OSStatus AudioFileObject::WriteBytes(
Boolean inUseCache,
- SInt64 inStartingByte,
- UInt32 *ioNumBytes,
+ SInt64 inStartingByte,
+ UInt32 *ioNumBytes,
const void *inBuffer)
{
OSStatus err = noErr;
@@ -586,57 +586,57 @@ OSStatus AudioFileObject::WriteBytes(
// if so, see if file type supports this and bail if not
err = IsValidFilePosition(inStartingByte + *ioNumBytes);
FailIf(err != noErr, Bail, "invalid file position");
-
+
extendingTheAudioData = inStartingByte + *ioNumBytes > GetNumBytes();
-
+
// if file is not optimized, then do not write data that would overwrite chunks following the sound data chunk
- FailWithAction( extendingTheAudioData && !IsOptimized(),
+ FailWithAction( extendingTheAudioData && !IsOptimized(),
err = kAudioFileNotOptimizedError, Bail, "Can't write more data until the file is optimized");
if (!inUseCache)
mode |= kAudioFileNoCacheMask;
-
- err = GetDataSource()->WriteBytes(mode, mDataOffset + inStartingByte, *ioNumBytes,
+
+ err = GetDataSource()->WriteBytes(mode, mDataOffset + inStartingByte, *ioNumBytes,
inBuffer, ioNumBytes);
-
+
FailIf(err != noErr, Bail, "couldn't write new data");
-
+
if (extendingTheAudioData) {
SInt64 nuEOF; // Get the total bytes of audio data
SInt64 nuByteTotal;
err = GetDataSource()->GetSize(nuEOF);
FailIf(err != noErr, Bail, "GetSize failed");
-
+
nuByteTotal = nuEOF - mDataOffset;
err = UpdateNumBytes(nuByteTotal);
}
-
+
Bail:
return err;
}
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-OSStatus AudioFileObject::ReadPackets(
+OSStatus AudioFileObject::ReadPackets(
Boolean inUseCache,
UInt32 *outNumBytes,
AudioStreamPacketDescription *outPacketDescriptions,
- SInt64 inStartingPacket,
- UInt32 *ioNumPackets,
+ SInt64 inStartingPacket,
+ UInt32 *ioNumPackets,
void *outBuffer)
{
// This only works with CBR. To suppport VBR you must override.
OSStatus err = noErr;
-
+
FailWithAction(outBuffer == NULL, err = kAudio_ParamError, Bail, "NULL buffer");
-
+
FailWithAction((ioNumPackets == NULL) || (*ioNumPackets < 1), err = kAudio_ParamError, Bail, "invalid num packets parameter");
-
+
{
UInt32 byteCount = *ioNumPackets * mDataFormat.mBytesPerPacket;
SInt64 startingByte = inStartingPacket * mDataFormat.mBytesPerPacket;
-
+
err = ReadBytes (inUseCache, startingByte, &byteCount, outBuffer);
if ((err == noErr) || (err == kAudioFileEndOfFileError))
{
@@ -648,7 +648,7 @@ OSStatus AudioFileObject::ReadPackets(
if (outNumBytes)
*outNumBytes = byteCount;
-
+
if (err == kAudioFileEndOfFileError)
err = noErr;
}
@@ -664,12 +664,12 @@ Bail:
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-OSStatus AudioFileObject::ReadPacketData(
+OSStatus AudioFileObject::ReadPacketData(
Boolean inUseCache,
UInt32 *ioNumBytes,
AudioStreamPacketDescription *outPacketDescriptions,
- SInt64 inStartingPacket,
- UInt32 *ioNumPackets,
+ SInt64 inStartingPacket,
+ UInt32 *ioNumPackets,
void *outBuffer)
{
OSStatus err = noErr;
@@ -703,12 +703,12 @@ Bail:
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-OSStatus AudioFileObject::ReadPacketDataVBR(
+OSStatus AudioFileObject::ReadPacketDataVBR(
Boolean inUseCache,
UInt32 *ioNumBytes,
AudioStreamPacketDescription *outPacketDescriptions,
- SInt64 inStartingPacket,
- UInt32 *ioNumPackets,
+ SInt64 inStartingPacket,
+ UInt32 *ioNumPackets,
void *outBuffer)
{
OSStatus err = ScanForPackets(inStartingPacket+1); // need to scan packets up to start
@@ -718,7 +718,7 @@ OSStatus AudioFileObject::ReadPacketDataVBR(
SInt64 dataOffset = GetDataOffset();
CompressedPacketTable* packetTable = GetPacketTable();
- if (!packetTable)
+ if (!packetTable)
return kAudioFileInvalidFileError;
SInt64 packetTableSize = GetPacketTableSize();
@@ -728,7 +728,7 @@ OSStatus AudioFileObject::ReadPacketDataVBR(
*ioNumPackets = 0;
return kAudioFileEndOfFileError;
}
-
+
if (inStartingPacket + *ioNumPackets <= packetTableSize) {
err = ReadPacketDataVBR_InTable(inUseCache, ioNumBytes, outPacketDescriptions, inStartingPacket, ioNumPackets, outBuffer);
} else {
@@ -741,21 +741,21 @@ OSStatus AudioFileObject::ReadPacketDataVBR(
SInt64 remainingBytesInFile = fileSize - firstPacketOffset - dataOffset;
if (bytesRead > remainingBytesInFile)
bytesRead = (UInt32)remainingBytesInFile;
-
+
err = ReadBytes (inUseCache, firstPacketOffset, &bytesRead, outBuffer);
if (err && err != kAudioFileEndOfFileError) {
*ioNumBytes = 0;
*ioNumPackets = 0;
return err;
}
-
+
Buffer_DataSource bufSrc(bytesRead, outBuffer, dataOffset + firstPacketOffset);
-
+
OSStatus scanErr = ScanForPackets(kScanToEnd, &bufSrc, false);
if (scanErr && scanErr != kAudioFileEndOfFileError)
return scanErr;
packetTableSize = packetTable->size();
-
+
UInt32 numPacketsRead = 0;
UInt32 endOfData = 0;
SInt64 packetNumber = inStartingPacket;
@@ -765,10 +765,10 @@ OSStatus AudioFileObject::ReadPacketDataVBR(
SInt64 endOfPacket = curPacketOffset + curPacket.mDataByteSize;
if (endOfPacket > bytesRead) break;
endOfData = (UInt32)endOfPacket;
- outPacketDescriptions[numPacketsRead] = curPacket;
+ outPacketDescriptions[numPacketsRead] = curPacket;
outPacketDescriptions[numPacketsRead].mStartOffset = curPacketOffset;
}
-
+
*ioNumBytes = endOfData;
*ioNumPackets = numPacketsRead;
}
@@ -778,14 +778,14 @@ OSStatus AudioFileObject::ReadPacketDataVBR(
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
OSStatus AudioFileObject::HowManyPacketsCanBeReadIntoBuffer(UInt32* ioNumBytes, SInt64 inStartingPacket, UInt32 *ioNumPackets)
-{
+{
CompressedPacketTable* packetTable = GetPacketTable();
SInt64 packetTableSize = GetPacketTableSize();
if (inStartingPacket + *ioNumPackets > (SInt64)packetTableSize) {
*ioNumPackets = (UInt32)(packetTableSize - inStartingPacket);
}
-
+
AudioStreamPacketDescription firstPacket = (*packetTable)[inStartingPacket];
if (*ioNumBytes < firstPacket.mDataByteSize) {
@@ -795,28 +795,28 @@ OSStatus AudioFileObject::HowManyPacketsCanBeReadIntoBuffer(UInt32* ioNumBytes,
}
SInt64 lastPacketIndex = inStartingPacket + *ioNumPackets - 1;
- if (lastPacketIndex >= packetTableSize)
+ if (lastPacketIndex >= packetTableSize)
lastPacketIndex = packetTableSize - 1;
-
+
AudioStreamPacketDescription lastPacket = (*packetTable)[lastPacketIndex];
-
+
SInt64 readBytes = lastPacket.mStartOffset + lastPacket.mDataByteSize - firstPacket.mStartOffset;
if (readBytes <= *ioNumBytes) {
*ioNumBytes = (UInt32)readBytes;
return noErr;
}
-
+
SInt64 lowBound = inStartingPacket;
SInt64 highBound = lastPacketIndex + 1;
SInt64 okIndex = lowBound;
- while (highBound >= lowBound) {
+ while (highBound >= lowBound) {
SInt64 tryBound = (lowBound + highBound) >> 1;
- if (tryBound > lastPacketIndex)
+ if (tryBound > lastPacketIndex)
break;
AudioStreamPacketDescription tryPacket = (*packetTable)[tryBound];
-
+
SInt64 readBytes = tryPacket.mStartOffset + tryPacket.mDataByteSize - firstPacket.mStartOffset;
-
+
if (readBytes > (SInt64)*ioNumBytes) {
highBound = tryBound - 1;
} else if (readBytes < (SInt64)*ioNumBytes) {
@@ -826,14 +826,14 @@ OSStatus AudioFileObject::HowManyPacketsCanBeReadIntoBuffer(UInt32* ioNumBytes,
okIndex = tryBound;
break;
}
- }
-
+ }
+
SInt64 numPackets = okIndex - inStartingPacket + 1;
if (numPackets > *ioNumPackets) {
numPackets = *ioNumPackets;
okIndex = inStartingPacket + numPackets - 1;
}
-
+
AudioStreamPacketDescription packet = (*packetTable)[okIndex];
*ioNumBytes = (UInt32)(packet.mStartOffset + packet.mDataByteSize - firstPacket.mStartOffset);
*ioNumPackets = (UInt32)numPackets;
@@ -846,25 +846,25 @@ OSStatus AudioFileObject::HowManyPacketsCanBeReadIntoBuffer(UInt32* ioNumBytes,
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-OSStatus AudioFileObject::ReadPacketDataVBR_InTable(
+OSStatus AudioFileObject::ReadPacketDataVBR_InTable(
Boolean inUseCache,
UInt32 *ioNumBytes,
AudioStreamPacketDescription *outPacketDescriptions,
- SInt64 inStartingPacket,
- UInt32 *ioNumPackets,
+ SInt64 inStartingPacket,
+ UInt32 *ioNumPackets,
void *outBuffer)
{
CompressedPacketTable* packetTable = GetPacketTable();
- if (!packetTable)
+ if (!packetTable)
return kAudioFileInvalidFileError;
-
+
OSStatus err = HowManyPacketsCanBeReadIntoBuffer(ioNumBytes, inStartingPacket, ioNumPackets);
if (err) return err;
-
+
AudioStreamPacketDescription firstPacket = (*packetTable)[inStartingPacket];
SInt64 firstPacketOffset = firstPacket.mStartOffset;
UInt32 bytesRead = *ioNumBytes;
-
+
if (outBuffer) {
err = ReadBytes (inUseCache, firstPacketOffset, &bytesRead, outBuffer);
if (err && err != kAudioFileEndOfFileError) {
@@ -874,12 +874,12 @@ OSStatus AudioFileObject::ReadPacketDataVBR_InTable(
}
*ioNumBytes = bytesRead;
}
-
+
// fill out packet descriptions
- if (outPacketDescriptions) {
+ if (outPacketDescriptions) {
for (UInt32 i = 0; i < *ioNumPackets; i++) {
AudioStreamPacketDescription curPacket = (*packetTable)[i + inStartingPacket];
- outPacketDescriptions[i] = curPacket;
+ outPacketDescriptions[i] = curPacket;
outPacketDescriptions[i].mStartOffset = curPacket.mStartOffset - firstPacketOffset;
}
}
@@ -890,20 +890,20 @@ OSStatus AudioFileObject::ReadPacketDataVBR_InTable(
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-OSStatus AudioFileObject::WritePackets(
+OSStatus AudioFileObject::WritePackets(
Boolean inUseCache,
UInt32 inNumBytes,
const AudioStreamPacketDescription *inPacketDescriptions,
- SInt64 inStartingPacket,
- UInt32 *ioNumPackets,
+ SInt64 inStartingPacket,
+ UInt32 *ioNumPackets,
const void *inBuffer)
{
// This only works with CBR. To suppport VBR you must override.
OSStatus err = noErr;
-
+
FailWithAction(inStartingPacket > GetNumPackets(), err = kAudioFileInvalidPacketOffsetError, Bail, "write past end");
FailWithAction((ioNumPackets == NULL) || (inBuffer == NULL), err = kAudioFileUnspecifiedError, Bail, "invalid parameter");
-
+
{
UInt32 byteCount = *ioNumPackets * mDataFormat.mBytesPerPacket;
SInt64 startingByte = inStartingPacket * mDataFormat.mBytesPerPacket;
@@ -922,21 +922,21 @@ Bail:
OSStatus AudioFileObject::GetBitRate( UInt32 *outBitRate)
{
-
+
if (!outBitRate) return kAudioFileUnspecifiedError;
-
+
UInt32 bytesPerPacket = GetDataFormat().mBytesPerPacket;
UInt32 framesPerPacket = GetDataFormat().mFramesPerPacket;
Float64 sampleRate = GetDataFormat().mSampleRate;
const Float64 bitsPerByte = 8.;
-
+
if (bytesPerPacket && framesPerPacket) {
*outBitRate = (UInt32)(bitsPerByte * (Float64)bytesPerPacket * sampleRate / (Float64)framesPerPacket);
- } else {
+ } else {
SInt64 numPackets = GetNumPackets();
SInt64 numBytes = GetNumBytes();
SInt64 numFrames = 0;
-
+
if (framesPerPacket) {
numFrames = numPackets * framesPerPacket;
} else {
@@ -953,12 +953,12 @@ OSStatus AudioFileObject::GetBitRate( UInt32 *outBitRate)
#endif
{
numFrames += (*packetTable)[i].mVariableFramesInPacket;
- }
+ }
} else {
return kAudioFileUnsupportedPropertyError;
}
}
-
+
if (numFrames == 0 || (sampleRate == 0.)) {
*outBitRate = 0;
return noErr;
@@ -1098,18 +1098,18 @@ OSStatus AudioFileObject::GetInfoDictionarySize( UInt32 *outDataSize,
}
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
+
OSStatus AudioFileObject::GetInfoDictionary(CACFDictionary *infoDict)
-{
+{
Float64 fl;
if (GetEstimatedDuration(&fl) == noErr)
return AddDurationToInfoDictionary(infoDict, fl);
-
+
return kAudioFileUnsupportedPropertyError;
}
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
+
OSStatus AudioFileObject::SetInfoDictionary(CACFDictionary *infoDict)
{
return kAudioFileUnsupportedPropertyError;
@@ -1120,31 +1120,31 @@ OSStatus AudioFileObject::GetEstimatedDuration(Float64* duration)
{
// calculate duration
AudioStreamBasicDescription ASBD = GetDataFormat();
-
+
*duration = (ASBD.mFramesPerPacket != 0) ? (GetNumPackets() * ASBD.mFramesPerPacket) / ASBD.mSampleRate : 0.0;
-
+
/*
For now, assume that any ASBD that has zero in the frames per packet field has been subclassed for this
method. i.e. A CAF file has a frame count in one of it's chunks.
-
- MP3 has been subclassed because it guesstimates a duration so the entire file does not
+
+ MP3 has been subclassed because it guesstimates a duration so the entire file does not
need to be parsed in order to calculate the total frames.
*/
-
+
return noErr;
}
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-OSStatus AudioFileObject::GetPropertyInfo (
+OSStatus AudioFileObject::GetPropertyInfo (
AudioFilePropertyID inPropertyID,
UInt32 *outDataSize,
UInt32 *isWritable)
{
OSStatus err = noErr;
UInt32 writable = 0;
-
+
switch (inPropertyID)
{
case kAudioFilePropertyDeferSizeUpdates :
@@ -1161,11 +1161,11 @@ OSStatus AudioFileObject::GetPropertyInfo (
if (outDataSize) *outDataSize = sizeof(AudioStreamBasicDescription);
writable = 1;
break;
-
+
case kAudioFilePropertyFormatList:
err = GetFormatListInfo(*outDataSize, writable);
break;
-
+
case kAudioFilePropertyPacketSizeUpperBound:
case kAudioFilePropertyIsOptimized:
case kAudioFilePropertyMaximumPacketSize:
@@ -1184,25 +1184,25 @@ OSStatus AudioFileObject::GetPropertyInfo (
if (outDataSize) *outDataSize = sizeof(SInt64);
break;
- case kAudioFilePropertyBitRate:
+ case kAudioFilePropertyBitRate:
writable = 0;
if (outDataSize) *outDataSize = sizeof(UInt32);
break;
- case kAudioFilePropertyMagicCookieData:
+ case kAudioFilePropertyMagicCookieData:
err = GetMagicCookieDataSize(outDataSize, &writable);
break;
case kAudioFilePropertyMarkerList :
- err = GetMarkerListSize(outDataSize, &writable);
+ err = GetMarkerListSize(outDataSize, &writable);
break;
-
+
case kAudioFilePropertyRegionList :
- err = GetRegionListSize(outDataSize, &writable);
+ err = GetRegionListSize(outDataSize, &writable);
break;
-
+
case kAudioFilePropertyChannelLayout :
- err = GetChannelLayoutSize(outDataSize, &writable);
+ err = GetChannelLayoutSize(outDataSize, &writable);
break;
case kAudioFilePropertyPacketToFrame :
@@ -1218,11 +1218,11 @@ OSStatus AudioFileObject::GetPropertyInfo (
break;
case kAudioFilePropertyInfoDictionary :
- err = GetInfoDictionarySize(outDataSize, &writable);
+ err = GetInfoDictionarySize(outDataSize, &writable);
break;
case kTEMPAudioFilePropertySoundCheckDictionary :
- err = GetSoundCheckDictionarySize(outDataSize, &writable);
+ err = GetSoundCheckDictionarySize(outDataSize, &writable);
break;
case kTEMPAudioFilePropertyGenerateLoudnessInfo :
@@ -1253,7 +1253,7 @@ OSStatus AudioFileObject::GetPropertyInfo (
if (outDataSize) *outDataSize = sizeof(SInt32);
if (isWritable) *isWritable = CanWrite();
break;
-
+
default:
writable = 0;
err = kAudioFileUnsupportedPropertyError;
@@ -1275,109 +1275,109 @@ OSStatus AudioFileObject::GetProperty(
OSStatus err = noErr;
UInt32 neededSize;
UInt32 writable;
-
+
switch (inPropertyID)
{
case kAudioFilePropertyFileFormat:
- FailWithAction(*ioDataSize != sizeof(UInt32),
+ FailWithAction(*ioDataSize != sizeof(UInt32),
err = kAudioFileBadPropertySizeError, Bail, "inDataSize is wrong");
-
+
*(UInt32 *) ioPropertyData = GetFileType();
break;
case kAudioFilePropertyFormatList:
err = GetFormatList(*ioDataSize, (AudioFormatListItem*)ioPropertyData);
break;
-
+
case kAudioFilePropertyDataFormat:
- FailWithAction(*ioDataSize != sizeof(AudioStreamBasicDescription),
+ FailWithAction(*ioDataSize != sizeof(AudioStreamBasicDescription),
err = kAudioFileBadPropertySizeError, Bail, "inDataSize is wrong");
-
+
memcpy(ioPropertyData, &mDataFormat, sizeof(AudioStreamBasicDescription));
break;
case kAudioFilePropertyDataOffset:
- FailWithAction(*ioDataSize != sizeof(SInt64),
+ FailWithAction(*ioDataSize != sizeof(SInt64),
err = kAudioFileBadPropertySizeError, Bail, "inDataSize is wrong");
*(SInt64 *) ioPropertyData = mDataOffset;
break;
case kAudioFilePropertyIsOptimized:
- FailWithAction(*ioDataSize != sizeof(UInt32),
+ FailWithAction(*ioDataSize != sizeof(UInt32),
err = kAudioFileBadPropertySizeError, Bail, "inDataSize is wrong");
*(UInt32 *) ioPropertyData = mIsOptimized;
break;
case kAudioFilePropertyAudioDataByteCount:
- FailWithAction(*ioDataSize != sizeof(SInt64),
+ FailWithAction(*ioDataSize != sizeof(SInt64),
err = kAudioFileBadPropertySizeError, Bail, "inDataSize is wrong");
*(SInt64 *)ioPropertyData = GetNumBytes();
break;
case kAudioFilePropertyAudioDataPacketCount:
- FailWithAction(*ioDataSize != sizeof(SInt64),
+ FailWithAction(*ioDataSize != sizeof(SInt64),
err = kAudioFileBadPropertySizeError, Bail, "inDataSize is wrong");
*(SInt64 *)ioPropertyData = GetNumPackets();
break;
case kAudioFilePropertyPacketSizeUpperBound:
- FailWithAction(*ioDataSize != sizeof(UInt32),
+ FailWithAction(*ioDataSize != sizeof(UInt32),
err = kAudioFileBadPropertySizeError, Bail, "inDataSize is wrong");
*(UInt32 *)ioPropertyData = GetPacketSizeUpperBound();
break;
-
+
case kAudioFilePropertyMaximumPacketSize:
- FailWithAction(*ioDataSize != sizeof(UInt32),
+ FailWithAction(*ioDataSize != sizeof(UInt32),
err = kAudioFileBadPropertySizeError, Bail, "inDataSize is wrong");
*(UInt32 *)ioPropertyData = FindMaximumPacketSize();
break;
- case kAudioFilePropertyBitRate:
- FailWithAction(*ioDataSize != sizeof(UInt32),
+ case kAudioFilePropertyBitRate:
+ FailWithAction(*ioDataSize != sizeof(UInt32),
err = kAudioFileBadPropertySizeError, Bail, "inDataSize is wrong");
err = GetBitRate((UInt32*)ioPropertyData);
break;
- case kAudioFilePropertyMagicCookieData:
-
+ case kAudioFilePropertyMagicCookieData:
+
err = GetMagicCookieData(ioDataSize, ioPropertyData);
break;
case kAudioFilePropertyMarkerList :
- err = GetMarkerList(ioDataSize, static_cast<AudioFileMarkerList*>(ioPropertyData));
+ err = GetMarkerList(ioDataSize, static_cast<AudioFileMarkerList*>(ioPropertyData));
break;
-
+
case kAudioFilePropertyRegionList :
memset(ioPropertyData, 0, *ioDataSize);
- err = GetRegionList(ioDataSize, static_cast<AudioFileRegionList*>(ioPropertyData));
+ err = GetRegionList(ioDataSize, static_cast<AudioFileRegionList*>(ioPropertyData));
break;
-
+
case kAudioFilePropertyChannelLayout :
err = GetChannelLayoutSize(&neededSize, &writable);
FailIf(err, Bail, "GetChannelLayoutSize failed");
FailWithAction(*ioDataSize != neededSize, err = kAudioFileBadPropertySizeError, Bail, "inDataSize is wrong");
-
- err = GetChannelLayout(ioDataSize, static_cast<AudioChannelLayout*>(ioPropertyData));
+
+ err = GetChannelLayout(ioDataSize, static_cast<AudioChannelLayout*>(ioPropertyData));
break;
-
+
case kAudioFilePropertyDeferSizeUpdates :
- FailWithAction(*ioDataSize != sizeof(UInt32),
+ FailWithAction(*ioDataSize != sizeof(UInt32),
err = kAudioFileBadPropertySizeError, Bail, "inDataSize is wrong");
-
+
*(UInt32 *) ioPropertyData = DeferSizeUpdates();
break;
- case kAudioFilePropertyPacketToFrame :
+ case kAudioFilePropertyPacketToFrame :
{
- FailWithAction(*ioDataSize != sizeof(AudioFramePacketTranslation),
+ FailWithAction(*ioDataSize != sizeof(AudioFramePacketTranslation),
err = kAudioFileBadPropertySizeError, Bail, "inDataSize is wrong");
-
+
AudioFramePacketTranslation* afpt = (AudioFramePacketTranslation*)ioPropertyData;
err = PacketToFrame(afpt->mPacket, afpt->mFrame);
break;
- }
+ }
case kAudioFilePropertyFrameToPacket :
{
- FailWithAction(*ioDataSize != sizeof(AudioFramePacketTranslation),
+ FailWithAction(*ioDataSize != sizeof(AudioFramePacketTranslation),
err = kAudioFileBadPropertySizeError, Bail, "inDataSize is wrong");
AudioFramePacketTranslation* afpt = (AudioFramePacketTranslation*)ioPropertyData;
@@ -1385,18 +1385,18 @@ OSStatus AudioFileObject::GetProperty(
break;
}
- case kAudioFilePropertyPacketToByte :
+ case kAudioFilePropertyPacketToByte :
{
- FailWithAction(*ioDataSize != sizeof(AudioBytePacketTranslation),
+ FailWithAction(*ioDataSize != sizeof(AudioBytePacketTranslation),
err = kAudioFileBadPropertySizeError, Bail, "inDataSize is wrong");
-
+
AudioBytePacketTranslation* abpt = (AudioBytePacketTranslation*)ioPropertyData;
err = PacketToByte(abpt);
break;
- }
+ }
case kAudioFilePropertyByteToPacket :
{
- FailWithAction(*ioDataSize != sizeof(AudioBytePacketTranslation),
+ FailWithAction(*ioDataSize != sizeof(AudioBytePacketTranslation),
err = kAudioFileBadPropertySizeError, Bail, "inDataSize is wrong");
AudioBytePacketTranslation* abpt = (AudioBytePacketTranslation*)ioPropertyData;
@@ -1406,13 +1406,13 @@ OSStatus AudioFileObject::GetProperty(
case kAudioFilePropertyInfoDictionary :
{
- FailWithAction(*ioDataSize != sizeof(CFDictionaryRef),
+ FailWithAction(*ioDataSize != sizeof(CFDictionaryRef),
err = kAudioFileBadPropertySizeError, Bail, "inDataSize is wrong");
CACFDictionary afInfoDictionary(true);
- err = GetInfoDictionary(&afInfoDictionary);
-
+ err = GetInfoDictionary(&afInfoDictionary);
+
if (!err)
{
*(CFMutableDictionaryRef *)ioPropertyData = afInfoDictionary.CopyCFMutableDictionary();
@@ -1422,7 +1422,7 @@ OSStatus AudioFileObject::GetProperty(
case kTEMPAudioFilePropertySoundCheckDictionary :
{
- FailWithAction(*ioDataSize != sizeof(CFDictionaryRef),
+ FailWithAction(*ioDataSize != sizeof(CFDictionaryRef),
err = kAudioFileBadPropertySizeError, Bail, "inDataSize is wrong");
CACFDictionary afInfoDictionary(true);
@@ -1432,7 +1432,7 @@ OSStatus AudioFileObject::GetProperty(
OSStatus err2 = GetSoundCheckDictionaryFromLoudnessInfo(&afInfoDictionary);
if (err2 == noErr) err = noErr; // else report original error from GetSoundCheckDictionary.
}
-
+
if (!err)
{
*(CFMutableDictionaryRef *)ioPropertyData = afInfoDictionary.CopyCFMutableDictionary();
@@ -1442,7 +1442,7 @@ OSStatus AudioFileObject::GetProperty(
case kTEMPAudioFilePropertyLoudnessInfo :
{
- FailWithAction(*ioDataSize != sizeof(CFDictionaryRef),
+ FailWithAction(*ioDataSize != sizeof(CFDictionaryRef),
err = kAudioFileBadPropertySizeError, Bail, "inDataSize is wrong");
CACFDictionary afInfoDictionary(true);
@@ -1452,8 +1452,8 @@ OSStatus AudioFileObject::GetProperty(
OSStatus err2 = GetLoudnessInfoFromSoundCheckDictionary(&afInfoDictionary);
if (err2 == noErr) err = noErr; // else report original error from GetLoudnessInfo.
}
-
- if (!err)
+
+ if (!err)
{
*(CFMutableDictionaryRef *)ioPropertyData = afInfoDictionary.CopyCFMutableDictionary();
}
@@ -1467,8 +1467,8 @@ OSStatus AudioFileObject::GetProperty(
CACFDictionary afInfoDictionary(true);
- err = GenerateLoudnessInfo(&afInfoDictionary);
-
+ err = GenerateLoudnessInfo(&afInfoDictionary);
+
if (!err)
{
*(CFMutableDictionaryRef *)ioPropertyData = afInfoDictionary.CopyCFMutableDictionary();
@@ -1478,10 +1478,10 @@ OSStatus AudioFileObject::GetProperty(
case kAudioFilePropertyEstimatedDuration :
{
- FailWithAction(*ioDataSize != sizeof(Float64),
+ FailWithAction(*ioDataSize != sizeof(Float64),
err = kAudioFileBadPropertySizeError, Bail, "inDataSize is wrong");
-
- err = GetEstimatedDuration((Float64*)ioPropertyData);
+
+ err = GetEstimatedDuration((Float64*)ioPropertyData);
break;
}
@@ -1492,21 +1492,21 @@ OSStatus AudioFileObject::GetProperty(
*ioDataSize = sizeof(CFStringRef);
err = GetLyrics((CFStringRef*) ioPropertyData);
break;
-
- case 'eof?' :
+
+ case 'eof?' :
{
if (*ioDataSize != sizeof(UInt32))
return kAudioFileBadPropertySizeError;
-
+
SInt64 pos;
err = GetDataSource()->GetPos(pos);
if (err) break;
-
+
SInt64 endOfData = GetDataOffset() + GetNumBytes();
*(UInt32*)ioPropertyData = pos >= endOfData;
-
+
break;
- }
+ }
case 'sbtd' /*kAudioFilePropertySourceBitDepth*/ :
{
if (*ioDataSize != sizeof(SInt32))
@@ -1518,17 +1518,17 @@ OSStatus AudioFileObject::GetProperty(
// if there was no stored source bit depth, and this file is LPCM, then report this file's bit depth.
err = noErr;
outValue = GetDataFormat().mBitsPerChannel;
- if (GetDataFormat().mFormatFlags & kAudioFormatFlagIsFloat)
+ if (GetDataFormat().mFormatFlags & kAudioFormatFlagIsFloat)
outValue = -outValue;
- } else if (err)
+ } else if (err)
break;
-
+
*(SInt32 *) ioPropertyData = outValue;
-
+
break;
- }
+ }
default:
- err = kAudioFileUnsupportedPropertyError;
+ err = kAudioFileUnsupportedPropertyError;
break;
}
@@ -1548,14 +1548,14 @@ OSStatus AudioFileObject::SetProperty(
switch (inPropertyID)
{
case kAudioFilePropertyDataFormat:
- FailWithAction(inDataSize != sizeof(AudioStreamBasicDescription),
+ FailWithAction(inDataSize != sizeof(AudioStreamBasicDescription),
err = kAudioFileBadPropertySizeError, Bail, "Incorrect data size");
err = UpdateDataFormat((AudioStreamBasicDescription *) inPropertyData);
break;
case kAudioFilePropertyFormatList:
err = SetFormatList(inDataSize, (AudioFormatListItem*)inPropertyData);
break;
-
+
case kAudioFilePropertyAudioDataByteCount: {
FailWithAction(inDataSize != sizeof(SInt64), err = kAudioFileBadPropertySizeError, Bail, "Incorrect data size");
SInt64 numBytes = *(SInt64 *) inPropertyData;
@@ -1577,82 +1577,82 @@ OSStatus AudioFileObject::SetProperty(
}
err = UpdateNumPackets(numPackets);
} break;
-
- case kAudioFilePropertyMagicCookieData:
+
+ case kAudioFilePropertyMagicCookieData:
err = SetMagicCookieData(inDataSize, inPropertyData);
break;
case kAudioFilePropertyMarkerList :
- err = SetMarkerList(inDataSize, static_cast<const AudioFileMarkerList*>(inPropertyData));
+ err = SetMarkerList(inDataSize, static_cast<const AudioFileMarkerList*>(inPropertyData));
break;
-
+
case kAudioFilePropertyRegionList :
- err = SetRegionList(inDataSize, static_cast<const AudioFileRegionList*>(inPropertyData));
+ err = SetRegionList(inDataSize, static_cast<const AudioFileRegionList*>(inPropertyData));
break;
-
+
case kAudioFilePropertyChannelLayout :
- err = SetChannelLayout(inDataSize, static_cast<const AudioChannelLayout*>(inPropertyData));
+ err = SetChannelLayout(inDataSize, static_cast<const AudioChannelLayout*>(inPropertyData));
break;
case kAudioFilePropertyDeferSizeUpdates :
- FailWithAction(inDataSize != sizeof(UInt32),
+ FailWithAction(inDataSize != sizeof(UInt32),
err = kAudioFileBadPropertySizeError, Bail, "inDataSize is wrong");
SetDeferSizeUpdates(*(UInt32 *) inPropertyData);
break;
case kAudioFilePropertyInfoDictionary :
{
- FailWithAction(inDataSize != sizeof(CFDictionaryRef),
+ FailWithAction(inDataSize != sizeof(CFDictionaryRef),
err = kAudioFileBadPropertySizeError, Bail, "inDataSize is wrong");
// pass the SetInfoDictionary a CACFDictionary object made with the provided CFDictionaryRef
// Let the caller release their own CFObject so pass false for th erelease parameter
CACFDictionary afInfoDictionary(*(CFDictionaryRef *)inPropertyData, false);
- err = SetInfoDictionary(&afInfoDictionary);
-
+ err = SetInfoDictionary(&afInfoDictionary);
+
break;
}
-
+
case kTEMPAudioFilePropertySoundCheckDictionary :
{
- FailWithAction(inDataSize != sizeof(CFDictionaryRef),
+ FailWithAction(inDataSize != sizeof(CFDictionaryRef),
err = kAudioFileBadPropertySizeError, Bail, "inDataSize is wrong");
// pass the SetInfoDictionary a CACFDictionary object made with the provided CFDictionaryRef
// Let the caller release their own CFObject so pass false for the release parameter
CACFDictionary afInfoDictionary(*(CFDictionaryRef *)inPropertyData, false);
- err = SetSoundCheckDictionary(&afInfoDictionary);
-
+ err = SetSoundCheckDictionary(&afInfoDictionary);
+
break;
}
case kTEMPAudioFilePropertyLoudnessInfo :
{
- FailWithAction(inDataSize != sizeof(CFDictionaryRef),
+ FailWithAction(inDataSize != sizeof(CFDictionaryRef),
err = kAudioFileBadPropertySizeError, Bail, "inDataSize is wrong");
// pass the SetInfoDictionary a CACFDictionary object made with the provided CFDictionaryRef
// Let the caller release their own CFObject so pass false for the release parameter
CACFDictionary afInfoDictionary(*(CFDictionaryRef *)inPropertyData, false);
- err = SetLoudnessInfo(&afInfoDictionary);
-
+ err = SetLoudnessInfo(&afInfoDictionary);
+
break;
}
-
+
case 'sbtd' /*kAudioFilePropertySourceBitDepth*/ :
{
- FailWithAction(inDataSize != sizeof(SInt32),
+ FailWithAction(inDataSize != sizeof(SInt32),
err = kAudioFileBadPropertySizeError, Bail, "inDataSize is wrong");
SInt32 inValue = *(SInt32 *)inPropertyData;
err = SetSourceBitDepth(inValue);
-
+
break;
- }
+ }
default:
- err = kAudioFileUnsupportedPropertyError;
+ err = kAudioFileUnsupportedPropertyError;
break;
}
@@ -1666,17 +1666,17 @@ Bail:
OSStatus AudioFileObject::SetDataFormat(const AudioStreamBasicDescription* inStreamFormat)
{
OSStatus err = noErr;
-
+
if (!IsDataFormatValid(inStreamFormat))
return kAudioFileUnsupportedDataFormatError;
- if (!IsDataFormatSupported(inStreamFormat))
+ if (!IsDataFormatSupported(inStreamFormat))
return kAudioFileUnsupportedDataFormatError;
-
+
UInt32 prevBytesPerPacket = mDataFormat.mBytesPerPacket;
-
+
mDataFormat = *inStreamFormat;
-
+
// if CBR and bytes per packet changes, we need to change the number of packets we think we have.
if (mDataFormat.mBytesPerPacket && mDataFormat.mBytesPerPacket != prevBytesPerPacket)
{
@@ -1687,9 +1687,9 @@ OSStatus AudioFileObject::SetDataFormat(const AudioStreamBasicDescription* inStr
if (!mFirstSetFormat)
SizeChanged();
}
-
+
mFirstSetFormat = false;
-
+
return err;
}
@@ -1712,7 +1712,7 @@ OSStatus AudioFileObject::GetFormatList( UInt32 &ioDataSize,
// default implementation is to just return the data format
if (ioDataSize < sizeof(AudioFormatListItem))
return kAudioFileBadPropertySizeError;
-
+
AudioFormatListItem afli;
afli.mASBD = mDataFormat;
AudioChannelLayoutTag layoutTag = /*kAudioChannelLayoutTag_Unknown*/ 0xFFFF0000 | mDataFormat.mChannelsPerFrame;
@@ -1727,14 +1727,14 @@ OSStatus AudioFileObject::GetFormatList( UInt32 &ioDataSize,
layoutTag = layout->mChannelLayoutTag;
}
}
- afli.mChannelLayoutTag = layoutTag;
-
+ afli.mChannelLayoutTag = layoutTag;
+
memcpy(ioPropertyData, &afli, sizeof(AudioFormatListItem));
-
+
ioDataSize = sizeof(AudioFormatListItem);
return noErr;
}
-
+
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
OSStatus AudioFileObject::SetFormatList( UInt32 inDataSize,
@@ -1765,22 +1765,22 @@ Boolean AudioFileObject::IsDataFormatValid(AudioStreamBasicDescription const* in
return false;
if (inDesc->mFormatID == kAudioFormatLinearPCM)
- {
+ {
if (inDesc->mBitsPerChannel < 1 || inDesc->mBitsPerChannel > 64)
return false;
-
+
if (inDesc->mFramesPerPacket != 1)
return false;
-
- if (inDesc->mBytesPerPacket == 0)
+
+ if (inDesc->mBytesPerPacket == 0)
return false;
if (inDesc->mBytesPerFrame != inDesc->mBytesPerPacket)
return false;
-
+
// [3605260] we assume here that a packet is an integer number of frames.
UInt32 minimumBytesPerPacket = (inDesc->mBitsPerChannel * inDesc->mChannelsPerFrame + 7) / 8;
- if (inDesc->mBytesPerPacket < minimumBytesPerPacket)
+ if (inDesc->mBytesPerPacket < minimumBytesPerPacket)
return false;
}
return true;
@@ -1788,7 +1788,7 @@ Boolean AudioFileObject::IsDataFormatValid(AudioStreamBasicDescription const* in
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-void AudioFileObject::SetDataSource(DataSource* inDataSource)
+void AudioFileObject::SetDataSource(DataSource* inDataSource)
{
if (mDataSource != inDataSource) {
delete mDataSource;
@@ -1811,21 +1811,21 @@ OSStatus AudioFileObject::OpenFile(SInt8 inPermissions, int inFD)
OSStatus err = noErr;
SetDataSource(new Cached_DataSource(new UnixFile_DataSource(inFD, inPermissions, true)));
-
+
mFileD = inFD;
SetPermissions (inPermissions);
return err;
}
-
+
OSStatus AudioFileObject::CreateDataFile (CFURLRef inFileRef, int &outFileD)
-{
- UInt8 fPath[FILENAME_MAX];
+{
+ UInt8 fPath[FILENAME_MAX];
if (!CFURLGetFileSystemRepresentation (inFileRef, true, fPath, FILENAME_MAX))
return kAudio_FileNotFoundError;
-
+
struct stat stbuf;
- if (stat ((const char*)fPath, &stbuf) == 0)
+ if (stat ((const char*)fPath, &stbuf) == 0)
return kAudioFilePermissionsError;
#if TARGET_OS_WIN32
@@ -1863,7 +1863,7 @@ OSStatus AudioFileObject::AddDurationToInfoDictionary(CACFDictionary *infoDict,
OSStatus AudioFileObject::SizeChanged()
{
OSStatus err = noErr;
- if (mPermissions & kAudioFileWritePermission)
+ if (mPermissions & kAudioFileWritePermission)
{
if (DeferSizeUpdates())
SetNeedsSizeUpdate(true);
@@ -1874,8 +1874,8 @@ OSStatus AudioFileObject::SizeChanged()
}
OSStatus AudioFileObject::UpdateSizeIfNeeded()
-{
- if (GetNeedsSizeUpdate())
+{
+ if (GetNeedsSizeUpdate())
{
OSStatus err = UpdateSize();
if (err) return err;
@@ -1896,7 +1896,7 @@ OSStatus AudioFileObject::GetUserDataSize( UInt32 /*inUserDataID*/,
{
return kAudioFileOperationNotSupportedError;
}
-
+
OSStatus AudioFileObject::GetUserData( UInt32 /*inUserDataID*/,
UInt32 /*inIndex*/,
UInt32* /*ioDataSize*/,
@@ -1904,7 +1904,7 @@ OSStatus AudioFileObject::GetUserData( UInt32 /*inUserDataID*/,
{
return kAudioFileOperationNotSupportedError;
}
-
+
OSStatus AudioFileObject::SetUserData( UInt32 /*inUserDataID*/,
UInt32 /*inIndex*/,
UInt32 /*inDataSize*/,
@@ -1912,7 +1912,7 @@ OSStatus AudioFileObject::SetUserData( UInt32 /*inUserDataID*/,
{
return kAudioFileOperationNotSupportedError;
}
-
+
OSStatus AudioFileObject::RemoveUserData( UInt32 /*inUserDataID*/,
UInt32 /*inIndex*/)
{
@@ -1921,7 +1921,7 @@ OSStatus AudioFileObject::RemoveUserData( UInt32 /*inUserDataID*/,
OSStatus AudioFileObject::MoveData(SInt64 fromPos, SInt64 toPos, SInt64 size)
{
- if (fromPos == toPos)
+ if (fromPos == toPos)
return noErr;
OSStatus err = noErr;
@@ -1933,13 +1933,13 @@ OSStatus AudioFileObject::MoveData(SInt64 fromPos, SInt64 toPos, SInt64 size)
{
// read from old file
UInt32 byteCount;
- SInt64 count = (bytesRemaining < kCopySoundDataBufferSize) ? bytesRemaining : kCopySoundDataBufferSize;
+ SInt64 count = (bytesRemaining < kCopySoundDataBufferSize) ? bytesRemaining : kCopySoundDataBufferSize;
err = GetDataSource()->ReadBytes(SEEK_SET, fromPos+(bytesRemaining-count), (UInt32)count, audioData(), &byteCount);
FailIf (err != noErr, Bail, "MoveData ReadBytes failed");
err = GetDataSource()->WriteBytes(SEEK_SET, toPos+(bytesRemaining-count), (UInt32)count, audioData(), &byteCount);
FailIf (err != noErr, Bail, "WriteBytes failed");
-
+
bytesRemaining -= count;
}
} else {
@@ -1947,17 +1947,17 @@ OSStatus AudioFileObject::MoveData(SInt64 fromPos, SInt64 toPos, SInt64 size)
{
// read from old file
UInt32 byteCount;
- SInt64 count = (bytesRemaining < kCopySoundDataBufferSize) ? bytesRemaining : kCopySoundDataBufferSize;
+ SInt64 count = (bytesRemaining < kCopySoundDataBufferSize) ? bytesRemaining : kCopySoundDataBufferSize;
err = GetDataSource()->ReadBytes(SEEK_SET, fromPos+(size - bytesRemaining), (UInt32)count, audioData(), &byteCount);
FailIf (err != noErr, Bail, "MoveData ReadBytes failed");
-
+
err = GetDataSource()->WriteBytes(SEEK_SET, toPos+(size - bytesRemaining), (UInt32)count, audioData(), &byteCount);
FailIf (err != noErr, Bail, "WriteBytes failed");
-
+
bytesRemaining -= count;
}
}
-
+
Bail:
return err;
}
diff --git a/libs/appleutility/CoreAudio/AudioFile/AFPublic/AudioFileObject.h b/libs/appleutility/CoreAudio/AudioFile/AFPublic/AudioFileObject.h
index 6d7c868976..9af04ec972 100644
--- a/libs/appleutility/CoreAudio/AudioFile/AFPublic/AudioFileObject.h
+++ b/libs/appleutility/CoreAudio/AudioFile/AFPublic/AudioFileObject.h
@@ -2,14 +2,14 @@
File: AudioFileObject.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 _AudioFileObject_H_
#define _AudioFileObject_H_
@@ -96,12 +96,12 @@ enum {
// as described by the magic cookie.
// The specifier is an AudioFormatInfo struct. At a minimum formatID member of the ASBD struct must filled in. Other fields
// may be filled in.
-
+
kAudioFormatProperty_OutputFormatList = 'ofls',
// Returns a list of AudioFormatListItem structs describing the audio formats which may be obtained by decoding the format
// described by the specifier.
// The specifier is an AudioFormatInfo struct. At a minimum formatID member of the ASBD struct must filled in. Other fields
- // may be filled in. If there is no magic cookie, then the number of channels and sample rate should be filled in.
+ // may be filled in. If there is no magic cookie, then the number of channels and sample rate should be filled in.
};
@@ -134,7 +134,7 @@ enum {
kUpperCase_IMACompression = 'IMA4', /*IMA 4:1*/
kUpperCase_ULawCompression = 'ULAW', /*µLaw 2:1*/
kUpperCase_ALawCompression = 'ALAW', /*aLaw 2:1*/
-
+
kUpperCase_Float32 = 'FL32',
kUpperCase_Float64 = 'FL64'
};
@@ -142,7 +142,7 @@ enum {
enum
{
// in what header is this defined? what is it?
- kGSM = 'agsm',
+ kGSM = 'agsm',
kUpperCase_GSM = 'GSM '
};
@@ -209,9 +209,9 @@ private:
AudioStreamBasicDescription mDataFormat; // format of the audio data
SInt64 mDataOffset; // position if the file where audio data begins
UInt32 mIsOptimized; // 1 if there is nothing in the file following the audio data, 0 if there is
- UInt32 mFileType; // file type of the audio file (i.e. AIFF, WAVE, etc.)
+ UInt32 mFileType; // file type of the audio file (i.e. AIFF, WAVE, etc.)
CFURLRef mFileRef; // URL of the file passed to AudioFileOpen or AudioFileCreate
- int mFileD; // Ref num of the file after opening within Audio File
+ int mFileD; // Ref num of the file after opening within Audio File
SInt8 mPermissions; // file permissions indicated by the caller, passed by AudioFileOpen or set with SetProperty function
Boolean mIsInitialized; // has the AudioFileObject for this file been intialized?
DataSource *mDataSource;
@@ -221,9 +221,9 @@ private:
Boolean mNeedsSizeUpdate;
Boolean mFirstSetFormat;
Boolean mAlignDataWithFillerChunks;
-
-public:
-
+
+public:
+
AudioFileObject (UInt32 inFileType)
: mNumBytes(0),
mNumPackets(0),
@@ -244,159 +244,159 @@ public:
{
memset(&mDataFormat, 0, sizeof(mDataFormat));
}
-
+
virtual ~AudioFileObject();
-
+
/* Public API Function Implementation */
// The DoSomething() versions of these functions are wrappers that perform a standard prologue.
// The Something() methods are those which should be overridden in the subclasses.
-
+
OSStatus DoCreate( CFURLRef inFileRef,
const AudioStreamBasicDescription *inFormat,
UInt32 inFlags);
-
+
virtual OSStatus Create( CFURLRef inFileRef,
const AudioStreamBasicDescription *inFormat);
-
- OSStatus DoOpen( CFURLRef inFileRef,
+
+ OSStatus DoOpen( CFURLRef inFileRef,
SInt8 inPermissions,
int inFD);
-
- virtual OSStatus Open( CFURLRef inFileRef,
+
+ virtual OSStatus Open( CFURLRef inFileRef,
SInt8 inPermissions,
int inFD);
OSStatus DoOpenWithCallbacks(
- void * inRefCon,
- AudioFile_ReadProc inReadFunc,
- AudioFile_WriteProc inWriteFunc,
+ void * inRefCon,
+ AudioFile_ReadProc inReadFunc,
+ AudioFile_WriteProc inWriteFunc,
AudioFile_GetSizeProc inGetSizeFunc,
AudioFile_SetSizeProc inSetSizeFunc);
-
-
+
+
OSStatus DoInitialize( CFURLRef inFileRef,
const AudioStreamBasicDescription *inFormat,
UInt32 inFlags);
-
+
virtual OSStatus Initialize( CFURLRef inFileRef,
const AudioStreamBasicDescription *inFormat,
UInt32 inFlags);
-
+
OSStatus DoInitializeWithCallbacks(
- void * inRefCon,
- AudioFile_ReadProc inReadFunc,
- AudioFile_WriteProc inWriteFunc,
+ void * inRefCon,
+ AudioFile_ReadProc inReadFunc,
+ AudioFile_WriteProc inWriteFunc,
AudioFile_GetSizeProc inGetSizeFunc,
AudioFile_SetSizeProc inSetSizeFunc,
UInt32 inFileType,
const AudioStreamBasicDescription *inFormat,
UInt32 inFlags);
-
+
virtual OSStatus OpenFromDataSource(void);
-
+
virtual OSStatus InitializeDataSource(const AudioStreamBasicDescription *inFormat, UInt32 inFlags);
-
+
OSStatus DoClose();
-
+
virtual OSStatus Close();
-
+
OSStatus DoOptimize();
-
+
virtual OSStatus Optimize();
-
+
virtual OSStatus ReadBytes( Boolean inUseCache,
- SInt64 inStartingByte,
- UInt32 *ioNumBytes,
+ SInt64 inStartingByte,
+ UInt32 *ioNumBytes,
void *outBuffer);
-
+
virtual OSStatus WriteBytes( Boolean inUseCache,
- SInt64 inStartingByte,
- UInt32 *ioNumBytes,
+ SInt64 inStartingByte,
+ UInt32 *ioNumBytes,
const void *inBuffer);
-
+
virtual OSStatus ReadPackets( Boolean inUseCache,
UInt32 *outNumBytes,
AudioStreamPacketDescription *outPacketDescriptions,
- SInt64 inStartingPacket,
- UInt32 *ioNumPackets,
+ SInt64 inStartingPacket,
+ UInt32 *ioNumPackets,
void *outBuffer);
- virtual OSStatus ReadPacketData(
+ virtual OSStatus ReadPacketData(
Boolean inUseCache,
UInt32 *ioNumBytes,
AudioStreamPacketDescription *outPacketDescriptions,
- SInt64 inStartingPacket,
- UInt32 *ioNumPackets,
+ SInt64 inStartingPacket,
+ UInt32 *ioNumPackets,
void *outBuffer);
-
- virtual OSStatus ReadPacketDataVBR(
+
+ virtual OSStatus ReadPacketDataVBR(
Boolean inUseCache,
UInt32 *ioNumBytes,
AudioStreamPacketDescription *outPacketDescriptions,
- SInt64 inStartingPacket,
- UInt32 *ioNumPackets,
+ SInt64 inStartingPacket,
+ UInt32 *ioNumPackets,
void *outBuffer);
virtual OSStatus HowManyPacketsCanBeReadIntoBuffer(UInt32* ioNumBytes, SInt64 inStartingPacket, UInt32 *ioNumPackets);
- virtual OSStatus ReadPacketDataVBR_InTable(
+ virtual OSStatus ReadPacketDataVBR_InTable(
Boolean inUseCache,
UInt32 *ioNumBytes,
AudioStreamPacketDescription *outPacketDescriptions,
- SInt64 inStartingPacket,
- UInt32 *ioNumPackets,
+ SInt64 inStartingPacket,
+ UInt32 *ioNumPackets,
void *outBuffer);
-
+
virtual OSStatus WritePackets( Boolean inUseCache,
UInt32 inNumBytes,
const AudioStreamPacketDescription *inPacketDescriptions,
- SInt64 inStartingPacket,
- UInt32 *ioNumPackets,
+ SInt64 inStartingPacket,
+ UInt32 *ioNumPackets,
const void *inBuffer);
/* Property Support */
- virtual OSStatus GetPropertyInfo (
+ virtual OSStatus GetPropertyInfo (
AudioFilePropertyID inPropertyID,
UInt32 *outDataSize,
UInt32 *isWritable);
-
+
virtual OSStatus GetProperty ( AudioFilePropertyID inPropertyID,
UInt32 *ioDataSize,
void *ioPropertyData);
-
+
virtual OSStatus SetProperty ( AudioFilePropertyID inPropertyID,
UInt32 inDataSize,
const void *inPropertyData);
-
+
UInt32 GetFileType() const { return mFileType; }
void SetFileType(UInt32 inFileType) { mFileType = inFileType; }
-
+
// this will set the format in memory only.
virtual OSStatus SetDataFormat(const AudioStreamBasicDescription* inStreamFormat);
-
+
// this will update the format info on disk and in memory.
virtual OSStatus UpdateDataFormat(const AudioStreamBasicDescription* inStreamFormat);
-
+
const UInt32 GetBytesPerPacket() const { return mDataFormat.mBytesPerPacket; }
-
+
const AudioStreamBasicDescription &GetDataFormat() const { return mDataFormat; }
-
+
virtual OSStatus GetFormatListInfo( UInt32 &outDataSize,
UInt32 &outWritable);
-
+
virtual OSStatus GetFormatList( UInt32 &ioDataSize,
AudioFormatListItem *ioPropertyData);
-
+
virtual OSStatus SetFormatList( UInt32 inDataSize,
const AudioFormatListItem *inPropertyData);
-
+
virtual OSStatus UpdateSize() { return noErr; }
UInt32 DeferSizeUpdates() { return mDeferSizeUpdates; }
void SetDeferSizeUpdates(UInt32 inFlag) { mDeferSizeUpdates = inFlag; }
OSStatus UpdateSizeIfNeeded();
OSStatus SizeChanged();
-
+
Boolean IsOptimized() const { return mIsOptimized != 0; }
void SetIsOptimized(Boolean inIsOptimized) { mIsOptimized = inIsOptimized ? 1 : 0; }
@@ -407,79 +407,79 @@ public:
// this will update the header size info on disk
OSStatus UpdateNumBytes(SInt64 inNumBytes);
-
+
virtual SInt64 GetNumPackets(){ return mNumPackets; }
virtual void SetNumPackets(SInt64 inNumPackets) { mNumPackets = inNumPackets; }
-
+
// this will update the header size info on disk
OSStatus UpdateNumPackets(SInt64 inNumPackets);
virtual OSStatus PacketToFrame(SInt64 inPacket, SInt64& outFirstFrameInPacket);
virtual OSStatus FrameToPacket(SInt64 inFrame, SInt64& outPacket, UInt32& outFrameOffsetInPacket);
-
+
virtual OSStatus PacketToByte(AudioBytePacketTranslation* abpt);
-
+
virtual OSStatus ByteToPacket(AudioBytePacketTranslation* abpt);
-
+
virtual OSStatus GetBitRate( UInt32 *outBitRate);
-
+
virtual OSStatus GetMagicCookieDataSize( UInt32 *outDataSize,
UInt32 *isWritable);
-
+
virtual OSStatus GetMagicCookieData( UInt32 *ioDataSize,
void *ioPropertyData);
-
+
virtual OSStatus SetMagicCookieData( UInt32 inDataSize,
const void *inPropertyData);
virtual OSStatus GetMarkerListSize( UInt32 *outDataSize,
UInt32 *isWritable);
-
+
virtual OSStatus GetMarkerList( UInt32 *ioDataSize,
AudioFileMarkerList *ioMarkerList);
-
+
virtual OSStatus SetMarkerList( UInt32 inDataSize,
const AudioFileMarkerList *inMarkerList);
virtual OSStatus GetRegionListSize( UInt32 *outDataSize,
UInt32 *isWritable);
-
+
virtual OSStatus GetRegionList( UInt32 *ioDataSize,
AudioFileRegionList *ioRegionList);
-
+
virtual OSStatus SetRegionList( UInt32 inDataSize,
const AudioFileRegionList *inRegionList);
virtual OSStatus GetChannelLayoutSize( UInt32 *outDataSize,
UInt32 *isWritable);
-
+
virtual OSStatus GetChannelLayout( UInt32 *ioDataSize,
AudioChannelLayout *ioChannelLayout);
-
+
virtual OSStatus SetChannelLayout( UInt32 inDataSize,
const AudioChannelLayout *inChannelLayout);
virtual OSStatus GetInfoDictionarySize( UInt32 *outDataSize,
UInt32 *isWritable);
-
+
virtual OSStatus GetInfoDictionary( CACFDictionary *infoDict);
-
+
virtual OSStatus SetInfoDictionary( CACFDictionary *infoDict);
virtual OSStatus GetSoundCheckDictionarySize( UInt32 *outDataSize,
UInt32 *isWritable) { return kAudioFileUnsupportedPropertyError; }
-
+
virtual OSStatus GetSoundCheckDictionary( CACFDictionary *infoDict) { return kAudioFileUnsupportedPropertyError; }
-
+
virtual OSStatus SetSoundCheckDictionary( CACFDictionary *infoDict) { return kAudioFileUnsupportedPropertyError; }
-
+
virtual OSStatus GetLoudnessInfo( CACFDictionary *infoDict) { return kAudioFileUnsupportedPropertyError; }
-
+
virtual OSStatus GetSoundCheckDictionaryFromLoudnessInfo(CACFDictionary* outInfoDict) { return kAudioFileUnsupportedPropertyError; }
virtual OSStatus GetLoudnessInfoFromSoundCheckDictionary(CACFDictionary* outInfoDict) { return kAudioFileUnsupportedPropertyError; }
-
+
virtual OSStatus SetLoudnessInfo( CACFDictionary *infoDict) { return kAudioFileUnsupportedPropertyError; }
virtual OSStatus GetLoudnessInfoSize( UInt32 *outDataSize,
@@ -491,16 +491,16 @@ public:
virtual OSStatus CountUserData( UInt32 inUserDataID,
UInt32 *outNumberItems);
-
+
virtual OSStatus GetUserDataSize( UInt32 inUserDataID,
UInt32 inIndex,
UInt32 *outDataSize);
-
+
virtual OSStatus GetUserData( UInt32 inUserDataID,
UInt32 inIndex,
UInt32 *ioDataSize,
void *ioUserData);
-
+
virtual OSStatus SetUserData( UInt32 inUserDataID,
UInt32 inIndex,
UInt32 inDataSize,
@@ -516,14 +516,14 @@ public:
Boolean CanWrite() const { return mPermissions & kAudioFileWritePermission; }
void SetPermissions(SInt8 inPermissions) { mPermissions = inPermissions; }
-
+
/* Other Helper Methods: (some may not be necessary depending on how things are refactored) */
-
+
OSStatus OpenFile(SInt8 inPermissions, int inFD);
OSStatus CreateDataFile (CFURLRef inFileRef, int &outFileD);
- OSStatus AddDurationToInfoDictionary(CACFDictionary *infoDict, Float64 &inDuration);
+ OSStatus AddDurationToInfoDictionary(CACFDictionary *infoDict, Float64 &inDuration);
virtual Boolean IsDataFormatSupported(const AudioStreamBasicDescription *inFormat) = 0;
virtual Boolean IsDataFormatValid(const AudioStreamBasicDescription *inFormat);
@@ -535,21 +535,21 @@ public:
/* Accessors: */
Boolean IsInitialized() const { return mIsInitialized; }
void SetInitialized(Boolean inFlag) { mIsInitialized = inFlag; }
-
+
DataSource* GetDataSource() const { return mDataSource; }
void SetDataSource(DataSource *inDataSource);
-
+
void SetURL (CFURLRef inURL);
-
+
virtual UInt32 GetMaximumPacketSize() { return mMaximumPacketSize; }
virtual UInt32 FindMaximumPacketSize() { return mMaximumPacketSize; }
virtual void SetMaximumPacketSize(const UInt32 inPacketSize) { mMaximumPacketSize = inPacketSize; }
-
+
virtual UInt32 GetPacketSizeUpperBound() { return GetMaximumPacketSize (); }
-
- SInt64 GetDataOffset() const { return mDataOffset; }
- void SetDataOffset(SInt64 inOffset) { mDataOffset = inOffset; }
-
+
+ SInt64 GetDataOffset() const { return mDataOffset; }
+ void SetDataOffset(SInt64 inOffset) { mDataOffset = inOffset; }
+
// I like this idiom better than DoesPacketTableExist+NewPacketTable:
CompressedPacketTable* GetPacketTable(Boolean inCreateIt = false)
{
@@ -557,35 +557,35 @@ public:
mPacketTable = new CompressedPacketTable(mDataFormat.mFramesPerPacket);
return mPacketTable;
}
- void ClearPacketTable()
+ void ClearPacketTable()
{
DeletePacketTable();
GetPacketTable(true);
}
-
- virtual OSStatus ScanForPackets(SInt64 inToPacketCount, DataSource* inDataSrc = NULL, bool fullyParsedIfEndOfDataReached = true)
+
+ virtual OSStatus ScanForPackets(SInt64 inToPacketCount, DataSource* inDataSrc = NULL, bool fullyParsedIfEndOfDataReached = true)
{
// In formats that read packets lazily, this will be overridden to scan for packets up to the index.
if (inToPacketCount > GetNumPackets())
return kAudioFileEndOfFileError;
-
- return noErr;
+
+ return noErr;
}
-
- void AppendPacket(const AudioStreamPacketDescription &inPacket)
+
+ void AppendPacket(const AudioStreamPacketDescription &inPacket)
{
CompressedPacketTable* packetTable = GetPacketTable(true);
UInt32 numFramesInPacket = mDataFormat.mFramesPerPacket ? mDataFormat.mFramesPerPacket : inPacket.mVariableFramesInPacket;
-
+
AudioStreamPacketDescriptionExtended pext;
memset(&pext, 0, sizeof(pext));
pext.mStartOffset = inPacket.mStartOffset;
pext.mDataByteSize = inPacket.mDataByteSize;
pext.mVariableFramesInPacket = inPacket.mVariableFramesInPacket;
pext.mFrameOffset = numFramesInPacket + (packetTable->size() ? packetTable->back().mFrameOffset : 0);
-
- packetTable->push_back(pext);
- if (inPacket.mDataByteSize > mMaximumPacketSize)
+
+ packetTable->push_back(pext);
+ if (inPacket.mDataByteSize > mMaximumPacketSize)
mMaximumPacketSize = inPacket.mDataByteSize;
}
void DeletePacketTable() { delete mPacketTable; mPacketTable = NULL;}
@@ -597,9 +597,9 @@ public:
{
// only get as many packet descriptions as can fit in outPacketDescriptions
UInt32 count = *ioDataSize / sizeof(AudioStreamPacketDescription);
- if (count + inStartingPacket > GetPacketTableSize())
+ if (count + inStartingPacket > GetPacketTableSize())
count = (UInt32)(GetPacketTableSize() - inStartingPacket);
-
+
*ioDataSize = 0;
for (UInt32 i = inStartingPacket; i < (count + inStartingPacket); i++)
{
@@ -632,7 +632,7 @@ public:
Boolean GetNeedsSizeUpdate() const { return mNeedsSizeUpdate; }
void SetNeedsSizeUpdate(Boolean inNeedsSizeUpdate) { mNeedsSizeUpdate = inNeedsSizeUpdate; }
-
+
CFURLRef GetURL () const { return mFileRef; }
virtual OSStatus GetSourceBitDepth(SInt32& outValue) { outValue = 0; return kAudioFileUnsupportedPropertyError; }
@@ -646,7 +646,7 @@ private:
void SetAlignDataWithFillerChunks(Boolean inFlag) { mAlignDataWithFillerChunks = inFlag; }
OSStatus ValidateFormatAndData();
-
+
/* debug */
// virtual void PrintFile (FILE* inFile, const char *indent) = 0;
};
diff --git a/libs/appleutility/CoreAudio/AudioFile/AFPublic/CompressedPacketTable.cpp b/libs/appleutility/CoreAudio/AudioFile/AFPublic/CompressedPacketTable.cpp
index ba07580bba..d2c08906fb 100644
--- a/libs/appleutility/CoreAudio/AudioFile/AFPublic/CompressedPacketTable.cpp
+++ b/libs/appleutility/CoreAudio/AudioFile/AFPublic/CompressedPacketTable.cpp
@@ -2,14 +2,14 @@
File: CompressedPacketTable.cpp
Abstract: CompressedPacketTable.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 "CompressedPacketTable.h"
#include "CAAutoDisposer.h"
@@ -66,7 +66,7 @@ void CompressedPacketTable::push_back(const AudioStreamPacketDescriptionExtended
{
SInt64 baseIndex = mSize >> kShift;
UInt32 packetIndex = (UInt32)(mSize & kMask);
-
+
if (packetIndex == 0) {
// first packet in a new sequence. create a new PacketBase.
PacketBase newBase;
@@ -75,16 +75,16 @@ void CompressedPacketTable::push_back(const AudioStreamPacketDescriptionExtended
newBase.mDescType = kExtendedPacketDescription;
mBases.push_back(newBase);
}
-
+
PacketBase& base = mBases[(size_t)baseIndex];
AudioStreamPacketDescriptionExtended* descs = (AudioStreamPacketDescriptionExtended*)base.mDescs;
descs[packetIndex] = inDesc;
-
+
if (packetIndex == kMask) {
// last packet in a sequence. compress the sequence.
Compress(base);
}
-
+
mSize++;
}
@@ -109,13 +109,13 @@ const AudioStreamPacketDescriptionExtended CompressedPacketTable::operator[](SIn
if ((size_t)baseIndex >= mBases.size())
throw -1;
-
+
const PacketBase& base = mBases[(size_t)baseIndex];
-
+
SInt64 packetOffset = 0;
UInt32 packetSize = 0;
-
- switch (base.mDescType)
+
+ switch (base.mDescType)
{
ACCESS_TYPE(Tiny)
ACCESS_TYPE(Small)
@@ -123,7 +123,7 @@ const AudioStreamPacketDescriptionExtended CompressedPacketTable::operator[](SIn
case kExtendedPacketDescription :
return ((AudioStreamPacketDescriptionExtended*)base.mDescs)[packetIndex];
}
-
+
AudioStreamPacketDescriptionExtended outDesc;
outDesc.mStartOffset = base.mBaseOffset + packetOffset;
outDesc.mDataByteSize = packetSize;
@@ -131,14 +131,14 @@ const AudioStreamPacketDescriptionExtended CompressedPacketTable::operator[](SIn
outDesc.mFrameOffset = mFramesPerPacket * inPacketIndex;
//printf("get %d %10qd %10qd %2d %10qd %6d %10qd\n", base.mDescType, inPacketIndex, baseIndex, packetIndex, outDesc.mStartOffset, outDesc.mDataByteSize, outDesc.mFrameOffset);
-
+
return outDesc;
}
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
bool CompressedPacketTable::isContiguous(PacketBase& base)
-{
+{
AudioStreamPacketDescriptionExtended* descs = (AudioStreamPacketDescriptionExtended*)base.mDescs;
SInt64 expectedOffset = descs[0].mStartOffset + descs[0].mDataByteSize;
for (UInt32 i = 1; i <= kMask; ++i) {
@@ -149,7 +149,7 @@ bool CompressedPacketTable::isContiguous(PacketBase& base)
}
bool CompressedPacketTable::hasVariableFrames(PacketBase& base)
-{
+{
AudioStreamPacketDescriptionExtended* descs = (AudioStreamPacketDescriptionExtended*)base.mDescs;
for (UInt32 i = 0; i <= kMask; ++i) {
if (descs[i].mVariableFramesInPacket) return true;
@@ -158,7 +158,7 @@ bool CompressedPacketTable::hasVariableFrames(PacketBase& base)
}
UInt32 CompressedPacketTable::largestPacket(PacketBase& base)
-{
+{
UInt32 maxPacketSize = 0;
AudioStreamPacketDescriptionExtended* descs = (AudioStreamPacketDescriptionExtended*)base.mDescs;
for (UInt32 i = 0; i <= kMask; ++i) {
@@ -193,17 +193,17 @@ UInt32 CompressedPacketTable::largestPacket(PacketBase& base)
void CompressedPacketTable::Compress(PacketBase& base)
{
- if (hasVariableFrames(base))
+ if (hasVariableFrames(base))
return;
-
+
bool contiguous = isContiguous(base);
-
+
AudioStreamPacketDescriptionExtended* descs = (AudioStreamPacketDescriptionExtended*)base.mDescs;
SInt64 delta = descs[kMask].mStartOffset + descs[kMask].mDataByteSize - descs[0].mStartOffset;
-
+
SInt64 baseOffset = descs[0].mStartOffset;
base.mBaseOffset = baseOffset;
-
+
if (delta <= 65535LL) {
COMPRESS_TYPE(Tiny, UInt16)
} else if (delta <= 4294967295LL && largestPacket(base) <= 65535) {
diff --git a/libs/appleutility/CoreAudio/AudioFile/AFPublic/CompressedPacketTable.h b/libs/appleutility/CoreAudio/AudioFile/AFPublic/CompressedPacketTable.h
index 47e28ca499..8ca0ccfa50 100644
--- a/libs/appleutility/CoreAudio/AudioFile/AFPublic/CompressedPacketTable.h
+++ b/libs/appleutility/CoreAudio/AudioFile/AFPublic/CompressedPacketTable.h
@@ -2,14 +2,14 @@
File: CompressedPacketTable.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 <iterator>
#include <vector>
@@ -72,17 +72,17 @@ class CompressedPacketTable
public:
CompressedPacketTable(UInt32 inFramesPerPacket) : mSize(0), mFramesPerPacket(inFramesPerPacket) {}
~CompressedPacketTable();
-
+
SInt64 size() const { return mSize; }
void push_back(const AudioStreamPacketDescriptionExtended& inDesc);
-
+
const AudioStreamPacketDescriptionExtended operator[](SInt64 inPacketIndex) const;
const AudioStreamPacketDescriptionExtended front() const { return (*this)[0]; }
const AudioStreamPacketDescriptionExtended back() const { return (*this)[mSize-1]; }
-
+
//SInt64 PacketForByte(SInt64 inByteOffset) const;
SInt64 ByteForPacket(SInt64 inPacketIndex) const { return (*this)[inPacketIndex].mStartOffset; }
-
+
class iterator {
public:
typedef std::input_iterator_tag iterator_category;
@@ -90,18 +90,18 @@ public:
typedef SInt64 difference_type;
typedef AudioStreamPacketDescriptionExtended value_type;
typedef value_type& reference;
-
+
iterator() : mTable(NULL), mIndex(0) {}
iterator(const CompressedPacketTable* table, SInt64 index) : mTable(table), mIndex(index) {}
iterator(const iterator& that) : mTable(that.mTable), mIndex(that.mIndex) {}
-
+
iterator& operator=(const iterator& that) { mTable = that.mTable; mIndex = that.mIndex; return *this; }
-
+
const AudioStreamPacketDescriptionExtended operator*() const { return (*mTable)[mIndex]; }
const AudioStreamPacketDescriptionExtended* const operator->() { mValue = (*mTable)[mIndex]; return &mValue; }
iterator& operator++() { ++mIndex; return *this; }
iterator& operator--() { --mIndex; return *this; }
-
+
SInt64 operator-(const iterator& that) { return mIndex - that.mIndex; }
const iterator operator-(SInt64 index) { return iterator(mTable, mIndex - index); }
const iterator operator+(SInt64 index) { return iterator(mTable, mIndex + index); }
@@ -114,52 +114,52 @@ public:
SInt64 mIndex;
AudioStreamPacketDescriptionExtended mValue; // in order to support operator-> .
};
-
+
iterator begin() const { return iterator(this, 0); }
iterator end() const { return iterator(this, mSize); }
-
+
private:
struct TinyContiguousPacketDescription
{
UInt16 mNextOffset;
};
-
+
struct TinyDiscontiguousPacketDescription : TinyContiguousPacketDescription
{
UInt16 mDataByteSize;
};
-
- // There could be a 24 bit packet description. But ALAC is who usually needs SmallContiguousPacketDescription and
- // it already uses 8x fewer packet descriptions than AAC due to the mFramesPerPacket being 8x greater.
+
+ // There could be a 24 bit packet description. But ALAC is who usually needs SmallContiguousPacketDescription and
+ // it already uses 8x fewer packet descriptions than AAC due to the mFramesPerPacket being 8x greater.
// So there isn't as great a need for saving space. 4 bytes per packet is OK for ALAC.
-
+
struct SmallContiguousPacketDescription
{
UInt32 mNextOffset;
};
-
+
struct SmallDiscontiguousPacketDescription : SmallContiguousPacketDescription
{
UInt16 mDataByteSize;
};
-
+
struct BigContiguousPacketDescription
{
UInt64 mNextOffset;
};
-
+
struct BigDiscontiguousPacketDescription : BigContiguousPacketDescription
{
UInt32 mDataByteSize;
};
-
+
struct PacketBase
{
SInt64 mBaseOffset;
UInt8 mDescType;
void* mDescs;
};
-
+
enum {
kTinyContiguousPacketDescription,
kTinyDiscontiguousPacketDescription,
@@ -171,14 +171,14 @@ private:
};
static const UInt32 kShift;
static const UInt32 kMask;
-
+
bool isContiguous(PacketBase& base);
bool hasVariableFrames(PacketBase& base);
UInt32 largestPacket(PacketBase& base);
-
+
void Compress(PacketBase& base);
-private:
+private:
std::vector<PacketBase> mBases;
UInt64 mSize;
UInt32 mFramesPerPacket;
diff --git a/libs/appleutility/CoreAudio/AudioFile/AFPublic/DataSource.cpp b/libs/appleutility/CoreAudio/AudioFile/AFPublic/DataSource.cpp
index c8a93d2756..9ef9be24fb 100644
--- a/libs/appleutility/CoreAudio/AudioFile/AFPublic/DataSource.cpp
+++ b/libs/appleutility/CoreAudio/AudioFile/AFPublic/DataSource.cpp
@@ -2,14 +2,14 @@
File: DataSource.cpp
Abstract: DataSource.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 "DataSource.h"
#if TARGET_OS_WIN32
@@ -70,7 +70,7 @@ DataSource::~DataSource()
{
}
-SInt64 DataSource::CalcOffset( UInt16 positionMode,
+SInt64 DataSource::CalcOffset( UInt16 positionMode,
SInt64 positionOffset,
SInt64 currentOffset,
SInt64 size)
@@ -120,10 +120,10 @@ OSStatus MacFile_DataSource::SetSize(SInt64 inSize)
OSStatus MacFile_DataSource::ReadBytes(
- UInt16 positionMode,
- SInt64 positionOffset,
- UInt32 requestCount,
- void *buffer,
+ UInt16 positionMode,
+ SInt64 positionOffset,
+ UInt32 requestCount,
+ void *buffer,
UInt32* actualCount)
{
if (actualCount) *actualCount = 0;
@@ -135,10 +135,10 @@ OSStatus MacFile_DataSource::ReadBytes(
}
OSStatus MacFile_DataSource::WriteBytes(
- UInt16 positionMode,
- SInt64 positionOffset,
- UInt32 requestCount,
- const void *buffer,
+ UInt16 positionMode,
+ SInt64 positionOffset,
+ UInt32 requestCount,
+ const void *buffer,
UInt32* actualCount)
{
if (!buffer) return kAudio_ParamError;
@@ -162,7 +162,7 @@ UnixFile_DataSource::~UnixFile_DataSource()
{
if (mCloseOnDelete) close(mFileD);
}
-
+
OSStatus UnixFile_DataSource::GetSize(SInt64& outSize)
{
#if 0 // 6764274 using the cached file size causes a regression for apps that play a file while writing to it.
@@ -197,31 +197,31 @@ OSStatus UnixFile_DataSource::GetPos(SInt64& outPos) const
return noErr;
}
-SInt64 UnixFile_DataSource::UFCurrentOffset (UInt16 positionMode,
+SInt64 UnixFile_DataSource::UFCurrentOffset (UInt16 positionMode,
SInt64 positionOffset)
{
SInt64 offset = -1;
- switch (positionMode & kPositionModeMask)
+ switch (positionMode & kPositionModeMask)
{
- /*case fsAtMark :
+ /*case fsAtMark :
{
SInt64 pos;
OSStatus result = GetPos (pos);
if (result) return result;
- offset = pos;
+ offset = pos;
break;
}*/
case SEEK_SET :
{
- offset = positionOffset;
+ offset = positionOffset;
break;
}
- case SEEK_END :
+ case SEEK_END :
{
SInt64 size;
OSStatus result = GetSize (size);
if (result) return result;
- offset = size + positionOffset;
+ offset = size + positionOffset;
break;
}
case SEEK_CUR :
@@ -229,23 +229,23 @@ SInt64 UnixFile_DataSource::UFCurrentOffset (UInt16 positionMode,
SInt64 pos;
OSStatus result = GetPos (pos);
if (result) return result;
- offset = positionOffset + pos;
+ offset = positionOffset + pos;
break;
}
}
return offset;
}
-
+
OSStatus UnixFile_DataSource::ReadBytes( UInt16 positionMode,
- SInt64 positionOffset,
- UInt32 requestCount,
- void *buffer,
+ SInt64 positionOffset,
+ UInt32 requestCount,
+ void *buffer,
UInt32* actualCount)
{
if (actualCount) *actualCount = 0;
if (!buffer) return kAudio_ParamError;
- // can't use current offset as we need to go to the disk too much
+ // can't use current offset as we need to go to the disk too much
SInt64 offset = UFCurrentOffset (positionMode, positionOffset);
if (offset < 0) return kAudioFilePositionError;
@@ -260,7 +260,7 @@ OSStatus UnixFile_DataSource::ReadBytes( UInt16 positionMode,
else if (requestCount > remain) requestCount = remain;
} while (false);
#endif
-
+
if (requestCount <= 0) {
if (actualCount) *actualCount = 0;
return noErr;
@@ -283,20 +283,20 @@ OSStatus UnixFile_DataSource::ReadBytes( UInt16 positionMode,
#endif
if (numBytes == -1) return kAudioFilePositionError;
mFilePointer = offset + numBytes;
-
+
if (actualCount) *actualCount = (UInt32)numBytes;
return noErr;
}
-
-OSStatus UnixFile_DataSource::WriteBytes(UInt16 positionMode,
- SInt64 positionOffset,
- UInt32 requestCount,
- const void *buffer,
+
+OSStatus UnixFile_DataSource::WriteBytes(UInt16 positionMode,
+ SInt64 positionOffset,
+ UInt32 requestCount,
+ const void *buffer,
UInt32* actualCount)
{
if (!buffer) return kAudio_ParamError;
- // can't use current offset as we need to go to the disk too much
+ // can't use current offset as we need to go to the disk too much
SInt64 offset = UFCurrentOffset (positionMode, positionOffset);
if (offset < 0) return kAudioFilePositionError;
@@ -320,7 +320,7 @@ OSStatus UnixFile_DataSource::WriteBytes(UInt16 positionMode,
#endif
if (numBytes == -1) return kAudioFilePositionError;
mFilePointer = offset + numBytes;
-
+
if (actualCount) *actualCount = (UInt32)numBytes;
return noErr;
}
@@ -330,50 +330,50 @@ OSStatus UnixFile_DataSource::WriteBytes(UInt16 positionMode,
#define NO_CACHE 0
OSStatus Cached_DataSource::ReadFromHeaderCache(
- SInt64 offset,
+ SInt64 offset,
UInt32 requestCount,
- void *buffer,
+ void *buffer,
UInt32* actualCount)
{
if (actualCount) *actualCount = 0;
OSStatus err = noErr;
ByteCount theActualCount = 0;
-#if VERBOSE
+#if VERBOSE
printf("read from header %lld %lu %lld %lu\n", offset, requestCount, 0LL, mHeaderCacheSize);
#endif
- if (!mHeaderCache())
+ if (!mHeaderCache())
{
mHeaderCache.allocBytes(mHeaderCacheSize, true);
err = mDataSource->ReadBytes(SEEK_SET, 0, mHeaderCacheSize, mHeaderCache(), &mHeaderCacheSize);
if (err == kAudioFileEndOfFileError) err = noErr;
if (err) return err;
}
-
+
ByteCount firstPart = std::min((ByteCount)requestCount, (ByteCount)(mHeaderCacheSize - offset));
ByteCount secondPart = requestCount - firstPart;
-
+
memcpy(buffer, mHeaderCache + (ByteCount)offset, firstPart);
theActualCount = firstPart;
-
+
if (secondPart) {
UInt32 secondPartActualCount = 0;
err = mDataSource->ReadBytes(SEEK_SET, mHeaderCacheSize, static_cast<UInt32>(secondPart), (char*)buffer + firstPart, &secondPartActualCount);
theActualCount += secondPartActualCount;
}
-
+
if (actualCount) *actualCount = (UInt32)theActualCount;
mOffset = offset + theActualCount;
-
+
return err;
}
OSStatus Cached_DataSource::ReadBytes(
- UInt16 positionMode,
- SInt64 positionOffset,
- UInt32 requestCount,
- void *buffer,
+ UInt16 positionMode,
+ SInt64 positionOffset,
+ UInt32 requestCount,
+ void *buffer,
UInt32* actualCount)
{
if (actualCount) *actualCount = 0;
@@ -384,7 +384,7 @@ OSStatus Cached_DataSource::ReadBytes(
if (!buffer) return kAudio_ParamError;
if ((positionMode & kPositionModeMask) != SEEK_END) size = 0; // not used in this case
- else
+ else
{
err = GetSize(size);
if (err) return err;
@@ -392,7 +392,7 @@ OSStatus Cached_DataSource::ReadBytes(
SInt64 offset = CalcOffset(positionMode, positionOffset, mOffset, size);
if (offset < 0) return kAudioFilePositionError;
-
+
if (offset < mHeaderCacheSize) {
return ReadFromHeaderCache(offset, requestCount, buffer, actualCount);
}
@@ -405,10 +405,10 @@ OSStatus Cached_DataSource::ReadBytes(
SInt64 cacheEnd = mBodyCacheOffset + mBodyCacheCurSize;
if (mBodyCache() && requestCount < mBodyCacheSize && offset >= mBodyCacheOffset && offset < cacheEnd)
{
- if (offset + requestCount <= cacheEnd)
+ if (offset + requestCount <= cacheEnd)
{
// request is entirely within cache
-#if VERBOSE
+#if VERBOSE
printf("request is entirely within cache %lld %lu %lld %lu\n", offset, requestCount, mBodyCacheOffset, mBodyCacheCurSize);
#endif
memcpy(buffer, mBodyCache + (size_t)(offset - mBodyCacheOffset), requestCount);
@@ -417,25 +417,25 @@ OSStatus Cached_DataSource::ReadBytes(
else
{
// part of request is within cache. copy, read next cache block, copy.
-#if VERBOSE
+#if VERBOSE
printf("part of request is within cache %lld %lu %lld %lu\n", offset, requestCount, mBodyCacheOffset, mBodyCacheCurSize);
#endif
-
+
// copy first part.
ByteCount firstPart = (ByteCount)(cacheEnd - offset);
ByteCount secondPart = requestCount - firstPart;
-#if VERBOSE
- printf("memcpy offset %lld mBodyCacheOffset %lld offset - mBodyCacheOffset %lld firstPart %lu requestCount %lu\n",
+#if VERBOSE
+ printf("memcpy offset %lld mBodyCacheOffset %lld offset - mBodyCacheOffset %lld firstPart %lu requestCount %lu\n",
offset, mBodyCacheOffset, offset - mBodyCacheOffset, firstPart, requestCount);
#endif
memcpy(buffer, mBodyCache + (size_t)(offset - mBodyCacheOffset), firstPart);
-
+
theActualCount = static_cast<UInt32>(firstPart);
-
+
// read new block
SInt64 nextOffset = mBodyCacheOffset + mBodyCacheCurSize;
err = mDataSource->ReadBytes(SEEK_SET, nextOffset, mBodyCacheSize, mBodyCache(), &mBodyCacheCurSize);
-
+
if (err == kAudioFileEndOfFileError) err = noErr;
if (err) goto leave;
@@ -447,11 +447,11 @@ OSStatus Cached_DataSource::ReadBytes(
theActualCount = static_cast<UInt32>(firstPart + secondPart);
}
}
- else
+ else
{
if (requestCount > mBodyCacheSize)
{
-#if VERBOSE
+#if VERBOSE
printf("large request %lld %lu %lld %lu\n", offset, requestCount, mBodyCacheOffset, mBodyCacheCurSize);
#endif
// the request is larger than we normally cache, just do a read and don't cache.
@@ -461,19 +461,19 @@ OSStatus Cached_DataSource::ReadBytes(
else
{
// request is outside cache. read new block.
-#if VERBOSE
+#if VERBOSE
printf("request is outside cache %lld %lu %lld %lu\n", offset, requestCount, mBodyCacheOffset, mBodyCacheCurSize);
#endif
- if (!mBodyCache())
+ if (!mBodyCache())
{
mBodyCache.allocBytes(mBodyCacheSize, true);
-#if VERBOSE
+#if VERBOSE
printf("alloc mBodyCache %08X\n", mBodyCache());
#endif
}
mBodyCacheOffset = offset;
err = mDataSource->ReadBytes(SEEK_SET, mBodyCacheOffset, mBodyCacheSize, mBodyCache(), &mBodyCacheCurSize);
-#if VERBOSE
+#if VERBOSE
printf("read %08X %d mBodyCacheOffset %lld %lu %lu\n", err, err, mBodyCacheOffset, mBodyCacheSize, mBodyCacheCurSize);
#endif
if (err == kAudioFileEndOfFileError) err = noErr;
@@ -482,32 +482,32 @@ OSStatus Cached_DataSource::ReadBytes(
theActualCount = std::min(requestCount, mBodyCacheCurSize);
memcpy(buffer, mBodyCache(), theActualCount);
}
-
+
}
leave:
#endif
if (actualCount) *actualCount = (UInt32)theActualCount;
-#if VERBOSE
+#if VERBOSE
printf("<<read err %d actualCount %lu\n", err, *actualCount);
#endif
return err;
}
OSStatus Cached_DataSource::WriteBytes(
- UInt16 positionMode,
- SInt64 positionOffset,
- UInt32 requestCount,
- const void *buffer,
+ UInt16 positionMode,
+ SInt64 positionOffset,
+ UInt32 requestCount,
+ const void *buffer,
UInt32* actualCount)
{
OSStatus err = noErr;
SInt64 size;
if (!buffer) return kAudio_ParamError;
-
+
if ((positionMode & kPositionModeMask) != SEEK_END) size = 0; // not used in this case
- else
+ else
{
err = GetSize(size);
if (err) return err;
@@ -515,18 +515,18 @@ OSStatus Cached_DataSource::WriteBytes(
SInt64 offset = CalcOffset(positionMode, positionOffset, mOffset, size);
if (offset < 0) return kAudioFilePositionError;
-
- if (mHeaderCache() && offset < mHeaderCacheSize)
+
+ if (mHeaderCache() && offset < mHeaderCacheSize)
{
// header cache write through
ByteCount firstPart = std::min((ByteCount)requestCount, (ByteCount)(mHeaderCacheSize - offset));
-#if VERBOSE
+#if VERBOSE
printf("header cache write through %lu %lu\n", mHeaderCacheSize, firstPart);
#endif
memcpy(mHeaderCache + (size_t)offset, buffer, firstPart);
}
-
-#if VERBOSE
+
+#if VERBOSE
printf("write %lld %lu %lld %d %lld\n", offset, requestCount, mOffset, positionMode, positionOffset);
#endif
@@ -535,18 +535,18 @@ OSStatus Cached_DataSource::WriteBytes(
{
// body cache write through
ByteCount firstPart = std::min((SInt64)requestCount, cacheEnd - offset);
-#if VERBOSE
+#if VERBOSE
printf("body cache write through %lld %lu %lld %lu\n", mBodyCacheOffset, mBodyCacheCurSize, offset, firstPart);
#endif
memcpy(mBodyCache + (offset - mBodyCacheOffset), buffer, firstPart);
}
-
+
UInt32 theActualCount;
err = mDataSource->WriteBytes(positionMode, positionOffset, requestCount, buffer, &theActualCount);
-
+
mOffset = offset + theActualCount;
if (actualCount) *actualCount = (UInt32)theActualCount;
-
+
return err;
}
@@ -555,11 +555,11 @@ OSStatus Cached_DataSource::WriteBytes(
//////////////////////////////////////////////////////////////////////////////////////////
Seekable_DataSource::Seekable_DataSource( void * inClientData,
- AudioFile_ReadProc inReadFunc,
- AudioFile_WriteProc inWriteFunc,
+ AudioFile_ReadProc inReadFunc,
+ AudioFile_WriteProc inWriteFunc,
AudioFile_GetSizeProc inGetSizeFunc,
AudioFile_SetSizeProc inSetSizeFunc)
- : DataSource(false), mClientData(inClientData), mReadFunc(inReadFunc), mWriteFunc(inWriteFunc),
+ : DataSource(false), mClientData(inClientData), mReadFunc(inReadFunc), mWriteFunc(inWriteFunc),
mSizeFunc(inGetSizeFunc), mSetSizeFunc(inSetSizeFunc)
{
}
@@ -585,15 +585,15 @@ OSStatus Seekable_DataSource::SetSize(SInt64 inSize)
return (*mSetSizeFunc)(mClientData, inSize);
}
-OSStatus Seekable_DataSource::ReadBytes(
- UInt16 positionMode,
- SInt64 positionOffset,
- UInt32 requestCount,
- void *buffer,
+OSStatus Seekable_DataSource::ReadBytes(
+ UInt16 positionMode,
+ SInt64 positionOffset,
+ UInt32 requestCount,
+ void *buffer,
UInt32* actualCount)
{
OSStatus err;
-
+
if (actualCount) *actualCount = 0;
if (!mReadFunc) return kAudioFileOperationNotSupportedError;
if (!buffer) return kAudio_ParamError;
@@ -605,16 +605,16 @@ OSStatus Seekable_DataSource::ReadBytes(
if (err) return err;
SInt64 offset = CalcOffset(positionMode, positionOffset, mOffset, size);
-
+
// request is outside bounds of file
- if (offset < 0)
+ if (offset < 0)
return kAudioFilePositionError;
- if (offset >= size)
+ if (offset >= size)
return kAudioFileEndOfFileError;
-
+
// reduce request if it exceeds the amount available
requestCount = static_cast<UInt32>(std::min((SInt64)requestCount, size - offset));
-
+
UInt32 theActualCount = 0;
err = (*mReadFunc)(mClientData, offset, requestCount, buffer, &theActualCount);
if (actualCount) *actualCount = theActualCount;
@@ -622,23 +622,23 @@ OSStatus Seekable_DataSource::ReadBytes(
return err;
}
-
+
OSStatus Seekable_DataSource::WriteBytes(
- UInt16 positionMode,
- SInt64 positionOffset,
- UInt32 requestCount,
- const void *buffer,
+ UInt16 positionMode,
+ SInt64 positionOffset,
+ UInt32 requestCount,
+ const void *buffer,
UInt32* actualCount)
{
OSStatus err;
-
+
if (!mWriteFunc) return kAudioFileOperationNotSupportedError;
if (!buffer) return kAudio_ParamError;
SInt64 size;
positionMode &= kPositionModeMask;
if (positionMode != SEEK_END) size = 0; // not used in this case
- else
+ else
{
err = GetSize(size);
if (err) return err;
@@ -646,7 +646,7 @@ OSStatus Seekable_DataSource::WriteBytes(
SInt64 offset = CalcOffset(positionMode, positionOffset, mOffset, size);
if (offset < 0) return kAudioFilePositionError;
-
+
UInt32 theActualCount;
err = (*mWriteFunc)(mClientData, offset, requestCount, buffer, &theActualCount);
if (err) return err;
@@ -658,16 +658,16 @@ OSStatus Seekable_DataSource::WriteBytes(
//////////////////////////////////////////////////////////////////////////////////////////
OSStatus Buffer_DataSource::ReadBytes(
- UInt16 positionMode,
- SInt64 positionOffset,
- UInt32 requestCount,
- void *buffer,
+ UInt16 positionMode,
+ SInt64 positionOffset,
+ UInt32 requestCount,
+ void *buffer,
UInt32* actualCount)
{
if (actualCount) *actualCount = 0;
- SInt64 offsetWithinBuffer = CalcOffset(positionMode, positionOffset, mOffset, mDataByteSize + mStartOffset) - mStartOffset;
+ SInt64 offsetWithinBuffer = CalcOffset(positionMode, positionOffset, mOffset, mDataByteSize + mStartOffset) - mStartOffset;
if (offsetWithinBuffer < 0 || offsetWithinBuffer >= mDataByteSize) return kAudioFilePositionError;
-
+
SInt64 bytesAfterOffset = mDataByteSize - offsetWithinBuffer;
SInt64 theActualCount = std::min(bytesAfterOffset, (SInt64)requestCount);
@@ -677,7 +677,7 @@ OSStatus Buffer_DataSource::ReadBytes(
}
memcpy(buffer, mData + offsetWithinBuffer, theActualCount);
-
+
if (actualCount) *actualCount = static_cast<UInt32>(theActualCount);
mOffset = offsetWithinBuffer + theActualCount;
diff --git a/libs/appleutility/CoreAudio/AudioFile/AFPublic/DataSource.h b/libs/appleutility/CoreAudio/AudioFile/AFPublic/DataSource.h
index 6c79c94df9..916ae071ef 100644
--- a/libs/appleutility/CoreAudio/AudioFile/AFPublic/DataSource.h
+++ b/libs/appleutility/CoreAudio/AudioFile/AFPublic/DataSource.h
@@ -2,14 +2,14 @@
File: DataSource.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 __DataSource_h__
#define __DataSource_h__
@@ -63,10 +63,10 @@
class DataSource
{
public:
-
+
DataSource(Boolean inCloseOnDelete);
virtual ~DataSource();
-
+
virtual OSStatus GetSize32(UInt32& outSize)
{
SInt64 size64;
@@ -76,43 +76,43 @@ public:
outSize = (UInt32)size64;
return noErr;
}
-
+
virtual OSStatus GetSize(SInt64& outSize) =0;
-
+
virtual OSStatus SetSize(SInt64 inSize)=0;
-
- virtual OSStatus GetPos(SInt64& outPos) const=0;
-
- /* non seekable data sources should use fsAtMark for the positionMode (or SEEK_CUR with offset zero,
- or SEEK_SET with offset equal to the current position in the stream, in other words no seeking from the
+
+ virtual OSStatus GetPos(SInt64& outPos) const=0;
+
+ /* non seekable data sources should use fsAtMark for the positionMode (or SEEK_CUR with offset zero,
+ or SEEK_SET with offset equal to the current position in the stream, in other words no seeking from the
current position is allowed.)
*/
-
- virtual OSStatus ReadBytes( UInt16 positionMode,
- SInt64 positionOffset,
- UInt32 requestCount,
- void *buffer,
+
+ virtual OSStatus ReadBytes( UInt16 positionMode,
+ SInt64 positionOffset,
+ UInt32 requestCount,
+ void *buffer,
UInt32* actualCount)=0;
-
- virtual OSStatus WriteBytes(UInt16 positionMode,
- SInt64 positionOffset,
- UInt32 requestCount,
- const void *buffer,
+
+ virtual OSStatus WriteBytes(UInt16 positionMode,
+ SInt64 positionOffset,
+ UInt32 requestCount,
+ const void *buffer,
UInt32* actualCount)=0;
-
+
virtual void SetCloseOnDelete(Boolean inFlag) { mCloseOnDelete = inFlag; }
-
+
virtual Boolean CanSeek() const=0;
virtual Boolean CanGetSize() const=0;
virtual Boolean CanSetSize() const=0;
virtual Boolean CanRead() const=0;
virtual Boolean CanWrite() const=0;
-
+
protected:
Boolean mCloseOnDelete;
-
+
/* utility method */
- SInt64 CalcOffset( UInt16 positionMode,
+ SInt64 CalcOffset( UInt16 positionMode,
SInt64 positionOffset,
SInt64 currentOffset,
SInt64 size);
@@ -131,33 +131,33 @@ class MacFile_DataSource : public DataSource
{
FSIORefNum mFileNum;
SInt8 mPermissions;
-
+
public:
MacFile_DataSource( FSIORefNum inForkRefNum, SInt8 inPermissions, Boolean inCloseOnDelete);
virtual ~MacFile_DataSource();
-
+
virtual OSStatus GetSize(SInt64& outSize);
- virtual OSStatus GetPos(SInt64& outPos) const;
-
+ virtual OSStatus GetPos(SInt64& outPos) const;
+
virtual OSStatus SetSize(SInt64 inSize);
-
- virtual OSStatus ReadBytes( UInt16 positionMode,
- SInt64 positionOffset,
- UInt32 requestCount,
- void *buffer,
+
+ virtual OSStatus ReadBytes( UInt16 positionMode,
+ SInt64 positionOffset,
+ UInt32 requestCount,
+ void *buffer,
UInt32* actualCount);
-
- virtual OSStatus WriteBytes(UInt16 positionMode,
- SInt64 positionOffset,
- UInt32 requestCount,
- const void *buffer,
+
+ virtual OSStatus WriteBytes(UInt16 positionMode,
+ SInt64 positionOffset,
+ UInt32 requestCount,
+ const void *buffer,
UInt32* actualCount);
-
+
virtual Boolean CanSeek() const { return true; }
virtual Boolean CanGetSize() const { return true; }
virtual Boolean CanSetSize() const { return true; }
-
+
virtual Boolean CanRead() const { return mPermissions & kAudioFileReadPermission; }
virtual Boolean CanWrite() const { return mPermissions & kAudioFileWritePermission; }
};
@@ -171,39 +171,39 @@ class UnixFile_DataSource : public DataSource
UInt32 mNoCache;
SInt64 mCachedSize;
SInt64 mFilePointer;
-
+
public:
UnixFile_DataSource( int inFD, SInt8 inPermissions, Boolean inCloseOnDelete);
virtual ~UnixFile_DataSource();
-
+
virtual OSStatus GetSize(SInt64& outSize);
- virtual OSStatus GetPos(SInt64& outPos) const;
-
+ virtual OSStatus GetPos(SInt64& outPos) const;
+
virtual OSStatus SetSize(SInt64 inSize);
-
- virtual OSStatus ReadBytes( UInt16 positionMode,
- SInt64 positionOffset,
- UInt32 requestCount,
- void *buffer,
+
+ virtual OSStatus ReadBytes( UInt16 positionMode,
+ SInt64 positionOffset,
+ UInt32 requestCount,
+ void *buffer,
UInt32* actualCount);
-
- virtual OSStatus WriteBytes(UInt16 positionMode,
- SInt64 positionOffset,
- UInt32 requestCount,
- const void *buffer,
+
+ virtual OSStatus WriteBytes(UInt16 positionMode,
+ SInt64 positionOffset,
+ UInt32 requestCount,
+ const void *buffer,
UInt32* actualCount);
-
+
virtual Boolean CanSeek() const { return true; }
virtual Boolean CanGetSize() const { return true; }
virtual Boolean CanSetSize() const { return true; }
-
+
virtual Boolean CanRead() const { return mPermissions & kAudioFileReadPermission; }
virtual Boolean CanWrite() const { return mPermissions & kAudioFileWritePermission; }
private:
- SInt64 UFCurrentOffset (UInt16 positionMode,
+ SInt64 UFCurrentOffset (UInt16 positionMode,
SInt64 positionOffset);
};
@@ -225,50 +225,50 @@ class Cached_DataSource : public DataSource
SInt64 mBodyCacheOffset;
SInt64 mOffset;
Boolean mOwnDataSource;
-
+
public:
Cached_DataSource(DataSource* inDataSource, UInt32 inHeaderCacheSize = 4096, UInt32 inBodyCacheSize = 32768, Boolean inOwnDataSource = true)
- : DataSource(false),
- mDataSource(inDataSource), mHeaderCacheSize(inHeaderCacheSize),
- mBodyCacheSize(inBodyCacheSize), mBodyCacheCurSize(0), mBodyCacheOffset(-1),
+ : DataSource(false),
+ mDataSource(inDataSource), mHeaderCacheSize(inHeaderCacheSize),
+ mBodyCacheSize(inBodyCacheSize), mBodyCacheCurSize(0), mBodyCacheOffset(-1),
mOffset(0),
mOwnDataSource(inOwnDataSource)
{
}
-
+
virtual ~Cached_DataSource()
{
if (mOwnDataSource) delete mDataSource;
}
-
+
virtual OSStatus GetSize(SInt64& outSize) { return mDataSource->GetSize(outSize); }
- virtual OSStatus GetPos(SInt64& outPos) const { return mDataSource->GetPos(outPos); }
-
+ virtual OSStatus GetPos(SInt64& outPos) const { return mDataSource->GetPos(outPos); }
+
virtual OSStatus SetSize(SInt64 inSize) { return mDataSource->SetSize(inSize); }
-
- virtual OSStatus ReadBytes( UInt16 positionMode,
- SInt64 positionOffset,
- UInt32 requestCount,
- void *buffer,
+
+ virtual OSStatus ReadBytes( UInt16 positionMode,
+ SInt64 positionOffset,
+ UInt32 requestCount,
+ void *buffer,
UInt32* actualCount);
-
- virtual OSStatus WriteBytes( UInt16 positionMode,
- SInt64 positionOffset,
- UInt32 requestCount,
- const void *buffer,
+
+ virtual OSStatus WriteBytes( UInt16 positionMode,
+ SInt64 positionOffset,
+ UInt32 requestCount,
+ const void *buffer,
UInt32* actualCount);
-
- OSStatus ReadFromHeaderCache( SInt64 offset,
+
+ OSStatus ReadFromHeaderCache( SInt64 offset,
UInt32 requestCount,
- void *buffer,
+ void *buffer,
UInt32* actualCount);
-
+
virtual Boolean CanSeek() const { return mDataSource->CanSeek(); }
virtual Boolean CanGetSize() const { return mDataSource->CanGetSize(); }
virtual Boolean CanSetSize() const { return mDataSource->CanSetSize(); }
-
+
virtual Boolean CanRead() const { return mDataSource->CanRead(); }
virtual Boolean CanWrite() const { return mDataSource->CanWrite(); }
};
@@ -286,37 +286,37 @@ class Seekable_DataSource : public DataSource
{
void * mClientData;
SInt64 mOffset;
-
+
AudioFile_ReadProc mReadFunc;
AudioFile_WriteProc mWriteFunc;
AudioFile_GetSizeProc mSizeFunc;
AudioFile_SetSizeProc mSetSizeFunc;
-
+
public:
Seekable_DataSource( void * inClientData,
- AudioFile_ReadProc inReadFunc,
- AudioFile_WriteProc inWriteFunc,
+ AudioFile_ReadProc inReadFunc,
+ AudioFile_WriteProc inWriteFunc,
AudioFile_GetSizeProc inGetSizeFunc,
AudioFile_SetSizeProc inSetSizeFunc
);
-
+
virtual ~Seekable_DataSource();
-
+
virtual OSStatus GetSize(SInt64& outSize);
- virtual OSStatus GetPos(SInt64& outPos) const { outPos = mOffset; return noErr; };
-
+ virtual OSStatus GetPos(SInt64& outPos) const { outPos = mOffset; return noErr; };
+
virtual OSStatus SetSize(SInt64 inSize);
-
- virtual OSStatus ReadBytes( UInt16 positionMode,
- SInt64 positionOffset,
- UInt32 requestCount,
- void *buffer,
+
+ virtual OSStatus ReadBytes( UInt16 positionMode,
+ SInt64 positionOffset,
+ UInt32 requestCount,
+ void *buffer,
UInt32* actualCount);
-
- virtual OSStatus WriteBytes(UInt16 positionMode,
- SInt64 positionOffset,
- UInt32 requestCount,
- const void *buffer,
+
+ virtual OSStatus WriteBytes(UInt16 positionMode,
+ SInt64 positionOffset,
+ UInt32 requestCount,
+ const void *buffer,
UInt32* actualCount);
virtual Boolean CanSeek() const { return true; }
@@ -340,24 +340,24 @@ public:
const void * inData,
SInt64 inStartOffset = 0
) : DataSource(false), mDataByteSize(inDataByteSize), mData((const char*)inData), mStartOffset(inStartOffset), mOffset(mStartOffset) {}
-
+
virtual ~Buffer_DataSource() {}
-
+
virtual OSStatus GetSize(SInt64& outSize) { outSize = mDataByteSize + mStartOffset; return noErr; }
- virtual OSStatus GetPos(SInt64& outPos) const { outPos = mOffset; return noErr; };
-
+ virtual OSStatus GetPos(SInt64& outPos) const { outPos = mOffset; return noErr; };
+
virtual OSStatus SetSize(SInt64 inSize) { throw std::runtime_error("not writable"); }
-
- virtual OSStatus ReadBytes( UInt16 positionMode,
- SInt64 positionOffset,
- UInt32 requestCount,
- void *buffer,
+
+ virtual OSStatus ReadBytes( UInt16 positionMode,
+ SInt64 positionOffset,
+ UInt32 requestCount,
+ void *buffer,
UInt32* actualCount);
-
- virtual OSStatus WriteBytes(UInt16 positionMode,
- SInt64 positionOffset,
- UInt32 requestCount,
- const void *buffer,
+
+ virtual OSStatus WriteBytes(UInt16 positionMode,
+ SInt64 positionOffset,
+ UInt32 requestCount,
+ const void *buffer,
UInt32* actualCount) { throw std::runtime_error("not writable"); }
virtual Boolean CanSeek() const { return true; }
diff --git a/libs/appleutility/CoreAudio/AudioUnits/AUPublic/AUBase/AUBase.cpp b/libs/appleutility/CoreAudio/AudioUnits/AUPublic/AUBase/AUBase.cpp
index 612bc4d308..c77322dcbf 100644
--- a/libs/appleutility/CoreAudio/AudioUnits/AUPublic/AUBase/AUBase.cpp
+++ b/libs/appleutility/CoreAudio/AudioUnits/AUPublic/AUBase/AUBase.cpp
@@ -2,14 +2,14 @@
File: AUBase.cpp
Abstract: AUBase.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 "AUBase.h"
#include "AUDispatch.h"
@@ -88,7 +88,7 @@ SInt32 AUBase::sVectorUnitType = kVecUninitialized;
//_____________________________________________________________________________
//
-AUBase::AUBase( AudioComponentInstance inInstance,
+AUBase::AUBase( AudioComponentInstance inInstance,
UInt32 numInputElements,
UInt32 numOutputElements,
UInt32 numGroupElements) :
@@ -96,7 +96,7 @@ AUBase::AUBase( AudioComponentInstance inInstance,
mElementsCreated(false),
mInitialized(false),
mHasBegunInitializing(false),
- mInitNumInputEls(numInputElements), mInitNumOutputEls(numOutputElements),
+ mInitNumInputEls(numInputElements), mInitNumOutputEls(numOutputElements),
#if !CA_BASIC_AU_FEATURES
mInitNumGroupEls(numGroupElements),
#endif
@@ -115,7 +115,7 @@ AUBase::AUBase( AudioComponentInstance inInstance,
#endif
{
ResetRenderTime ();
-
+
if(!sAUBaseCFStringsInitialized)
{
kUntitledString = CFSTR("Untitled");
@@ -137,11 +137,11 @@ AUBase::AUBase( AudioComponentInstance inInstance,
}
mAudioUnitAPIVersion = 2;
-
+
SetMaxFramesPerSlice(kAUDefaultMaxFramesPerSlice);
GlobalScope().Initialize(this, kAudioUnitScope_Global, 1);
-
+
#if !CA_NO_AU_UI_FEATURES
memset (&mHostCallbackInfo, 0, sizeof (mHostCallbackInfo));
#endif
@@ -175,7 +175,7 @@ void AUBase::CreateElements()
Groups().Initialize(this, kAudioUnitScope_Group, mInitNumGroupEls);
#endif
CreateExtendedElements();
-
+
mElementsCreated = true;
}
}
@@ -202,7 +202,7 @@ OSStatus AUBase::CanSetMaxFrames() const
void AUBase::ReallocateBuffers()
{
CreateElements();
-
+
UInt32 nOutputs = Outputs().GetNumberOfElements();
for (UInt32 i = 0; i < nOutputs; ++i) {
AUOutputElement *output = GetOutput(i);
@@ -241,7 +241,7 @@ void AUBase::DeallocateIOBuffers()
OSStatus AUBase::DoInitialize()
{
OSStatus result = noErr;
-
+
if (!mInitialized) {
result = Initialize();
if (result == noErr) {
@@ -279,7 +279,7 @@ void AUBase::DoCleanup()
{
if (mInitialized)
Cleanup();
-
+
DeallocateIOBuffers();
ResetRenderTime ();
@@ -312,22 +312,22 @@ OSStatus AUBase::DispatchGetPropertyInfo(AudioUnitPropertyID inID,
{
OSStatus result = noErr;
bool validateElement = true;
-
+
switch (inID) {
case kAudioUnitProperty_MakeConnection:
ca_require(inScope == kAudioUnitScope_Input || inScope == kAudioUnitScope_Global, InvalidScope);
outDataSize = sizeof(AudioUnitConnection);
outWritable = true;
break;
-
-
+
+
case kAudioUnitProperty_SetRenderCallback:
ca_require(AudioUnitAPIVersion() > 1, InvalidProperty);
ca_require(inScope == kAudioUnitScope_Input || inScope == kAudioUnitScope_Global, InvalidScope);
outDataSize = sizeof(AURenderCallbackStruct);
outWritable = true;
break;
-
+
case kAudioUnitProperty_StreamFormat:
outDataSize = sizeof(CAStreamBasicDescription);
outWritable = IsStreamFormatWritable(inScope, inElement);
@@ -352,7 +352,7 @@ OSStatus AUBase::DispatchGetPropertyInfo(AudioUnitPropertyID inID,
outWritable = false;
}
break;
-
+
case kAudioUnitProperty_PresentPreset:
#if !CA_USE_AUDIO_PLUGIN_ONLY
#ifndef __LP64__
@@ -363,23 +363,23 @@ OSStatus AUBase::DispatchGetPropertyInfo(AudioUnitPropertyID inID,
outDataSize = sizeof(AUPreset);
outWritable = true;
break;
-
+
case kAudioUnitProperty_ElementName:
outDataSize = sizeof (CFStringRef);
outWritable = true;
break;
-
+
case kAudioUnitProperty_ParameterList:
{
UInt32 nparams = 0;
result = GetParameterList(inScope, NULL, nparams);
-
+
outDataSize = sizeof(AudioUnitParameterID) * nparams;
outWritable = false;
validateElement = false;
}
break;
-
+
case kAudioUnitProperty_ParameterInfo:
outDataSize = sizeof(AudioUnitParameterInfo);
outWritable = false;
@@ -397,13 +397,13 @@ OSStatus AUBase::DispatchGetPropertyInfo(AudioUnitPropertyID inID,
outWritable = BusCountWritable(inScope);
validateElement = false;
break;
-
+
case kAudioUnitProperty_Latency:
ca_require(inScope == kAudioUnitScope_Global, InvalidScope);
outDataSize = sizeof(Float64);
outWritable = false;
break;
-
+
case kAudioUnitProperty_TailTime:
ca_require(inScope == kAudioUnitScope_Global, InvalidScope);
if (SupportsTail()) {
@@ -412,19 +412,19 @@ OSStatus AUBase::DispatchGetPropertyInfo(AudioUnitPropertyID inID,
} else
goto InvalidProperty;
break;
-
+
case kAudioUnitProperty_MaximumFramesPerSlice:
ca_require(inScope == kAudioUnitScope_Global, InvalidScope);
outDataSize = sizeof(UInt32);
outWritable = true;
break;
-
+
case kAudioUnitProperty_LastRenderError:
ca_require(inScope == kAudioUnitScope_Global, InvalidScope);
outDataSize = sizeof(OSStatus);
outWritable = false;
break;
-
+
case kAudioUnitProperty_SupportedNumChannels:
{
ca_require(inScope == kAudioUnitScope_Global, InvalidScope);
@@ -437,7 +437,7 @@ OSStatus AUBase::DispatchGetPropertyInfo(AudioUnitPropertyID inID,
outWritable = false;
break;
}
-
+
case kAudioUnitProperty_SupportedChannelLayoutTags:
{
UInt32 numLayouts = GetChannelLayoutTags(inScope, inElement, NULL);
@@ -450,7 +450,7 @@ OSStatus AUBase::DispatchGetPropertyInfo(AudioUnitPropertyID inID,
validateElement = false; //already done it
break;
}
-
+
case kAudioUnitProperty_AudioChannelLayout:
{
outWritable = false;
@@ -490,11 +490,11 @@ OSStatus AUBase::DispatchGetPropertyInfo(AudioUnitPropertyID inID,
if (outDataSize == 0)
goto InvalidProperty;
outDataSize *= sizeof (AudioComponentDescription);
-
+
outWritable = false;
break;
#endif
-
+
case kAudioUnitProperty_ParameterValueStrings:
result = GetParameterValueStrings(inScope, inElement, NULL);
if (result == noErr) {
@@ -517,7 +517,7 @@ OSStatus AUBase::DispatchGetPropertyInfo(AudioUnitPropertyID inID,
outDataSize = sizeof(CFStringRef);
outWritable = true;
break;
-
+
case kAudioUnitProperty_IconLocation:
ca_require(inScope == kAudioUnitScope_Global, InvalidScope);
outWritable = false;
@@ -537,7 +537,7 @@ OSStatus AUBase::DispatchGetPropertyInfo(AudioUnitPropertyID inID,
outDataSize = sizeof(Float64);
outWritable = false;
break;
-
+
case kAudioUnitProperty_NickName:
ca_require(inScope == kAudioUnitScope_Global, InvalidScope);
outDataSize = sizeof(CFStringRef);
@@ -551,9 +551,9 @@ OSStatus AUBase::DispatchGetPropertyInfo(AudioUnitPropertyID inID,
}
if (result == noErr && validateElement) {
- ca_require(GetElement(inScope, inElement) != NULL, InvalidElement);
+ ca_require(GetElement(inScope, inElement) != NULL, InvalidElement);
}
-
+
return result;
InvalidProperty:
return kAudioUnitErr_InvalidProperty;
@@ -579,11 +579,11 @@ OSStatus AUBase::DispatchGetProperty( AudioUnitPropertyID inID,
case kAudioUnitProperty_StreamFormat:
*(CAStreamBasicDescription *)outData = GetStreamFormat(inScope, inElement);
break;
-
+
case kAudioUnitProperty_SampleRate:
*(Float64 *)outData = GetStreamFormat(inScope, inElement).mSampleRate;
break;
-
+
case kAudioUnitProperty_ParameterList:
{
UInt32 nparams = 0;
@@ -615,7 +615,7 @@ OSStatus AUBase::DispatchGetProperty( AudioUnitPropertyID inID,
result = GetPresets ((CFArrayRef *)outData);
}
break;
-
+
case kAudioUnitProperty_PresentPreset:
#if !CA_USE_AUDIO_PLUGIN_ONLY
#ifndef __LP64__
@@ -624,15 +624,15 @@ OSStatus AUBase::DispatchGetProperty( AudioUnitPropertyID inID,
#endif
{
*(AUPreset *)outData = mCurrentPreset;
-
+
// retain current string (as client owns a reference to it and will release it)
- if (inID == kAudioUnitProperty_PresentPreset && mCurrentPreset.presetName)
+ if (inID == kAudioUnitProperty_PresentPreset && mCurrentPreset.presetName)
CFRetain (mCurrentPreset.presetName);
result = noErr;
}
break;
-
+
case kAudioUnitProperty_ElementName:
{
AUElement * element = GetElement(inScope, inElement);
@@ -648,7 +648,7 @@ OSStatus AUBase::DispatchGetProperty( AudioUnitPropertyID inID,
case kAudioUnitProperty_ElementCount:
*(UInt32 *)outData = GetScope(inScope).GetNumberOfElements();
break;
-
+
case kAudioUnitProperty_Latency:
*(Float64 *)outData = GetLatency();
break;
@@ -659,7 +659,7 @@ OSStatus AUBase::DispatchGetProperty( AudioUnitPropertyID inID,
else
result = kAudioUnitErr_InvalidProperty;
break;
-
+
case kAudioUnitProperty_MaximumFramesPerSlice:
*(UInt32 *)outData = mMaxFramesPerSlice;
break;
@@ -686,9 +686,9 @@ OSStatus AUBase::DispatchGetProperty( AudioUnitPropertyID inID,
result = kAudioUnitErr_InvalidProperty;
}
break;
-
+
case kAudioUnitProperty_AudioChannelLayout:
- {
+ {
AudioChannelLayout* ptr = outData ? static_cast<AudioChannelLayout*>(outData) : NULL;
Boolean writable;
UInt32 dataSize = GetAudioChannelLayout(inScope, inElement, ptr, writable);
@@ -710,7 +710,7 @@ OSStatus AUBase::DispatchGetProperty( AudioUnitPropertyID inID,
case kAudioUnitProperty_ParameterValueStrings:
result = GetParameterValueStrings(inScope, inElement, (CFArrayRef *)outData);
break;
-
+
#if !CA_USE_AUDIO_PLUGIN_ONLY
case kAudioUnitProperty_FastDispatch:
if (!IsCMgrObject()) result = kAudioUnitErr_InvalidProperty;
@@ -765,21 +765,21 @@ OSStatus AUBase::DispatchGetProperty( AudioUnitPropertyID inID,
result = kAudioUnitErr_InvalidPropertyValue;
}
break;
-
+
case kAudioUnitProperty_ParameterClumpName:
{
AudioUnitParameterNameInfo * ioClumpInfo = (AudioUnitParameterNameInfo*) outData;
if (ioClumpInfo->inID == kAudioUnitClumpID_System) // this ID value is reserved
result = kAudioUnitErr_InvalidPropertyValue;
- else
+ else
{
result = CopyClumpName(inScope, ioClumpInfo->inID, ioClumpInfo->inDesiredLength, &ioClumpInfo->outName);
-
+
// this is provided for compatbility with existing implementations that don't know
// about this new mechanism
if (result == kAudioUnitErr_InvalidProperty)
result = GetProperty (inID, inScope, inElement, outData);
- }
+ }
}
break;
@@ -794,7 +794,7 @@ OSStatus AUBase::DispatchGetProperty( AudioUnitPropertyID inID,
if (mNickName) CFRetain(mNickName);
*(CFStringRef*)outData = mNickName;
break;
-
+
default:
result = GetProperty(inID, inScope, inElement, outData);
break;
@@ -822,7 +822,7 @@ OSStatus AUBase::DispatchSetProperty( AudioUnitPropertyID inID,
}
break;
-
+
case kAudioUnitProperty_SetRenderCallback:
{
ca_require(inDataSize >= sizeof(AURenderCallbackStruct), InvalidPropertyValue);
@@ -840,7 +840,7 @@ OSStatus AUBase::DispatchSetProperty( AudioUnitPropertyID inID,
PropertyChanged(inID, inScope, inElement);
}
break;
-
+
case kAudioUnitProperty_MaximumFramesPerSlice:
ca_require(inDataSize == sizeof(UInt32), InvalidPropertyValue);
result = CanSetMaxFrames();
@@ -862,14 +862,14 @@ OSStatus AUBase::DispatchSetProperty( AudioUnitPropertyID inID,
ca_require(ValidFormat(inScope, inElement, newDesc), InvalidFormat);
const CAStreamBasicDescription curDesc = GetStreamFormat(inScope, inElement);
-
+
if ( !curDesc.IsEqual(newDesc, false) ) {
ca_require(IsStreamFormatWritable(inScope, inElement), NotWritable);
result = ChangeStreamFormat(inScope, inElement, curDesc, newDesc);
}
}
break;
-
+
case kAudioUnitProperty_SampleRate:
{
ca_require(inDataSize == sizeof(Float64), InvalidPropertyValue);
@@ -878,9 +878,9 @@ OSStatus AUBase::DispatchSetProperty( AudioUnitPropertyID inID,
const CAStreamBasicDescription curDesc = GetStreamFormat(inScope, inElement);
CAStreamBasicDescription newDesc = curDesc;
newDesc.mSampleRate = *(Float64 *)inData;
-
+
ca_require(ValidFormat(inScope, inElement, newDesc), InvalidFormat);
-
+
if ( !curDesc.IsEqual(newDesc, false) ) {
ca_require(IsStreamFormatWritable(inScope, inElement), NotWritable);
result = ChangeStreamFormat(inScope, inElement, curDesc, newDesc);
@@ -892,14 +892,14 @@ OSStatus AUBase::DispatchSetProperty( AudioUnitPropertyID inID,
{
const AudioChannelLayout *layout = static_cast<const AudioChannelLayout *>(inData);
size_t headerSize = sizeof(AudioChannelLayout) - sizeof(AudioChannelDescription);
-
+
ca_require(inDataSize >= headerSize + layout->mNumberChannelDescriptions * sizeof(AudioChannelDescription), InvalidPropertyValue);
result = SetAudioChannelLayout(inScope, inElement, layout);
if (result == noErr)
PropertyChanged(inID, inScope, inElement);
break;
}
-
+
case kAudioUnitProperty_ClassInfo:
ca_require(inDataSize == sizeof(CFPropertyListRef *), InvalidPropertyValue);
ca_require(inScope == kAudioUnitScope_Global, InvalidScope);
@@ -916,7 +916,7 @@ OSStatus AUBase::DispatchSetProperty( AudioUnitPropertyID inID,
ca_require(inDataSize == sizeof(AUPreset), InvalidPropertyValue);
ca_require(inScope == kAudioUnitScope_Global, InvalidScope);
AUPreset & newPreset = *(AUPreset *)inData;
-
+
if (newPreset.presetNumber >= 0)
{
result = NewFactoryPresetSet(newPreset);
@@ -935,7 +935,7 @@ OSStatus AUBase::DispatchSetProperty( AudioUnitPropertyID inID,
result = kAudioUnitErr_InvalidPropertyValue;
}
break;
-
+
case kAudioUnitProperty_ElementName:
{
ca_require(GetElement(inScope, inElement) != NULL, InvalidElement);
@@ -1003,7 +1003,7 @@ OSStatus AUBase::DispatchSetProperty( AudioUnitPropertyID inID,
break;
#endif // !CA_NO_AU_UI_FEATURES
-
+
case kAudioUnitProperty_NickName:
{
ca_require(inScope == kAudioUnitScope_Global, InvalidScope);
@@ -1015,12 +1015,12 @@ OSStatus AUBase::DispatchSetProperty( AudioUnitPropertyID inID,
PropertyChanged(inID, inScope, inElement);
break;
}
-
+
default:
result = SetProperty(inID, inScope, inElement, inData, inDataSize);
if (result == noErr)
PropertyChanged(inID, inScope, inElement);
-
+
break;
}
return result;
@@ -1062,7 +1062,7 @@ OSStatus AUBase::DispatchRemovePropertyValue (AudioUnitPropertyID inID,
PropertyChanged(inID, inScope, inElement);
break;
}
-
+
#if !CA_NO_AU_HOST_CALLBACKS
case kAudioUnitProperty_HostCallbacks:
{
@@ -1088,7 +1088,7 @@ OSStatus AUBase::DispatchRemovePropertyValue (AudioUnitPropertyID inID,
mContextName = NULL;
result = noErr;
break;
-
+
#endif // !CA_NO_AU_UI_FEATURES
case kAudioUnitProperty_NickName:
@@ -1104,10 +1104,10 @@ OSStatus AUBase::DispatchRemovePropertyValue (AudioUnitPropertyID inID,
}
default:
- result = RemovePropertyValue (inID, inScope, inElement);
+ result = RemovePropertyValue (inID, inScope, inElement);
break;
}
-
+
return result;
#if !CA_NO_AU_UI_FEATURES || !CA_NO_AU_HOST_CALLBACKS
InvalidScope:
@@ -1157,7 +1157,7 @@ OSStatus AUBase::RemovePropertyValue ( AudioUnitPropertyID inID,
{
return kAudioUnitErr_InvalidPropertyValue;
}
-
+
//_____________________________________________________________________________
//
OSStatus AUBase::AddPropertyListener( AudioUnitPropertyID inID,
@@ -1165,11 +1165,11 @@ OSStatus AUBase::AddPropertyListener( AudioUnitPropertyID inID,
void * inProcRefCon)
{
PropertyListener pl;
-
+
pl.propertyID = inID;
pl.listenerProc = inProc;
pl.listenerRefCon = inProcRefCon;
-
+
if (mPropertyListeners.empty())
mPropertyListeners.reserve(32);
mPropertyListeners.push_back(pl);
@@ -1196,7 +1196,7 @@ OSStatus AUBase::RemovePropertyListener( AudioUnitPropertyID inID,
//_____________________________________________________________________________
//
void AUBase::PropertyChanged( AudioUnitPropertyID inID,
- AudioUnitScope inScope,
+ AudioUnitScope inScope,
AudioUnitElement inElement)
{
for (PropertyListeners::iterator it = mPropertyListeners.begin(); it != mPropertyListeners.end(); ++it)
@@ -1239,7 +1239,7 @@ OSStatus AUBase::GetParameter( AudioUnitParameterID inID,
return noErr;
}
-
+
//_____________________________________________________________________________
//
OSStatus AUBase::SetParameter( AudioUnitParameterID inID,
@@ -1259,22 +1259,22 @@ OSStatus AUBase::ScheduleParameter ( const AudioUnitParameterEvent *inParamet
UInt32 inNumEvents)
{
bool canScheduleParameters = CanScheduleParameters();
-
- for (UInt32 i = 0; i < inNumEvents; ++i)
+
+ for (UInt32 i = 0; i < inNumEvents; ++i)
{
if (inParameterEvent[i].eventType == kParameterEvent_Immediate)
{
SetParameter (inParameterEvent[i].parameter,
- inParameterEvent[i].scope,
+ inParameterEvent[i].scope,
inParameterEvent[i].element,
- inParameterEvent[i].eventValues.immediate.value,
+ inParameterEvent[i].eventValues.immediate.value,
inParameterEvent[i].eventValues.immediate.bufferOffset);
}
if (canScheduleParameters) {
mParamList.push_back (inParameterEvent[i]);
}
}
-
+
return noErr;
}
@@ -1297,9 +1297,9 @@ OSStatus AUBase::ProcessForScheduledParams( ParameterEventList &inParamList,
void *inUserData )
{
OSStatus result = noErr;
-
+
int totalFramesToProcess = inFramesToProcess;
-
+
int framesRemaining = totalFramesToProcess;
unsigned int currentStartFrame = 0; // start of the whole buffer
@@ -1310,23 +1310,23 @@ OSStatus AUBase::ProcessForScheduledParams( ParameterEventList &inParamList,
std::sort(inParamList.begin(), inParamList.end(), SortParameterEventList);
ParameterEventList::iterator iter = inParamList.begin();
-
-
+
+
while(framesRemaining > 0 )
{
// first of all, go through the ramped automation events and find out where the next
// division of our whole buffer will be
-
+
int currentEndFrame = totalFramesToProcess; // start out assuming we'll process all the way to
// the end of the buffer
-
+
iter = inParamList.begin();
-
+
// find the next break point
while(iter != inParamList.end() )
{
AudioUnitParameterEvent &event = *iter;
-
+
int offset = event.eventType == kParameterEvent_Immediate ? event.eventValues.immediate.bufferOffset : event.eventValues.ramp.startBufferOffset;
if(offset > (int)currentStartFrame && offset < currentEndFrame )
@@ -1339,7 +1339,7 @@ OSStatus AUBase::ProcessForScheduledParams( ParameterEventList &inParamList,
if(event.eventType == kParameterEvent_Ramped )
{
offset = event.eventValues.ramp.startBufferOffset + event.eventValues.ramp.durationInFrames;
-
+
if(offset > (int)currentStartFrame && offset < currentEndFrame )
{
currentEndFrame = offset;
@@ -1348,31 +1348,31 @@ OSStatus AUBase::ProcessForScheduledParams( ParameterEventList &inParamList,
iter++;
}
-
+
int framesThisTime = currentEndFrame - currentStartFrame;
- // next, setup the parameter maps to be current for the ramp parameters active during
+ // next, setup the parameter maps to be current for the ramp parameters active during
// this time segment...
-
+
for(ParameterEventList::iterator iter2 = inParamList.begin(); iter2 != inParamList.end(); iter2++ )
{
AudioUnitParameterEvent &event = *iter2;
-
+
bool eventFallsInSlice;
-
-
+
+
if(event.eventType == kParameterEvent_Ramped)
- eventFallsInSlice = event.eventValues.ramp.startBufferOffset < currentEndFrame
+ eventFallsInSlice = event.eventValues.ramp.startBufferOffset < currentEndFrame
&& event.eventValues.ramp.startBufferOffset + event.eventValues.ramp.durationInFrames > currentStartFrame;
else /* kParameterEvent_Immediate */
// actually, for the same parameter, there may be future immediate events which override this one,
// but it's OK since the event list is sorted in time order, we're guaranteed to end up with the current one
eventFallsInSlice = event.eventValues.immediate.bufferOffset <= currentStartFrame;
-
+
if(eventFallsInSlice)
{
AUElement *element = GetElement(event.scope, event.element );
-
+
if(element) element->SetScheduledEvent( event.parameter,
event,
currentStartFrame,
@@ -1383,18 +1383,18 @@ OSStatus AUBase::ProcessForScheduledParams( ParameterEventList &inParamList,
// Finally, actually do the processing for this slice.....
-
+
result = ProcessScheduledSlice( inUserData,
currentStartFrame,
framesThisTime,
inFramesToProcess );
-
+
if(result != noErr) break;
-
+
framesRemaining -= framesThisTime;
currentStartFrame = currentEndFrame; // now start from where we left off last time
}
-
+
return result;
}
@@ -1402,9 +1402,9 @@ OSStatus AUBase::ProcessForScheduledParams( ParameterEventList &inParamList,
//
void AUBase::SetWantsRenderThreadID (bool inFlag)
{
- if (inFlag == mWantsRenderThreadID)
+ if (inFlag == mWantsRenderThreadID)
return;
-
+
mWantsRenderThreadID = inFlag;
if (!mWantsRenderThreadID)
mRenderThreadID = NULL;
@@ -1423,10 +1423,10 @@ OSStatus AUBase::DoRender( AudioUnitRenderActionFlags & ioActionFlags,
{
OSStatus theError;
RenderCallbackList::iterator rcit;
-
+
AUTRACE(kCATrace_AUBaseRenderStart, mComponentInstance, (uintptr_t)this, inBusNumber, inFramesToProcess, (uintptr_t)ioData.mBuffers[0].mData);
DISABLE_DENORMALS
-
+
try {
ca_require(IsInitialized(), Uninitialized);
ca_require(mAudioUnitAPIVersion >= 2, ParamErr);
@@ -1468,7 +1468,7 @@ OSStatus AUBase::DoRender( AudioUnitRenderActionFlags & ioActionFlags,
buf.mDataByteSize = expectedBufferByteSize;
}
}
-
+
if (WantsRenderThreadID())
{
#if TARGET_OS_MAC
@@ -1477,7 +1477,7 @@ OSStatus AUBase::DoRender( AudioUnitRenderActionFlags & ioActionFlags,
mRenderThreadID = GetCurrentThreadId();
#endif
}
-
+
AudioUnitRenderActionFlags flags;
if (mRenderCallbacksTouched) {
mRenderCallbacks.update();
@@ -1485,26 +1485,26 @@ OSStatus AUBase::DoRender( AudioUnitRenderActionFlags & ioActionFlags,
for (rcit = mRenderCallbacks.begin(); rcit != mRenderCallbacks.end(); ++rcit) {
RenderCallback &rc = *rcit;
AUTRACE(kCATrace_AUBaseRenderCallbackStart, mComponentInstance, (intptr_t)this, (intptr_t)rc.mRenderNotify, 1, 0);
- (*(AURenderCallback)rc.mRenderNotify)(rc.mRenderNotifyRefCon,
+ (*(AURenderCallback)rc.mRenderNotify)(rc.mRenderNotifyRefCon,
&flags,
&inTimeStamp, inBusNumber, inFramesToProcess, &ioData);
AUTRACE(kCATrace_AUBaseRenderCallbackEnd, mComponentInstance, (intptr_t)this, (intptr_t)rc.mRenderNotify, 1, 0);
}
}
-
+
theError = DoRenderBus(ioActionFlags, inTimeStamp, inBusNumber, output, inFramesToProcess, ioData);
-
+
if (mRenderCallbacksTouched) {
flags = ioActionFlags | kAudioUnitRenderAction_PostRender;
-
+
if (SetRenderError (theError)) {
- flags |= kAudioUnitRenderAction_PostRenderError;
+ flags |= kAudioUnitRenderAction_PostRenderError;
}
-
+
for (rcit = mRenderCallbacks.begin(); rcit != mRenderCallbacks.end(); ++rcit) {
RenderCallback &rc = *rcit;
AUTRACE(kCATrace_AUBaseRenderCallbackStart, mComponentInstance, (intptr_t)this, (intptr_t)rc.mRenderNotify, 2, 0);
- (*(AURenderCallback)rc.mRenderNotify)(rc.mRenderNotifyRefCon,
+ (*(AURenderCallback)rc.mRenderNotify)(rc.mRenderNotifyRefCon,
&flags,
&inTimeStamp, inBusNumber, inFramesToProcess, &ioData);
AUTRACE(kCATrace_AUBaseRenderCallbackEnd, mComponentInstance, (intptr_t)this, (intptr_t)rc.mRenderNotify, 2, 0);
@@ -1527,12 +1527,12 @@ OSStatus AUBase::DoRender( AudioUnitRenderActionFlags & ioActionFlags,
theError = -1;
goto errexit;
}
-done:
+done:
RESTORE_DENORMALS
AUTRACE(kCATrace_AUBaseRenderEnd, mComponentInstance, (intptr_t)this, theError, ioActionFlags, CATrace::ablData(ioData));
-
+
return theError;
-
+
Uninitialized: theError = kAudioUnitErr_Uninitialized; goto errexit;
ParamErr: theError = kAudio_ParamError; goto errexit;
TooManyFrames: theError = kAudioUnitErr_TooManyFramesToProcess; goto errexit;
@@ -1553,8 +1553,8 @@ OSStatus AUBase::DoProcess ( AudioUnitRenderActionFlags & ioActionFlags,
AUTRACE(kCATrace_AUBaseRenderStart, mComponentInstance, (intptr_t)this, -1, inFramesToProcess, 0);
DISABLE_DENORMALS
- try {
-
+ try {
+
if (!(ioActionFlags & (1 << 9)/*kAudioUnitRenderAction_DoNotCheckRenderArgs*/)) {
ca_require(IsInitialized(), Uninitialized);
ca_require(inFramesToProcess <= mMaxFramesPerSlice, TooManyFrames);
@@ -1587,7 +1587,7 @@ OSStatus AUBase::DoProcess ( AudioUnitRenderActionFlags & ioActionFlags,
}
}
}
-
+
if (WantsRenderThreadID())
{
#if TARGET_OS_MAC
@@ -1596,12 +1596,12 @@ OSStatus AUBase::DoProcess ( AudioUnitRenderActionFlags & ioActionFlags,
mRenderThreadID = GetCurrentThreadId();
#endif
}
-
+
if (NeedsToRender (inTimeStamp)) {
theError = ProcessBufferLists (ioActionFlags, ioData, ioData, inFramesToProcess);
} else
theError = noErr;
-
+
}
catch (OSStatus err) {
theError = err;
@@ -1611,12 +1611,12 @@ OSStatus AUBase::DoProcess ( AudioUnitRenderActionFlags & ioActionFlags,
theError = -1;
goto errexit;
}
-done:
+done:
RESTORE_DENORMALS
AUTRACE(kCATrace_AUBaseRenderEnd, mComponentInstance, (intptr_t)this, theError, ioActionFlags, CATrace::ablData(ioData));
-
+
return theError;
-
+
Uninitialized: theError = kAudioUnitErr_Uninitialized; goto errexit;
ParamErr: theError = kAudio_ParamError; goto errexit;
TooManyFrames: theError = kAudioUnitErr_TooManyFramesToProcess; goto errexit;
@@ -1636,25 +1636,25 @@ OSStatus AUBase::DoProcessMultiple ( AudioUnitRenderActionFlags & ioActionFlags
{
OSStatus theError;
DISABLE_DENORMALS
-
+
try {
-
+
if (!(ioActionFlags & (1 << 9)/*kAudioUnitRenderAction_DoNotCheckRenderArgs*/)) {
ca_require(IsInitialized(), Uninitialized);
ca_require(inFramesToProcess <= mMaxFramesPerSlice, TooManyFrames);
ca_require (!UsesFixedBlockSize() || inFramesToProcess == GetMaxFramesPerSlice(), ParamErr);
-
+
for (unsigned ibl = 0; ibl < inNumberInputBufferLists; ++ibl) {
if (inInputBufferLists[ibl] != NULL) {
AUInputElement *input = GetInput(ibl); // will throw if non-existant
unsigned expectedBufferByteSize = inFramesToProcess * input->GetStreamFormat().mBytesPerFrame;
-
+
if (input->GetStreamFormat().NumberChannelStreams() != inInputBufferLists[ibl]->mNumberBuffers) {
DebugMessageN5("%s:%d inInputBufferLists[%u]->mNumberBuffers=%u, input->GetStreamFormat().NumberChannelStreams()=%u; kAudio_ParamError",
__FILE__, __LINE__, ibl, (unsigned)inInputBufferLists[ibl]->mNumberBuffers, (unsigned)input->GetStreamFormat().NumberChannelStreams());
goto ParamErr;
}
-
+
for (unsigned ibuf = 0; ibuf < inInputBufferLists[ibl]->mNumberBuffers; ++ibuf) {
const AudioBuffer &buf = inInputBufferLists[ibl]->mBuffers[ibuf];
if (buf.mData != NULL) {
@@ -1673,7 +1673,7 @@ OSStatus AUBase::DoProcessMultiple ( AudioUnitRenderActionFlags & ioActionFlags
// skip NULL input audio buffer list
}
}
-
+
for (unsigned obl = 0; obl < inNumberOutputBufferLists; ++obl) {
if (ioOutputBufferLists[obl] != NULL) {
AUOutputElement *output = GetOutput(obl); // will throw if non-existant
@@ -1684,7 +1684,7 @@ OSStatus AUBase::DoProcessMultiple ( AudioUnitRenderActionFlags & ioActionFlags
__FILE__, __LINE__, obl, (unsigned)ioOutputBufferLists[obl]->mNumberBuffers, (unsigned)output->GetStreamFormat().NumberChannelStreams());
goto ParamErr;
}
-
+
for (unsigned obuf = 0; obuf < ioOutputBufferLists[obl]->mNumberBuffers; ++obuf) {
AudioBuffer &buf = ioOutputBufferLists[obl]->mBuffers[obuf];
if (buf.mData != NULL) {
@@ -1708,7 +1708,7 @@ OSStatus AUBase::DoProcessMultiple ( AudioUnitRenderActionFlags & ioActionFlags
}
}
}
-
+
if (WantsRenderThreadID())
{
#if TARGET_OS_MAC
@@ -1717,7 +1717,7 @@ OSStatus AUBase::DoProcessMultiple ( AudioUnitRenderActionFlags & ioActionFlags
mRenderThreadID = GetCurrentThreadId();
#endif
}
-
+
if (NeedsToRender (inTimeStamp)) {
theError = ProcessMultipleBufferLists (ioActionFlags, inFramesToProcess, inNumberInputBufferLists, inInputBufferLists, inNumberOutputBufferLists, ioOutputBufferLists);
} else
@@ -1731,11 +1731,11 @@ OSStatus AUBase::DoProcessMultiple ( AudioUnitRenderActionFlags & ioActionFlags
theError = -1;
goto errexit;
}
-done:
+done:
RESTORE_DENORMALS
-
+
return theError;
-
+
Uninitialized: theError = kAudioUnitErr_Uninitialized; goto errexit;
ParamErr: theError = kAudio_ParamError; goto errexit;
TooManyFrames: theError = kAudioUnitErr_TooManyFramesToProcess; goto errexit;
@@ -1748,15 +1748,15 @@ errexit:
//_____________________________________________________________________________
//
OSStatus AUBase::SetInputCallback( UInt32 inPropertyID,
- AudioUnitElement inElement,
+ AudioUnitElement inElement,
AURenderCallback inProc,
void * inRefCon)
{
AUInputElement *input = GetInput(inElement); // may throw
-
+
input->SetInputCallback(inProc, inRefCon);
PropertyChanged(inPropertyID, kAudioUnitScope_Input, inElement);
-
+
return noErr;
}
@@ -1767,7 +1767,7 @@ OSStatus AUBase::SetConnection( const AudioUnitConnection & inConnection)
OSStatus err;
AUInputElement *input = GetInput(inConnection.destInputNumber); // may throw
-
+
if (inConnection.sourceAudioUnit) {
// connecting, not disconnecting
CAStreamBasicDescription sourceDesc;
@@ -1779,19 +1779,19 @@ OSStatus AUBase::SetConnection( const AudioUnitConnection & inConnection)
inConnection.sourceOutputNumber,
&sourceDesc,
&size), errexit);
- ca_require_noerr(err = DispatchSetProperty (kAudioUnitProperty_StreamFormat,
- kAudioUnitScope_Input, inConnection.destInputNumber,
+ ca_require_noerr(err = DispatchSetProperty (kAudioUnitProperty_StreamFormat,
+ kAudioUnitScope_Input, inConnection.destInputNumber,
&sourceDesc, sizeof(CAStreamBasicDescription)), errexit);
}
input->SetConnection(inConnection);
-
+
PropertyChanged(kAudioUnitProperty_MakeConnection, kAudioUnitScope_Input, inConnection.destInputNumber);
return noErr;
errexit:
return err;
}
-
+
//_____________________________________________________________________________
//
UInt32 AUBase::SupportedNumChannels ( const AUChannelInfo** outInfo)
@@ -1838,7 +1838,7 @@ const CAStreamBasicDescription &
{
//#warning "aliasing of global scope format should be pushed to subclasses"
AUIOElement *element;
-
+
switch (inScope) {
case kAudioUnitScope_Input:
element = Inputs().GetIOElement(inElement);
@@ -1858,9 +1858,9 @@ const CAStreamBasicDescription &
OSStatus AUBase::SetBusCount( AudioUnitScope inScope,
UInt32 inCount)
{
- if (IsInitialized())
+ if (IsInitialized())
return kAudioUnitErr_Initialized;
-
+
GetScope(inScope).SetNumberOfElements(inCount);
return noErr;
}
@@ -1874,7 +1874,7 @@ OSStatus AUBase::ChangeStreamFormat( AudioUnitScope inScope,
{
//#warning "aliasing of global scope format should be pushed to subclasses"
AUIOElement *element;
-
+
switch (inScope) {
case kAudioUnitScope_Input:
element = Inputs().GetIOElement(inElement);
@@ -1921,7 +1921,7 @@ OSStatus AUBase::RemoveAudioChannelLayout( AudioUnitScope inScope,
return result;
}
-OSStatus AUBase::SetAudioChannelLayout( AudioUnitScope inScope,
+OSStatus AUBase::SetAudioChannelLayout( AudioUnitScope inScope,
AudioUnitElement inElement,
const AudioChannelLayout * inLayout)
{
@@ -1946,7 +1946,7 @@ OSStatus AUBase::SetAudioChannelLayout( AudioUnitScope inScope,
}
}
free(tags);
-
+
if (foundTag == false)
return kAudioUnitErr_InvalidPropertyValue;
@@ -1966,7 +1966,7 @@ OSStatus AUBase::SaveState( CFPropertyListRef * outData)
{
AudioComponentDescription desc = GetComponentDescription();
- CFMutableDictionaryRef dict = CFDictionaryCreateMutable (NULL, 0,
+ CFMutableDictionaryRef dict = CFDictionaryCreateMutable (NULL, 0,
&kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks);
// first step -> save the version to the data ref
@@ -1979,24 +1979,24 @@ OSStatus AUBase::SaveState( CFPropertyListRef * outData)
value = desc.componentSubType;
AddNumToDictionary (dict, kSubtypeString, value);
-
+
value = desc.componentManufacturer;
AddNumToDictionary (dict, kManufacturerString, value);
-
+
// fourth step -> save the state of all parameters on all scopes and elements
CFMutableDataRef data = CFDataCreateMutable(NULL, 0);
for (AudioUnitScope iscope = 0; iscope < 3; ++iscope) {
AUScope &scope = GetScope(iscope);
scope.SaveState (data);
}
-
+
SaveExtendedScopes(data);
// save all this in the data section of the dictionary
CFDictionarySetValue(dict, kDataString, data);
CFRelease (data);
-
-//OK - now we're going to do some properties
+
+//OK - now we're going to do some properties
//save the preset name...
CFDictionarySetValue (dict, kNameString, mCurrentPreset.presetName);
@@ -2006,44 +2006,44 @@ OSStatus AUBase::SaveState( CFPropertyListRef * outData)
kAudioUnitScope_Global,
0,
&value);
-
+
if (result == noErr) {
AddNumToDictionary (dict, kRenderQualityString, value);
}
-
+
// Does the unit support the CPULoad Quality property - if so, save it...
Float32 cpuLoad;
result = DispatchGetProperty (6/*kAudioUnitProperty_CPULoad*/,
kAudioUnitScope_Global,
0,
&cpuLoad);
-
+
if (result == noErr) {
CFNumberRef num = CFNumberCreate (NULL, kCFNumberFloatType, &cpuLoad);
CFDictionarySetValue (dict, kCPULoadString, num);
CFRelease (num);
}
-// Do we have any element names for any of our scopes?
+// Do we have any element names for any of our scopes?
// first check to see if we have any names...
bool foundName = false;
for (AudioUnitScope i = 0; i < kNumScopes; ++i) {
foundName = GetScope (i).HasElementWithName();
- if (foundName)
+ if (foundName)
break;
}
// OK - we found a name away we go...
if (foundName) {
- CFMutableDictionaryRef nameDict = CFDictionaryCreateMutable (NULL, 0,
+ CFMutableDictionaryRef nameDict = CFDictionaryCreateMutable (NULL, 0,
&kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks);
for (AudioUnitScope i = 0; i < kNumScopes; ++i) {
GetScope (i).AddElementNamesToDict (nameDict);
}
-
+
CFDictionarySetValue (dict, kElementNameString, nameDict);
CFRelease (nameDict);
}
-
+
// we're done!!!
*outData = dict;
@@ -2055,16 +2055,16 @@ OSStatus AUBase::SaveState( CFPropertyListRef * outData)
OSStatus AUBase::RestoreState( CFPropertyListRef plist)
{
if (CFGetTypeID(plist) != CFDictionaryGetTypeID()) return kAudioUnitErr_InvalidPropertyValue;
-
+
AudioComponentDescription desc = GetComponentDescription();
-
+
CFDictionaryRef dict = static_cast<CFDictionaryRef>(plist);
// zeroeth step - make sure the Part key is NOT present, as this method is used
-// to restore the GLOBAL state of the dictionary
+// to restore the GLOBAL state of the dictionary
if (CFDictionaryContainsKey (dict, kPartString))
return kAudioUnitErr_InvalidPropertyValue;
-
+
// first step -> check the saved version in the data ref
// at this point we're only dealing with version==0
CFNumberRef cfnum = reinterpret_cast<CFNumberRef>(CFDictionaryGetValue (dict, kVersionString));
@@ -2087,22 +2087,22 @@ OSStatus AUBase::RestoreState( CFPropertyListRef plist)
CFNumberGetValue (cfnum, kCFNumberSInt32Type, &value);
if (UInt32(value) != desc.componentManufacturer) return kAudioUnitErr_InvalidPropertyValue;
-// fourth step -> restore the state of all of the parameters for each scope and element
+// fourth step -> restore the state of all of the parameters for each scope and element
CFDataRef data = reinterpret_cast<CFDataRef>(CFDictionaryGetValue (dict, kDataString));
- if (data != NULL)
+ if (data != NULL)
{
const UInt8 *p, *pend;
-
+
p = CFDataGetBytePtr(data);
pend = p + CFDataGetLength(data);
-
+
// we have a zero length data, which may just mean there were no parameters to save!
- // if (p >= pend) return noErr;
-
+ // if (p >= pend) return noErr;
+
while (p < pend) {
UInt32 scopeIdx = CFSwapInt32BigToHost(*(UInt32 *)p);
p += sizeof(UInt32);
-
+
AUScope &scope = GetScope(scopeIdx);
p = scope.RestoreState(p);
}
@@ -2116,12 +2116,12 @@ OSStatus AUBase::RestoreState( CFPropertyListRef plist)
{
mCurrentPreset.presetName = name;
mCurrentPreset.presetNumber = -1;
- }
+ }
else { // no name entry make the default one
mCurrentPreset.presetName = kUntitledString;
mCurrentPreset.presetNumber = -1;
}
-
+
CFRetain (mCurrentPreset.presetName);
#if !CA_USE_AUDIO_PLUGIN_ONLY
#ifndef __LP64__
@@ -2130,8 +2130,8 @@ OSStatus AUBase::RestoreState( CFPropertyListRef plist)
#endif
PropertyChanged(kAudioUnitProperty_PresentPreset, kAudioUnitScope_Global, 0);
-// Does the dict contain render quality information?
- if (CFDictionaryGetValueIfPresent (dict, kRenderQualityString, reinterpret_cast<const void**>(&cfnum)))
+// Does the dict contain render quality information?
+ if (CFDictionaryGetValueIfPresent (dict, kRenderQualityString, reinterpret_cast<const void**>(&cfnum)))
{
CFNumberGetValue (cfnum, kCFNumberSInt32Type, &value);
DispatchSetProperty (kAudioUnitProperty_RenderQuality,
@@ -2140,9 +2140,9 @@ OSStatus AUBase::RestoreState( CFPropertyListRef plist)
&value,
sizeof(value));
}
-
+
// Does the unit support the CPULoad Quality property - if so, save it...
- if (CFDictionaryGetValueIfPresent (dict, kCPULoadString, reinterpret_cast<const void**>(&cfnum)))
+ if (CFDictionaryGetValueIfPresent (dict, kCPULoadString, reinterpret_cast<const void**>(&cfnum)))
{
Float32 floatValue;
CFNumberGetValue (cfnum, kCFNumberFloatType, &floatValue);
@@ -2155,24 +2155,24 @@ OSStatus AUBase::RestoreState( CFPropertyListRef plist)
// Do we have any element names for any of our scopes?
CFDictionaryRef nameDict;
- if (CFDictionaryGetValueIfPresent (dict, kElementNameString, reinterpret_cast<const void**>(&nameDict)))
+ if (CFDictionaryGetValueIfPresent (dict, kElementNameString, reinterpret_cast<const void**>(&nameDict)))
{
char string[64];
- for (int i = 0; i < kNumScopes; ++i)
+ for (int i = 0; i < kNumScopes; ++i)
{
snprintf (string, sizeof(string), "%d", i);
CFStringRef key = CFStringCreateWithCString (NULL, string, kCFStringEncodingASCII);
CFDictionaryRef elementDict;
- if (CFDictionaryGetValueIfPresent (nameDict, key, reinterpret_cast<const void**>(&elementDict)))
+ if (CFDictionaryGetValueIfPresent (nameDict, key, reinterpret_cast<const void**>(&elementDict)))
{
bool didAddElements = GetScope (i).RestoreElementNames (elementDict);
if (didAddElements)
PropertyChanged (kAudioUnitProperty_ElementCount, i, 0);
}
- CFRelease (key);
+ CFRelease (key);
}
}
-
+
return noErr;
}
@@ -2206,18 +2206,18 @@ bool AUBase::SetAFactoryPresetAsCurrent (const AUPreset & inPreset)
}
#if !CA_USE_AUDIO_PLUGIN_ONLY
-int AUBase::GetNumCustomUIComponents ()
+int AUBase::GetNumCustomUIComponents ()
{
return 0;
}
void AUBase::GetUIComponentDescs (ComponentDescription* inDescArray) {}
#endif
-
-bool AUBase::HasIcon ()
+
+bool AUBase::HasIcon ()
{
#if !CA_NO_AU_UI_FEATURES
- CFURLRef url = CopyIconLocation();
+ CFURLRef url = CopyIconLocation();
if (url) {
CFRelease (url);
return true;
@@ -2226,11 +2226,11 @@ bool AUBase::HasIcon ()
return false;
}
-CFURLRef AUBase::CopyIconLocation ()
+CFURLRef AUBase::CopyIconLocation ()
{
return NULL;
}
-
+
//_____________________________________________________________________________
//
OSStatus AUBase::GetParameterList( AudioUnitScope inScope,
@@ -2240,7 +2240,7 @@ OSStatus AUBase::GetParameterList( AudioUnitScope inScope,
AUScope &scope = GetScope(inScope);
AUElement *elementWithMostParameters = NULL;
UInt32 maxNumParams = 0;
-
+
int nElems = scope.GetNumberOfElements();
for (int ielem = 0; ielem < nElems; ++ielem) {
AUElement *element = scope.GetElement(ielem);
@@ -2250,10 +2250,10 @@ OSStatus AUBase::GetParameterList( AudioUnitScope inScope,
elementWithMostParameters = element;
}
}
-
+
if (outParameterList != NULL && elementWithMostParameters != NULL)
elementWithMostParameters->GetParameterList(outParameterList);
-
+
outNumParameters = maxNumParams;
return noErr;
}
@@ -2289,8 +2289,8 @@ OSStatus AUBase::GetParameterHistoryInfo( AudioUnitScope inScope,
//_____________________________________________________________________________
//
-OSStatus AUBase::CopyClumpName( AudioUnitScope inScope,
- UInt32 inClumpID,
+OSStatus AUBase::CopyClumpName( AudioUnitScope inScope,
+ UInt32 inClumpID,
UInt32 inDesiredNameLength,
CFStringRef * outClumpName)
{
@@ -2328,7 +2328,7 @@ AUElement * AUBase::CreateElement( AudioUnitScope scope,
#endif
}
COMPONENT_THROW(kAudioUnitErr_InvalidScope);
-
+
return NULL; // get rid of compiler warning
}
@@ -2374,9 +2374,9 @@ const Float64 AUBase::kNoLastRenderedSampleTime = -1.;
char* AUBase::GetLoggingString () const
{
if (mLogString) return mLogString;
-
+
AudioComponentDescription desc = GetComponentDescription();
-
+
const size_t logStringSize = 256;
const_cast<AUBase*>(this)->mLogString = new char[logStringSize];
char str[24];
diff --git a/libs/appleutility/CoreAudio/AudioUnits/AUPublic/AUBase/AUBase.h b/libs/appleutility/CoreAudio/AudioUnits/AUPublic/AUBase/AUBase.h
index 0c78221cc8..8cc600fc64 100644
--- a/libs/appleutility/CoreAudio/AudioUnits/AUPublic/AUBase/AUBase.h
+++ b/libs/appleutility/CoreAudio/AudioUnits/AUPublic/AUBase/AUBase.h
@@ -2,14 +2,14 @@
File: AUBase.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 __AUBase_h__
#define __AUBase_h__
@@ -81,7 +81,7 @@
#ifndef AUTRACE
#define AUTRACE(code, obj, a, b, c, d)
-#endif
+#endif
#include "AUPlugInDispatch.h"
@@ -92,11 +92,11 @@
#define kAUDefaultSampleRate 44100.0
#if !TARGET_OS_WIN32
-#define kAUDefaultMaxFramesPerSlice 1156
+#define kAUDefaultMaxFramesPerSlice 1156
//this allows enough default frames for a 512 dest 44K and SRC from 96K
// add a padding of 4 frames for any altivec rounding
#else
-#define kAUDefaultMaxFramesPerSlice 2048
+#define kAUDefaultMaxFramesPerSlice 2048
#endif
// ________________________________________________________________________
@@ -106,16 +106,16 @@ class AUBase : public ComponentBase {
public:
/*! @ctor AUBase */
- AUBase( AudioComponentInstance inInstance,
+ AUBase( AudioComponentInstance inInstance,
UInt32 numInputElements,
UInt32 numOutputElements,
UInt32 numGroupElements = 0);
/*! @dtor AUBase */
virtual ~AUBase();
-
+
/*! @method PostConstructor */
virtual void PostConstructor() { CreateElements(); }
-
+
/*! @method PreDestructor */
virtual void PreDestructor();
@@ -133,7 +133,7 @@ public:
// ________________________________________________________________________
// Virtual methods (mostly) directly corresponding to the entry points. Many of these
// have useful implementations here and will not need overriding.
-
+
/*! @method DoInitialize */
OSStatus DoInitialize();
// this implements the entry point and makes sure that initialization
@@ -143,16 +143,16 @@ public:
virtual OSStatus Initialize();
// ... so that overrides to this method can assume that they will only
// be called exactly once.
-
+
/*! @method IsInitialized */
bool IsInitialized() const { return mInitialized; }
/*! @method HasBegunInitializing */
bool HasBegunInitializing() const { return mHasBegunInitializing; }
-
+
/*! @method DoCleanup */
void DoCleanup();
// same pattern as with Initialize
-
+
/*! @method Cleanup */
virtual void Cleanup();
@@ -161,7 +161,7 @@ public:
AudioUnitElement inElement);
// Note about GetPropertyInfo, GetProperty, SetProperty:
- // Certain properties are trapped out in these dispatch functions and handled with different virtual
+ // Certain properties are trapped out in these dispatch functions and handled with different virtual
// methods. (To discourage hacks and keep vtable size down, these are non-virtual)
/*! @method DispatchGetPropertyInfo */
@@ -183,7 +183,7 @@ public:
AudioUnitElement inElement,
const void * inData,
UInt32 inDataSize);
-
+
OSStatus DispatchRemovePropertyValue( AudioUnitPropertyID inID,
AudioUnitScope inScope,
AudioUnitElement inElement);
@@ -207,7 +207,7 @@ public:
AudioUnitElement inElement,
const void * inData,
UInt32 inDataSize);
-
+
/*! @method ClearPropertyUsage */
virtual OSStatus RemovePropertyValue ( AudioUnitPropertyID inID,
AudioUnitScope inScope,
@@ -217,28 +217,28 @@ public:
virtual OSStatus AddPropertyListener( AudioUnitPropertyID inID,
AudioUnitPropertyListenerProc inProc,
void * inProcRefCon);
-
+
/*! @method RemovePropertyListener */
virtual OSStatus RemovePropertyListener( AudioUnitPropertyID inID,
AudioUnitPropertyListenerProc inProc,
void * inProcRefCon,
bool refConSpecified);
-
+
/*! @method SetRenderNotification */
virtual OSStatus SetRenderNotification( AURenderCallback inProc,
void * inRefCon);
-
+
/*! @method RemoveRenderNotification */
virtual OSStatus RemoveRenderNotification(
AURenderCallback inProc,
void * inRefCon);
-
+
/*! @method GetParameter */
virtual OSStatus GetParameter( AudioUnitParameterID inID,
AudioUnitScope inScope,
AudioUnitElement inElement,
AudioUnitParameterValue & outValue);
-
+
/*! @method SetParameter */
virtual OSStatus SetParameter( AudioUnitParameterID inID,
AudioUnitScope inScope,
@@ -252,7 +252,7 @@ public:
/*! @method ScheduleParameter */
virtual OSStatus ScheduleParameter ( const AudioUnitParameterEvent *inParameterEvent,
UInt32 inNumEvents);
-
+
/*! @method DoRender */
OSStatus DoRender( AudioUnitRenderActionFlags & ioActionFlags,
@@ -260,14 +260,14 @@ public:
UInt32 inBusNumber,
UInt32 inNumberFrames,
AudioBufferList & ioData);
-
+
/*! @method Process */
OSStatus DoProcess ( AudioUnitRenderActionFlags & ioActionFlags,
const AudioTimeStamp & inTimeStamp,
UInt32 inFramesToProcess,
AudioBufferList & ioData);
-
+
/*! @method ProcessMultiple */
OSStatus DoProcessMultiple ( AudioUnitRenderActionFlags & ioActionFlags,
const AudioTimeStamp & inTimeStamp,
@@ -276,7 +276,7 @@ public:
const AudioBufferList ** inInputBufferLists,
UInt32 inNumberOutputBufferLists,
AudioBufferList ** ioOutputBufferLists);
-
+
/*! @method ProcessBufferLists */
virtual OSStatus ProcessBufferLists( AudioUnitRenderActionFlags & ioActionFlags,
const AudioBufferList & inBuffer,
@@ -288,26 +288,26 @@ public:
/*! @method ProcessMultipleBufferLists */
virtual OSStatus ProcessMultipleBufferLists( AudioUnitRenderActionFlags & ioActionFlags,
- UInt32 inFramesToProcess,
+ UInt32 inFramesToProcess,
UInt32 inNumberInputBufferLists,
const AudioBufferList ** inInputBufferLists,
UInt32 inNumberOutputBufferLists,
- AudioBufferList ** ioOutputBufferLists)
+ AudioBufferList ** ioOutputBufferLists)
{
return kAudio_UnimplementedError;
}
-
+
/*! @method ComplexRender */
- virtual OSStatus ComplexRender( AudioUnitRenderActionFlags & ioActionFlags,
- const AudioTimeStamp & inTimeStamp,
- UInt32 inOutputBusNumber,
- UInt32 inNumberOfPackets,
- UInt32 * outNumberOfPackets,
- AudioStreamPacketDescription * outPacketDescriptions,
- AudioBufferList & ioData,
- void * outMetadata,
- UInt32 * outMetadataByteSize)
- {
+ virtual OSStatus ComplexRender( AudioUnitRenderActionFlags & ioActionFlags,
+ const AudioTimeStamp & inTimeStamp,
+ UInt32 inOutputBusNumber,
+ UInt32 inNumberOfPackets,
+ UInt32 * outNumberOfPackets,
+ AudioStreamPacketDescription * outPacketDescriptions,
+ AudioBufferList & ioData,
+ void * outMetadata,
+ UInt32 * outMetadataByteSize)
+ {
return kAudio_UnimplementedError;
}
@@ -316,7 +316,7 @@ public:
// Otherwise, override Render().
//
// N.B. Implementations of this method can assume that the output's buffer list has already been
- // prepared and access it with GetOutput(inBusNumber)->GetBufferList() instead of
+ // prepared and access it with GetOutput(inBusNumber)->GetBufferList() instead of
// GetOutput(inBusNumber)->PrepareBuffer(nFrames) -- if PrepareBuffer is called, a
// copy may occur after rendering.
/*! @method RenderBus */
@@ -331,7 +331,7 @@ public:
}
// N.B. For a unit with only one output bus, it can assume in its implementation of this
- // method that the output's buffer list has already been prepared and access it with
+ // method that the output's buffer list has already been prepared and access it with
// GetOutput(0)->GetBufferList() instead of GetOutput(0)->PrepareBuffer(nFrames)
// -- if PrepareBuffer is called, a copy may occur after rendering.
/*! @method Render */
@@ -342,7 +342,7 @@ public:
return noErr;
}
-
+
#pragma mark -
#pragma mark Property Dispatch
@@ -361,10 +361,10 @@ public:
/*! @method SetConnection */
virtual OSStatus SetConnection( const AudioUnitConnection & inConnection);
-
+
/*! @method SetInputCallback */
virtual OSStatus SetInputCallback( UInt32 inPropertyID,
- AudioUnitElement inElement,
+ AudioUnitElement inElement,
AURenderCallback inProc,
void * inRefCon);
@@ -386,7 +386,7 @@ public:
/*! @method SaveState */
virtual OSStatus SaveState( CFPropertyListRef * outData);
-
+
/*! @method SaveExtendedScopes */
virtual void SaveExtendedScopes( CFMutableDataRef outData) {};
@@ -399,8 +399,8 @@ public:
CFArrayRef * outStrings);
/*! @method CopyClumpName */
- virtual OSStatus CopyClumpName( AudioUnitScope inScope,
- UInt32 inClumpID,
+ virtual OSStatus CopyClumpName( AudioUnitScope inScope,
+ UInt32 inClumpID,
UInt32 inDesiredNameLength,
CFStringRef * outClumpName);
@@ -411,14 +411,14 @@ public:
// and the name should be valid, or the preset WON'T take
/*! @method SetAFactoryPresetAsCurrent */
bool SetAFactoryPresetAsCurrent (const AUPreset & inPreset);
-
+
// Called when someone sets a new, valid preset
// If this is a valid preset, then the subclass sets its state to that preset
// and returns noErr.
// If not a valid preset, return an error, and the pre-existing preset is restored
/*! @method NewFactoryPresetSet */
virtual OSStatus NewFactoryPresetSet (const AUPreset & inNewFactoryPreset);
-
+
/*! @method NewCustomPresetSet */
virtual OSStatus NewCustomPresetSet (const AUPreset & inNewCustomPreset);
@@ -429,10 +429,10 @@ public:
/*! @method GetUIComponentDescs */
virtual void GetUIComponentDescs (ComponentDescription* inDescArray);
#endif
-
+
/*! @method CopyIconLocation */
virtual CFURLRef CopyIconLocation ();
-
+
// default is no latency, and unimplemented tail time
/*! @method GetLatency */
virtual Float64 GetLatency() {return 0.0;}
@@ -444,18 +444,18 @@ public:
/*! @method IsStreamFormatWritable */
bool IsStreamFormatWritable( AudioUnitScope scope,
AudioUnitElement element);
-
+
/*! @method StreamFormatWritable */
virtual bool StreamFormatWritable( AudioUnitScope scope,
AudioUnitElement element) = 0;
// scope will always be input or output
-
+
// pass in a pointer to get the struct, and num channel infos
// you can pass in NULL to just get the number
// a return value of 0 (the default in AUBase) means the property is not supported...
/*! @method SupportedNumChannels */
virtual UInt32 SupportedNumChannels ( const AUChannelInfo** outInfo);
-
+
/*! @method ValidFormat */
virtual bool ValidFormat( AudioUnitScope inScope,
AudioUnitElement inElement,
@@ -466,7 +466,7 @@ public:
// native-endian 32-bit float, any sample rate,
// any number of channels; override when other
// formats are supported. A subclass's override can
- // choose to always return true and trap invalid
+ // choose to always return true and trap invalid
// formats in ChangeStreamFormat.
@@ -489,7 +489,7 @@ public:
const CAStreamBasicDescription & inNewFormat);
// Will only be called after StreamFormatWritable
// and ValidFormat have succeeded.
-
+
// ________________________________________________________________________
#if !CA_USE_AUDIO_PLUGIN_ONLY
@@ -500,7 +500,7 @@ public:
// ________________________________________________________________________
// Methods useful for subclasses
-
+
/*! @method GetScope */
AUScope & GetScope( AudioUnitScope inScope)
{
@@ -511,10 +511,10 @@ public:
}
return mScopes[inScope];
}
-
+
/*! @method GetScopeExtended */
virtual AUScope * GetScopeExtended (AudioUnitScope inScope) { return NULL; }
-
+
/*! @method GlobalScope */
AUScope & GlobalScope() { return mScopes[kAudioUnitScope_Global]; }
/*! @method Inputs */
@@ -527,7 +527,7 @@ public:
#endif
/*! @method Globals */
AUElement * Globals() { return mScopes[kAudioUnitScope_Global].GetElement(0); }
-
+
/*! @method SetNumberOfElements */
void SetNumberOfElements( AudioUnitScope inScope,
UInt32 numElements);
@@ -538,14 +538,14 @@ public:
{
return GetScope(inScope).GetElement(inElement);
}
-
+
/*! @method GetIOElement */
AUIOElement * GetIOElement( AudioUnitScope inScope,
AudioUnitElement inElement)
{
return GetScope(inScope).GetIOElement(inElement);
}
-
+
/*! @method SafeGetElement */
AUElement * SafeGetElement( AudioUnitScope inScope,
AudioUnitElement inElement)
@@ -558,13 +558,13 @@ public:
{
return static_cast<AUInputElement *>(Inputs().SafeGetElement(inElement));
}
-
+
/*! @method GetOutput */
AUOutputElement * GetOutput( AudioUnitElement inElement)
{
return static_cast<AUOutputElement *>(Outputs().SafeGetElement(inElement));
}
-
+
#if !CA_BASIC_AU_FEATURES
/*! @method GetGroup */
AUElement * GetGroup( AudioUnitElement inElement)
@@ -572,7 +572,7 @@ public:
return Groups().SafeGetElement(inElement);
}
#endif
-
+
/*! @method PullInput */
OSStatus PullInput( UInt32 inBusNumber,
AudioUnitRenderActionFlags &ioActionFlags,
@@ -589,7 +589,7 @@ public:
bool UsesFixedBlockSize() const { return mUsesFixedBlockSize; }
/*! @method SetUsesFixedBlockSize */
void SetUsesFixedBlockSize(bool inUsesFixedBlockSize) { mUsesFixedBlockSize = inUsesFixedBlockSize; }
-
+
/*! @method GetVectorUnitType */
static SInt32 GetVectorUnitType() { return sVectorUnitType; }
/*! @method HasVectorUnit */
@@ -600,12 +600,12 @@ public:
static bool HasSSE2() { return sVectorUnitType >= kVecSSE2; }
/*! @method HasSSE3 */
static bool HasSSE3() { return sVectorUnitType >= kVecSSE3; }
-
+
/*! @method AudioUnitAPIVersion */
UInt8 AudioUnitAPIVersion() const { return mAudioUnitAPIVersion; }
-
+
/*! @method IsRenderThread */
- bool InRenderThread () const
+ bool InRenderThread () const
{
#if TARGET_OS_MAC
return (mRenderThreadID ? pthread_equal (mRenderThreadID, pthread_self()) : false);
@@ -623,7 +623,7 @@ public:
/*! @method PropertyChanged */
virtual void PropertyChanged( AudioUnitPropertyID inID,
- AudioUnitScope inScope,
+ AudioUnitScope inScope,
AudioUnitElement inElement);
#if !CA_NO_AU_UI_FEATURES
@@ -634,12 +634,12 @@ public:
// as this can save work in the host.
/*! @method CallHostBeatAndTempo */
- OSStatus CallHostBeatAndTempo (Float64 *outCurrentBeat,
+ OSStatus CallHostBeatAndTempo (Float64 *outCurrentBeat,
Float64 *outCurrentTempo)
{
- return (mHostCallbackInfo.beatAndTempoProc
- ? (*mHostCallbackInfo.beatAndTempoProc) (mHostCallbackInfo.hostUserData,
- outCurrentBeat,
+ return (mHostCallbackInfo.beatAndTempoProc
+ ? (*mHostCallbackInfo.beatAndTempoProc) (mHostCallbackInfo.hostUserData,
+ outCurrentBeat,
outCurrentTempo)
: -1);
}
@@ -650,14 +650,14 @@ public:
UInt32 *outTimeSig_Denominator,
Float64 *outCurrentMeasureDownBeat)
{
- return (mHostCallbackInfo.musicalTimeLocationProc
+ return (mHostCallbackInfo.musicalTimeLocationProc
? (*mHostCallbackInfo.musicalTimeLocationProc) (mHostCallbackInfo.hostUserData,
outDeltaSampleOffsetToNextBeat,
outTimeSig_Numerator,
outTimeSig_Denominator,
outCurrentMeasureDownBeat)
: -1);
- }
+ }
/*! @method CallHostTransportState */
OSStatus CallHostTransportState (Boolean *outIsPlaying,
@@ -667,7 +667,7 @@ public:
Float64 *outCycleStartBeat,
Float64 *outCycleEndBeat)
{
- return (mHostCallbackInfo.transportStateProc
+ return (mHostCallbackInfo.transportStateProc
? (*mHostCallbackInfo.transportStateProc) (mHostCallbackInfo.hostUserData,
outIsPlaying,
outTransportStateChanged,
@@ -680,7 +680,7 @@ public:
#endif
char* GetLoggingString () const;
-
+
CAMutex* GetMutex() { return mAUMutex; }
// ________________________________________________________________________
@@ -698,7 +698,7 @@ public:
virtual OSStatus Start() { return kAudio_UnimplementedError; }
/*! @method Stop */
virtual OSStatus Stop() { return kAudio_UnimplementedError; }
-
+
#if !CA_BASIC_AU_FEATURES
#pragma mark -
#pragma mark AU Music Base Dispatch
@@ -711,38 +711,38 @@ public:
/*! @method PrepareInstrument */
virtual OSStatus ReleaseInstrument(MusicDeviceInstrumentID inInstrument) { return kAudio_UnimplementedError; }
#endif
-
+
// ________________________________________________________________________
// ________________________________________________________________________
// ________________________________________________________________________
// music device/music effect methods -- incomplete
/*! @method MIDIEvent */
- virtual OSStatus MIDIEvent( UInt32 inStatus,
- UInt32 inData1,
- UInt32 inData2,
+ virtual OSStatus MIDIEvent( UInt32 inStatus,
+ UInt32 inData1,
+ UInt32 inData2,
UInt32 inOffsetSampleFrame) { return kAudio_UnimplementedError; }
/*! @method SysEx */
- virtual OSStatus SysEx( const UInt8 * inData,
+ virtual OSStatus SysEx( const UInt8 * inData,
UInt32 inLength) { return kAudio_UnimplementedError;}
-
+
/*! @method StartNote */
- virtual OSStatus StartNote( MusicDeviceInstrumentID inInstrument,
- MusicDeviceGroupID inGroupID,
- NoteInstanceID * outNoteInstanceID,
- UInt32 inOffsetSampleFrame,
+ virtual OSStatus StartNote( MusicDeviceInstrumentID inInstrument,
+ MusicDeviceGroupID inGroupID,
+ NoteInstanceID * outNoteInstanceID,
+ UInt32 inOffsetSampleFrame,
const MusicDeviceNoteParams &inParams) { return kAudio_UnimplementedError; }
/*! @method StopNote */
- virtual OSStatus StopNote( MusicDeviceGroupID inGroupID,
- NoteInstanceID inNoteInstanceID,
+ virtual OSStatus StopNote( MusicDeviceGroupID inGroupID,
+ NoteInstanceID inNoteInstanceID,
UInt32 inOffsetSampleFrame) { return kAudio_UnimplementedError; }
#endif
// ________________________________________________________________________
// ________________________________________________________________________
// ________________________________________________________________________
-
+
protected:
#pragma mark -
#pragma mark Implementation methods
@@ -751,7 +751,7 @@ protected:
virtual void ReallocateBuffers();
// needs to be called when mMaxFramesPerSlice changes
virtual void DeallocateIOBuffers();
-
+
/*! @method FillInParameterName */
static void FillInParameterName (AudioUnitParameterInfo& ioInfo, CFStringRef inName, bool inShouldRelease)
{
@@ -761,25 +761,25 @@ protected:
ioInfo.flags |= kAudioUnitParameterFlag_CFNameRelease;
CFStringGetCString (inName, ioInfo.name, offsetof (AudioUnitParameterInfo, clumpID), kCFStringEncodingUTF8);
}
-
- static void HasClump (AudioUnitParameterInfo& ioInfo, UInt32 inClumpID)
+
+ static void HasClump (AudioUnitParameterInfo& ioInfo, UInt32 inClumpID)
{
ioInfo.clumpID = inClumpID;
ioInfo.flags |= kAudioUnitParameterFlag_HasClump;
}
-
+
/*! @method SetMaxFramesPerSlice */
virtual void SetMaxFramesPerSlice(UInt32 nFrames);
/*! @method CanSetMaxFrames */
virtual OSStatus CanSetMaxFrames() const;
-
+
/*! @method WantsRenderThreadID */
bool WantsRenderThreadID () const { return mWantsRenderThreadID; }
-
+
/*! @method SetWantsRenderThreadID */
void SetWantsRenderThreadID (bool inFlag);
-
+
/*! @method SetRenderError */
OSStatus SetRenderError (OSStatus inErr)
{
@@ -789,7 +789,7 @@ protected:
}
return inErr;
}
-
+
private:
/*! @method DoRenderBus */
// shared between Render and RenderSlice, inlined to minimize function call overhead
@@ -829,13 +829,13 @@ private:
memset (&mCurrentRenderTime, 0, sizeof(mCurrentRenderTime));
mCurrentRenderTime.mSampleTime = kNoLastRenderedSampleTime;
}
-
+
protected:
/*! @method GetAudioChannelLayout */
virtual UInt32 GetChannelLayoutTags( AudioUnitScope scope,
AudioUnitElement element,
AudioChannelLayoutTag * outLayoutTags);
-
+
/*! @method GetAudioChannelLayout */
virtual UInt32 GetAudioChannelLayout( AudioUnitScope scope,
AudioUnitElement element,
@@ -843,13 +843,13 @@ protected:
Boolean & outWritable);
/*! @method SetAudioChannelLayout */
- virtual OSStatus SetAudioChannelLayout( AudioUnitScope scope,
+ virtual OSStatus SetAudioChannelLayout( AudioUnitScope scope,
AudioUnitElement element,
const AudioChannelLayout * inLayout);
/*! @method RemoveAudioChannelLayout */
virtual OSStatus RemoveAudioChannelLayout(AudioUnitScope scope, AudioUnitElement element);
-
+
/*! @method NeedsToRender */
bool NeedsToRender( const AudioTimeStamp & inTimeStamp)
{
@@ -858,7 +858,7 @@ protected:
mCurrentRenderTime = inTimeStamp;
return needsToRender;
}
-
+
// Scheduled parameter implementation:
typedef std::vector<AudioUnitParameterEvent> ParameterEventList;
@@ -869,14 +869,14 @@ protected:
// for which the DSP code depends. ProcessForScheduledParams() will call (potentially repeatedly)
// virtual method ProcessScheduledSlice() to perform the actual DSP for a given sub-division of
// the buffer. The job of ProcessForScheduledParams() is to sub-divide the buffer into smaller
- // pieces according to the scheduled times found in the ParameterEventList (usually coming
+ // pieces according to the scheduled times found in the ParameterEventList (usually coming
// directly from a previous call to ScheduleParameter() ), setting the appropriate immediate or
// ramped parameter values for the corresponding scopes and elements, then calling ProcessScheduledSlice()
// to do the actual DSP for each of these divisions.
virtual OSStatus ProcessForScheduledParams( ParameterEventList &inParamList,
UInt32 inFramesToProcess,
void *inUserData );
-
+
// This method is called (potentially repeatedly) by ProcessForScheduledParams()
// in order to perform the actual DSP required for this portion of the entire buffer
// being processed. The entire buffer can be divided up into smaller "slices"
@@ -889,11 +889,11 @@ protected:
UInt32 inStartFrameInBuffer,
UInt32 inSliceFramesToProcess,
UInt32 inTotalBufferFrames ) {return noErr;}; // default impl does nothing...
-
-
+
+
/*! @method CurrentRenderTime */
const AudioTimeStamp & CurrentRenderTime () const { return mCurrentRenderTime; }
-
+
// ________________________________________________________________________
// Private data members to discourage hacking in subclasses
private:
@@ -902,23 +902,23 @@ private:
mRenderNotify(proc),
mRenderNotifyRefCon(ref)
{ }
-
+
AURenderCallback mRenderNotify;
void * mRenderNotifyRefCon;
-
+
bool operator == (const RenderCallback &other) {
return this->mRenderNotify == other.mRenderNotify &&
this->mRenderNotifyRefCon == other.mRenderNotifyRefCon;
}
};
typedef TThreadSafeList<RenderCallback> RenderCallbackList;
-
+
#if !CA_BASIC_AU_FEATURES
enum { kNumScopes = 4 };
#else
enum { kNumScopes = 3 };
#endif
-
+
/*! @var mElementsCreated */
bool mElementsCreated;
protected:
@@ -929,7 +929,7 @@ protected:
private:
/*! @var mAudioUnitAPIVersion */
UInt8 mAudioUnitAPIVersion;
-
+
/*! @var mInitNumInputEls */
const UInt32 mInitNumInputEls;
/*! @var mInitNumOutputEls */
@@ -940,36 +940,36 @@ private:
#endif
/*! @var mScopes */
AUScope mScopes[kNumScopes];
-
+
/*! @var mRenderCallbacks */
RenderCallbackList mRenderCallbacks;
bool mRenderCallbacksTouched;
-
+
/*! @var mRenderThreadID */
#if TARGET_OS_MAC
pthread_t mRenderThreadID;
#elif TARGET_OS_WIN32
UInt32 mRenderThreadID;
#endif
-
+
/*! @var mWantsRenderThreadID */
bool mWantsRenderThreadID;
-
+
/*! @var mCurrentRenderTime */
AudioTimeStamp mCurrentRenderTime;
-
+
/*! @var mMaxFramesPerSlice */
UInt32 mMaxFramesPerSlice;
-
+
/*! @var mLastRenderError */
OSStatus mLastRenderError;
/*! @var mCurrentPreset */
AUPreset mCurrentPreset;
-
+
protected:
/*! @var mUsesFixedBlockSize */
bool mUsesFixedBlockSize;
-
+
struct PropertyListener {
AudioUnitPropertyID propertyID;
AudioUnitPropertyListenerProc listenerProc;
@@ -981,10 +981,10 @@ protected:
ParameterEventList mParamList;
/*! @var mPropertyListeners */
PropertyListeners mPropertyListeners;
-
+
/*! @var mBuffersAllocated */
bool mBuffersAllocated;
-
+
/*! @var mLogString */
// if this is NOT null, it will contain identifying info about this AU.
char* mLogString;
@@ -1012,7 +1012,7 @@ protected:
#endif
};
-inline OSStatus AUInputElement::PullInputWithBufferList(
+inline OSStatus AUInputElement::PullInputWithBufferList(
AudioUnitRenderActionFlags & ioActionFlags,
const AudioTimeStamp & inTimeStamp,
AudioUnitElement inElement,
@@ -1020,7 +1020,7 @@ inline OSStatus AUInputElement::PullInputWithBufferList(
AudioBufferList * inBufferList)
{
OSStatus theResult;
-
+
if (HasConnection()) {
// only support connections for V2 audio units
#if !CA_USE_AUDIO_PLUGIN_ONLY
@@ -1036,7 +1036,7 @@ inline OSStatus AUInputElement::PullInputWithBufferList(
theResult = (mInputProc)(
mInputProcRefCon, &ioActionFlags, &inTimeStamp, inElement, nFrames, inBufferList);
}
-
+
if (mInputType == kNoInput) // defense: the guy upstream could have disconnected
// it's a horrible thing to do, but may happen!
return kAudioUnitErr_NoConnection;
diff --git a/libs/appleutility/CoreAudio/AudioUnits/AUPublic/AUBase/AUDispatch.cpp b/libs/appleutility/CoreAudio/AudioUnits/AUPublic/AUBase/AUDispatch.cpp
index 1f0f01c7d5..ed27327050 100644
--- a/libs/appleutility/CoreAudio/AudioUnits/AUPublic/AUBase/AUDispatch.cpp
+++ b/libs/appleutility/CoreAudio/AudioUnits/AUPublic/AUBase/AUDispatch.cpp
@@ -2,14 +2,14 @@
File: AUDispatch.cpp
Abstract: AUDispatch.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 "AUBase.h"
#include "CAXException.h"
@@ -101,19 +101,19 @@ OSStatus AUBase::ComponentEntryDispatch(ComponentParameters *params, AUBase *Th
case kAudioUnitRenderSelect:
result = (This->AudioUnitAPIVersion() > 1);
break;
-
+
default:
return ComponentBase::ComponentEntryDispatch(params, This);
}
break;
-
+
case kAudioUnitInitializeSelect:
{
CAMutex::Locker lock2(This->GetMutex());
result = This->DoInitialize();
}
break;
-
+
case kAudioUnitUninitializeSelect:
{
CAMutex::Locker lock2(This->GetMutex());
@@ -136,7 +136,7 @@ OSStatus AUBase::ComponentEntryDispatch(ComponentParameters *params, AUBase *Th
// always assume they're non-null
UInt32 dataSize;
Boolean writable;
-
+
result = This->DispatchGetPropertyInfo(pinID, pinScope, pinElement, dataSize, writable);
if (poutDataSize != NULL)
*poutDataSize = dataSize;
@@ -158,7 +158,7 @@ OSStatus AUBase::ComponentEntryDispatch(ComponentParameters *params, AUBase *Th
Boolean writable;
char *tempBuffer;
void *destBuffer;
-
+
if (pioDataSize == NULL) {
ca_debug_string("AudioUnitGetProperty: null size pointer");
result = kAudio_ParamError;
@@ -166,12 +166,12 @@ OSStatus AUBase::ComponentEntryDispatch(ComponentParameters *params, AUBase *Th
}
if (poutData == NULL) {
UInt32 dataSize;
-
+
result = This->DispatchGetPropertyInfo(pinID, pinScope, pinElement, dataSize, writable);
*pioDataSize = dataSize;
goto finishGetProperty;
}
-
+
clientBufferSize = *pioDataSize;
if (clientBufferSize == 0)
{
@@ -180,13 +180,13 @@ OSStatus AUBase::ComponentEntryDispatch(ComponentParameters *params, AUBase *Th
result = kAudio_ParamError;
goto finishGetProperty;
}
-
- result = This->DispatchGetPropertyInfo(pinID, pinScope, pinElement,
+
+ result = This->DispatchGetPropertyInfo(pinID, pinScope, pinElement,
actualPropertySize, writable);
- if (result)
+ if (result)
goto finishGetProperty;
-
- if (clientBufferSize < actualPropertySize)
+
+ if (clientBufferSize < actualPropertySize)
{
tempBuffer = new char[actualPropertySize];
destBuffer = tempBuffer;
@@ -194,9 +194,9 @@ OSStatus AUBase::ComponentEntryDispatch(ComponentParameters *params, AUBase *Th
tempBuffer = NULL;
destBuffer = poutData;
}
-
+
result = This->DispatchGetProperty(pinID, pinScope, pinElement, destBuffer);
-
+
if (result == noErr) {
if (clientBufferSize < actualPropertySize && tempBuffer != NULL)
{
@@ -213,7 +213,7 @@ OSStatus AUBase::ComponentEntryDispatch(ComponentParameters *params, AUBase *Th
}
break;
-
+
case kAudioUnitSetPropertySelect:
{
CAMutex::Locker lock(This->GetMutex());
@@ -222,7 +222,7 @@ OSStatus AUBase::ComponentEntryDispatch(ComponentParameters *params, AUBase *Th
PARAM(AudioUnitElement, pinElement, 2, 5);
PARAM(const void *, pinData, 3, 5);
PARAM(UInt32, pinDataSize, 4, 5);
-
+
if (pinData && pinDataSize)
result = This->DispatchSetProperty(pinID, pinScope, pinElement, pinData, pinDataSize);
else {
@@ -247,7 +247,7 @@ OSStatus AUBase::ComponentEntryDispatch(ComponentParameters *params, AUBase *Th
}
break;
-
+
case kAudioUnitAddPropertyListenerSelect:
{
CAMutex::Locker lock(This->GetMutex());
@@ -278,7 +278,7 @@ OSStatus AUBase::ComponentEntryDispatch(ComponentParameters *params, AUBase *Th
result = This->RemovePropertyListener(pinID, pinProc, pinProcRefCon, true);
}
break;
-
+
case kAudioUnitAddRenderNotifySelect:
{
CAMutex::Locker lock(This->GetMutex());
@@ -344,7 +344,7 @@ OSStatus AUBase::ComponentEntryDispatch(ComponentParameters *params, AUBase *Th
PARAM(UInt32, pinNumberFrames, 3, 5);
PARAM(AudioBufferList *, pioData, 4, 5);
AudioUnitRenderActionFlags tempFlags;
-
+
if (pinTimeStamp == NULL || pioData == NULL)
result = kAudio_ParamError;
else {
@@ -354,7 +354,7 @@ OSStatus AUBase::ComponentEntryDispatch(ComponentParameters *params, AUBase *Th
}
result = This->DoRender(*pinActionFlags, *pinTimeStamp, pinOutputBusNumber, pinNumberFrames, *pioData);
}
- }
+ }
}
break;
@@ -385,13 +385,13 @@ OSStatus CMgr_AudioUnitBaseGetParameter( AUBase * This,
float *outValue)
{
OSStatus result = AUBase::noErr;
-
+
try {
if (This == NULL || outValue == NULL) return kAudio_ParamError;
result = This->GetParameter(inID, inScope, inElement, *outValue);
}
COMPONENT_CATCH
-
+
return result;
}
@@ -403,13 +403,13 @@ OSStatus CMgr_AudioUnitBaseSetParameter( AUBase * This,
UInt32 inBufferOffset)
{
OSStatus result = AUBase::noErr;
-
+
try {
if (This == NULL) return kAudio_ParamError;
result = This->SetParameter(inID, inScope, inElement, inValue, inBufferOffset);
}
COMPONENT_CATCH
-
+
return result;
}
@@ -421,10 +421,10 @@ OSStatus CMgr_AudioUnitBaseRender( AUBase * This,
AudioBufferList * ioData)
{
if (inTimeStamp == NULL || ioData == NULL) return kAudio_ParamError;
-
+
OSStatus result = AUBase::noErr;
AudioUnitRenderActionFlags tempFlags;
-
+
try {
if (ioActionFlags == NULL) {
tempFlags = 0;
@@ -433,6 +433,6 @@ OSStatus CMgr_AudioUnitBaseRender( AUBase * This,
result = This->DoRender(*ioActionFlags, *inTimeStamp, inBusNumber, inNumberFrames, *ioData);
}
COMPONENT_CATCH
-
+
return result;
}
diff --git a/libs/appleutility/CoreAudio/AudioUnits/AUPublic/AUBase/AUDispatch.h b/libs/appleutility/CoreAudio/AudioUnits/AUPublic/AUBase/AUDispatch.h
index 5acd96250a..fcdc29e76e 100644
--- a/libs/appleutility/CoreAudio/AudioUnits/AUPublic/AUBase/AUDispatch.h
+++ b/libs/appleutility/CoreAudio/AudioUnits/AUPublic/AUBase/AUDispatch.h
@@ -2,14 +2,14 @@
File: AUDispatch.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 __AUDispatch_h__
#define __AUDispatch_h__
diff --git a/libs/appleutility/CoreAudio/AudioUnits/AUPublic/AUBase/AUInputElement.cpp b/libs/appleutility/CoreAudio/AudioUnits/AUPublic/AUBase/AUInputElement.cpp
index 2e148e8ba7..688e404bfe 100644
--- a/libs/appleutility/CoreAudio/AudioUnits/AUPublic/AUBase/AUInputElement.cpp
+++ b/libs/appleutility/CoreAudio/AudioUnits/AUPublic/AUBase/AUInputElement.cpp
@@ -2,14 +2,14 @@
File: AUInputElement.cpp
Abstract: AUInputElement.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 "AUBase.h"
@@ -76,8 +76,8 @@ void AUInputElement::SetConnection(const AudioUnitConnection &conn)
if (conn.sourceAudioUnit == 0) {
Disconnect();
return;
- }
-
+ }
+
mInputType = kFromConnection;
mConnection = conn;
AllocateBuffer();
@@ -136,16 +136,16 @@ OSStatus AUInputElement::PullInput( AudioUnitRenderActionFlags & ioActionFlag
const AudioTimeStamp & inTimeStamp,
AudioUnitElement inElement,
UInt32 nFrames)
-{
+{
if (!IsActive())
return kAudioUnitErr_NoConnection;
-
+
AudioBufferList *pullBuffer;
-
+
if (HasConnection() || !WillAllocateBuffer())
pullBuffer = &mIOBuffer.PrepareNullBuffer(mStreamFormat, nFrames);
else
pullBuffer = &mIOBuffer.PrepareBuffer(mStreamFormat, nFrames);
-
+
return PullInputWithBufferList (ioActionFlags, inTimeStamp, inElement, nFrames, pullBuffer);
}
diff --git a/libs/appleutility/CoreAudio/AudioUnits/AUPublic/AUBase/AUInputElement.h b/libs/appleutility/CoreAudio/AudioUnits/AUPublic/AUBase/AUInputElement.h
index 891e4c60b7..128efe5b16 100644
--- a/libs/appleutility/CoreAudio/AudioUnits/AUPublic/AUBase/AUInputElement.h
+++ b/libs/appleutility/CoreAudio/AudioUnits/AUPublic/AUBase/AUInputElement.h
@@ -2,14 +2,14 @@
File: AUInputElement.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 __AUInput_h__
#define __AUInput_h__
@@ -53,7 +53,7 @@
/*! @class AUInputElement */
class AUInputElement : public AUIOElement {
public:
-
+
/*! @ctor AUInputElement */
AUInputElement(AUBase *audioUnit);
/*! @dtor ~AUInputElement */
@@ -103,7 +103,7 @@ protected:
AURenderCallback mInputProc;
/*! @var mInputProcRefCon */
void * mInputProcRefCon;
-
+
// if from connection:
/*! @var mConnection */
AudioUnitConnection mConnection;
diff --git a/libs/appleutility/CoreAudio/AudioUnits/AUPublic/AUBase/AUOutputElement.cpp b/libs/appleutility/CoreAudio/AudioUnits/AUPublic/AUBase/AUOutputElement.cpp
index 5eb34a1c20..080fa63e56 100644
--- a/libs/appleutility/CoreAudio/AudioUnits/AUPublic/AUBase/AUOutputElement.cpp
+++ b/libs/appleutility/CoreAudio/AudioUnits/AUPublic/AUBase/AUOutputElement.cpp
@@ -2,14 +2,14 @@
File: AUOutputElement.cpp
Abstract: AUOutputElement.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,14 +40,14 @@
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 "AUOutputElement.h"
#include "AUBase.h"
-AUOutputElement::AUOutputElement(AUBase *audioUnit) :
+AUOutputElement::AUOutputElement(AUBase *audioUnit) :
AUIOElement(audioUnit)
{
AllocateBuffer();
diff --git a/libs/appleutility/CoreAudio/AudioUnits/AUPublic/AUBase/AUOutputElement.h b/libs/appleutility/CoreAudio/AudioUnits/AUPublic/AUBase/AUOutputElement.h
index 3e6a938fff..42ae842dcf 100644
--- a/libs/appleutility/CoreAudio/AudioUnits/AUPublic/AUBase/AUOutputElement.h
+++ b/libs/appleutility/CoreAudio/AudioUnits/AUPublic/AUBase/AUOutputElement.h
@@ -2,14 +2,14 @@
File: AUOutputElement.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 __AUOutput_h__
#define __AUOutput_h__
diff --git a/libs/appleutility/CoreAudio/AudioUnits/AUPublic/AUBase/AUPlugInDispatch.cpp b/libs/appleutility/CoreAudio/AudioUnits/AUPublic/AUBase/AUPlugInDispatch.cpp
index 3bab198369..c75d208718 100644
--- a/libs/appleutility/CoreAudio/AudioUnits/AUPublic/AUBase/AUPlugInDispatch.cpp
+++ b/libs/appleutility/CoreAudio/AudioUnits/AUPublic/AUBase/AUPlugInDispatch.cpp
@@ -2,14 +2,14 @@
File: AUPlugInDispatch.cpp
Abstract: AUPlugInDispatch.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 "AUPlugInDispatch.h"
#include "CAXException.h"
@@ -83,7 +83,7 @@ static OSStatus AUMethodGetPropertyInfo(void *self, AudioUnitPropertyID prop, Au
try {
UInt32 dataSize = 0; // 13517289 GetPropetyInfo was returning an uninitialized value when there is an error. This is a problem for auval.
Boolean writable = false;
-
+
AUI_LOCK
result = AUI->DispatchGetPropertyInfo(prop, scope, elem, dataSize, writable);
if (outDataSize != NULL)
@@ -103,7 +103,7 @@ static OSStatus AUMethodGetProperty(void *self, AudioUnitPropertyID inID, AudioU
Boolean writable;
char *tempBuffer;
void *destBuffer;
-
+
AUI_LOCK
if (ioDataSize == NULL) {
ca_debug_string("AudioUnitGetProperty: null size pointer");
@@ -112,12 +112,12 @@ static OSStatus AUMethodGetProperty(void *self, AudioUnitPropertyID inID, AudioU
}
if (outData == NULL) {
UInt32 dataSize;
-
+
result = AUI->DispatchGetPropertyInfo(inID, inScope, inElement, dataSize, writable);
*ioDataSize = dataSize;
goto finishGetProperty;
}
-
+
clientBufferSize = *ioDataSize;
if (clientBufferSize == 0)
{
@@ -126,12 +126,12 @@ static OSStatus AUMethodGetProperty(void *self, AudioUnitPropertyID inID, AudioU
result = kAudio_ParamError;
goto finishGetProperty;
}
-
+
result = AUI->DispatchGetPropertyInfo(inID, inScope, inElement, actualPropertySize, writable);
- if (result != noErr)
+ if (result != noErr)
goto finishGetProperty;
-
- if (clientBufferSize < actualPropertySize)
+
+ if (clientBufferSize < actualPropertySize)
{
tempBuffer = new char[actualPropertySize];
destBuffer = tempBuffer;
@@ -139,9 +139,9 @@ static OSStatus AUMethodGetProperty(void *self, AudioUnitPropertyID inID, AudioU
tempBuffer = NULL;
destBuffer = outData;
}
-
+
result = AUI->DispatchGetProperty(inID, inScope, inElement, destBuffer);
-
+
if (result == noErr) {
if (clientBufferSize < actualPropertySize && tempBuffer != NULL)
{
@@ -285,7 +285,7 @@ static OSStatus AUMethodRender(void *self, AudioUnitRenderActionFlags *ioActionF
#endif
// this is a processing method; no lock
AudioUnitRenderActionFlags tempFlags;
-
+
if (inTimeStamp == NULL || ioData == NULL)
result = kAudio_ParamError;
else {
@@ -313,7 +313,7 @@ static OSStatus AUMethodComplexRender(void *self, AudioUnitRenderActionFlags *io
#endif
// this is a processing method; no lock
AudioUnitRenderActionFlags tempFlags;
-
+
if (inTimeStamp == NULL || ioData == NULL)
result = kAudio_ParamError;
else {
@@ -362,7 +362,7 @@ static OSStatus AUMethodProcess (void *self, AudioUnitRenderActionFlags *ioActio
if (*ioActionFlags & (1 << 9)/*kAudioUnitRenderAction_DoNotCheckRenderArgs*/)
doParamCheck = false;
}
-
+
if (doParamCheck && (inTimeStamp == NULL || ioData == NULL))
result = kAudio_ParamError;
else {
@@ -380,15 +380,15 @@ static OSStatus AUMethodProcess (void *self, AudioUnitRenderActionFlags *ioActio
static OSStatus AUMethodProcessMultiple (void *self, AudioUnitRenderActionFlags *ioActionFlags, const AudioTimeStamp *inTimeStamp, UInt32 inNumberFrames, UInt32 inNumberInputBufferLists, const AudioBufferList **inInputBufferLists, UInt32 inNumberOutputBufferLists, AudioBufferList **ioOutputBufferLists)
{
OSStatus result = noErr;
-
+
#if !TARGET_OS_IPHONE
try {
#endif
// this is a processing method; no lock
bool doParamCheck = true;
-
+
AudioUnitRenderActionFlags tempFlags;
-
+
if (ioActionFlags == NULL) {
tempFlags = 0;
ioActionFlags = &tempFlags;
@@ -402,7 +402,7 @@ static OSStatus AUMethodProcessMultiple (void *self, AudioUnitRenderActionFlags
else {
result = AUI->DoProcessMultiple(*ioActionFlags, *inTimeStamp, inNumberFrames, inNumberInputBufferLists, inInputBufferLists, inNumberOutputBufferLists, ioOutputBufferLists);
}
-
+
#if !TARGET_OS_IPHONE
}
COMPONENT_CATCH
@@ -465,7 +465,7 @@ static OSStatus AUMethodStartNote(void *self, MusicDeviceInstrumentID inInstrume
OSStatus result = noErr;
try {
// this is a potential render-time method; no lock
- if (inParams == NULL || outNoteInstanceID == NULL)
+ if (inParams == NULL || outNoteInstanceID == NULL)
result = kAudio_ParamError;
else
result = AUI->StartNote(inInstrument, inGroupID, outNoteInstanceID, inOffsetSampleFrame, *inParams);
@@ -559,10 +559,10 @@ AudioComponentMethod AUComplexOutputLookup::Lookup (SInt16 selector)
{
AudioComponentMethod method = AUBaseLookup::Lookup(selector);
if (method) return method;
-
+
method = AUOutputLookup::Lookup(selector);
if (method) return method;
-
+
if (selector == kAudioUnitComplexRenderSelect)
return (AudioComponentMethod)AUMethodComplexRender;
return NULL;
@@ -572,10 +572,10 @@ AudioComponentMethod AUBaseProcessLookup::Lookup (SInt16 selector)
{
AudioComponentMethod method = AUBaseLookup::Lookup(selector);
if (method) return method;
-
+
if (selector == kAudioUnitProcessSelect)
return (AudioComponentMethod)AUMethodProcess;
-
+
return NULL;
}
@@ -583,10 +583,10 @@ AudioComponentMethod AUBaseProcessMultipleLookup::Lookup (SInt16 selector)
{
AudioComponentMethod method = AUBaseLookup::Lookup(selector);
if (method) return method;
-
+
if (selector == kAudioUnitProcessMultipleSelect)
return (AudioComponentMethod)AUMethodProcessMultiple;
-
+
return NULL;
}
@@ -597,7 +597,7 @@ AudioComponentMethod AUBaseProcessAndMultipleLookup::Lookup (SInt16 selector)
method = AUBaseProcessMultipleLookup::Lookup(selector);
if (method) return method;
-
+
method = AUBaseProcessLookup::Lookup(selector);
if (method) return method;
@@ -620,7 +620,7 @@ AudioComponentMethod AUMIDILookup::Lookup (SInt16 selector)
{
AudioComponentMethod method = AUBaseLookup::Lookup(selector);
if (method) return method;
-
+
return MIDI_Lookup(selector);
}
@@ -628,7 +628,7 @@ AudioComponentMethod AUMIDIProcessLookup::Lookup (SInt16 selector)
{
AudioComponentMethod method = AUBaseProcessLookup::Lookup(selector);
if (method) return method;
-
+
return MIDI_Lookup(selector);
}
@@ -644,7 +644,7 @@ AudioComponentMethod AUMusicLookup::Lookup (SInt16 selector)
case kMusicDevicePrepareInstrumentSelect: return (AudioComponentMethod)AUMethodPrepareInstrument;
case kMusicDeviceReleaseInstrumentSelect: return (AudioComponentMethod)AUMethodReleaseInstrument;
#endif
- default:
+ default:
break;
}
return MIDI_Lookup (selector);
@@ -656,10 +656,10 @@ AudioComponentMethod AUAuxBaseLookup::Lookup (SInt16 selector)
case kAudioUnitGetPropertyInfoSelect: return (AudioComponentMethod)AUMethodGetPropertyInfo;
case kAudioUnitGetPropertySelect: return (AudioComponentMethod)AUMethodGetProperty;
case kAudioUnitSetPropertySelect: return (AudioComponentMethod)AUMethodSetProperty;
-
+
case kAudioUnitGetParameterSelect: return (AudioComponentMethod)AUMethodGetParameter;
case kAudioUnitSetParameterSelect: return (AudioComponentMethod)AUMethodSetParameter;
-
+
default:
break;
}
diff --git a/libs/appleutility/CoreAudio/AudioUnits/AUPublic/AUBase/AUPlugInDispatch.h b/libs/appleutility/CoreAudio/AudioUnits/AUPublic/AUBase/AUPlugInDispatch.h
index 6ebea75fd6..1ce471b399 100644
--- a/libs/appleutility/CoreAudio/AudioUnits/AUPublic/AUBase/AUPlugInDispatch.h
+++ b/libs/appleutility/CoreAudio/AudioUnits/AUPublic/AUBase/AUPlugInDispatch.h
@@ -2,14 +2,14 @@
File: AUPlugInDispatch.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 __AUPlugInBase_h__
#define __AUPlugInBase_h__
diff --git a/libs/appleutility/CoreAudio/AudioUnits/AUPublic/AUBase/AUScopeElement.cpp b/libs/appleutility/CoreAudio/AudioUnits/AUPublic/AUBase/AUScopeElement.cpp
index 24bd18e434..99d359ff8c 100644
--- a/libs/appleutility/CoreAudio/AudioUnits/AUPublic/AUBase/AUScopeElement.cpp
+++ b/libs/appleutility/CoreAudio/AudioUnits/AUPublic/AUBase/AUScopeElement.cpp
@@ -2,14 +2,14 @@
File: AUScopeElement.cpp
Abstract: AUScopeElement.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 "AUScopeElement.h"
#include "AUBase.h"
@@ -57,7 +57,7 @@
//
void AUElement::UseIndexedParameters(int inNumberOfParameters)
{
- mIndexedParameters.resize (inNumberOfParameters);
+ mIndexedParameters.resize (inNumberOfParameters);
mUseIndexedParameters = true;
}
@@ -69,12 +69,12 @@ void AUElement::UseIndexedParameters(int inNumberOfParameters)
inline ParameterMapEvent& AUElement::GetParamEvent(AudioUnitParameterID paramID)
{
ParameterMapEvent *event;
-
+
if(mUseIndexedParameters)
{
if(paramID >= mIndexedParameters.size() )
COMPONENT_THROW(kAudioUnitErr_InvalidParameter);
-
+
event = &mIndexedParameters[paramID];
}
else
@@ -82,10 +82,10 @@ inline ParameterMapEvent& AUElement::GetParamEvent(AudioUnitParameterID paramID)
ParameterMap::iterator i = mParameters.find(paramID);
if (i == mParameters.end())
COMPONENT_THROW(kAudioUnitErr_InvalidParameter);
-
+
event = &(*i).second;
}
-
+
return *event;
}
@@ -95,19 +95,19 @@ inline ParameterMapEvent& AUElement::GetParamEvent(AudioUnitParameterID paramID)
// returns whether the specified paramID is known to the element
//
bool AUElement::HasParameterID (AudioUnitParameterID paramID) const
-{
+{
if(mUseIndexedParameters)
{
if(paramID >= mIndexedParameters.size() )
return false;
-
+
return true;
}
-
+
ParameterMap::const_iterator i = mParameters.find(paramID);
if (i == mParameters.end())
return false;
-
+
return true;
}
@@ -118,7 +118,7 @@ bool AUElement::HasParameterID (AudioUnitParameterID paramID) const
AudioUnitParameterValue AUElement::GetParameter(AudioUnitParameterID paramID)
{
ParameterMapEvent &event = GetParamEvent(paramID);
-
+
return event.GetValue();
}
@@ -132,7 +132,7 @@ void AUElement::GetRampSliceStartEnd( AudioUnitParameterID paramID,
{
ParameterMapEvent &event = GetParamEvent(paramID);
-
+
// works even if the value is constant (immediate parameter value)
event.GetRampSliceStartEnd(outStartValue, outEndValue, outValuePerFrameDelta );
}
@@ -143,7 +143,7 @@ AudioUnitParameterValue AUElement::GetEndValue( AudioUnitParameterID paramID)
{
ParameterMapEvent &event = GetParamEvent(paramID);
-
+
// works even if the value is constant (immediate parameter value)
return event.GetEndValue();
}
@@ -160,21 +160,21 @@ void AUElement::SetParameter(AudioUnitParameterID paramID, AudioUnitParameterV
else
{
ParameterMap::iterator i = mParameters.find(paramID);
-
+
if (i == mParameters.end())
{
if (mAudioUnit->IsInitialized() && !okWhenInitialized) {
// The AU should not be creating new parameters once initialized.
- // If a client tries to set an undefined parameter, we could throw as follows,
+ // If a client tries to set an undefined parameter, we could throw as follows,
// but this might cause a regression. So it is better to just fail silently.
// COMPONENT_THROW(kAudioUnitErr_InvalidParameter);
#if DEBUG
- fprintf(stderr, "WARNING: %s SetParameter for undefined param ID %d while initialized. Ignoring..\n",
+ fprintf(stderr, "WARNING: %s SetParameter for undefined param ID %d while initialized. Ignoring..\n",
mAudioUnit->GetLoggingString(), (int)paramID);
#endif
} else {
// create new entry in map for the paramID (only happens first time)
- ParameterMapEvent event(inValue);
+ ParameterMapEvent event(inValue);
mParameters[paramID] = event;
}
}
@@ -203,21 +203,21 @@ void AUElement::SetScheduledEvent( AudioUnitParameterID paramID,
else
{
ParameterMap::iterator i = mParameters.find(paramID);
-
+
if (i == mParameters.end())
{
if (mAudioUnit->IsInitialized() && !okWhenInitialized) {
// The AU should not be creating new parameters once initialized.
- // If a client tries to set an undefined parameter, we could throw as follows,
+ // If a client tries to set an undefined parameter, we could throw as follows,
// but this might cause a regression. So it is better to just fail silently.
// COMPONENT_THROW(kAudioUnitErr_InvalidParameter);
#if DEBUG
- fprintf(stderr, "WARNING: %s SetScheduledEvent for undefined param ID %d while initialized. Ignoring..\n",
+ fprintf(stderr, "WARNING: %s SetScheduledEvent for undefined param ID %d while initialized. Ignoring..\n",
mAudioUnit->GetLoggingString(), (int)paramID);
#endif
} else {
// create new entry in map for the paramID (only happens first time)
- ParameterMapEvent event(inEvent, inSliceOffsetInBuffer, inSliceDurationFrames);
+ ParameterMapEvent event(inEvent, inSliceOffsetInBuffer, inSliceDurationFrames);
mParameters[paramID] = event;
}
}
@@ -225,7 +225,7 @@ void AUElement::SetScheduledEvent( AudioUnitParameterID paramID,
{
// paramID already exists in map so simply change its value
ParameterMapEvent &event = (*i).second;
-
+
event.SetScheduledEvent(inEvent, inSliceOffsetInBuffer, inSliceDurationFrames );
}
}
@@ -259,7 +259,7 @@ void AUElement::SaveState(CFMutableDataRef data)
UInt32 nparams = static_cast<UInt32>(mIndexedParameters.size());
UInt32 theData = CFSwapInt32HostToBig(nparams);
CFDataAppendBytes(data, (UInt8 *)&theData, sizeof(nparams));
-
+
for (UInt32 i = 0; i < nparams; i++)
{
struct {
@@ -267,12 +267,12 @@ void AUElement::SaveState(CFMutableDataRef data)
//CFSwappedFloat32 value; crashes gcc3 PFE
UInt32 value; // really a big-endian float
} entry;
-
+
entry.paramID = CFSwapInt32HostToBig(i);
-
+
AudioUnitParameterValue v = mIndexedParameters[i].GetValue();
entry.value = CFSwapInt32HostToBig(*(UInt32 *)&v );
-
+
CFDataAppendBytes(data, (UInt8 *)&entry, sizeof(entry));
}
}
@@ -280,19 +280,19 @@ void AUElement::SaveState(CFMutableDataRef data)
{
UInt32 nparams = CFSwapInt32HostToBig(static_cast<uint32_t>(mParameters.size()));
CFDataAppendBytes(data, (UInt8 *)&nparams, sizeof(nparams));
-
+
for (ParameterMap::iterator i = mParameters.begin(); i != mParameters.end(); ++i) {
struct {
UInt32 paramID;
//CFSwappedFloat32 value; crashes gcc3 PFE
UInt32 value; // really a big-endian float
} entry;
-
+
entry.paramID = CFSwapInt32HostToBig((*i).first);
-
+
AudioUnitParameterValue v = (*i).second.GetValue();
entry.value = CFSwapInt32HostToBig(*(UInt32 *)&v );
-
+
CFDataAppendBytes(data, (UInt8 *)&entry, sizeof(entry));
}
}
@@ -306,20 +306,20 @@ const UInt8 * AUElement::RestoreState(const UInt8 *state)
const UInt8 *p = state;
UInt32 nparams = CFSwapInt32BigToHost(*(UInt32 *)p);
p += sizeof(UInt32);
-
+
for (UInt32 i = 0; i < nparams; ++i) {
struct {
AudioUnitParameterID paramID;
AudioUnitParameterValue value;
} entry;
-
+
entry.paramID = CFSwapInt32BigToHost(*(UInt32 *)p);
p += sizeof(UInt32);
FloatInt32 temp;
temp.i = CFSwapInt32BigToHost(*(UInt32 *)p);
entry.value = temp.f;
p += sizeof(AudioUnitParameterValue);
-
+
SetParameter(entry.paramID, entry.value);
}
return p;
@@ -327,10 +327,10 @@ const UInt8 * AUElement::RestoreState(const UInt8 *state)
//_____________________________________________________________________________
//
-void AUElement::SetName (CFStringRef inName)
-{
+void AUElement::SetName (CFStringRef inName)
+{
if (mElementName) CFRelease (mElementName);
- mElementName = inName;
+ mElementName = inName;
if (mElementName) CFRetain (mElementName);
}
@@ -362,9 +362,9 @@ void AUIOElement::AllocateBuffer(UInt32 inFramesToAllocate)
if (GetAudioUnit()->HasBegunInitializing())
{
UInt32 framesToAllocate = inFramesToAllocate > 0 ? inFramesToAllocate : GetAudioUnit()->GetMaxFramesPerSlice();
-
+
// printf ("will allocate: %d\n", (int)((mWillAllocate && NeedsBufferSpace()) ? framesToAllocate : 0));
-
+
mIOBuffer.Allocate(mStreamFormat, (mWillAllocate && NeedsBufferSpace()) ? framesToAllocate : 0);
}
}
@@ -381,21 +381,21 @@ void AUIOElement::DeallocateBuffer()
// AudioChannelLayout support
// outLayoutTagsPtr WILL be NULL if called to find out how many
-// layouts that Audio Unit will report
+// layouts that Audio Unit will report
// return 0 (ie. NO channel layouts) if the AU doesn't require channel layout knowledge
UInt32 AUIOElement::GetChannelLayoutTags (AudioChannelLayoutTag *outLayoutTagsPtr)
{
return 0;
}
-
-// As the AudioChannelLayout can be a variable length structure
+
+// As the AudioChannelLayout can be a variable length structure
// (though in most cases it won't be!!!)
// The size of the ACL is always returned by the method
-// if outMapPtr is NOT-NULL, then AU should copy into this pointer (outMapPtr) the current ACL that it has in use.
+// if outMapPtr is NOT-NULL, then AU should copy into this pointer (outMapPtr) the current ACL that it has in use.
// the AU should also return whether the property is writable (that is the client can provide any arbitrary ACL that the audio unit will then honour)
// or if the property is read only - which is the generally preferred mode.
// If the AU doesn't require an AudioChannelLayout, then just return 0.
-UInt32 AUIOElement::GetAudioChannelLayout (AudioChannelLayout *outMapPtr,
+UInt32 AUIOElement::GetAudioChannelLayout (AudioChannelLayout *outMapPtr,
Boolean &outWritable)
{
return 0;
@@ -500,7 +500,7 @@ bool AUScope::RestoreElementNames (CFDictionaryRef& inNameDict)
//first we have to see if we have enough elements
bool didAddElements = false;
unsigned int maxElNum = GetNumberOfElements();
-
+
int dictSize = static_cast<int>(CFDictionaryGetCount(inNameDict));
CFStringRef * keys = (CFStringRef*)CA_malloc (dictSize * sizeof (CFStringRef));
CFDictionaryGetKeysAndValues (inNameDict, reinterpret_cast<const void**>(keys), NULL);
@@ -519,7 +519,7 @@ bool AUScope::RestoreElementNames (CFDictionaryRef& inNameDict)
}
}
free (keys);
-
+
return didAddElements;
}
@@ -534,11 +534,11 @@ void AUScope::SaveState(CFMutableDataRef data)
UInt32 scope;
UInt32 element;
} hdr;
-
+
hdr.scope = CFSwapInt32HostToBig(GetScope());
hdr.element = CFSwapInt32HostToBig(ielem);
CFDataAppendBytes(data, (UInt8 *)&hdr, sizeof(hdr));
-
+
element->SaveState(data);
}
}
@@ -556,10 +556,10 @@ const UInt8 * AUScope::RestoreState(const UInt8 *state)
} entry;
UInt32 nparams = CFSwapInt32BigToHost(*(UInt32 *)p);
p += sizeof(UInt32);
-
+
p += nparams * sizeof(entry);
} else
p = element->RestoreState(p);
-
+
return p;
}
diff --git a/libs/appleutility/CoreAudio/AudioUnits/AUPublic/AUBase/AUScopeElement.h b/libs/appleutility/CoreAudio/AudioUnits/AUPublic/AUBase/AUScopeElement.h
index 47ebe2f338..ae493f217b 100644
--- a/libs/appleutility/CoreAudio/AudioUnits/AUPublic/AUBase/AUScopeElement.h
+++ b/libs/appleutility/CoreAudio/AudioUnits/AUPublic/AUBase/AUScopeElement.h
@@ -2,14 +2,14 @@
File: AUScopeElement.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 __AUScopeElement_h__
#define __AUScopeElement_h__
@@ -69,15 +69,15 @@ class ParameterMapEvent
{
public:
/*! @ctor ParameterMapEvent */
- ParameterMapEvent()
- : mEventType(kParameterEvent_Immediate), mBufferOffset(0), mDurationInFrames(0), mValue1(0.0f), mValue2(0.0f), mSliceDurationFrames(0)
+ ParameterMapEvent()
+ : mEventType(kParameterEvent_Immediate), mBufferOffset(0), mDurationInFrames(0), mValue1(0.0f), mValue2(0.0f), mSliceDurationFrames(0)
{}
/*! @ctor ParameterMapEvent */
ParameterMapEvent(AudioUnitParameterValue inValue)
- : mEventType(kParameterEvent_Immediate), mBufferOffset(0), mDurationInFrames(0), mValue1(inValue), mValue2(inValue), mSliceDurationFrames(0)
+ : mEventType(kParameterEvent_Immediate), mBufferOffset(0), mDurationInFrames(0), mValue1(inValue), mValue2(inValue), mSliceDurationFrames(0)
{}
-
+
// constructor for scheduled event
/*! @ctor ParameterMapEvent */
ParameterMapEvent( const AudioUnitParameterEvent &inEvent,
@@ -86,7 +86,7 @@ public:
{
SetScheduledEvent(inEvent, inSliceOffsetInBuffer, inSliceDurationFrames );
};
-
+
/*! @method SetScheduledEvent */
void SetScheduledEvent( const AudioUnitParameterEvent &inEvent,
UInt32 inSliceOffsetInBuffer,
@@ -94,7 +94,7 @@ public:
{
mEventType = inEvent.eventType;
mSliceDurationFrames = inSliceDurationFrames;
-
+
if(mEventType == kParameterEvent_Immediate )
{
// constant immediate value for the whole slice
@@ -111,9 +111,9 @@ public:
mValue2 = inEvent.eventValues.ramp.endValue;
}
};
-
-
-
+
+
+
/*! @method GetEventType */
AUParameterEventType GetEventType() const {return mEventType;};
@@ -122,13 +122,13 @@ public:
/*! @method GetEndValue */
AudioUnitParameterValue GetEndValue() const {return mValue2;}; // only valid if immediate event type
/*! @method SetValue */
- void SetValue(AudioUnitParameterValue inValue)
+ void SetValue(AudioUnitParameterValue inValue)
{
- mEventType = kParameterEvent_Immediate;
- mValue1 = inValue;
+ mEventType = kParameterEvent_Immediate;
+ mValue1 = inValue;
mValue2 = inValue;
}
-
+
// interpolates the start and end values corresponding to the current processing slice
// most ramp parameter implementations will want to use this method
// the start value will correspond to the start of the slice
@@ -140,7 +140,7 @@ public:
{
if (mEventType == kParameterEvent_Ramped) {
outValuePerFrameDelta = (mValue2 - mValue1) / mDurationInFrames;
-
+
outStartValue = mValue1 + outValuePerFrameDelta * (-mBufferOffset); // corresponds to frame 0 of this slice
outEndValue = outStartValue + outValuePerFrameDelta * mSliceDurationFrames;
} else {
@@ -178,15 +178,15 @@ public:
}
#endif
-private:
+private:
AUParameterEventType mEventType;
-
+
SInt32 mBufferOffset; // ramp start offset relative to start of this slice (may be negative)
UInt32 mDurationInFrames; // total duration of ramp parameter
AudioUnitParameterValue mValue1; // value if immediate : startValue if ramp
AudioUnitParameterValue mValue2; // endValue (only used for ramp)
-
- UInt32 mSliceDurationFrames; // duration of this processing slice
+
+ UInt32 mSliceDurationFrames; // duration of this processing slice
};
@@ -201,10 +201,10 @@ public:
/*! @ctor AUElement */
AUElement(AUBase *audioUnit) : mAudioUnit(audioUnit),
mUseIndexedParameters(false), mElementName(0) { }
-
+
/*! @dtor ~AUElement */
virtual ~AUElement() { if (mElementName) CFRelease (mElementName); }
-
+
/*! @method GetNumberOfParameters */
virtual UInt32 GetNumberOfParameters()
{
@@ -214,12 +214,12 @@ public:
virtual void GetParameterList(AudioUnitParameterID *outList);
/*! @method HasParameterID */
bool HasParameterID (AudioUnitParameterID paramID) const;
-
+
/*! @method GetParameter */
AudioUnitParameterValue GetParameter(AudioUnitParameterID paramID);
/*! @method SetParameter */
void SetParameter(AudioUnitParameterID paramID, AudioUnitParameterValue value, bool okWhenInitialized = false);
- // Only set okWhenInitialized to true when you know the outside world cannot access this element. Otherwise the parameter map could get corrupted.
+ // Only set okWhenInitialized to true when you know the outside world cannot access this element. Otherwise the parameter map could get corrupted.
// interpolates the start and end values corresponding to the current processing slice
// most ramp parameter implementations will want to use this method
@@ -228,7 +228,7 @@ public:
AudioUnitParameterValue & outStartValue,
AudioUnitParameterValue & outEndValue,
AudioUnitParameterValue & outValuePerFrameDelta );
-
+
/*! @method GetEndValue */
AudioUnitParameterValue GetEndValue( AudioUnitParameterID paramID);
@@ -238,7 +238,7 @@ public:
UInt32 inSliceOffsetInBuffer,
UInt32 inSliceDurationFrames,
bool okWhenInitialized = false );
- // Only set okWhenInitialized to true when you know the outside world cannot access this element. Otherwise the parameter map could get corrupted.
+ // Only set okWhenInitialized to true when you know the outside world cannot access this element. Otherwise the parameter map could get corrupted.
/*! @method GetAudioUnit */
@@ -259,13 +259,13 @@ public:
/*! @method AsIOElement*/
virtual AUIOElement* AsIOElement () { return NULL; }
-
+
protected:
inline ParameterMapEvent& GetParamEvent(AudioUnitParameterID paramID);
-
+
private:
typedef std::map<AudioUnitParameterID, ParameterMapEvent, std::less<AudioUnitParameterID> > ParameterMap;
-
+
/*! @var mAudioUnit */
AUBase * mAudioUnit;
/*! @var mParameters */
@@ -275,7 +275,7 @@ private:
bool mUseIndexedParameters;
/*! @var mIndexedParameters */
std::vector<ParameterMapEvent> mIndexedParameters;
-
+
/*! @var mElementName */
CFStringRef mElementName;
};
@@ -292,7 +292,7 @@ public:
/*! @method GetStreamFormat */
const CAStreamBasicDescription &GetStreamFormat() const { return mStreamFormat; }
-
+
/*! @method SetStreamFormat */
virtual OSStatus SetStreamFormat(const CAStreamBasicDescription &desc);
@@ -304,14 +304,14 @@ public:
virtual bool NeedsBufferSpace() const = 0;
/*! @method SetWillAllocateBuffer */
- void SetWillAllocateBuffer(bool inFlag) {
- mWillAllocate = inFlag;
+ void SetWillAllocateBuffer(bool inFlag) {
+ mWillAllocate = inFlag;
}
/*! @method WillAllocateBuffer */
- bool WillAllocateBuffer() const {
- return mWillAllocate;
+ bool WillAllocateBuffer() const {
+ return mWillAllocate;
}
-
+
/*! @method UseExternalBuffer */
void UseExternalBuffer(const AudioUnitExternalBuffer &buf) {
mIOBuffer.UseExternalBuffer(mStreamFormat, buf);
@@ -392,7 +392,7 @@ public:
/*! @method SetAudioChannelLayout */
virtual OSStatus SetAudioChannelLayout (const AudioChannelLayout &inData);
-
+
/*! @method RemoveAudioChannelLayout */
virtual OSStatus RemoveAudioChannelLayout ();
@@ -416,32 +416,32 @@ protected:
class AUScopeDelegate {
public:
/*! @ctor AUScopeDelegate */
- AUScopeDelegate() : mCreator(NULL), mScope(0) { }
+ AUScopeDelegate() : mCreator(NULL), mScope(0) { }
/*! @dtor ~AUScopeDelegate */
virtual ~AUScopeDelegate() {}
-
+
/*! @method Initialize */
- void Initialize( AUBase *creator,
- AudioUnitScope scope,
+ void Initialize( AUBase *creator,
+ AudioUnitScope scope,
UInt32 numElements)
{
mCreator = creator;
mScope = scope;
SetNumberOfElements(numElements);
}
-
+
/*! @method SetNumberOfElements */
virtual void SetNumberOfElements(UInt32 numElements) = 0;
-
+
/*! @method GetNumberOfElements */
virtual UInt32 GetNumberOfElements() = 0;
-
+
/*! @method GetElement */
virtual AUElement * GetElement(UInt32 elementIndex) = 0;
-
+
AUBase * GetCreator() const { return mCreator; }
AudioUnitScope GetScope() const { return mScope; }
-
+
private:
/*! @var mCreator */
@@ -458,13 +458,13 @@ private:
class AUScope {
public:
/*! @ctor AUScope */
- AUScope() : mCreator(NULL), mScope(0), mDelegate(0) { }
+ AUScope() : mCreator(NULL), mScope(0), mDelegate(0) { }
/*! @dtor ~AUScope */
~AUScope();
-
+
/*! @method Initialize */
- void Initialize(AUBase *creator,
- AudioUnitScope scope,
+ void Initialize(AUBase *creator,
+ AudioUnitScope scope,
UInt32 numElements)
{
mCreator = creator;
@@ -472,22 +472,22 @@ public:
if (mDelegate)
return mDelegate->Initialize(creator, scope, numElements);
-
+
SetNumberOfElements(numElements);
}
-
+
/*! @method SetNumberOfElements */
void SetNumberOfElements(UInt32 numElements);
-
+
/*! @method GetNumberOfElements */
- UInt32 GetNumberOfElements() const
+ UInt32 GetNumberOfElements() const
{
if (mDelegate)
return mDelegate->GetNumberOfElements();
-
+
return static_cast<UInt32>(mElements.size());
}
-
+
/*! @method GetElement */
AUElement * GetElement(UInt32 elementIndex) const
{
@@ -498,7 +498,7 @@ public:
// catch passing -1 in as the elementIndex - causes a wrap around
return (i >= mElements.end() || i < mElements.begin()) ? NULL : *i;
}
-
+
/*! @method SafeGetElement */
AUElement * SafeGetElement(UInt32 elementIndex)
{
@@ -507,7 +507,7 @@ public:
COMPONENT_THROW(kAudioUnitErr_InvalidElement);
return element;
}
-
+
/*! @method GetIOElement */
AUIOElement * GetIOElement(UInt32 elementIndex) const
{
@@ -517,15 +517,15 @@ public:
COMPONENT_THROW (kAudioUnitErr_InvalidElement);
return ioel;
}
-
+
/*! @method HasElementWithName */
bool HasElementWithName () const;
-
+
/*! @method AddElementNamesToDict */
void AddElementNamesToDict (CFMutableDictionaryRef & inNameDict);
-
+
bool RestoreElementNames (CFDictionaryRef& inNameDict);
-
+
AudioUnitScope GetScope() const { return mScope; }
void SetDelegate(AUScopeDelegate* inDelegate) { mDelegate = inDelegate; }
@@ -535,7 +535,7 @@ public:
/*! @method RestoreState */
const UInt8 * RestoreState(const UInt8 *state);
-
+
private:
typedef std::vector<AUElement *> ElementVector;
/*! @var mCreator */
diff --git a/libs/appleutility/CoreAudio/AudioUnits/AUPublic/AUBase/ComponentBase.cpp b/libs/appleutility/CoreAudio/AudioUnits/AUPublic/AUBase/ComponentBase.cpp
index fc987335dc..37328fe791 100644
--- a/libs/appleutility/CoreAudio/AudioUnits/AUPublic/AUBase/ComponentBase.cpp
+++ b/libs/appleutility/CoreAudio/AudioUnits/AUPublic/AUBase/ComponentBase.cpp
@@ -2,14 +2,14 @@
File: ComponentBase.cpp
Abstract: ComponentBase.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 "ComponentBase.h"
#include "CAXException.h"
@@ -72,11 +72,11 @@ static OSStatus CB_GetComponentDescription (const AudioComponentInstance inInsta
static OSStatus CMgr_GetComponentDescription (const AudioComponentInstance inInstance, AudioComponentDescription * outDesc);
#endif
-ComponentBase::ComponentBase(AudioComponentInstance inInstance)
- : mComponentInstance(inInstance),
- mInstanceType(sNewInstanceType)
-{
- GetComponentDescription();
+ComponentBase::ComponentBase(AudioComponentInstance inInstance)
+ : mComponentInstance(inInstance),
+ mInstanceType(sNewInstanceType)
+{
+ GetComponentDescription();
}
ComponentBase::~ComponentBase()
@@ -99,7 +99,7 @@ OSStatus ComponentBase::AP_Open(void *self, AudioUnit compInstance)
OSStatus result = noErr;
try {
ComponentInitLocker lock;
-
+
ComponentBase::sNewInstanceType = ComponentBase::kAudioComponentInstance;
ComponentBase *cb = (ComponentBase *)(*ACPI->mConstruct)(&ACPI->mInstanceStorage, compInstance);
cb->PostConstructor(); // allows base class to do additional initialization
@@ -137,13 +137,13 @@ OSStatus ComponentBase::ComponentEntryDispatch(ComponentParameters *p, Componen
if (This == NULL) return kAudio_ParamError;
OSStatus result = noErr;
-
+
switch (p->what) {
case kComponentCloseSelect:
This->PreDestructor();
delete This;
break;
-
+
case kComponentVersionSelect:
result = This->Version();
break;
@@ -158,7 +158,7 @@ OSStatus ComponentBase::ComponentEntryDispatch(ComponentParameters *p, Componen
default:
return 0;
}
-
+
default:
result = badComponentSelector;
break;
@@ -169,7 +169,7 @@ OSStatus ComponentBase::ComponentEntryDispatch(ComponentParameters *p, Componen
SInt16 ComponentBase::GetSelectorForCanDo(ComponentParameters *params)
{
if (params->what != kComponentCanDoSelect) return 0;
-
+
#if TARGET_CPU_X86
SInt16 sel = params->params[0];
#elif TARGET_CPU_X86_64
@@ -179,9 +179,9 @@ SInt16 ComponentBase::GetSelectorForCanDo(ComponentParameters *params)
#else
SInt16 sel = params->params[0];
#endif
-
+
return sel;
-/*
+/*
printf ("flags:%d, paramSize: %d, what: %d\n\t", params->flags, params->paramSize, params->what);
for (int i = 0; i < params->paramSize; ++i) {
printf ("[%d]:%d(0x%x), ", i, params->params[i], params->params[i]);
@@ -192,7 +192,7 @@ SInt16 ComponentBase::GetSelectorForCanDo(ComponentParameters *params)
#endif
-#if CA_DO_NOT_USE_AUDIO_COMPONENT
+#if CA_DO_NOT_USE_AUDIO_COMPONENT
static OSStatus ComponentBase_GetComponentDescription (const AudioComponentInstance & inInstance, AudioComponentDescription &outDesc);
#endif
@@ -200,20 +200,20 @@ AudioComponentDescription ComponentBase::GetComponentDescription() const
{
AudioComponentDescription desc;
OSStatus result = 1;
-
+
if (IsPluginObject()) {
ca_require_noerr(result = CB_GetComponentDescription (mComponentInstance, &desc), home);
}
#if !CA_USE_AUDIO_PLUGIN_ONLY
else {
- ca_require_noerr(result = CMgr_GetComponentDescription (mComponentInstance, &desc), home);
+ ca_require_noerr(result = CMgr_GetComponentDescription (mComponentInstance, &desc), home);
}
#endif
home:
if (result)
memset (&desc, 0, sizeof(AudioComponentDescription));
-
+
return desc;
}
@@ -239,13 +239,13 @@ static OSStatus CB_GetComponentDescription (const AudioComponentInstance inInsta
{
typedef AudioComponent (*AudioComponentInstanceGetComponentProc) (AudioComponentInstance);
static AudioComponentInstanceGetComponentProc aciGCProc = NULL;
-
+
typedef OSStatus (*AudioComponentGetDescriptionProc)(AudioComponent, AudioComponentDescription *);
static AudioComponentGetDescriptionProc acGDProc = NULL;
-
+
static int doneInit = 0;
if (doneInit == 0) {
- doneInit = 1;
+ doneInit = 1;
void* theImage = dlopen("/System/Library/Frameworks/AudioUnit.framework/AudioUnit", RTLD_LAZY);
if (theImage != NULL)
{
@@ -255,13 +255,13 @@ static OSStatus CB_GetComponentDescription (const AudioComponentInstance inInsta
}
}
}
-
+
OSStatus result = kAudio_UnimplementedError;
if (acGDProc && aciGCProc) {
AudioComponent comp = (*aciGCProc)(inInstance);
if (comp)
result = (*acGDProc)(comp, outDesc);
- }
+ }
#if !CA_USE_AUDIO_PLUGIN_ONLY
else {
result = CMgr_GetComponentDescription (inInstance, outDesc);
@@ -317,7 +317,7 @@ static void CSInit ()
dispatch_once_f(&sCSInitOnce, NULL, CSInitOnce);
}
-#else
+#else
static void CSInit ()
{
diff --git a/libs/appleutility/CoreAudio/AudioUnits/AUPublic/AUBase/ComponentBase.h b/libs/appleutility/CoreAudio/AudioUnits/AUPublic/AUBase/ComponentBase.h
index 67417aa9d1..f8c5511f16 100644
--- a/libs/appleutility/CoreAudio/AudioUnits/AUPublic/AUBase/ComponentBase.h
+++ b/libs/appleutility/CoreAudio/AudioUnits/AUPublic/AUBase/ComponentBase.h
@@ -2,14 +2,14 @@
File: ComponentBase.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 __ComponentBase_h__
#define __ComponentBase_h__
@@ -57,7 +57,7 @@
#if !CA_USE_AUDIO_PLUGIN_ONLY
#include <CoreServices/../Frameworks/CarbonCore.framework/Headers/Components.h>
-
+
#if (MAC_OS_X_VERSION_MAX_ALLOWED <= MAC_OS_X_VERSION_10_5)
#define AudioComponentInstance ComponentInstance
#define AudioComponentDescription ComponentDescription
@@ -115,13 +115,13 @@ public:
/*! @ctor ComponentBase */
ComponentBase(AudioComponentInstance inInstance);
-
+
/*! @dtor ~ComponentBase */
virtual ~ComponentBase();
-
+
/*! @method PostConstructor */
virtual void PostConstructor();
-
+
/*! @method PreDestructor */
virtual void PreDestructor();
@@ -135,14 +135,14 @@ public:
/*! GetSelectorForCanDo */
static SInt16 GetSelectorForCanDo(ComponentParameters *params);
#endif
-
+
/*! @method GetComponentInstance */
AudioComponentInstance GetComponentInstance() const { return mComponentInstance; }
/*! @method GetComponentDescription */
AudioComponentDescription GetComponentDescription() const;
- // This global variable is so that new instances know how they were instantiated: via the Component Manager,
+ // This global variable is so that new instances know how they were instantiated: via the Component Manager,
// or as AudioComponents. It's ugly, but preferable to altering the constructor of every class in the hierarchy.
// It's safe because construction is protected by ComponentInitLocker.
enum EInstanceType { kComponentMgrInstance, kAudioComponentInstance };
@@ -158,27 +158,27 @@ public:
/*! @method AP_Close */
static OSStatus AP_Close(void *self);
-
+
protected:
/*! @var mComponentInstance */
AudioComponentInstance mComponentInstance;
EInstanceType mInstanceType;
};
-class ComponentInitLocker
+class ComponentInitLocker
{
#if TARGET_OS_MAC
public:
- ComponentInitLocker()
- {
+ ComponentInitLocker()
+ {
pthread_once(&sOnce, InitComponentInitLocker);
- pthread_mutex_lock(&sComponentOpenMutex);
+ pthread_mutex_lock(&sComponentOpenMutex);
mPreviousNewInstanceType = ComponentBase::sNewInstanceType;
}
- ~ComponentInitLocker()
- {
+ ~ComponentInitLocker()
+ {
ComponentBase::sNewInstanceType = mPreviousNewInstanceType;
- pthread_mutex_unlock(&sComponentOpenMutex);
+ pthread_mutex_unlock(&sComponentOpenMutex);
}
// There are situations (11844772) where we need to be able to release the lock early.
@@ -190,7 +190,7 @@ public:
}
~Unlocker()
{
- pthread_mutex_lock(&sComponentOpenMutex);
+ pthread_mutex_lock(&sComponentOpenMutex);
}
};
@@ -198,7 +198,7 @@ private:
static pthread_mutex_t sComponentOpenMutex;
static pthread_once_t sOnce;
static void InitComponentInitLocker();
-
+
#elif TARGET_OS_WIN32
public:
bool sNeedsUnlocking;
@@ -207,12 +207,12 @@ public:
private:
static CAGuard sComponentOpenGuard;
#endif
-
+
private:
ComponentBase::EInstanceType mPreviousNewInstanceType;
};
-/*! @class AudioComponentPlugInInstance */
+/*! @class AudioComponentPlugInInstance */
struct AudioComponentPlugInInstance {
AudioComponentPlugInInterface mPlugInInterface;
void * (*mConstruct)(void *memory, AudioComponentInstance ci);
@@ -222,7 +222,7 @@ struct AudioComponentPlugInInstance {
// this member is just a placeholder. it is aligned to a 16byte boundary
};
-/*! @class APFactory */
+/*! @class APFactory */
template <class APMethodLookup, class Implementor>
class APFactory {
public:
@@ -230,7 +230,7 @@ public:
{
return new(memory) Implementor(compInstance);
}
-
+
static void Destruct(void *memory)
{
((Implementor *)memory)->~Implementor();
@@ -240,7 +240,7 @@ public:
// The actual implementation object is not created until Open().
static AudioComponentPlugInInterface *Factory(const AudioComponentDescription * /* inDesc */)
{
- AudioComponentPlugInInstance *acpi =
+ AudioComponentPlugInInstance *acpi =
(AudioComponentPlugInInstance *)malloc( offsetof(AudioComponentPlugInInstance, mInstanceStorage) + sizeof(Implementor) );
acpi->mPlugInInterface.Open = ComponentBase::AP_Open;
acpi->mPlugInInterface.Close = ComponentBase::AP_Close;
@@ -252,17 +252,17 @@ public:
acpi->mPad[1] = NULL;
return (AudioComponentPlugInInterface*)acpi;
}
-
+
// This is for runtime registration (not for plug-ins loaded from bundles).
static AudioComponent Register(UInt32 type, UInt32 subtype, UInt32 manuf, CFStringRef name, UInt32 vers, UInt32 flags=0)
{
AudioComponentDescription desc = { type, subtype, manuf, flags, 0 };
- return AudioComponentRegister(&desc, name, vers, Factory);
+ return AudioComponentRegister(&desc, name, vers, Factory);
}
};
#if !CA_USE_AUDIO_PLUGIN_ONLY
-/*! @class ComponentEntryPoint
+/*! @class ComponentEntryPoint
* @discussion This is only used for a component manager version
*/
template <class Class>
@@ -272,7 +272,7 @@ public:
static OSStatus Dispatch(ComponentParameters *params, Class *obj)
{
OSStatus result = noErr;
-
+
try {
if (params->what == kComponentOpenSelect) {
// solve a host of initialization thread safety issues.
@@ -283,16 +283,16 @@ public:
Class *This = new Class((AudioComponentInstance)ci);
This->PostConstructor(); // allows base class to do additional initialization
// once the derived class is fully constructed
-
+
CMgr_SetComponentInstanceStorage(ci, (Handle)This);
} else
result = Class::ComponentEntryDispatch(params, obj);
}
COMPONENT_CATCH
-
+
return result;
}
-
+
/*! @method Register */
static Component Register(OSType compType, OSType subType, OSType manufacturer)
{
diff --git a/libs/appleutility/CoreAudio/AudioUnits/AUPublic/AUCarbonViewBase/AUCarbonViewBase.cpp b/libs/appleutility/CoreAudio/AudioUnits/AUPublic/AUCarbonViewBase/AUCarbonViewBase.cpp
index 332475335d..d3394ee19d 100644
--- a/libs/appleutility/CoreAudio/AudioUnits/AUPublic/AUCarbonViewBase/AUCarbonViewBase.cpp
+++ b/libs/appleutility/CoreAudio/AudioUnits/AUPublic/AUCarbonViewBase/AUCarbonViewBase.cpp
@@ -2,14 +2,14 @@
File: AUCarbonViewBase.cpp
Abstract: AUCarbonViewBase.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 "AUCarbonViewBase.h"
#include "AUCarbonViewControl.h"
@@ -59,11 +59,11 @@ AUCarbonViewBase::AUCarbonViewBase(AudioUnitCarbonView inInstance, Float32 inNot
mTimerUPP (NULL),
mCarbonWindow(NULL),
mCarbonPane(NULL),
- mXOffset(0),
+ mXOffset(0),
mYOffset(0)
{
AUEventListenerCreate (ParameterListener, this,
- CFRunLoopGetCurrent(), kCFRunLoopCommonModes,
+ CFRunLoopGetCurrent(), kCFRunLoopCommonModes,
inNotificationInterval, inNotificationInterval,
&mParameterListener);
}
@@ -82,12 +82,12 @@ AUCarbonViewBase::~AUCarbonViewBase()
if (mTimerRef)
::RemoveEventLoopTimer (mTimerRef);
-
+
if (mTimerUPP)
DisposeEventLoopTimerUPP (mTimerUPP);
#endif
}
-
+
void AUCarbonViewBase::AddControl(AUCarbonViewControl *control)
{
ControlList::iterator it = find(mControlList.begin(), mControlList.end(), control);
@@ -126,7 +126,7 @@ void AUCarbonViewBase::ParameterListener(void * inCallbackRefCon,
}
}
-
+
OSStatus AUCarbonViewBase::CreateCarbonView(AudioUnit inAudioUnit, WindowRef inWindow, ControlRef inParentControl, const Float32Point &inLocation, const Float32Point &inSize, ControlRef &outParentControl)
{
#if !__LP64__
@@ -140,19 +140,19 @@ OSStatus AUCarbonViewBase::CreateCarbonView(AudioUnit inAudioUnit, WindowRef i
Rect area;
area.left = short(inLocation.x); area.top = short(inLocation.y);
area.right = short(area.left + inSize.x); area.bottom = short(area.top + inSize.y);
- OSStatus err = ::CreateUserPaneControl(inWindow, &area,
+ OSStatus err = ::CreateUserPaneControl(inWindow, &area,
kControlSupportsEmbedding,
&mCarbonPane); // subclass can resize mCarbonPane to taste
verify_noerr(err);
if (err) return err;
outParentControl = mCarbonPane;
-
+
// register for mouse-down in our pane -- we want to clear focus
EventTypeSpec paneEvents[] = {
{ kEventClassControl, kEventControlClick }
};
WantEventTypes(GetControlEventTarget(mCarbonPane), GetEventTypeCount(paneEvents), paneEvents);
-
+
if (IsCompositWindow()) {
verify_noerr(::HIViewAddSubview(inParentControl, mCarbonPane));
mXOffset = 0;
@@ -164,7 +164,7 @@ OSStatus AUCarbonViewBase::CreateCarbonView(AudioUnit inAudioUnit, WindowRef i
mYOffset = inLocation.y;
}
mBottomRight.h = mBottomRight.v = 0;
-
+
SizeControl(mCarbonPane, 0, 0);
if (err = CreateUI(mXOffset, mYOffset))
return err;
@@ -187,12 +187,12 @@ OSStatus AUCarbonViewBase::CreateCarbonView(AudioUnit inAudioUnit, WindowRef i
{ kEventClassScrollable, kEventScrollableGetInfo },
{ kEventClassScrollable, kEventScrollableScrollTo }
};
-
+
WantEventTypes(GetControlEventTarget(mCarbonPane), GetEventTypeCount(scrollEvents), scrollEvents);
-
+
mCurrentScrollPoint.x = mCurrentScrollPoint.y = 0.0f;
}
-
+
return err;
#else
return noErr;
@@ -212,10 +212,10 @@ OSStatus AUCarbonViewBase::EmbedControl(ControlRef ctl)
if (r.right > mBottomRight.h) mBottomRight.h = r.right;
if (r.bottom > mBottomRight.v) mBottomRight.v = r.bottom;
- if (IsCompositWindow())
+ if (IsCompositWindow())
return ::HIViewAddSubview(mCarbonPane, ctl);
- else
- return ::EmbedControl(ctl, mCarbonPane);
+ else
+ return ::EmbedControl(ctl, mCarbonPane);
#else
return noErr;
#endif
@@ -224,19 +224,19 @@ OSStatus AUCarbonViewBase::EmbedControl(ControlRef ctl)
void AUCarbonViewBase::AddCarbonControl(AUCarbonViewControl::ControlType type, const CAAUParameter &param, ControlRef control)
{
verify_noerr(EmbedControl(control));
-
+
AUCarbonViewControl *auvc = new AUCarbonViewControl(this, mParameterListener, type, param, control);
auvc->Bind();
AddControl(auvc);
}
bool AUCarbonViewBase::HandleEvent(EventHandlerCallRef inHandlerRef, EventRef event)
-{
+{
#if !__LP64__
UInt32 eclass = GetEventClass(event);
UInt32 ekind = GetEventKind(event);
ControlRef control;
-
+
switch (eclass) {
case kEventClassControl:
{
@@ -250,7 +250,7 @@ bool AUCarbonViewBase::HandleEvent(EventHandlerCallRef inHandlerRef, EventRef ev
}
}
break;
-
+
case kEventClassScrollable:
{
switch (ekind) {
@@ -262,7 +262,7 @@ bool AUCarbonViewBase::HandleEvent(EventHandlerCallRef inHandlerRef, EventRef ev
*/
HISize originalSize = { mBottomRight.h, mBottomRight.v };
verify_noerr(SetEventParameter(event, kEventParamImageSize, typeHISize, sizeof(HISize), &originalSize));
-
+
// [2/4]
/* <-- kEventParamViewSize (out, typeHISize)
* On exit, contains the amount of the scrollable view that is
@@ -274,7 +274,7 @@ bool AUCarbonViewBase::HandleEvent(EventHandlerCallRef inHandlerRef, EventRef ev
//HISize windowSize = { float(windowBounds.right - windowBounds.left),
// float(windowBounds.bottom - windowBounds.top) };
verify_noerr(SetEventParameter(event, kEventParamViewSize, typeHISize, sizeof(HISize), &(parentBounds.size)));
-
+
// [3/4]
/* <-- kEventParamLineSize (out, typeHISize)
* On exit, contains the amount that should be scrolled in
@@ -282,7 +282,7 @@ bool AUCarbonViewBase::HandleEvent(EventHandlerCallRef inHandlerRef, EventRef ev
*/
HISize scrollIncrementSize = { 16.0f, float(20) };
verify_noerr(SetEventParameter(event, kEventParamLineSize, typeHISize, sizeof(HISize), &scrollIncrementSize));
-
+
// [4/4]
/* <-- kEventParamOrigin (out, typeHIPoint)
* On exit, contains the scrollable viewÕs current origin (the
@@ -294,17 +294,17 @@ bool AUCarbonViewBase::HandleEvent(EventHandlerCallRef inHandlerRef, EventRef ev
verify_noerr(SetEventParameter(event, kEventParamOrigin, typeHIPoint, sizeof(HIPoint), &mCurrentScrollPoint));
}
return true;
-
+
case kEventScrollableScrollTo:
{
/*
* kEventClassScrollable / kEventScrollableScrollTo
- *
+ *
* Summary:
* Requests that an HIScrollViewÕs scrollable view should scroll to
* a particular origin.
*/
-
+
/* --> kEventParamOrigin (in, typeHIPoint)
* The new origin for the scrollable view. The origin
* coordinates will vary from (0,0) to scrollable viewÕs image
@@ -312,24 +312,24 @@ bool AUCarbonViewBase::HandleEvent(EventHandlerCallRef inHandlerRef, EventRef ev
*/
HIPoint pointToScrollTo;
verify_noerr(GetEventParameter(event, kEventParamOrigin, typeHIPoint, NULL, sizeof(HIPoint), NULL, &pointToScrollTo));
-
+
float xDelta = mCurrentScrollPoint.x - pointToScrollTo.x;
float yDelta = mCurrentScrollPoint.y - pointToScrollTo.y;
// move visible portion the appropriate amount
verify_noerr(HIViewScrollRect(mCarbonPane, NULL, xDelta, yDelta));
// set new content to be drawn
verify_noerr(HIViewSetBoundsOrigin(mCarbonPane, pointToScrollTo.x, pointToScrollTo.y));
-
+
mCurrentScrollPoint = pointToScrollTo;
}
return true;
-
+
default:
break;
}
}
break;
-
+
default:
break;
}
@@ -352,7 +352,7 @@ void AUCarbonViewBase::TellListener (const CAAUParameter &auvp, AudioUnitCarbonV
} else {
auEvent.mEventType = kAudioUnitEvent_EndParameterChangeGesture;
}
- AUEventListenerNotify(mParameterListener, this, &auEvent);
+ AUEventListenerNotify(mParameterListener, this, &auEvent);
}
@@ -370,34 +370,34 @@ pascal void AUCarbonViewBase::TheTimerProc (EventLoopTimerRef inTimer, void *in
This->RespondToEventTimer (inTimer);
}
-void AUCarbonViewBase::RespondToEventTimer (EventLoopTimerRef inTimer)
+void AUCarbonViewBase::RespondToEventTimer (EventLoopTimerRef inTimer)
{}
-/*
+/*
THESE are reasonable values for these two times
- 0.005 // delay
+ 0.005 // delay
0.050 // interval
*/
-OSStatus AUCarbonViewBase::CreateEventLoopTimer (Float32 inDelay, Float32 inInterval)
+OSStatus AUCarbonViewBase::CreateEventLoopTimer (Float32 inDelay, Float32 inInterval)
{
if (mTimerUPP)
return noErr;
-
+
mTimerUPP = NewEventLoopTimerUPP(TheTimerProc);
-
+
EventLoopRef mainEventLoop = GetMainEventLoop();
-
+
//doesn't seem to like too small a value
if (inDelay < 0.005)
inDelay = 0.005;
-
+
OSStatus timerResult = ::InstallEventLoopTimer(
mainEventLoop,
inDelay,
inInterval,
mTimerUPP,
this,
- &mTimerRef);
+ &mTimerRef);
return timerResult;
}
diff --git a/libs/appleutility/CoreAudio/AudioUnits/AUPublic/AUCarbonViewBase/AUCarbonViewBase.h b/libs/appleutility/CoreAudio/AudioUnits/AUPublic/AUCarbonViewBase/AUCarbonViewBase.h
index 910e53ffa6..0afc5fc074 100644
--- a/libs/appleutility/CoreAudio/AudioUnits/AUPublic/AUCarbonViewBase/AUCarbonViewBase.h
+++ b/libs/appleutility/CoreAudio/AudioUnits/AUPublic/AUCarbonViewBase/AUCarbonViewBase.h
@@ -2,14 +2,14 @@
File: AUCarbonViewBase.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 __AUCarbonViewBase_h__
#define __AUCarbonViewBase_h__
@@ -62,7 +62,7 @@ public:
Float32 inNotificationInterval = kDefaultNotificationInterval /* in seconds */);
/*! @dtor ~AUCarbonViewBase */
virtual ~AUCarbonViewBase();
-
+
// AUViewBase overrides
/*! @method CreateCarbonView */
virtual OSStatus CreateCarbonView (AudioUnit inAudioUnit, WindowRef inWindow, ControlRef inParentControl, const Float32Point &inLocation, const Float32Point &inSize, ControlRef &outParentControl);
@@ -73,7 +73,7 @@ public:
/*! @method HandleEvent */
virtual bool HandleEvent (EventHandlerCallRef inHandlerRef, EventRef event);
-
+
/*! @method GetEditAudioUnit */
const AudioUnit GetEditAudioUnit () const { return mEditAudioUnit; }
//
@@ -84,8 +84,8 @@ public:
/*! @method AddCarbonControl */
void AddCarbonControl (
- AUCarbonViewControl::ControlType type,
- const CAAUParameter & param,
+ AUCarbonViewControl::ControlType type,
+ const CAAUParameter & param,
ControlRef control);
/*! @method GetCarbonWindow */
@@ -94,27 +94,27 @@ public:
ControlRef GetCarbonPane () { return mCarbonPane; }
/*! @method EmbedControl */
OSStatus EmbedControl (ControlRef ctl);
-
+
/*! @method TellListener */
void TellListener (const CAAUParameter &auvp, AudioUnitCarbonViewEventID event, void *evpar);
-
+
// pass in true if wanting an update to the view and you're calling this from a thread
// that is safe to do UI in.
// If you don't know, pass in false!
/*! @method Update */
void Update (bool inUIThread);
-
+
/*! @method GetXOffset */
Float32 GetXOffset () { return mXOffset; }
/*! @method GetYOffset */
Float32 GetYOffset () { return mYOffset; }
-
+
/*! @method ClearControls */
void ClearControls ();
-
+
/*! @method IsCompositWindow */
bool IsCompositWindow () const { return mCompositWindow; }
-
+
protected:
#if !__LP64__
/*! @method SetEventListener */
@@ -131,15 +131,15 @@ protected:
void RemoveControl (AUCarbonViewControl *control);
OSStatus CreateEventLoopTimer (Float32 inDelay, Float32 inInterval);
-
+
/*! @method ParameterListener */
static void ParameterListener (void * inCallbackRefCon,
void * inObject,
const AudioUnitEvent * inEvent,
UInt64 inEventHostTime,
Float32 inParameterValue);
-
- static pascal void TheTimerProc ( EventLoopTimerRef inTimer,
+
+ static pascal void TheTimerProc ( EventLoopTimerRef inTimer,
void * inUserData);
virtual void RespondToEventTimer (EventLoopTimerRef inTimer);
diff --git a/libs/appleutility/CoreAudio/AudioUnits/AUPublic/AUCarbonViewBase/AUCarbonViewControl.cpp b/libs/appleutility/CoreAudio/AudioUnits/AUPublic/AUCarbonViewBase/AUCarbonViewControl.cpp
index 981347b0f1..c22c50c4a3 100644
--- a/libs/appleutility/CoreAudio/AudioUnits/AUPublic/AUCarbonViewBase/AUCarbonViewControl.cpp
+++ b/libs/appleutility/CoreAudio/AudioUnits/AUPublic/AUCarbonViewBase/AUCarbonViewControl.cpp
@@ -2,14 +2,14 @@
File: AUCarbonViewControl.cpp
Abstract: AUCarbonViewControl.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 "AUCarbonViewControl.h"
#include "AUCarbonViewBase.h"
@@ -74,11 +74,11 @@ void AUCarbonViewControl::Bind()
mInControlInitialization = 1; // true
AUListenerAddParameter(mListener, this, &mParam);
// will cause an almost-immediate callback
-
+
EventTypeSpec events[] = {
{ kEventClassControl, kEventControlValueFieldChanged } // N.B. OS X only
};
-
+
WantEventTypes(GetControlEventTarget(mControl), GetEventTypeCount(events), events);
if (mType == kTypeContinuous || mType == kTypeText || mType == kTypeDiscrete) {
@@ -88,18 +88,18 @@ void AUCarbonViewControl::Bind()
{ kEventClassControl, kEventControlTrack }
};
WantEventTypes(GetControlEventTarget(mControl), GetEventTypeCount(events), events);
- }
+ }
if (mType == kTypeText) {
EventTypeSpec events[] = {
{ kEventClassControl, kEventControlSetFocusPart }
};
- WantEventTypes(GetControlEventTarget(mControl), GetEventTypeCount(events), events);
+ WantEventTypes(GetControlEventTarget(mControl), GetEventTypeCount(events), events);
ControlKeyFilterUPP proc = mParam.ValuesHaveStrings() ? StdKeyFilterCallback : NumericKeyFilterCallback;
// this will fail for a static text field
SetControlData(mControl, 0, kControlEditTextKeyFilterTag, sizeof(proc), &proc);
}
-
+
Update(true);
mInControlInitialization = 0; // false
#endif
@@ -116,7 +116,7 @@ void AUCarbonViewControl::ParameterToControl(Float32 paramValue)
case kTypeDiscrete:
{
long value = long(paramValue);
-
+
// special case [1] -- menu parameters
if (mParam.HasNamedParams()) {
// if we're dealing with menus they behave differently!
@@ -124,17 +124,17 @@ void AUCarbonViewControl::ParameterToControl(Float32 paramValue)
// first menu item always reports a control value of 1
ControlKind ctrlKind;
if (GetControlKind(mControl, &ctrlKind) == noErr) {
- if ((ctrlKind.kind == kControlKindPopupArrow)
- || (ctrlKind.kind == kControlKindPopupButton))
+ if ((ctrlKind.kind == kControlKindPopupArrow)
+ || (ctrlKind.kind == kControlKindPopupButton))
{
value = value - long(mParam.ParamInfo().minValue) + 1;
}
}
}
-
+
// special case [2] -- Write-only boolean parameters
AudioUnitParameterInfo AUPI = mParam.ParamInfo();
-
+
bool isWriteOnlyBoolParameter = ( (AUPI.unit == kAudioUnitParameterUnit_Boolean) &&
(AUPI.flags & kAudioUnitParameterFlag_IsWritable) &&
!(AUPI.flags & kAudioUnitParameterFlag_IsReadable) );
@@ -148,7 +148,7 @@ void AUCarbonViewControl::ParameterToControl(Float32 paramValue)
CFStringRef cfstr = mParam.GetStringFromValueCopy(&paramValue);
if ( !(mParam.ParamInfo().flags & kAudioUnitParameterFlag_IsWritable) //READ ONLY PARAMS
- && (mParam.ParamInfo().flags & kAudioUnitParameterFlag_IsReadable))
+ && (mParam.ParamInfo().flags & kAudioUnitParameterFlag_IsReadable))
{
if (mParam.GetParamTag()) {
CFMutableStringRef str = CFStringCreateMutableCopy(NULL, 256, cfstr);
@@ -184,7 +184,7 @@ void AUCarbonViewControl::ControlToParameter()
case kTypeDiscrete:
{
long value = GetValue();
-
+
// special case [1] -- Menus
if (mParam.HasNamedParams()) {
// if we're dealing with menus they behave differently!
@@ -192,24 +192,24 @@ void AUCarbonViewControl::ControlToParameter()
// first menu item always reports a control value of 1
ControlKind ctrlKind;
if (GetControlKind(mControl, &ctrlKind) == noErr) {
- if ((ctrlKind.kind == kControlKindPopupArrow)
- || (ctrlKind.kind == kControlKindPopupButton))
+ if ((ctrlKind.kind == kControlKindPopupArrow)
+ || (ctrlKind.kind == kControlKindPopupButton))
{
value = value + long(mParam.ParamInfo().minValue) - 1;
}
}
}
-
+
// special case [2] -- Write-only boolean parameters
AudioUnitParameterInfo AUPI = mParam.ParamInfo();
-
+
bool isWriteOnlyBoolParameter = ( (AUPI.unit == kAudioUnitParameterUnit_Boolean) &&
(AUPI.flags & kAudioUnitParameterFlag_IsWritable) &&
!(AUPI.flags & kAudioUnitParameterFlag_IsReadable) );
if (isWriteOnlyBoolParameter) {
value = 1;
}
-
+
mParam.SetValue (mListener, this, value);
}
break;
@@ -284,25 +284,25 @@ long AUCarbonViewControl::GetValue()
#endif
}
-/* Notes on event handling
-
+/* Notes on event handling
+
Button (Click and release on button)
kEventControlClick received
kEventControlTrack received
kEventControlValueFieldChanged received
kEventControlHit received
-
+
Button (Click and release outside of button bounds)
kEventControlClick received
kEventControlTrack received
-
+
Slider (Click, drag, and release)
kEventControlClick received
kEventControlTrack received
kEventControlValueFieldChanged received
kEventControlValueFieldChanged received
kEventControlHit received
-
+
Slider (Click, release without changing value)
kEventControlClick received
kEventControlTrack received
@@ -313,16 +313,16 @@ bool AUCarbonViewControl::HandleEvent(EventHandlerCallRef inHandlerRef, EventRef
UInt32 ekind = GetEventKind(event);
ControlRef control;
bool handled = true;
-
+
switch (eclass) {
case kEventClassControl:
{
AudioUnitParameterInfo AUPI = mParam.ParamInfo();
-
+
bool isWriteOnlyBoolParameter = ( (AUPI.unit == kAudioUnitParameterUnit_Boolean) &&
(AUPI.flags & kAudioUnitParameterFlag_IsWritable) &&
!(AUPI.flags & kAudioUnitParameterFlag_IsReadable) );
-
+
switch (ekind) {
case kEventControlSetFocusPart: // tab
handled = !handled; // fall through to next case
@@ -331,7 +331,7 @@ bool AUCarbonViewControl::HandleEvent(EventHandlerCallRef inHandlerRef, EventRef
GetEventParameter(event, kEventParamDirectObject, typeControlRef, NULL, sizeof(ControlRef), NULL, &control);
verify(control == mControl);
ControlToParameter();
- return handled;
+ return handled;
case kEventControlClick:
if (isWriteOnlyBoolParameter) {
GetEventParameter(event, kEventParamDirectObject, typeControlRef, NULL, sizeof(ControlRef), NULL, &control);
@@ -341,7 +341,7 @@ bool AUCarbonViewControl::HandleEvent(EventHandlerCallRef inHandlerRef, EventRef
if (mLastControl != NULL) {
mLastControl->Update(false);
}
- mLastControl = this;
+ mLastControl = this;
}
mOwnerView->TellListener(mParam, kAudioUnitCarbonViewEvent_MouseDownInControl, NULL);
break; // don't return true, continue normal processing
@@ -349,17 +349,17 @@ bool AUCarbonViewControl::HandleEvent(EventHandlerCallRef inHandlerRef, EventRef
if (mLastControl != this) {
if (mLastControl != NULL)
mLastControl->Update(false);
- mLastControl = this;
- }
+ mLastControl = this;
+ }
mOwnerView->TellListener(mParam, kAudioUnitCarbonViewEvent_MouseUpInControl, NULL);
break; // don't return true, continue normal processing
- case kEventControlTrack:
+ case kEventControlTrack:
if (mLastControl != this) {
if (mLastControl != NULL)
mLastControl->Update(false);
- mLastControl = this;
+ mLastControl = this;
}
-
+
CallNextEventHandler(inHandlerRef, event);
ControlToParameter(); // new code
mOwnerView->TellListener(mParam, kAudioUnitCarbonViewEvent_MouseUpInControl, NULL);
@@ -379,8 +379,8 @@ pascal void AUCarbonViewControl::SliderTrackProc(ControlRef theControl, ControlP
// AUCarbonViewControl *This = (AUCarbonViewControl *)GetControlReference(theControl);
}
-pascal ControlKeyFilterResult AUCarbonViewControl::StdKeyFilterCallback(ControlRef theControl,
- SInt16 *keyCode, SInt16 *charCode,
+pascal ControlKeyFilterResult AUCarbonViewControl::StdKeyFilterCallback(ControlRef theControl,
+ SInt16 *keyCode, SInt16 *charCode,
EventModifiers *modifiers)
{
#if !__LP64__
@@ -397,8 +397,8 @@ pascal ControlKeyFilterResult AUCarbonViewControl::StdKeyFilterCallback(ControlR
return kControlKeyFilterBlockKey;
}
-pascal ControlKeyFilterResult AUCarbonViewControl::NumericKeyFilterCallback(ControlRef theControl,
- SInt16 *keyCode, SInt16 *charCode,
+pascal ControlKeyFilterResult AUCarbonViewControl::NumericKeyFilterCallback(ControlRef theControl,
+ SInt16 *keyCode, SInt16 *charCode,
EventModifiers *modifiers)
{
#if !__LP64__
@@ -420,43 +420,43 @@ Boolean AUCarbonViewControl::SizeControlToFit(ControlRef inControl, SInt16 *outW
{
#if !__LP64__
if (inControl == 0) return false;
-
+
Boolean bValue = false;
// this only works on text controls -- returns an error for other controls, but doesn't do anything,
// so the error is irrelevant
SetControlData(inControl, kControlEntireControl, 'stim' /* kControlStaticTextIsMultilineTag */, sizeof(Boolean), &bValue);
-
+
SInt16 baseLineOffset;
Rect bestRect;
- OSErr err = GetBestControlRect(inControl, &bestRect, &baseLineOffset);
+ OSErr err = GetBestControlRect(inControl, &bestRect, &baseLineOffset);
if (err != noErr) return false;
-
+
int width = (bestRect.right - bestRect.left) + 1;
int height = (bestRect.bottom - bestRect.top) + 1;
-
+
Rect boundsRect;
GetControlBounds (inControl, &boundsRect);
-
+
Rect newRect;
newRect.top = boundsRect.top;
newRect.bottom = newRect.top + height;
newRect.left = boundsRect.left;
newRect.right = newRect.left + width;
-
+
SetControlBounds (inControl, &newRect);
-
+
if (outWidth)
*outWidth = width;
-
+
if (outHeight)
*outHeight = height;
-#endif
+#endif
return true;
}
#pragma mark ___AUPropertyControl
bool AUPropertyControl::HandleEvent(EventHandlerCallRef inHandlerRef, EventRef event)
-{
+{
UInt32 eclass = GetEventClass(event);
UInt32 ekind = GetEventKind(event);
switch (eclass) {
@@ -477,14 +477,14 @@ void AUPropertyControl::RegisterEvents ()
EventTypeSpec events[] = {
{ kEventClassControl, kEventControlValueFieldChanged } // N.B. OS X only
};
-
+
WantEventTypes(GetControlEventTarget(mControl), GetEventTypeCount(events), events);
#endif
}
-void AUPropertyControl::EmbedControl (ControlRef theControl)
-{
- mView->EmbedControl (theControl);
+void AUPropertyControl::EmbedControl (ControlRef theControl)
+{
+ mView->EmbedControl (theControl);
}
WindowRef AUPropertyControl::GetCarbonWindow()
@@ -498,11 +498,11 @@ static CFStringRef kStringFactoryPreset = kAUViewLocalizedStringKey_FactoryPrese
static bool sAUVPresetLocalized = false;
#endif
-AUVPresets::AUVPresets (AUCarbonViewBase* inParentView,
+AUVPresets::AUVPresets (AUCarbonViewBase* inParentView,
CFArrayRef& inPresets,
- Point inLocation,
- int nameWidth,
- int controlWidth,
+ Point inLocation,
+ int nameWidth,
+ int controlWidth,
ControlFontStyleRec & inFontStyle)
: AUPropertyControl (inParentView),
mPresets (inPresets),
@@ -510,13 +510,13 @@ AUVPresets::AUVPresets (AUCarbonViewBase* inParentView,
{
#if !__LP64__
Rect r;
-
+
// ok we now have an array of factory presets
// get their strings and display them
r.top = inLocation.v; r.bottom = r.top;
r.left = inLocation.h; r.right = r.left;
-
+
// localize as necessary
if (!sAUVPresetLocalized) {
CFBundleRef mainBundle = CFBundleGetBundleWithIdentifier(kLocalizedStringBundle_AUView);
@@ -527,86 +527,86 @@ AUVPresets::AUVPresets (AUCarbonViewBase* inParentView,
sAUVPresetLocalized = true;
}
}
-
+
// create localized title string
CFMutableStringRef factoryPresetsTitle = CFStringCreateMutable(NULL, 0);
CFStringAppend(factoryPresetsTitle, kStringFactoryPreset);
CFStringAppend(factoryPresetsTitle, kAUViewUnlocalizedString_TitleSeparator);
-
+
ControlRef theControl;
verify_noerr(CreateStaticTextControl(mView->GetCarbonWindow(), &r, factoryPresetsTitle, &inFontStyle, &theControl));
SInt16 width = 0;
AUCarbonViewControl::SizeControlToFit(theControl, &width, &mHeight);
CFRelease(factoryPresetsTitle);
EmbedControl(theControl);
-
+
r.top -= 2;
r.left += width + 10;
r.right = r.left;
r.bottom = r.top;
-
- verify_noerr(CreatePopupButtonControl ( mView->GetCarbonWindow(), &r, NULL,
+
+ verify_noerr(CreatePopupButtonControl ( mView->GetCarbonWindow(), &r, NULL,
-12345, // DON'T GET MENU FROM RESOURCE mMenuID,!!!
- FALSE, // variableWidth,
- 0, // titleWidth,
- 0, // titleJustification,
- 0, // titleStyle,
+ FALSE, // variableWidth,
+ 0, // titleWidth,
+ 0, // titleJustification,
+ 0, // titleStyle,
&mControl));
-
+
MenuRef menuRef;
verify_noerr(CreateNewMenu(1, 0, &menuRef));
-
+
int numPresets = CFArrayGetCount(mPresets);
-
+
for (int i = 0; i < numPresets; ++i)
{
AUPreset* preset = (AUPreset*) CFArrayGetValueAtIndex (mPresets, i);
verify_noerr(AppendMenuItemTextWithCFString (menuRef, preset->presetName, 0, 0, 0));
}
-
+
verify_noerr(SetControlData(mControl, 0, kControlPopupButtonMenuRefTag, sizeof(menuRef), &menuRef));
verify_noerr (SetControlFontStyle (mControl, &inFontStyle));
-
+
SetControl32BitMaximum (mControl, numPresets);
-
+
// size popup
SInt16 height = 0;
-
+
AUCarbonViewControl::SizeControlToFit(mControl, &width, &height);
-
+
if (height > mHeight) mHeight = height;
if (mHeight < 0) mHeight = 0;
-
+
// find which menu item is the Default preset
UInt32 propertySize = sizeof(AUPreset);
AUPreset defaultPreset;
- OSStatus result = AudioUnitGetProperty (mView->GetEditAudioUnit(),
+ OSStatus result = AudioUnitGetProperty (mView->GetEditAudioUnit(),
kAudioUnitProperty_PresentPreset,
- kAudioUnitScope_Global,
- 0,
- &defaultPreset,
+ kAudioUnitScope_Global,
+ 0,
+ &defaultPreset,
&propertySize);
-
+
mPropertyID = kAudioUnitProperty_PresentPreset;
-#endif
+#endif
#ifndef __LP64__
if (result != noErr) { // if the PresentPreset property is not implemented, fall back to the CurrentPreset property
- OSStatus result = AudioUnitGetProperty (mView->GetEditAudioUnit(),
+ OSStatus result = AudioUnitGetProperty (mView->GetEditAudioUnit(),
kAudioUnitProperty_CurrentPreset,
- kAudioUnitScope_Global,
- 0,
- &defaultPreset,
+ kAudioUnitScope_Global,
+ 0,
+ &defaultPreset,
&propertySize);
mPropertyID = kAudioUnitProperty_CurrentPreset;
if (result == noErr)
CFRetain (defaultPreset.presetName);
- }
+ }
#endif
-#if !__LP64__
+#if !__LP64__
EmbedControl (mControl);
-
+
HandlePropertyChange(defaultPreset);
-
+
RegisterEvents();
#endif
}
@@ -620,7 +620,7 @@ void AUVPresets::AddInterest (AUEventListenerRef inListener,
e.mArgument.mProperty.mPropertyID = mPropertyID;
e.mArgument.mProperty.mScope = kAudioUnitScope_Global;
e.mArgument.mProperty.mElement = 0;
-
+
AUEventListenerAddEventType(inListener, inObject, &e);
}
@@ -644,14 +644,14 @@ void AUVPresets::HandleControlChange ()
if (i > 0)
{
AUPreset* preset = (AUPreset*) CFArrayGetValueAtIndex (mPresets, i-1);
-
- verify_noerr(AudioUnitSetProperty (mView->GetEditAudioUnit(),
+
+ verify_noerr(AudioUnitSetProperty (mView->GetEditAudioUnit(),
mPropertyID, // either currentPreset or PresentPreset depending on which is supported
- kAudioUnitScope_Global,
- 0,
- preset,
+ kAudioUnitScope_Global,
+ 0,
+ preset,
sizeof(AUPreset)));
-
+
// when we change a preset we can't expect the AU to update its state
// as it isn't meant to know that its being viewed!
// so we broadcast a notification to all listeners that all parameters on this AU have changed
@@ -663,12 +663,12 @@ void AUVPresets::HandleControlChange ()
#endif
}
-void AUVPresets::HandlePropertyChange(AUPreset &preset)
+void AUVPresets::HandlePropertyChange(AUPreset &preset)
{
#if !__LP64__
// check to see if the preset is in our menu
int numPresets = CFArrayGetCount(mPresets);
- if (preset.presetNumber < 0) {
+ if (preset.presetNumber < 0) {
SetControl32BitValue (mControl, 0); //controls are one-based
} else {
for (SInt32 i = 0; i < numPresets; ++i) {
@@ -679,7 +679,7 @@ void AUVPresets::HandlePropertyChange(AUPreset &preset)
}
}
}
-
+
if (preset.presetName)
CFRelease (preset.presetName);
#endif
@@ -687,16 +687,16 @@ void AUVPresets::HandlePropertyChange(AUPreset &preset)
bool AUVPresets::HandlePropertyChange (const AudioUnitProperty &inProp)
{
- if (inProp.mPropertyID == mPropertyID)
+ if (inProp.mPropertyID == mPropertyID)
{
UInt32 theSize = sizeof(AUPreset);
AUPreset currentPreset;
-
- OSStatus result = AudioUnitGetProperty(inProp.mAudioUnit,
- inProp.mPropertyID,
- inProp.mScope,
+
+ OSStatus result = AudioUnitGetProperty(inProp.mAudioUnit,
+ inProp.mPropertyID,
+ inProp.mScope,
inProp.mElement, &currentPreset, &theSize);
-
+
if (result == noErr) {
#ifndef __LP64__
if (inProp.mPropertyID == kAudioUnitProperty_CurrentPreset && currentPreset.presetName)
diff --git a/libs/appleutility/CoreAudio/AudioUnits/AUPublic/AUCarbonViewBase/AUCarbonViewControl.h b/libs/appleutility/CoreAudio/AudioUnits/AUPublic/AUCarbonViewBase/AUCarbonViewControl.h
index 3d5f975614..b22e992ede 100644
--- a/libs/appleutility/CoreAudio/AudioUnits/AUPublic/AUCarbonViewBase/AUCarbonViewControl.h
+++ b/libs/appleutility/CoreAudio/AudioUnits/AUPublic/AUCarbonViewBase/AUCarbonViewControl.h
@@ -2,14 +2,14 @@
File: AUCarbonViewControl.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 __AUCarbonViewControl_h__
#define __AUCarbonViewControl_h__
@@ -69,7 +69,7 @@ public:
kTypeDiscrete, // e.g. pop-up menu
kTypeText
};
-
+
AUCarbonViewControl(AUCarbonViewBase *ownerView, AUParameterListenerRef listener, ControlType type, const CAAUParameter &param, ControlRef control);
~AUCarbonViewControl();
@@ -80,7 +80,7 @@ public:
virtual void ControlToParameter();
/*! @method ParameterToControl */
virtual void ParameterToControl(Float32 newValue);
-
+
/*! @method SetValueFract */
virtual void SetValueFract(double value);
/*! @method GetValueFract */
@@ -93,34 +93,34 @@ public:
virtual void SetValue(long value);
/*! @method GetValue */
virtual long GetValue();
-
+
/*! @method GetOwnerView */
AUCarbonViewBase * GetOwnerView() {return mOwnerView;}
/*! @method Update */
- void Update (bool inUIThread)
- {
+ void Update (bool inUIThread)
+ {
if (inUIThread)
ParameterToControl (mParam.GetValue());
else
AUParameterListenerNotify (mListener, this, &mParam);
}
-
-
+
+
// CarbonEventHandler overrides
/*! @method HandleEvent */
virtual bool HandleEvent(EventHandlerCallRef inHandlerRef, EventRef event);
-
+
/*! @method ControlRef */
operator ControlRef() { return mControl; }
-
+
/*! @method SizeControlToFit */
static Boolean SizeControlToFit(ControlRef inControl, SInt16 *outWidth = NULL, SInt16 *outHeight = NULL);
-
+
/*! @method SliderTrackProc */
static pascal void SliderTrackProc(ControlRef theControl, ControlPartCode partCode);
/*! @method NumericKeyFilterCallback */
- static pascal ControlKeyFilterResult NumericKeyFilterCallback(ControlRef theControl, SInt16 *keyCode, SInt16 *charCode,
+ static pascal ControlKeyFilterResult NumericKeyFilterCallback(ControlRef theControl, SInt16 *keyCode, SInt16 *charCode,
EventModifiers *modifiers);
protected:
/*! @method ParamInfo */
@@ -137,12 +137,12 @@ protected:
/*! @var mControl */
ControlRef mControl;
-
+
/*! @method StdKeyFilterCallback */
- static pascal ControlKeyFilterResult StdKeyFilterCallback(ControlRef theControl, SInt16 *keyCode, SInt16 *charCode,
+ static pascal ControlKeyFilterResult StdKeyFilterCallback(ControlRef theControl, SInt16 *keyCode, SInt16 *charCode,
EventModifiers *modifiers);
SInt16 mInControlInitialization;
-
+
static AUCarbonViewControl* mLastControl;
};
@@ -151,34 +151,34 @@ class AUPropertyControl : public CarbonEventHandler {
public:
/*! @ctor AUPropertyControl */
AUPropertyControl (AUCarbonViewBase * inBase) : mControl(0), mView (inBase), mHeight(0) {}
-
+
/*! @method HandleEvent */
virtual bool HandleEvent(EventHandlerCallRef inHandlerRef, EventRef event);
/*! @method HandlePropertyChange */
virtual bool HandlePropertyChange (const AudioUnitProperty &inProp) = 0;
-
+
/*! @method AddInterest */
virtual void AddInterest (AUEventListenerRef inListener,
void * inObject) = 0;
-
+
/*! @method RemoveInterest */
virtual void RemoveInterest (AUEventListenerRef inListener,
void * inObject) = 0;
-
+
/*! @method GetHeight */
int GetHeight() { return mHeight;}
-
+
protected:
/*! @method HandleControlChange */
- virtual void HandleControlChange () = 0;
+ virtual void HandleControlChange () = 0;
/*! @method RegisterEvents */
void RegisterEvents ();
/*! @method EmbedControl */
void EmbedControl (ControlRef theControl);
-
+
/*! @method GetCarbonWindow */
WindowRef GetCarbonWindow();
@@ -194,30 +194,30 @@ protected:
class AUVPresets : public AUPropertyControl {
public:
/*! @ctor HandleControlChange */
- AUVPresets (AUCarbonViewBase * inBase,
+ AUVPresets (AUCarbonViewBase * inBase,
CFArrayRef& inPresets,
- Point inLocation,
- int nameWidth,
- int controlWidth,
+ Point inLocation,
+ int nameWidth,
+ int controlWidth,
ControlFontStyleRec & inFontStyle);
virtual ~AUVPresets () { CFRelease (mPresets); }
/*! @method HandlePropertyChange */
virtual bool HandlePropertyChange (const AudioUnitProperty &inProp);
-
+
/*! @method AddInterest */
virtual void AddInterest (AUEventListenerRef inListener,
void * inObject);
-
+
/*! @method RemoveInterest */
virtual void RemoveInterest (AUEventListenerRef inListener,
void * inObject);
protected:
/*! @method HandleControlChange */
- virtual void HandleControlChange ();
-
+ virtual void HandleControlChange ();
+
/*! @var mPresets */
CFArrayRef mPresets;
/*! @var mView */
diff --git a/libs/appleutility/CoreAudio/AudioUnits/AUPublic/AUCarbonViewBase/AUCarbonViewDispatch.cpp b/libs/appleutility/CoreAudio/AudioUnits/AUPublic/AUCarbonViewBase/AUCarbonViewDispatch.cpp
index 15a04e827e..2762a675d1 100644
--- a/libs/appleutility/CoreAudio/AudioUnits/AUPublic/AUCarbonViewBase/AUCarbonViewDispatch.cpp
+++ b/libs/appleutility/CoreAudio/AudioUnits/AUPublic/AUCarbonViewBase/AUCarbonViewDispatch.cpp
@@ -2,14 +2,14 @@
File: AUCarbonViewDispatch.cpp
Abstract: AUCarbonViewDispatch.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 "AUCarbonViewBase.h"
@@ -93,7 +93,7 @@ OSStatus AUCarbonViewBase::ComponentEntryDispatch(ComponentParameters *p, AUCar
if (This == NULL) return paramErr;
OSStatus result = noErr;
-
+
switch (p->what) {
case kAudioUnitCarbonViewCreateSelect:
{
@@ -104,7 +104,7 @@ OSStatus AUCarbonViewBase::ComponentEntryDispatch(ComponentParameters *p, AUCar
CheckNull(pb->inSize);
CheckNull(pb->inLocation);
CheckNull(pb->outControl);
- result = This->CreateCarbonView(pb->inAudioUnit, pb->inWindow, pb->inParentControl,
+ result = This->CreateCarbonView(pb->inAudioUnit, pb->inWindow, pb->inParentControl,
*pb->inLocation, *pb->inSize, *pb->outControl);
}
break;
@@ -116,7 +116,7 @@ OSStatus AUCarbonViewBase::ComponentEntryDispatch(ComponentParameters *p, AUCar
}
break;
#endif
-
+
default:
result = ComponentBase::ComponentEntryDispatch(p, This);
break;
diff --git a/libs/appleutility/CoreAudio/AudioUnits/AUPublic/AUCarbonViewBase/AUControlGroup.cpp b/libs/appleutility/CoreAudio/AudioUnits/AUPublic/AUCarbonViewBase/AUControlGroup.cpp
index 8976b401c0..d0b7b4107a 100644
--- a/libs/appleutility/CoreAudio/AudioUnits/AUPublic/AUCarbonViewBase/AUControlGroup.cpp
+++ b/libs/appleutility/CoreAudio/AudioUnits/AUPublic/AUCarbonViewBase/AUControlGroup.cpp
@@ -2,14 +2,14 @@
File: AUControlGroup.cpp
Abstract: AUControlGroup.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 <Carbon/Carbon.h>
#include "AUCarbonViewBase.h"
@@ -59,10 +59,10 @@ static bool sLocalized = false;
#endif
void AUControlGroup::CreateLabelledSlider(
- AUCarbonViewBase * auView,
- const CAAUParameter & auvp,
- const Rect & area,
- Point labelSize,
+ AUCarbonViewBase * auView,
+ const CAAUParameter & auvp,
+ const Rect & area,
+ Point labelSize,
const ControlFontStyleRec & inFontStyle)
{
#if !__LP64__
@@ -73,14 +73,14 @@ void AUControlGroup::CreateLabelledSlider(
CFStringRef cfstr;
int sliderValueMax, sliderValueMin, sliderValueDefault;
AUCarbonViewControl::ControlType sliderType;
-
+
bool horizontal = (width > height);
if (horizontal) {
maxValRect.top = minValRect.top = area.top + (height - labelSize.v) / 2;
minValRect.left = area.left;
maxValRect.left = area.right - labelSize.h;
-
+
minValRect.bottom = minValRect.top + labelSize.v;
minValRect.right = minValRect.left + labelSize.h;
maxValRect.bottom = maxValRect.top + labelSize.v;
@@ -104,12 +104,12 @@ void AUControlGroup::CreateLabelledSlider(
maxValRect.left = minValRect.left = area.left + (width - labelSize.h) / 2;
maxValRect.top = area.top;
minValRect.top = area.bottom - labelSize.v;
-
+
minValRect.bottom = minValRect.top + labelSize.v;
minValRect.right = minValRect.left + labelSize.h;
maxValRect.bottom = maxValRect.top + labelSize.v;
maxValRect.right = maxValRect.left + labelSize.h;
-
+
sliderRect.left = area.left + (width - kSliderThinDimension) / 2;
sliderRect.right = sliderRect.left + kSliderThinDimension + 4;
sliderRect.top = maxValRect.bottom + kLabelAndSliderSpacing;
@@ -117,7 +117,7 @@ void AUControlGroup::CreateLabelledSlider(
if (auvp.IsIndexedParam ()) {
sliderValueMin = sliderValueDefault = int(auvp.ParamInfo().minValue);
- sliderValueMax = int(auvp.ParamInfo().maxValue);
+ sliderValueMax = int(auvp.ParamInfo().maxValue);
sliderType = AUCarbonViewControl::kTypeDiscrete;
} else {
sliderValueMin = sliderValueDefault = 0;
@@ -134,7 +134,7 @@ void AUControlGroup::CreateLabelledSlider(
verify_noerr(CreateStaticTextControl(auView->GetCarbonWindow(), &minValRect, cfstr, &fontStyle, &newControl));
CFRelease(cfstr);
verify_noerr(auView->EmbedControl(newControl));
-
+
// maximum value label
cfstr = auvp.GetStringFromValueCopy(&auvp.ParamInfo().maxValue);
fontStyle.just = horizontal ? teFlushLeft : teCenter;
@@ -142,7 +142,7 @@ void AUControlGroup::CreateLabelledSlider(
CFRelease(cfstr);
verify_noerr(auView->EmbedControl(newControl));
}
-
+
// slider
verify_noerr(CreateSliderControl(auView->GetCarbonWindow(), &sliderRect, sliderValueDefault, sliderValueMin, sliderValueMax, kControlSliderDoesNotPoint, 0, true, AUCarbonViewControl::SliderTrackProc, &newControl));
@@ -154,10 +154,10 @@ void AUControlGroup::CreateLabelledSlider(
}
void AUControlGroup::CreateLabelledSliderAndEditText(
- AUCarbonViewBase * auView,
- const CAAUParameter & auvp,
- const Rect & area,
- Point labelSize,
+ AUCarbonViewBase * auView,
+ const CAAUParameter & auvp,
+ const Rect & area,
+ Point labelSize,
Point editTextSize,
const ControlFontStyleRec & inFontStyle)
{
@@ -166,7 +166,7 @@ void AUControlGroup::CreateLabelledSliderAndEditText(
Rect sliderArea, textArea;
ControlRef newControl;
int width = area.right - area.left, height = area.bottom - area.top;
-
+
bool horizontal = (width > height);
sliderArea = area;
@@ -188,55 +188,55 @@ void AUControlGroup::CreateLabelledSliderAndEditText(
textArea.right = textArea.left + editTextSize.h;
}
CreateLabelledSlider(auView, auvp, sliderArea, labelSize, fontStyle);
-
- verify_noerr(CreateEditUnicodeTextControl(auView->GetCarbonWindow(), &textArea, CFSTR(""), false,
+
+ verify_noerr(CreateEditUnicodeTextControl(auView->GetCarbonWindow(), &textArea, CFSTR(""), false,
&fontStyle, &newControl));
auView->AddCarbonControl(AUCarbonViewControl::kTypeText, auvp, newControl);
#endif
}
-void AUControlGroup::CreatePopupMenu (AUCarbonViewBase * auView,
- const CAAUParameter & auvp,
- const Rect & area,
+void AUControlGroup::CreatePopupMenu (AUCarbonViewBase * auView,
+ const CAAUParameter & auvp,
+ const Rect & area,
const ControlFontStyleRec & inFontStyle,
const bool inSizeToFit)
{
#if !__LP64__
ControlRef thePopUp;
-
- verify_noerr(CreatePopupButtonControl (auView->GetCarbonWindow(), &area, NULL,
+
+ verify_noerr(CreatePopupButtonControl (auView->GetCarbonWindow(), &area, NULL,
-12345, // DON'T GET MENU FROM RESOURCE mMenuID
- FALSE, // variableWidth,
- 0, // titleWidth,
- 0, // titleJustification,
- 0, // titleStyle,
+ FALSE, // variableWidth,
+ 0, // titleWidth,
+ 0, // titleJustification,
+ 0, // titleStyle,
&thePopUp));
-
+
ControlSize small = kControlSizeSmall;
SetControlData(thePopUp, kControlEntireControl, kControlSizeTag, sizeof(ControlSize), &small);
-
+
MenuRef menuRef;
verify_noerr(CreateNewMenu( 1, 0, &menuRef));
-
+
for (int i = 0; i < auvp.GetNumIndexedParams(); ++i) {
verify_noerr(AppendMenuItemTextWithCFString (menuRef, auvp.GetParamName(i), kMenuItemAttrIgnoreMeta, 0, 0));
}
-
+
verify_noerr(SetControlData(thePopUp, 0, kControlPopupButtonMenuRefTag, sizeof(menuRef), &menuRef));
SetControl32BitMaximum(thePopUp, auvp.GetNumIndexedParams());
verify_noerr (SetControlFontStyle (thePopUp, &inFontStyle));
-
+
if (inSizeToFit) {
AUCarbonViewControl::SizeControlToFit(thePopUp);
}
-
+
auView->AddCarbonControl(AUCarbonViewControl::kTypeDiscrete, auvp, thePopUp);
#endif
}
-void AUControlGroup::AddAUInfo ( AUCarbonViewBase * auView,
- const Point & inLocation,
+void AUControlGroup::AddAUInfo ( AUCarbonViewBase * auView,
+ const Point & inLocation,
const SInt16 inRightOffset,
const SInt16 inTotalWidth)
{
@@ -245,14 +245,14 @@ void AUControlGroup::AddAUInfo ( AUCarbonViewBase * auView,
ComponentDescription desc;
Handle h1 = NewHandleClear(4);
OSStatus err = GetComponentInfo ((Component)auView->GetEditAudioUnit(), &desc, h1, 0, 0);
-
- if (err == noErr) {
+
+ if (err == noErr) {
// Get the manufacturer's name... look for the ':' character convention
HLock(h1);
char* ptr1 = *h1;
int len = *ptr1++;
char* displayStr = 0;
-
+
for (int i = 0; i < len; ++i) {
if (ptr1[i] == ':') { // found the name
ptr1[i++] = 0;
@@ -260,7 +260,7 @@ void AUControlGroup::AddAUInfo ( AUCarbonViewBase * auView,
break;
}
}
-
+
// localize as necessary:
if (!sLocalized) {
CFBundleRef mainBundle = CFBundleGetBundleWithIdentifier(kLocalizedStringBundle_AUView);
@@ -271,7 +271,7 @@ void AUControlGroup::AddAUInfo ( AUCarbonViewBase * auView,
sLocalized = true;
}
}
-
+
// display strings
ControlRef newControl;
Rect r;
@@ -279,7 +279,7 @@ void AUControlGroup::AddAUInfo ( AUCarbonViewBase * auView,
ControlFontStyleRec fontStyle;
fontStyle.flags = kControlUseFontMask | kControlUseJustMask;
fontStyle.font = kControlFontSmallBoldSystemFont;
-
+
// display manufacturer string
if (displayStr) {
CFMutableStringRef mfrstring = CFStringCreateMutable(NULL, 0);
@@ -291,15 +291,15 @@ void AUControlGroup::AddAUInfo ( AUCarbonViewBase * auView,
CFStringAppend(mfrstring, mfrname); // "Manufacturer: MFRName"
CFRelease (mfrname);
}
-
- r.left = inLocation.h + inRightOffset;
+
+ r.left = inLocation.h + inRightOffset;
r.right = inLocation.h + inTotalWidth - 28;
fontStyle.just = teFlushRight;
-
+
verify_noerr(CreateStaticTextControl(auView->GetCarbonWindow(), &r, mfrstring, &fontStyle, &newControl));
verify_noerr(auView->EmbedControl(newControl));
CFRelease (mfrstring);
-
+
//move displayStr ptr past the manu, to the name
// we move the characters down an index, because the handle doesn't have any room
// at the end for the \0
@@ -316,42 +316,42 @@ void AUControlGroup::AddAUInfo ( AUCarbonViewBase * auView,
displayStr[j] = displayStr[i];
++j; ++i;
} while (i < len);
-
+
displayStr[j] = 0;
}
-
+
// display AudioUnit string
r.left = inLocation.h; r.right = r.left + inRightOffset;
fontStyle.just = 0;
-
+
CFMutableStringRef cfstr = CFStringCreateMutable(NULL, 0);
CFStringAppend(cfstr, kAUViewLocalizedStringKey_AudioUnit); // "Audio Unit"
CFStringAppend(cfstr, kAUViewUnlocalizedString_TitleSeparator);
// "Audio Unit: "
-
+
CFStringRef auname = CFStringCreateWithCString(NULL, displayStr, kCFStringEncodingUTF8);
CFStringAppend(cfstr, auname); // "Audio Unit: AUName"
CFRelease (auname);
-
+
verify_noerr(CreateStaticTextControl(auView->GetCarbonWindow(), &r, cfstr, &fontStyle, &newControl));
-
+
// size text control correctly
Boolean bValue = false;
SetControlData(newControl, kControlEntireControl, 'stim' /* kControlStaticTextIsMultilineTag */, sizeof(Boolean), &bValue);
SInt16 baseLineOffset;
Rect bestRect;
- err = GetBestControlRect(newControl, &bestRect, &baseLineOffset);
+ err = GetBestControlRect(newControl, &bestRect, &baseLineOffset);
if (err == noErr)
{
int width = (bestRect.right - bestRect.left) + 1;
int height = (bestRect.bottom - bestRect.top) + 1;
SizeControl (newControl, width, height);
}
-
+
verify_noerr(auView->EmbedControl(newControl));
CFRelease (cfstr);
}
-
+
DisposeHandle (h1);
#endif
}
diff --git a/libs/appleutility/CoreAudio/AudioUnits/AUPublic/AUCarbonViewBase/AUControlGroup.h b/libs/appleutility/CoreAudio/AudioUnits/AUPublic/AUCarbonViewBase/AUControlGroup.h
index 0e16100d2a..89ef4f29b7 100644
--- a/libs/appleutility/CoreAudio/AudioUnits/AUPublic/AUCarbonViewBase/AUControlGroup.h
+++ b/libs/appleutility/CoreAudio/AudioUnits/AUPublic/AUCarbonViewBase/AUControlGroup.h
@@ -2,14 +2,14 @@
File: AUControlGroup.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 __AUControlGroup_h__
#define __AUControlGroup_h__
@@ -57,31 +57,31 @@ class CAAUParameter;
class AUControlGroup {
public:
/*! @method CreateLabelledSlider */
- static void CreateLabelledSlider( AUCarbonViewBase * auView,
- const CAAUParameter & auvp,
- const Rect & area,
- Point labelSize,
+ static void CreateLabelledSlider( AUCarbonViewBase * auView,
+ const CAAUParameter & auvp,
+ const Rect & area,
+ Point labelSize,
const ControlFontStyleRec & fontStyle);
/*! @method CreateLabelledSliderAndEditText */
static void CreateLabelledSliderAndEditText(
- AUCarbonViewBase * auView,
- const CAAUParameter & auvp,
- const Rect & area,
- Point labelSize,
+ AUCarbonViewBase * auView,
+ const CAAUParameter & auvp,
+ const Rect & area,
+ Point labelSize,
Point editTextSize,
const ControlFontStyleRec & fontStyle);
/*! @method CreatePopupMenu */
- static void CreatePopupMenu ( AUCarbonViewBase * auView,
- const CAAUParameter & auvp,
- const Rect & area,
+ static void CreatePopupMenu ( AUCarbonViewBase * auView,
+ const CAAUParameter & auvp,
+ const Rect & area,
const ControlFontStyleRec & inFontStyle,
const bool inSizeToFit = false);
/*! @method AddAUInfo */
- static void AddAUInfo ( AUCarbonViewBase * auView,
- const Point & inLocation,
+ static void AddAUInfo ( AUCarbonViewBase * auView,
+ const Point & inLocation,
const SInt16 inRightOffset,
const SInt16 inTotalWidth);
};
diff --git a/libs/appleutility/CoreAudio/AudioUnits/AUPublic/AUCarbonViewBase/CarbonEventHandler.cpp b/libs/appleutility/CoreAudio/AudioUnits/AUPublic/AUCarbonViewBase/CarbonEventHandler.cpp
index fe9a731d1d..c935e3351b 100644
--- a/libs/appleutility/CoreAudio/AudioUnits/AUPublic/AUCarbonViewBase/CarbonEventHandler.cpp
+++ b/libs/appleutility/CoreAudio/AudioUnits/AUPublic/AUCarbonViewBase/CarbonEventHandler.cpp
@@ -2,14 +2,14 @@
File: CarbonEventHandler.cpp
Abstract: CarbonEventHandler.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 "CarbonEventHandler.h"
@@ -65,22 +65,22 @@ CarbonEventHandler::~CarbonEventHandler()
int count = static_cast<int>(CFDictionaryGetCount(mHandlers));
EventHandlerRef *theHandlers = (EventHandlerRef*) malloc(count * sizeof(EventHandlerRef));
CFDictionaryGetKeysAndValues(mHandlers, NULL, (const void **)theHandlers);
-
+
for (int i = 0; i < count; i++)
RemoveEventHandler(theHandlers[i]);
CFDictionaryRemoveAllValues(mHandlers);
CFRelease (mHandlers);
free(theHandlers);
- }
+ }
}
void CarbonEventHandler::WantEventTypes(EventTargetRef target, UInt32 inNumTypes, const EventTypeSpec *inList)
{
if (mHandlers == NULL)
mHandlers = CFDictionaryCreateMutable(NULL, 0, NULL, NULL);
-
+
EventHandlerRef handler;
-
+
if (CFDictionaryGetValueIfPresent (mHandlers, target, (const void **)&handler)) // if there is already a handler for the target, add the type
verify_noerr(AddEventTypesToHandler(handler, inNumTypes, inList));
else {
diff --git a/libs/appleutility/CoreAudio/AudioUnits/AUPublic/AUCarbonViewBase/CarbonEventHandler.h b/libs/appleutility/CoreAudio/AudioUnits/AUPublic/AUCarbonViewBase/CarbonEventHandler.h
index 9225e1acd7..b3231a8182 100644
--- a/libs/appleutility/CoreAudio/AudioUnits/AUPublic/AUCarbonViewBase/CarbonEventHandler.h
+++ b/libs/appleutility/CoreAudio/AudioUnits/AUPublic/AUCarbonViewBase/CarbonEventHandler.h
@@ -2,14 +2,14 @@
File: CarbonEventHandler.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 __CarbonEventHandler_h__
#define __CarbonEventHandler_h__
@@ -56,7 +56,7 @@ public:
CarbonEventHandler();
/*! @dtor ~CarbonEventHandler */
virtual ~CarbonEventHandler();
-
+
/*! @method WantEventTypes */
virtual void WantEventTypes(EventTargetRef target, UInt32 inNumTypes, const EventTypeSpec *inList);
diff --git a/libs/appleutility/CoreAudio/AudioUnits/AUPublic/AUInstrumentBase/AUInstrumentBase.cpp b/libs/appleutility/CoreAudio/AudioUnits/AUPublic/AUInstrumentBase/AUInstrumentBase.cpp
index 1ce8b308b4..74336d92e0 100644
--- a/libs/appleutility/CoreAudio/AudioUnits/AUPublic/AUInstrumentBase/AUInstrumentBase.cpp
+++ b/libs/appleutility/CoreAudio/AudioUnits/AUPublic/AUInstrumentBase/AUInstrumentBase.cpp
@@ -2,14 +2,14 @@
File: AUInstrumentBase.cpp
Abstract: AUInstrumentBase.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 "AUInstrumentBase.h"
#include "AUMIDIDefs.h"
@@ -58,12 +58,12 @@
const UInt32 kEventQueueSize = 1024;
AUInstrumentBase::AUInstrumentBase(
- AudioComponentInstance inInstance,
+ AudioComponentInstance inInstance,
UInt32 numInputs,
UInt32 numOutputs,
UInt32 numGroups,
UInt32 numParts)
- : MusicDeviceBase(inInstance, numInputs, numOutputs, numGroups),
+ : MusicDeviceBase(inInstance, numInputs, numOutputs, numGroups),
mAbsoluteSampleFrame(0),
mEventQueue(kEventQueueSize),
mNumNotes(0),
@@ -79,7 +79,7 @@ AUInstrumentBase::AUInstrumentBase(
mFreeNotes.mState = kNoteState_Free;
SetWantsRenderThreadID(true);
}
-
+
AUInstrumentBase::~AUInstrumentBase()
{
@@ -100,12 +100,12 @@ AUElement * AUInstrumentBase::CreateElement(AudioUnitScope inScope, AudioUnitEle
return MusicDeviceBase::CreateElement(inScope, element);
}
-void AUInstrumentBase::CreateExtendedElements()
+void AUInstrumentBase::CreateExtendedElements()
{
Parts().Initialize(this, kAudioUnitScope_Part, mInitNumPartEls);
}
-AUScope * AUInstrumentBase::GetScopeExtended (AudioUnitScope inScope)
+AUScope * AUInstrumentBase::GetScopeExtended (AudioUnitScope inScope)
{
if (inScope == kAudioUnitScope_Part)
return &mPartScope;
@@ -122,7 +122,7 @@ void AUInstrumentBase::SetNotes(UInt32 inNumNotes, UInt32 inMaxActiveNotes, Syn
mMaxActiveNotes = inMaxActiveNotes;
mNoteSize = inNoteDataSize;
mNotes = inNotes;
-
+
for (UInt32 i=0; i<mNumNotes; ++i)
{
SynthNote *note = GetNote(i);
@@ -138,7 +138,7 @@ UInt32 AUInstrumentBase::CountActiveNotes()
for (UInt32 i=0; i<mNumNotes; ++i)
{
SynthNote *note = GetNote(i);
- if (note->GetState() <= kNoteState_Released)
+ if (note->GetState() <= kNoteState_Released)
sum++;
}
return sum;
@@ -165,16 +165,16 @@ OSStatus AUInstrumentBase::Initialize()
TO DO:
Currently ValidFormat will check and validate that the num channels is not being
changed if the AU doesn't support the SupportedNumChannels property - which is correct
-
+
What needs to happen here is that IFF the AU does support this property, (ie, the AU
can be configured to have different num channels than its original configuration) then
the state of the AU at Initialization needs to be validated.
-
+
This is work still to be done - see AUEffectBase for the kind of logic that needs to be applied here
*/
// override to call SetNotes
-
+
mNoteIDCounter = 128; // reset this every time we initialise
mAbsoluteSampleFrame = 0;
return noErr;
@@ -199,7 +199,7 @@ OSStatus AUInstrumentBase::Reset( AudioUnitScope inScope,
for (UInt32 i=0; i<mNumNotes; ++i)
{
SynthNote *note = GetNote(i);
- if (note->IsSounding())
+ if (note->IsSounding())
note->Kill(0);
note->ListRemove();
mFreeNotes.AddNote(note);
@@ -225,7 +225,7 @@ void AUInstrumentBase::PerformEvents(const AudioTimeStamp& inTimeStamp)
#endif
SynthEvent *event;
SynthGroupElement *group;
-
+
while ((event = mEventQueue.ReadItem()) != NULL)
{
#if DEBUG_PRINT_RENDER
@@ -270,12 +270,12 @@ void AUInstrumentBase::PerformEvents(const AudioTimeStamp& inTimeStamp)
group->ResetAllControllers(event->GetOffsetSampleFrame());
break;
}
-
+
mEventQueue.AdvanceReadPtr();
}
}
-
+
OSStatus AUInstrumentBase::Render( AudioUnitRenderActionFlags & ioActionFlags,
const AudioTimeStamp & inTimeStamp,
UInt32 inNumberFrames)
@@ -311,18 +311,18 @@ OSStatus AUInstrumentBase::Render( AudioUnitRenderActionFlags & ioActionFlag
bool AUInstrumentBase::ValidFormat( AudioUnitScope inScope,
AudioUnitElement inElement,
const CAStreamBasicDescription & inNewFormat)
-{
+{
// if the AU supports this, then we should just let this go through to the Init call
- if (SupportedNumChannels (NULL))
+ if (SupportedNumChannels (NULL))
return MusicDeviceBase::ValidFormat(inScope, inElement, inNewFormat);
bool isGood = MusicDeviceBase::ValidFormat (inScope, inElement, inNewFormat);
if (!isGood) return false;
-
+
// if we get to here, then the basic criteria is that the
// num channels cannot change on an existing bus
AUIOElement *el = GetIOElement (inScope, inElement);
- return (el->GetStreamFormat().NumberChannels() == inNewFormat.NumberChannels());
+ return (el->GetStreamFormat().NumberChannels() == inNewFormat.NumberChannels());
}
@@ -333,8 +333,8 @@ bool AUInstrumentBase::StreamFormatWritable( AudioUnitScope scope,
}
OSStatus AUInstrumentBase::RealTimeStartNote( SynthGroupElement *inGroup,
- NoteInstanceID inNoteInstanceID,
- UInt32 inOffsetSampleFrame,
+ NoteInstanceID inNoteInstanceID,
+ UInt32 inOffsetSampleFrame,
const MusicDeviceNoteParams &inParams)
{
return noErr;
@@ -358,10 +358,10 @@ SynthGroupElement * AUInstrumentBase::GetElForGroupID (MusicDeviceGroupID inGrou
AUScope & groups = Groups();
unsigned int numEls = groups.GetNumberOfElements();
SynthGroupElement* unassignedEl = NULL;
-
+
for (unsigned int i = 0; i < numEls; ++i) {
SynthGroupElement* el = reinterpret_cast<SynthGroupElement*>(groups.GetElement(i));
- if (el->GroupID() == inGroupID)
+ if (el->GroupID() == inGroupID)
return el;
if (el->GroupID() == SynthGroupElement::kUnassignedGroup) {
unassignedEl = el;
@@ -376,14 +376,14 @@ SynthGroupElement * AUInstrumentBase::GetElForGroupID (MusicDeviceGroupID inGrou
}
OSStatus AUInstrumentBase::RealTimeStopNote(
- MusicDeviceGroupID inGroupID,
- NoteInstanceID inNoteInstanceID,
+ MusicDeviceGroupID inGroupID,
+ NoteInstanceID inNoteInstanceID,
UInt32 inOffsetSampleFrame)
{
#if DEBUG_PRINT
printf("AUInstrumentBase::RealTimeStopNote ch %d id %d\n", inGroupID, inNoteInstanceID);
#endif
-
+
SynthGroupElement *gp = (inGroupID == kMusicNoteEvent_Unused
? GetElForNoteID (inNoteInstanceID)
: GetElForGroupID(inGroupID));
@@ -391,7 +391,7 @@ OSStatus AUInstrumentBase::RealTimeStopNote(
{
gp->NoteOff (inNoteInstanceID, inOffsetSampleFrame);
}
-
+
return noErr;
}
@@ -402,7 +402,7 @@ SynthGroupElement * AUInstrumentBase::GetElForNoteID (NoteInstanceID inNoteID)
#endif
AUScope & groups = Groups();
unsigned int numEls = groups.GetNumberOfElements();
-
+
for (unsigned int i = 0; i < numEls; ++i) {
SynthGroupElement* el = reinterpret_cast<SynthGroupElement*>(groups.GetElement(i));
if (el->GetNote(inNoteID) != NULL) // searches for any note state
@@ -411,27 +411,27 @@ SynthGroupElement * AUInstrumentBase::GetElForNoteID (NoteInstanceID inNoteID)
throw static_cast<OSStatus>(kAudioUnitErr_InvalidElement);
}
-OSStatus AUInstrumentBase::StartNote( MusicDeviceInstrumentID inInstrument,
- MusicDeviceGroupID inGroupID,
- NoteInstanceID * outNoteInstanceID,
- UInt32 inOffsetSampleFrame,
+OSStatus AUInstrumentBase::StartNote( MusicDeviceInstrumentID inInstrument,
+ MusicDeviceGroupID inGroupID,
+ NoteInstanceID * outNoteInstanceID,
+ UInt32 inOffsetSampleFrame,
const MusicDeviceNoteParams &inParams)
{
OSStatus err = noErr;
-
- NoteInstanceID noteID;
+
+ NoteInstanceID noteID;
if (outNoteInstanceID) {
noteID = NextNoteID();
*outNoteInstanceID = noteID;
} else
noteID = (UInt32)inParams.mPitch;
-
+
#if DEBUG_PRINT
printf("AUInstrumentBase::StartNote ch %u, key %u, offset %u\n", inGroupID, (unsigned) inParams.mPitch, inOffsetSampleFrame);
#endif
if (InRenderThread ())
- {
+ {
err = RealTimeStartNote(
GetElForGroupID(inGroupID),
noteID,
@@ -450,14 +450,14 @@ OSStatus AUInstrumentBase::StartNote( MusicDeviceInstrumentID inInstrument,
inOffsetSampleFrame,
&inParams
);
-
+
mEventQueue.AdvanceWritePtr();
}
return err;
}
-OSStatus AUInstrumentBase::StopNote( MusicDeviceGroupID inGroupID,
- NoteInstanceID inNoteInstanceID,
+OSStatus AUInstrumentBase::StopNote( MusicDeviceGroupID inGroupID,
+ NoteInstanceID inNoteInstanceID,
UInt32 inOffsetSampleFrame)
{
#if DEBUG_PRINT
@@ -466,7 +466,7 @@ OSStatus AUInstrumentBase::StopNote( MusicDeviceGroupID inGroupID,
OSStatus err = noErr;
if (InRenderThread ())
- {
+ {
err = RealTimeStopNote(
inGroupID,
inNoteInstanceID,
@@ -484,7 +484,7 @@ OSStatus AUInstrumentBase::StopNote( MusicDeviceGroupID inGroupID,
inOffsetSampleFrame,
NULL
);
-
+
mEventQueue.AdvanceWritePtr();
}
return err;
@@ -492,13 +492,13 @@ OSStatus AUInstrumentBase::StopNote( MusicDeviceGroupID inGroupID,
OSStatus AUInstrumentBase::SendPedalEvent(MusicDeviceGroupID inGroupID, UInt32 inEventType, UInt32 inOffsetSampleFrame)
{
-
+
if (InRenderThread ())
{
SynthGroupElement *group = GetElForGroupID(inGroupID);
if (!group)
return kAudioUnitErr_InvalidElement;
-
+
switch (inEventType)
{
case SynthEvent::kEventType_SustainOn :
@@ -532,7 +532,7 @@ OSStatus AUInstrumentBase::SendPedalEvent(MusicDeviceGroupID inGroupID, UInt32 i
if (!event) return -1; // queue full
event->Set(inEventType, inGroupID, 0, 0, NULL);
-
+
mEventQueue.AdvanceWritePtr();
}
return noErr;
@@ -576,7 +576,7 @@ OSStatus AUInstrumentBase::HandleControlChange( UInt8 inChannel,
}
return noErr;
}
-
+
OSStatus AUInstrumentBase::HandlePitchWheel( UInt8 inChannel,
UInt8 inPitch1, // LSB
UInt8 inPitch2, // MSB
@@ -592,7 +592,7 @@ OSStatus AUInstrumentBase::HandlePitchWheel( UInt8 inChannel,
return kAudioUnitErr_InvalidElement;
}
-
+
OSStatus AUInstrumentBase::HandleChannelPressure(UInt8 inChannel,
UInt8 inValue,
UInt32 inStartFrame)
@@ -647,13 +647,13 @@ OSStatus AUInstrumentBase::HandleResetAllControllers( UInt8 inChannel)
return SendPedalEvent (inChannel, SynthEvent::kEventType_ResetAllControllers, 0);
}
-
+
OSStatus AUInstrumentBase::HandleAllNotesOff( UInt8 inChannel)
{
return SendPedalEvent (inChannel, SynthEvent::kEventType_AllNotesOff, 0);
}
-
+
OSStatus AUInstrumentBase::HandleAllSoundOff( UInt8 inChannel)
{
return SendPedalEvent (inChannel, SynthEvent::kEventType_AllSoundOff, 0);
@@ -670,7 +670,7 @@ SynthNote* AUInstrumentBase::GetAFreeNote(UInt32 inFrame)
mFreeNotes.RemoveNote(note);
return note;
}
-
+
return VoiceStealing(inFrame, true);
}
@@ -724,13 +724,13 @@ SynthNote* AUInstrumentBase::VoiceStealing(UInt32 inFrame, bool inKillIt)
#if DEBUG_PRINT_NOTE
printf("no notes to steal????\n");
#endif
- return NULL; // It should be impossible to get here. It means there were no notes to kill in any state.
+ return NULL; // It should be impossible to get here. It means there were no notes to kill in any state.
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////
AUMonotimbralInstrumentBase::AUMonotimbralInstrumentBase(
- AudioComponentInstance inInstance,
+ AudioComponentInstance inInstance,
UInt32 numInputs,
UInt32 numOutputs,
UInt32 numGroups,
@@ -739,28 +739,28 @@ AUMonotimbralInstrumentBase::AUMonotimbralInstrumentBase(
{
}
-OSStatus AUMonotimbralInstrumentBase::RealTimeStartNote(
- SynthGroupElement *inGroup,
- NoteInstanceID inNoteInstanceID,
- UInt32 inOffsetSampleFrame,
+OSStatus AUMonotimbralInstrumentBase::RealTimeStartNote(
+ SynthGroupElement *inGroup,
+ NoteInstanceID inNoteInstanceID,
+ UInt32 inOffsetSampleFrame,
const MusicDeviceNoteParams &inParams)
{
#if DEBUG_PRINT_RENDER
printf("AUMonotimbralInstrumentBase::RealTimeStartNote %d\n", inNoteInstanceID);
#endif
- if (NumActiveNotes() + 1 > MaxActiveNotes())
+ if (NumActiveNotes() + 1 > MaxActiveNotes())
{
VoiceStealing(inOffsetSampleFrame, false);
}
SynthNote *note = GetAFreeNote(inOffsetSampleFrame);
if (!note) return -1;
-
+
SynthPartElement *part = GetPartElement (0); // Only one part for monotimbral
-
+
IncNumActiveNotes();
inGroup->NoteOn(note, part, inNoteInstanceID, inOffsetSampleFrame, inParams);
-
+
return noErr;
}
@@ -774,8 +774,8 @@ OSStatus AUMultitimbralInstrumentBase::GetPropertyInfo(AudioUnitPropertyID inI
Boolean & outWritable)
{
OSStatus result = noErr;
-
- switch (inID)
+
+ switch (inID)
{
#if !TARGET_OS_IPHONE
case kMusicDeviceProperty_PartGroup:
@@ -797,7 +797,7 @@ OSStatus AUMultitimbralInstrumentBase::GetProperty( AudioUnitPropertyID inID,
{
OSStatus result = noErr;
- switch (inID)
+ switch (inID)
{
#if !TARGET_OS_IPHONE
case kMusicDeviceProperty_PartGroup:
@@ -809,7 +809,7 @@ OSStatus AUMultitimbralInstrumentBase::GetProperty( AudioUnitPropertyID inID,
default:
result = AUInstrumentBase::GetProperty (inID, inScope, inElement, outData);
}
-
+
return result;
}
@@ -823,7 +823,7 @@ OSStatus AUMultitimbralInstrumentBase::SetProperty( AudioUnitPropertyID in
{
OSStatus result = noErr;
- switch (inID)
+ switch (inID)
{
#if !TARGET_OS_IPHONE
case kMusicDeviceProperty_PartGroup:
@@ -835,7 +835,7 @@ OSStatus AUMultitimbralInstrumentBase::SetProperty( AudioUnitPropertyID in
default:
result = MusicDeviceBase::SetProperty (inID, inScope, inElement, inData, inDataSize);
}
-
+
return result;
}
diff --git a/libs/appleutility/CoreAudio/AudioUnits/AUPublic/AUInstrumentBase/AUInstrumentBase.h b/libs/appleutility/CoreAudio/AudioUnits/AUPublic/AUInstrumentBase/AUInstrumentBase.h
index 3ad7e03a66..7e3bfbf66c 100644
--- a/libs/appleutility/CoreAudio/AudioUnits/AUPublic/AUInstrumentBase/AUInstrumentBase.h
+++ b/libs/appleutility/CoreAudio/AudioUnits/AUPublic/AUInstrumentBase/AUInstrumentBase.h
@@ -2,14 +2,14 @@
File: AUInstrumentBase.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 __AUInstrumentBase__
#define __AUInstrumentBase__
@@ -66,7 +66,7 @@ class AUInstrumentBase : public MusicDeviceBase
{
public:
AUInstrumentBase(
- AudioComponentInstance inInstance,
+ AudioComponentInstance inInstance,
UInt32 numInputs,
UInt32 numOutputs,
UInt32 numGroups = 16,
@@ -74,7 +74,7 @@ public:
virtual ~AUInstrumentBase();
virtual OSStatus Initialize();
-
+
/*! @method Parts */
AUScope & Parts() { return mPartScope; }
@@ -92,10 +92,10 @@ public:
virtual void CreateExtendedElements();
virtual void Cleanup();
-
+
virtual OSStatus Reset( AudioUnitScope inScope,
AudioUnitElement inElement);
-
+
virtual bool ValidFormat( AudioUnitScope inScope,
AudioUnitElement inElement,
const CAStreamBasicDescription & inNewFormat);
@@ -109,35 +109,35 @@ public:
const AudioTimeStamp & inTimeStamp,
UInt32 inNumberFrames);
- virtual OSStatus StartNote( MusicDeviceInstrumentID inInstrument,
- MusicDeviceGroupID inGroupID,
- NoteInstanceID * outNoteInstanceID,
- UInt32 inOffsetSampleFrame,
+ virtual OSStatus StartNote( MusicDeviceInstrumentID inInstrument,
+ MusicDeviceGroupID inGroupID,
+ NoteInstanceID * outNoteInstanceID,
+ UInt32 inOffsetSampleFrame,
const MusicDeviceNoteParams &inParams);
- virtual OSStatus StopNote( MusicDeviceGroupID inGroupID,
- NoteInstanceID inNoteInstanceID,
+ virtual OSStatus StopNote( MusicDeviceGroupID inGroupID,
+ NoteInstanceID inNoteInstanceID,
UInt32 inOffsetSampleFrame);
virtual OSStatus RealTimeStartNote( SynthGroupElement *inGroup,
- NoteInstanceID inNoteInstanceID,
- UInt32 inOffsetSampleFrame,
+ NoteInstanceID inNoteInstanceID,
+ UInt32 inOffsetSampleFrame,
const MusicDeviceNoteParams &inParams);
-
- virtual OSStatus RealTimeStopNote( MusicDeviceGroupID inGroupID,
- NoteInstanceID inNoteInstanceID,
+
+ virtual OSStatus RealTimeStopNote( MusicDeviceGroupID inGroupID,
+ NoteInstanceID inNoteInstanceID,
UInt32 inOffsetSampleFrame);
-
+
virtual OSStatus HandleControlChange( UInt8 inChannel,
UInt8 inController,
UInt8 inValue,
UInt32 inStartFrame);
-
+
virtual OSStatus HandlePitchWheel( UInt8 inChannel,
UInt8 inPitch1,
UInt8 inPitch2,
UInt32 inStartFrame);
-
+
virtual OSStatus HandleChannelPressure( UInt8 inChannel,
UInt8 inValue,
UInt32 inStartFrame);
@@ -151,31 +151,31 @@ public:
UInt32 inStartFrame);
virtual OSStatus HandleResetAllControllers( UInt8 inChannel);
-
+
virtual OSStatus HandleAllNotesOff( UInt8 inChannel);
-
+
virtual OSStatus HandleAllSoundOff( UInt8 inChannel);
- SynthNote* GetNote(UInt32 inIndex)
- {
+ SynthNote* GetNote(UInt32 inIndex)
+ {
if (!mNotes)
throw std::runtime_error("no notes");
- return (SynthNote*)((char*)mNotes + inIndex * mNoteSize);
+ return (SynthNote*)((char*)mNotes + inIndex * mNoteSize);
}
-
+
SynthNote* GetAFreeNote(UInt32 inFrame);
void AddFreeNote(SynthNote* inNote);
-
+
friend class SynthGroupElement;
protected:
UInt32 NextNoteID() { return OSAtomicIncrement32((int32_t *)&mNoteIDCounter); }
-
-
- // call SetNotes in your Initialize() method to give the base class your note structures and to set the maximum
+
+
+ // call SetNotes in your Initialize() method to give the base class your note structures and to set the maximum
// number of active notes. inNoteData should be an array of size inMaxActiveNotes.
void SetNotes(UInt32 inNumNotes, UInt32 inMaxActiveNotes, SynthNote* inNotes, UInt32 inNoteSize);
-
+
void PerformEvents( const AudioTimeStamp & inTimeStamp);
OSStatus SendPedalEvent(MusicDeviceGroupID inGroupID, UInt32 inEventType, UInt32 inOffsetSampleFrame);
virtual SynthNote* VoiceStealing(UInt32 inFrame, bool inKillIt);
@@ -184,29 +184,29 @@ protected:
void IncNumActiveNotes() { ++mNumActiveNotes; }
void DecNumActiveNotes() { --mNumActiveNotes; }
UInt32 CountActiveNotes();
-
+
SynthPartElement * GetPartElement (AudioUnitElement inPartElement);
-
+
// this call throws if there's no assigned element for the group ID
virtual SynthGroupElement * GetElForGroupID (MusicDeviceGroupID inGroupID);
virtual SynthGroupElement * GetElForNoteID (NoteInstanceID inNoteID);
SInt64 mAbsoluteSampleFrame;
-
+
private:
-
+
SInt32 mNoteIDCounter;
-
+
SynthEventQueue mEventQueue;
-
+
UInt32 mNumNotes;
UInt32 mNumActiveNotes;
UInt32 mMaxActiveNotes;
- SynthNote* mNotes;
+ SynthNote* mNotes;
SynthNoteList mFreeNotes;
UInt32 mNoteSize;
-
+
AUScope mPartScope;
const UInt32 mInitNumPartEls;
};
@@ -217,15 +217,15 @@ class AUMonotimbralInstrumentBase : public AUInstrumentBase
{
public:
AUMonotimbralInstrumentBase(
- AudioComponentInstance inInstance,
+ AudioComponentInstance inInstance,
UInt32 numInputs,
UInt32 numOutputs,
UInt32 numGroups = 16,
UInt32 numParts = 1);
-
- virtual OSStatus RealTimeStartNote( SynthGroupElement *inGroup,
- NoteInstanceID inNoteInstanceID,
- UInt32 inOffsetSampleFrame,
+
+ virtual OSStatus RealTimeStartNote( SynthGroupElement *inGroup,
+ NoteInstanceID inNoteInstanceID,
+ UInt32 inOffsetSampleFrame,
const MusicDeviceNoteParams &inParams);
};
@@ -236,12 +236,12 @@ class AUMultitimbralInstrumentBase : public AUInstrumentBase
{
public:
AUMultitimbralInstrumentBase(
- AudioComponentInstance inInstance,
+ AudioComponentInstance inInstance,
UInt32 numInputs,
UInt32 numOutputs,
UInt32 numGroups,
UInt32 numParts);
-
+
virtual OSStatus GetPropertyInfo( AudioUnitPropertyID inID,
AudioUnitScope inScope,
AudioUnitElement inElement,
diff --git a/libs/appleutility/CoreAudio/AudioUnits/AUPublic/AUInstrumentBase/LockFreeFIFO.h b/libs/appleutility/CoreAudio/AudioUnits/AUPublic/AUInstrumentBase/LockFreeFIFO.h
index ea6c4c26e1..f9a0ec2dfe 100644
--- a/libs/appleutility/CoreAudio/AudioUnits/AUPublic/AUInstrumentBase/LockFreeFIFO.h
+++ b/libs/appleutility/CoreAudio/AudioUnits/AUPublic/AUInstrumentBase/LockFreeFIFO.h
@@ -2,14 +2,14 @@
File: LockFreeFIFO.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 <libkern/OSAtomic.h>
@@ -58,22 +58,22 @@ public:
mItems = new ITEM[inMaxSize];
mMask = inMaxSize - 1;
}
-
+
~LockFreeFIFOWithFree()
{
delete [] mItems;
}
-
- void Reset()
+
+ void Reset()
{
FreeItems();
mReadIndex = 0;
mWriteIndex = 0;
mFreeIndex = 0;
}
-
- ITEM* WriteItem()
+
+ ITEM* WriteItem()
{
//printf("WriteItem %d %d\n", mReadIndex, mWriteIndex);
FreeItems(); // free items on the write thread.
@@ -81,8 +81,8 @@ public:
if (nextWriteIndex == mFreeIndex) return NULL;
return &mItems[mWriteIndex];
}
-
- ITEM* ReadItem()
+
+ ITEM* ReadItem()
{
//printf("ReadItem %d %d\n", mReadIndex, mWriteIndex);
if (mReadIndex == mWriteIndex) return NULL;
@@ -91,14 +91,14 @@ public:
void AdvanceWritePtr() { OSAtomicCompareAndSwap32(mWriteIndex, (mWriteIndex + 1) & mMask, &mWriteIndex); }
void AdvanceReadPtr() { OSAtomicCompareAndSwap32(mReadIndex, (mReadIndex + 1) & mMask, &mReadIndex); }
private:
- ITEM* FreeItem()
+ ITEM* FreeItem()
{
if (mFreeIndex == mReadIndex) return NULL;
return &mItems[mFreeIndex];
}
void AdvanceFreePtr() { OSAtomicCompareAndSwap32(mFreeIndex, (mFreeIndex + 1) & mMask, &mFreeIndex); }
-
- void FreeItems()
+
+ void FreeItems()
{
ITEM* item;
while ((item = FreeItem()) != NULL)
@@ -107,7 +107,7 @@ private:
AdvanceFreePtr();
}
}
-
+
volatile int32_t mReadIndex, mWriteIndex, mFreeIndex;
int32_t mMask;
ITEM *mItems;
@@ -129,38 +129,38 @@ public:
mItems = new ITEM[inMaxSize];
mMask = inMaxSize - 1;
}
-
+
~LockFreeFIFO()
{
delete [] mItems;
}
-
- void Reset()
+
+ void Reset()
{
mReadIndex = 0;
mWriteIndex = 0;
}
-
- ITEM* WriteItem()
+
+ ITEM* WriteItem()
{
int32_t nextWriteIndex = (mWriteIndex + 1) & mMask;
if (nextWriteIndex == mReadIndex) return NULL;
return &mItems[mWriteIndex];
}
-
- ITEM* ReadItem()
+
+ ITEM* ReadItem()
{
if (mReadIndex == mWriteIndex) return NULL;
return &mItems[mReadIndex];
}
-
+
// the CompareAndSwap will always succeed. We use CompareAndSwap because it calls the PowerPC sync instruction,
// plus any processor bug workarounds for various CPUs.
void AdvanceWritePtr() { OSAtomicCompareAndSwap32(mWriteIndex, (mWriteIndex + 1) & mMask, &mWriteIndex); }
void AdvanceReadPtr() { OSAtomicCompareAndSwap32(mReadIndex, (mReadIndex + 1) & mMask, &mReadIndex); }
-
+
private:
-
+
volatile int32_t mReadIndex, mWriteIndex;
int32_t mMask;
ITEM *mItems;
diff --git a/libs/appleutility/CoreAudio/AudioUnits/AUPublic/AUInstrumentBase/MIDIControlHandler.h b/libs/appleutility/CoreAudio/AudioUnits/AUPublic/AUInstrumentBase/MIDIControlHandler.h
index 0f8003fcd5..408108c548 100644
--- a/libs/appleutility/CoreAudio/AudioUnits/AUPublic/AUInstrumentBase/MIDIControlHandler.h
+++ b/libs/appleutility/CoreAudio/AudioUnits/AUPublic/AUInstrumentBase/MIDIControlHandler.h
@@ -2,14 +2,14 @@
File: MIDIControlHandler.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 __MIDICONTROLHANDLER_H__
#define __MIDICONTROLHANDLER_H__
@@ -62,11 +62,11 @@ public:
virtual bool SetPolyPressure(UInt8 inKey, UInt8 inValue) = 0;
virtual bool SetController(UInt8 inControllerNumber, UInt8 inValue) = 0;
virtual bool SetSysex(void *inSysexMsg) = 0;
-
+
virtual float GetPitchBend() const = 0;
/*! Default controller values. These represent MSB values unless indicated in the name */
-
+
enum
{
kDefault_Midpoint = 0x40, //! Used for all center-null-point controllers
@@ -78,7 +78,7 @@ public:
kDefault_ChannelPressure = 0,
kDefault_ReverbSend = 40,
kDefault_ChorusSend = 0,
-
+
kDefault_RPN_LSB = 0x7f,
kDefault_RPN_MSB = 0x7f,
kDefault_PitchBendRange = 2,
diff --git a/libs/appleutility/CoreAudio/AudioUnits/AUPublic/AUInstrumentBase/SynthElement.cpp b/libs/appleutility/CoreAudio/AudioUnits/AUPublic/AUInstrumentBase/SynthElement.cpp
index fd329f84e8..cef3a50bf7 100644
--- a/libs/appleutility/CoreAudio/AudioUnits/AUPublic/AUInstrumentBase/SynthElement.cpp
+++ b/libs/appleutility/CoreAudio/AudioUnits/AUPublic/AUInstrumentBase/SynthElement.cpp
@@ -2,14 +2,14 @@
File: SynthElement.cpp
Abstract: SynthElement.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 "SynthElement.h"
#include "AUInstrumentBase.h"
@@ -78,7 +78,7 @@ void MidiControls::Reset()
}
-SynthElement::SynthElement(AUInstrumentBase *audioUnit, UInt32 inElement)
+SynthElement::SynthElement(AUInstrumentBase *audioUnit, UInt32 inElement)
: AUElement(audioUnit), mIndex(inElement)
{
}
@@ -87,7 +87,7 @@ SynthElement::~SynthElement()
{
}
-SynthGroupElement::SynthGroupElement(AUInstrumentBase *audioUnit, UInt32 inElement, MIDIControlHandler *inHandler)
+SynthGroupElement::SynthGroupElement(AUInstrumentBase *audioUnit, UInt32 inElement, MIDIControlHandler *inHandler)
: SynthElement(audioUnit, inElement),
mCurrentAbsoluteFrame(-1),
mMidiControlHandler(inHandler),
@@ -109,7 +109,7 @@ void SynthGroupElement::SetGroupID (MusicDeviceGroupID inGroup)
mGroupID = inGroup;
}
-void SynthGroupElement::Reset()
+void SynthGroupElement::Reset()
{
#if DEBUG_PRINT
printf("SynthGroupElement::Reset\n");
@@ -119,7 +119,7 @@ void SynthGroupElement::Reset()
mNoteList[i].Empty();
}
-SynthPartElement::SynthPartElement(AUInstrumentBase *audioUnit, UInt32 inElement)
+SynthPartElement::SynthPartElement(AUInstrumentBase *audioUnit, UInt32 inElement)
: SynthElement(audioUnit, inElement)
{
}
@@ -132,7 +132,7 @@ SynthNote *SynthGroupElement::GetNote(NoteInstanceID inNoteID, bool unreleasedOn
#if DEBUG_PRINT_RENDER
printf("SynthGroupElement::GetNote %d, unreleased = %d\n", inNoteID, unreleasedOnly);
#endif
- const UInt32 lastNoteState = unreleasedOnly ?
+ const UInt32 lastNoteState = unreleasedOnly ?
(mSostenutoIsOn ? kNoteState_Sostenutoed : kNoteState_Attacked)
: kNoteState_Released;
SynthNote *note = NULL;
@@ -176,7 +176,7 @@ void SynthGroupElement::NoteOn(SynthNote *note,
}
void SynthGroupElement::NoteOff(NoteInstanceID inNoteID, UInt32 inFrame)
-{
+{
#if DEBUG_PRINT_NOTE
printf("SynthGroupElement::NoteOff %d\n", inNoteID);
#endif
@@ -217,7 +217,7 @@ void SynthGroupElement::NoteEnded(SynthNote *inNote, UInt32 inFrame)
SynthNoteList *list = &mNoteList[inNote->GetState()];
list->RemoveNote(inNote);
}
-
+
GetAUInstrument()->AddFreeNote(inNote);
}
@@ -245,7 +245,7 @@ bool SynthGroupElement::ChannelMessage(UInt16 controllerID, UInt16 inValue)
// Sustain and sostenuto are "pedal events", and are handled during render cycle
if (controllerID <= kMidiController_RPN_MSB && controllerID != kMidiController_Sustain && controllerID != kMidiController_Sostenuto)
handled = mMidiControlHandler->SetController(controllerID, UInt8(inValue));
- else
+ else
{
switch (controllerID)
{
@@ -296,7 +296,7 @@ void SynthGroupElement::SostenutoOff(UInt32 inFrame)
mMidiControlHandler->SetController(kMidiController_Sostenuto, 0);
mSostenutoIsOn = false;
mNoteList[kNoteState_Attacked].TransferAllFrom(&mNoteList[kNoteState_Sostenutoed], inFrame);
- if (mSustainIsOn)
+ if (mSustainIsOn)
mNoteList[kNoteState_ReleasedButSustained].TransferAllFrom(&mNoteList[kNoteState_ReleasedButSostenutoed], inFrame);
else
mNoteList[kNoteState_Released].TransferAllFrom(&mNoteList[kNoteState_ReleasedButSostenutoed], inFrame);
@@ -323,7 +323,7 @@ void SynthGroupElement::SustainOff(UInt32 inFrame)
if (mSustainIsOn) {
mMidiControlHandler->SetController(kMidiController_Sustain, 0);
mSustainIsOn = false;
-
+
mNoteList[kNoteState_Released].TransferAllFrom(&mNoteList[kNoteState_ReleasedButSustained], inFrame);
}
}
@@ -342,14 +342,14 @@ void SynthGroupElement::AllNotesOff(UInt32 inFrame)
while (note)
{
SynthNote *nextNote = note->mNext;
-
+
mNoteList[i].RemoveNote(note);
note->Release(inFrame);
mNoteList[newState].AddNote(note);
-
+
note = nextNote;
}
- }
+ }
}
void SynthGroupElement::AllSoundOff(UInt32 inFrame)
@@ -358,21 +358,21 @@ void SynthGroupElement::AllSoundOff(UInt32 inFrame)
printf("SynthGroupElement::AllSoundOff\n");
#endif
SynthNote *note;
-
+
for (UInt32 i=0 ; i<kNumberOfActiveNoteStates; ++i)
{
note = mNoteList[i].mHead;
while (note)
{
SynthNote *nextNote = note->mNext;
-
+
mNoteList[i].RemoveNote(note);
note->FastRelease(inFrame);
mNoteList[kNoteState_FastReleased].AddNote(note);
GetAUInstrument()->DecNumActiveNotes();
note = nextNote;
}
- }
+ }
}
void SynthGroupElement::ResetAllControllers(UInt32 inFrame)
@@ -395,7 +395,7 @@ OSStatus SynthGroupElement::Render(SInt64 inAbsoluteSampleFrame, UInt32 inNumber
{
buffArray[outBus] = &GetAudioUnit()->GetOutput(outBus)->GetBufferList();
}
-
+
for (UInt32 i=0 ; i<kNumberOfSoundingNoteStates; ++i)
{
SynthNote *note = mNoteList[i].mHead;
@@ -405,10 +405,10 @@ OSStatus SynthGroupElement::Render(SInt64 inAbsoluteSampleFrame, UInt32 inNumber
printf("SynthGroupElement::Render: state %d, note %p\n", i, note);
#endif
SynthNote *nextNote = note->mNext;
-
+
OSStatus err = note->Render(inAbsoluteSampleFrame, inNumberFrames, buffArray, numOutputs);
if (err) return err;
-
+
note = nextNote;
}
}
diff --git a/libs/appleutility/CoreAudio/AudioUnits/AUPublic/AUInstrumentBase/SynthElement.h b/libs/appleutility/CoreAudio/AudioUnits/AUPublic/AUInstrumentBase/SynthElement.h
index 4ca3643106..8f844a5bf4 100644
--- a/libs/appleutility/CoreAudio/AudioUnits/AUPublic/AUInstrumentBase/SynthElement.h
+++ b/libs/appleutility/CoreAudio/AudioUnits/AUPublic/AUInstrumentBase/SynthElement.h
@@ -2,14 +2,14 @@
File: SynthElement.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 __SynthElement__
#define __SynthElement__
@@ -62,9 +62,9 @@ public:
virtual ~SynthElement();
UInt32 GetIndex() const { return mIndex; }
-
+
AUInstrumentBase* GetAUInstrument() { return (AUInstrumentBase*)GetAudioUnit(); }
-
+
private:
UInt32 mIndex;
};
@@ -98,11 +98,11 @@ public:
virtual float GetPitchBend() const { return mFPitchBend * mFPitchBendDepth; }
- SInt16 GetHiResControl(UInt32 inIndex) const
- {
+ SInt16 GetHiResControl(UInt32 inIndex) const
+ {
return ((mControls[inIndex] & 127) << 7) | (mControls[inIndex + 32] & 127);
}
-
+
float GetControl(UInt32 inIndex) const
{
if (inIndex < 32) {
@@ -111,10 +111,10 @@ public:
return (float)mControls[inIndex];
}
}
-
-
+
+
private:
-
+
UInt8 mControls[128];
UInt8 mPolyPressure[128];
UInt8 mMonoPressure;
@@ -124,17 +124,17 @@ private:
UInt16 mActiveNRPN;
UInt16 mActiveRPValue;
UInt16 mActiveNRPValue;
-
+
UInt16 mPitchBendDepth;
float mFPitchBendDepth;
float mFPitchBend;
-
+
void SetHiResControl(UInt32 inIndex, UInt8 inMSB, UInt8 inLSB)
- {
+ {
mControls[inIndex] = inMSB;
mControls[inIndex + 32] = inLSB;
}
-
+
};
@@ -144,7 +144,7 @@ public:
enum {
kUnassignedGroup = 0xFFFFFFFF
};
-
+
SynthGroupElement(AUInstrumentBase *audioUnit, UInt32 inElement, MIDIControlHandler *inHandler);
virtual ~SynthGroupElement();
@@ -157,27 +157,27 @@ public:
void NoteEnded(SynthNote *inNote, UInt32 inFrame);
void NoteFastReleased(SynthNote *inNote);
-
+
virtual bool ChannelMessage(UInt16 controlID, UInt16 controlValue);
virtual void AllNotesOff(UInt32 inFrame);
virtual void AllSoundOff(UInt32 inFrame);
void ResetAllControllers(UInt32 inFrame);
-
+
SynthNote * GetNote(NoteInstanceID inNoteID, bool unreleasedOnly=false, UInt32 *outNoteState=NULL);
-
+
void Reset();
-
+
virtual OSStatus Render(SInt64 inAbsoluteSampleFrame, UInt32 inNumberFrames, AUScope &outputs);
-
+
float GetPitchBend() const { return mMidiControlHandler->GetPitchBend(); }
SInt64 GetCurrentAbsoluteFrame() const { return mCurrentAbsoluteFrame; }
-
+
MusicDeviceGroupID GroupID () const { return mGroupID; }
virtual void SetGroupID (MusicDeviceGroupID inGroup);
MIDIControlHandler * GetMIDIControlHandler() const { return mMidiControlHandler; }
-
-protected:
+
+protected:
SInt64 mCurrentAbsoluteFrame;
SynthNoteList mNoteList[kNumberOfSoundingNoteStates];
MIDIControlHandler *mMidiControlHandler;
@@ -186,7 +186,7 @@ private:
friend class AUInstrumentBase;
friend class AUMonotimbralInstrumentBase;
friend class AUMultitimbralInstrumentBase;
-
+
bool mSustainIsOn;
bool mSostenutoIsOn;
UInt32 mOutputBus;
@@ -213,15 +213,15 @@ public:
UInt32 GetGroupIndex() const { return mGroupIndex; }
bool InRange(Float32 inNote, Float32 inVelocity);
-
+
UInt32 GetMaxPolyphony() const { return mMaxPolyphony; }
void SetMaxPolyphony(UInt32 inMaxPolyphony) { mMaxPolyphony = inMaxPolyphony; }
-
+
private:
UInt32 mGroupIndex;
UInt32 mPatchIndex;
UInt32 mMaxPolyphony;
- SynthKeyZone mKeyZone;
+ SynthKeyZone mKeyZone;
};
#endif
diff --git a/libs/appleutility/CoreAudio/AudioUnits/AUPublic/AUInstrumentBase/SynthEvent.h b/libs/appleutility/CoreAudio/AudioUnits/AUPublic/AUInstrumentBase/SynthEvent.h
index 9c27aee04f..abb7886b12 100644
--- a/libs/appleutility/CoreAudio/AudioUnits/AUPublic/AUInstrumentBase/SynthEvent.h
+++ b/libs/appleutility/CoreAudio/AudioUnits/AUPublic/AUInstrumentBase/SynthEvent.h
@@ -2,14 +2,14 @@
File: SynthEvent.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.
-
+
*/
/* You can either fill in code here or remove this and create or add new files. */
@@ -76,7 +76,7 @@ public:
SynthEvent() {}
~SynthEvent() {}
- void Set(
+ void Set(
UInt32 inEventType,
MusicDeviceGroupID inGroupID,
NoteInstanceID inNoteID,
@@ -88,20 +88,20 @@ public:
mGroupID = inGroupID;
mNoteID = inNoteID;
mOffsetSampleFrame = inOffsetSampleFrame;
-
+
if (inNoteParams)
{
- UInt32 paramSize = offsetof(MusicDeviceNoteParams, mControls) + (inNoteParams->argCount-2)*sizeof(NoteParamsControlValue);
- mNoteParams = inNoteParams->argCount > 3
- ? (MusicDeviceNoteParams*)malloc(paramSize)
+ UInt32 paramSize = offsetof(MusicDeviceNoteParams, mControls) + (inNoteParams->argCount-2)*sizeof(NoteParamsControlValue);
+ mNoteParams = inNoteParams->argCount > 3
+ ? (MusicDeviceNoteParams*)malloc(paramSize)
: &mSmallNoteParams;
memcpy(mNoteParams, inNoteParams, paramSize);
}
- else
+ else
mNoteParams = NULL;
}
-
-
+
+
void Free()
{
if (mNoteParams)
@@ -111,27 +111,27 @@ public:
mNoteParams = NULL;
}
}
-
+
UInt32 GetEventType() const { return mEventType; }
MusicDeviceGroupID GetGroupID() const { return mGroupID; }
NoteInstanceID GetNoteID() const { return mNoteID; }
UInt32 GetOffsetSampleFrame() const { return mOffsetSampleFrame; }
-
+
MusicDeviceNoteParams* GetParams() const { return mNoteParams; }
UInt32 GetArgCount() const { return mNoteParams->argCount; }
UInt32 NumberParameters() const { return mNoteParams->argCount - 2; }
-
+
Float32 GetNote() const { return mNoteParams->mPitch; }
Float32 GetVelocity() const { return mNoteParams->mVelocity; }
-
- NoteParamsControlValue GetParameter(UInt32 inIndex) const
+
+ NoteParamsControlValue GetParameter(UInt32 inIndex) const
{
- if (inIndex >= NumberParameters())
+ if (inIndex >= NumberParameters())
throw std::runtime_error("index out of range");
- return mNoteParams->mControls[inIndex];
+ return mNoteParams->mControls[inIndex];
}
-
+
private:
UInt32 mEventType;
MusicDeviceGroupID mGroupID;
diff --git a/libs/appleutility/CoreAudio/AudioUnits/AUPublic/AUInstrumentBase/SynthNote.cpp b/libs/appleutility/CoreAudio/AudioUnits/AUPublic/AUInstrumentBase/SynthNote.cpp
index 96a24d33c2..9ecced6b73 100644
--- a/libs/appleutility/CoreAudio/AudioUnits/AUPublic/AUInstrumentBase/SynthNote.cpp
+++ b/libs/appleutility/CoreAudio/AudioUnits/AUPublic/AUInstrumentBase/SynthNote.cpp
@@ -2,14 +2,14 @@
File: SynthNote.cpp
Abstract: SynthNote.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 "SynthNote.h"
#include "SynthElement.h"
@@ -51,9 +51,9 @@
bool SynthNote::AttackNote(
SynthPartElement * inPart,
SynthGroupElement * inGroup,
- NoteInstanceID inNoteID,
- UInt64 inAbsoluteSampleFrame,
- UInt32 inOffsetSampleFrame,
+ NoteInstanceID inNoteID,
+ UInt64 inAbsoluteSampleFrame,
+ UInt32 inOffsetSampleFrame,
const MusicDeviceNoteParams &inParams)
{
#if DEBUG_PRINT
@@ -70,8 +70,8 @@ bool SynthNote::AttackNote(
mPitch = inParams.mPitch;
mVelocity = inParams.mVelocity;
-
-
+
+
return Attack(inParams);
}
@@ -116,25 +116,25 @@ double SynthNote::SampleRate()
return GetAudioUnit()->GetOutput(0)->GetStreamFormat().mSampleRate;
}
-AUInstrumentBase* SynthNote::GetAudioUnit() const
-{
- return (AUInstrumentBase*)mGroup->GetAudioUnit();
+AUInstrumentBase* SynthNote::GetAudioUnit() const
+{
+ return (AUInstrumentBase*)mGroup->GetAudioUnit();
}
-Float32 SynthNote::GetGlobalParameter(AudioUnitParameterID inParamID) const
+Float32 SynthNote::GetGlobalParameter(AudioUnitParameterID inParamID) const
{
return mGroup->GetAudioUnit()->Globals()->GetParameter(inParamID);
}
-void SynthNote::NoteEnded(UInt32 inFrame)
-{
+void SynthNote::NoteEnded(UInt32 inFrame)
+{
mGroup->NoteEnded(this, inFrame);
- mNoteID = 0xFFFFFFFF;
+ mNoteID = 0xFFFFFFFF;
}
-float SynthNote::GetPitchBend() const
-{
- return mGroup->GetPitchBend();
+float SynthNote::GetPitchBend() const
+{
+ return mGroup->GetPitchBend();
}
diff --git a/libs/appleutility/CoreAudio/AudioUnits/AUPublic/AUInstrumentBase/SynthNote.h b/libs/appleutility/CoreAudio/AudioUnits/AUPublic/AUInstrumentBase/SynthNote.h
index cec6377217..89179b14f4 100644
--- a/libs/appleutility/CoreAudio/AudioUnits/AUPublic/AUInstrumentBase/SynthNote.h
+++ b/libs/appleutility/CoreAudio/AudioUnits/AUPublic/AUInstrumentBase/SynthNote.h
@@ -2,14 +2,14 @@
File: SynthNote.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 __SynthNote__
#define __SynthNote__
@@ -84,7 +84,7 @@ enum SynthNoteState {
end of note any state free
soft voice stealing any state fast released
hard voice stealing any state free
-
+
soft voice stealing happens when there is a note on event and NumActiveNotes > MaxActiveNotes
hard voice stealing happens when there is a note on event and NumActiveNotes == NumNotes (no free notes)
voice stealing removes the quietest note in the highest numbered state that has sounding notes.
@@ -108,20 +108,20 @@ struct SynthNote
mVelocity(0.0f)
{
}
-
+
virtual ~SynthNote() {}
-
+
virtual void Reset();
//! Returns true if active note resulted from this call, otherwise false
virtual bool AttackNote(
SynthPartElement * inPart,
SynthGroupElement * inGroup,
- NoteInstanceID inNoteID,
- UInt64 inAbsoluteSampleFrame,
- UInt32 inOffsetSampleFrame,
+ NoteInstanceID inNoteID,
+ UInt64 inAbsoluteSampleFrame,
+ UInt32 inOffsetSampleFrame,
const MusicDeviceNoteParams &inParams
);
-
+
virtual OSStatus Render(UInt64 inAbsoluteSampleFrame, UInt32 inNumFrames, AudioBufferList** inBufferList, UInt32 inOutBusCount) = 0;
//! Returns true if active note resulted from this call, otherwise false
virtual bool Attack(const MusicDeviceNoteParams &inParams) = 0;
@@ -134,7 +134,7 @@ struct SynthNote
SynthGroupElement* GetGroup() const { return mGroup; }
SynthPartElement* GetPart() const { return mPart; }
-
+
AUInstrumentBase* GetAudioUnit() const;
Float32 GetGlobalParameter(AudioUnitParameterID inParamID) const;
@@ -143,7 +143,7 @@ struct SynthNote
SynthNoteState GetState() const { return mState; }
UInt8 GetMidiKey() const { return (UInt8) mPitch; }
UInt8 GetMidiVelocity() const { return (UInt8) mVelocity; }
-
+
Boolean IsSounding() const { return mState < kNumberOfSoundingNoteStates; }
Boolean IsActive() const { return mState < kNumberOfActiveNoteStates; }
UInt64 GetAbsoluteStartFrame() const { return mAbsoluteStartFrame; }
@@ -155,7 +155,7 @@ struct SynthNote
float GetPitchBend() const;
double TuningA() const;
-
+
Float32 GetPitch() const { return mPitch; } // returns raw pitch from MusicDeviceNoteParams
virtual double Frequency(); // returns the frequency of note + pitch bend.
virtual double SampleRate();
@@ -163,7 +163,7 @@ struct SynthNote
// linked list pointers
SynthNote *mPrev;
SynthNote *mNext;
-
+
friend class SynthGroupElement;
friend struct SynthNoteList;
protected:
@@ -171,14 +171,14 @@ protected:
private:
SynthPartElement* mPart;
SynthGroupElement* mGroup;
-
+
NoteInstanceID mNoteID;
SynthNoteState mState;
UInt64 mAbsoluteStartFrame;
SInt32 mRelativeStartFrame;
SInt32 mRelativeReleaseFrame;
SInt32 mRelativeKillFrame;
-
+
Float32 mPitch;
Float32 mVelocity;
};
diff --git a/libs/appleutility/CoreAudio/AudioUnits/AUPublic/AUInstrumentBase/SynthNoteList.cpp b/libs/appleutility/CoreAudio/AudioUnits/AUPublic/AUInstrumentBase/SynthNoteList.cpp
index 849abd266b..7e49da970e 100644
--- a/libs/appleutility/CoreAudio/AudioUnits/AUPublic/AUInstrumentBase/SynthNoteList.cpp
+++ b/libs/appleutility/CoreAudio/AudioUnits/AUPublic/AUInstrumentBase/SynthNoteList.cpp
@@ -2,14 +2,14 @@
File: SynthNoteList.cpp
Abstract: SynthNoteList.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 "SynthNoteList.h"
#include <stdexcept>
@@ -52,23 +52,23 @@ void SynthNoteList::SanityCheck() const
if (mState >= kNoteState_Unset) {
throw std::runtime_error("SanityCheck: mState is bad");
}
-
+
if (mHead == NULL) {
- if (mTail != NULL)
+ if (mTail != NULL)
throw std::runtime_error("SanityCheck: mHead is NULL but not mTail");
return;
}
if (mTail == NULL) {
throw std::runtime_error("SanityCheck: mTail is NULL but not mHead");
}
-
+
if (mHead->mPrev) {
throw std::runtime_error("SanityCheck: mHead has a mPrev");
}
if (mTail->mNext) {
throw std::runtime_error("SanityCheck: mTail has a mNext");
}
-
+
SynthNote *note = mHead;
while (note)
{
diff --git a/libs/appleutility/CoreAudio/AudioUnits/AUPublic/AUInstrumentBase/SynthNoteList.h b/libs/appleutility/CoreAudio/AudioUnits/AUPublic/AUInstrumentBase/SynthNoteList.h
index 47a3593018..6718f18530 100644
--- a/libs/appleutility/CoreAudio/AudioUnits/AUPublic/AUInstrumentBase/SynthNoteList.h
+++ b/libs/appleutility/CoreAudio/AudioUnits/AUPublic/AUInstrumentBase/SynthNoteList.h
@@ -2,14 +2,14 @@
File: SynthNoteList.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 __SynthNoteList__
#define __SynthNoteList__
@@ -61,26 +61,26 @@
struct SynthNoteList
{
SynthNoteList() : mState(kNoteState_Unset), mHead(0), mTail(0) {}
-
+
bool NotEmpty() const { return mHead != NULL; }
bool IsEmpty() const { return mHead == NULL; }
- void Empty() {
+ void Empty() {
#if USE_SANITY_CHECK
SanityCheck();
#endif
- mHead = mTail = NULL;
+ mHead = mTail = NULL;
}
-
+
UInt32 Length() const {
#if USE_SANITY_CHECK
SanityCheck();
#endif
UInt32 length = 0;
- for (SynthNote* note = mHead; note; note = note->mNext)
+ for (SynthNote* note = mHead; note; note = note->mNext)
length++;
return length;
};
-
+
void AddNote(SynthNote *inNote)
{
#if DEBUG_PRINT
@@ -92,14 +92,14 @@ struct SynthNoteList
inNote->SetState(mState);
inNote->mNext = mHead;
inNote->mPrev = NULL;
-
+
if (mHead) { mHead->mPrev = inNote; mHead = inNote; }
else mHead = mTail = inNote;
#if USE_SANITY_CHECK
SanityCheck();
#endif
}
-
+
void RemoveNote(SynthNote *inNote)
{
#if DEBUG_PRINT
@@ -113,7 +113,7 @@ struct SynthNoteList
if (inNote->mNext) inNote->mNext->mPrev = inNote->mPrev;
else mTail = inNote->mPrev;
-
+
inNote->mPrev = 0;
inNote->mNext = 0;
#if USE_SANITY_CHECK
@@ -131,7 +131,7 @@ struct SynthNoteList
inNoteList->SanityCheck();
#endif
if (!inNoteList->mTail) return;
-
+
if (mState == kNoteState_Released)
{
for (SynthNote* note = inNoteList->mHead; note; note = note->mNext)
@@ -150,14 +150,14 @@ struct SynthNoteList
note->SetState(mState);
}
}
-
+
inNoteList->mTail->mNext = mHead;
-
+
if (mHead) mHead->mPrev = inNoteList->mTail;
else mTail = inNoteList->mTail;
-
+
mHead = inNoteList->mHead;
-
+
inNoteList->mHead = NULL;
inNoteList->mTail = NULL;
#if USE_SANITY_CHECK
@@ -165,7 +165,7 @@ struct SynthNoteList
inNoteList->SanityCheck();
#endif
}
-
+
SynthNote* FindOldestNote()
{
#if DEBUG_PRINT
@@ -186,7 +186,7 @@ struct SynthNoteList
}
return oldestNote;
}
-
+
SynthNote* FindMostQuietNote()
{
#if DEBUG_PRINT
@@ -219,9 +219,9 @@ struct SynthNoteList
#endif
return mostQuietNote;
}
-
+
void SanityCheck() const;
-
+
SynthNoteState mState;
SynthNote * mHead;
SynthNote * mTail;
diff --git a/libs/appleutility/CoreAudio/AudioUnits/AUPublic/AUViewBase/AUViewLocalizedStringKeys.h b/libs/appleutility/CoreAudio/AudioUnits/AUPublic/AUViewBase/AUViewLocalizedStringKeys.h
index 741be00fe0..995b9fb1f3 100644
--- a/libs/appleutility/CoreAudio/AudioUnits/AUPublic/AUViewBase/AUViewLocalizedStringKeys.h
+++ b/libs/appleutility/CoreAudio/AudioUnits/AUPublic/AUViewBase/AUViewLocalizedStringKeys.h
@@ -2,14 +2,14 @@
File: AUViewLocalizedStringKeys.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 __AUViewLocalizedStringKeys_h__
#define __AUViewLocalizedStringKeys_h__
@@ -53,27 +53,27 @@
// UNLOCALIZED STRINGS:
#define kAUViewUnlocalizedString_TitleSeparator CFSTR(": ")
-
+
// Generic View:
#define kAUViewLocalizedStringKey_AudioUnit CFSTR("Audio Unit")
#define kAUViewLocalizedStringKey_Manufacturer CFSTR("Manufacturer")
-
+
#define kAUViewLocalizedStringKey_FactoryPreset CFSTR("Factory Preset")
-
+
#define kAUViewLocalizedStringKey_Properties CFSTR("Properties")
#define kAUViewLocalizedStringKey_Parameters CFSTR("Parameters")
-
+
#define kAUViewLocalizedStringKey_Standard CFSTR("Standard")
#define kAUViewLocalizedStringKey_Expert CFSTR("Expert")
-
+
// AULoadCPU:
#define kAUViewLocalizedStringKey_RestrictCPULoad CFSTR("Restrict CPU Load")
#define kAUViewLocalizedStringKey_PercentSymbol CFSTR("%")
#define kAUViewLocalizedStringKey_NotApplicable CFSTR("n/a")
-
+
// AUDiskStreamingCheckbox:
#define kAUViewLocalizedStringKey_StreamFromDisk CFSTR("Stream From Disk")
-
+
// AURenderQualityPopup:
#define kAUViewLocalizedStringKey_RenderQuality CFSTR("Render Quality")
#define kAUViewLocalizedStringKey_Maximum CFSTR("Maximum")
@@ -84,5 +84,5 @@
// AUChannelLayoutPopUp:
#define kAUViewLocalizedStringKey_AudioChannelLayout CFSTR("Audio Channel Layout")
-
+
#endif //__AUViewLocalizedStringKeys_h__
diff --git a/libs/appleutility/CoreAudio/AudioUnits/AUPublic/OtherBases/AUEffectBase.cpp b/libs/appleutility/CoreAudio/AudioUnits/AUPublic/OtherBases/AUEffectBase.cpp
index 010082fc3f..c7a8c651ab 100644
--- a/libs/appleutility/CoreAudio/AudioUnits/AUPublic/OtherBases/AUEffectBase.cpp
+++ b/libs/appleutility/CoreAudio/AudioUnits/AUPublic/OtherBases/AUEffectBase.cpp
@@ -2,14 +2,14 @@
File: AUEffectBase.cpp
Abstract: AUEffectBase.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 "AUEffectBase.h"
-/*
+/*
This class does not deal as well as it should with N-M effects...
-
+
The problem areas are (if the channels don't match):
ProcessInPlace if the channels don't match - there will be problems if InputChan != OutputChan
Bypass - its just passing the buffers through when not processing them
@@ -84,7 +84,7 @@ void AUEffectBase::Cleanup()
{
for (KernelList::iterator it = mKernelList.begin(); it != mKernelList.end(); ++it)
delete *it;
-
+
mKernelList.clear();
mMainOutput = NULL;
mMainInput = NULL;
@@ -113,7 +113,7 @@ OSStatus AUEffectBase::Initialize()
if ((configNumInputs < 0) && (configNumOutputs < 0))
{
// unit accepts any number of channels on input and output
- if (((configNumInputs == -1) && (configNumOutputs == -2))
+ if (((configNumInputs == -1) && (configNumOutputs == -2))
|| ((configNumInputs == -2) && (configNumOutputs == -1)))
{
foundMatch = true;
@@ -129,7 +129,7 @@ OSStatus AUEffectBase::Initialize()
}
else
{
- // the -1 case on either scope is saying that the unit doesn't care about the
+ // the -1 case on either scope is saying that the unit doesn't care about the
// number of channels on that scope
bool inputMatch = (auNumInputs == configNumInputs) || (configNumInputs == -1);
bool outputMatch = (auNumOutputs == configNumOutputs) || (configNumOutputs == -1);
@@ -152,14 +152,14 @@ OSStatus AUEffectBase::Initialize()
}
MaintainKernels();
-
+
mMainOutput = GetOutput(0);
mMainInput = GetInput(0);
-
+
const CAStreamBasicDescription& format = GetStreamFormat(kAudioUnitScope_Output, 0);
format.IdentifyCommonPCMFormat(mCommonPCMFormat, NULL);
mBytesPerFrame = format.mBytesPerFrame;
-
+
return noErr;
}
@@ -171,7 +171,7 @@ OSStatus AUEffectBase::Reset( AudioUnitScope inScope,
if (kernel != NULL)
kernel->Reset();
}
-
+
return AUBase::Reset(inScope, inElement);
}
@@ -228,10 +228,10 @@ OSStatus AUEffectBase::SetProperty( AudioUnitPropertyID inID,
{
if (inDataSize < sizeof(UInt32))
return kAudioUnitErr_InvalidPropertyValue;
-
+
bool tempNewSetting = *((UInt32*)inData) != 0;
// we're changing the state of bypass
- if (tempNewSetting != IsBypassEffect())
+ if (tempNewSetting != IsBypassEffect())
{
if (!tempNewSetting && IsBypassEffect() && IsInitialized()) // turning bypass off and we're initialized
Reset(0, 0);
@@ -246,16 +246,16 @@ OSStatus AUEffectBase::SetProperty( AudioUnitPropertyID inID,
}
return AUBase::SetProperty (inID, inScope, inElement, inData, inDataSize);
}
-
+
void AUEffectBase::MaintainKernels()
{
#if TARGET_OS_IPHONE
UInt32 nKernels = mOnlyOneKernel ? 1 : GetNumberOfChannels();
-#else
+#else
UInt32 nKernels = GetNumberOfChannels();
#endif
-
+
if (mKernelList.size() < nKernels) {
mKernelList.reserve(nKernels);
for (UInt32 i = (UInt32)mKernelList.size(); i < nKernels; ++i)
@@ -267,7 +267,7 @@ void AUEffectBase::MaintainKernels()
mKernelList.pop_back();
}
}
-
+
for(unsigned int i = 0; i < nKernels; i++ )
{
if(mKernelList[i]) {
@@ -289,7 +289,7 @@ OSStatus AUEffectBase::ChangeStreamFormat( AudioUnitScope inScope,
{
OSStatus result = AUBase::ChangeStreamFormat(inScope, inElement, inPrevFormat, inNewFormat);
if (result == noErr)
- {
+ {
// for the moment this only dependency we know about
// where a parameter's range may change is with the sample rate
// and effects are only publishing parameters in the global scope!
@@ -314,11 +314,11 @@ OSStatus AUEffectBase::ProcessScheduledSlice( void *inUserData,
UInt32 inTotalBufferFrames )
{
ScheduledProcessParams &sliceParams = *((ScheduledProcessParams*)inUserData);
-
+
AudioUnitRenderActionFlags &actionFlags = *sliceParams.actionFlags;
AudioBufferList &inputBufferList = *sliceParams.inputBufferList;
AudioBufferList &outputBufferList = *sliceParams.outputBufferList;
-
+
UInt32 channelSize = inSliceFramesToProcess * mBytesPerFrame;
// fix the size of the buffer we're operating on before we render this slice of time
for(unsigned int i = 0; i < inputBufferList.mNumberBuffers; i++ ) {
@@ -333,15 +333,15 @@ OSStatus AUEffectBase::ProcessScheduledSlice( void *inUserData,
// we just partially processed the buffers, so increment the data pointers to the next part of the buffer to process
for(unsigned int i = 0; i < inputBufferList.mNumberBuffers; i++ ) {
- inputBufferList.mBuffers[i].mData =
+ inputBufferList.mBuffers[i].mData =
(char *)inputBufferList.mBuffers[i].mData + inputBufferList.mBuffers[i].mNumberChannels * channelSize;
}
-
+
for(unsigned int i = 0; i < outputBufferList.mNumberBuffers; i++ ) {
- outputBufferList.mBuffers[i].mData =
+ outputBufferList.mBuffers[i].mData =
(char *)outputBufferList.mBuffers[i].mData + outputBufferList.mBuffers[i].mNumberChannels * channelSize;
}
-
+
return result;
}
@@ -358,7 +358,7 @@ OSStatus AUEffectBase::Render( AudioUnitRenderActionFlags &ioActionFlags,
OSStatus result = noErr;
result = mMainInput->PullInput(ioActionFlags, inTimeStamp, 0 /* element */, nFrames);
-
+
if (result == noErr)
{
if(ProcessesInPlace() && mMainOutput->WillAllocateBuffer())
@@ -369,7 +369,7 @@ OSStatus AUEffectBase::Render( AudioUnitRenderActionFlags &ioActionFlags,
if (ShouldBypassEffect())
{
// leave silence bit alone
-
+
if(!ProcessesInPlace() )
{
mMainInput->CopyBufferContentsTo (mMainOutput->GetBufferList());
@@ -385,22 +385,22 @@ OSStatus AUEffectBase::Render( AudioUnitRenderActionFlags &ioActionFlags,
else
{
// deal with scheduled parameters...
-
+
AudioBufferList &inputBufferList = mMainInput->GetBufferList();
AudioBufferList &outputBufferList = mMainOutput->GetBufferList();
-
+
ScheduledProcessParams processParams;
processParams.actionFlags = &ioActionFlags;
processParams.inputBufferList = &inputBufferList;
processParams.outputBufferList = &outputBufferList;
-
+
// divide up the buffer into slices according to scheduled params then
// do the DSP for each slice (ProcessScheduledSlice() called for each slice)
result = ProcessForScheduledParams( mParamList,
nFrames,
&processParams );
-
-
+
+
// fixup the buffer pointers to how they were before we started
UInt32 channelSize = nFrames * mBytesPerFrame;
for(unsigned int i = 0; i < inputBufferList.mNumberBuffers; i++ ) {
@@ -408,7 +408,7 @@ OSStatus AUEffectBase::Render( AudioUnitRenderActionFlags &ioActionFlags,
inputBufferList.mBuffers[i].mData = (char *)inputBufferList.mBuffers[i].mData - size;
inputBufferList.mBuffers[i].mDataByteSize = size;
}
-
+
for(unsigned int i = 0; i < outputBufferList.mNumberBuffers; i++ ) {
UInt32 size = outputBufferList.mBuffers[i].mNumberChannels * channelSize;
outputBufferList.mBuffers[i].mData = (char *)outputBufferList.mBuffers[i].mData - size;
@@ -416,13 +416,13 @@ OSStatus AUEffectBase::Render( AudioUnitRenderActionFlags &ioActionFlags,
}
}
}
-
+
if ( (ioActionFlags & kAudioUnitRenderAction_OutputIsSilence) && !ProcessesInPlace() )
{
AUBufferList::ZeroBuffer(mMainOutput->GetBufferList() );
}
}
-
+
return result;
}
@@ -435,7 +435,7 @@ OSStatus AUEffectBase::ProcessBufferLists(
{
if (ShouldBypassEffect())
return noErr;
-
+
// interleaved (or mono)
switch (mCommonPCMFormat) {
case CAStreamBasicDescription::kPCMFormatFloat32 :
@@ -450,7 +450,7 @@ OSStatus AUEffectBase::ProcessBufferLists(
default :
throw CAException(kAudio_UnimplementedError);
}
-
+
return noErr;
}
diff --git a/libs/appleutility/CoreAudio/AudioUnits/AUPublic/OtherBases/AUEffectBase.h b/libs/appleutility/CoreAudio/AudioUnits/AUPublic/OtherBases/AUEffectBase.h
index 13ba96b393..a7c62c2098 100644
--- a/libs/appleutility/CoreAudio/AudioUnits/AUPublic/OtherBases/AUEffectBase.h
+++ b/libs/appleutility/CoreAudio/AudioUnits/AUPublic/OtherBases/AUEffectBase.h
@@ -2,14 +2,14 @@
File: AUEffectBase.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 __AUEffectBase_h__
#define __AUEffectBase_h__
@@ -63,7 +63,7 @@ public:
bool inProcessesInPlace = true );
/*! @dtor ~AUEffectBase */
~AUEffectBase();
-
+
/*! @method Initialize */
virtual OSStatus Initialize();
@@ -112,7 +112,7 @@ public:
UInt32 inNumberFrames);
// our virtual methods
-
+
// If your unit processes N to N channels, and there are no interactions between channels,
// it can override NewKernel to create a mono processing object per channel. Otherwise,
// don't override NewKernel, and instead, override ProcessBufferLists.
@@ -129,7 +129,7 @@ public:
// convenience format accessors (use output 0's format)
/*! @method GetSampleRate */
Float64 GetSampleRate();
-
+
/*! @method GetNumberOfChannels */
UInt32 GetNumberOfChannels();
@@ -141,7 +141,7 @@ public:
{
Globals()->SetParameter(paramID, value);
}
-
+
/*! @method GetParameter */
using AUBase::GetParameter;
AudioUnitParameterValue GetParameter( AudioUnitParameterID paramID )
@@ -151,13 +151,13 @@ public:
/*! @method CanScheduleParameters */
virtual bool CanScheduleParameters() const { return true; }
-
+
/*! @method IsBypassEffect */
// This is used for the property value - to reflect to the UI if an effect is bypassed
bool IsBypassEffect () { return mBypassEffect; }
-
+
protected:
-
+
/*! @method MaintainKernels */
void MaintainKernels();
@@ -165,17 +165,17 @@ protected:
// This is used in the render call to see if an effect is bypassed
// It can return a different status than IsBypassEffect (though it MUST take that into account)
virtual bool ShouldBypassEffect () { return IsBypassEffect(); }
-
+
public:
/*! @method SetBypassEffect */
virtual void SetBypassEffect (bool inFlag) { mBypassEffect = inFlag; }
-
+
/*! @method SetParamHasSampleRateDependency */
- void SetParamHasSampleRateDependency (bool inFlag)
- {
- mParamSRDep = inFlag;
+ void SetParamHasSampleRateDependency (bool inFlag)
+ {
+ mParamSRDep = inFlag;
}
-
+
/*! @method GetParamHasSampleRateDependency */
bool GetParamHasSampleRateDependency () const { return mParamSRDep; }
@@ -194,12 +194,12 @@ public:
bool ProcessesInPlace() const {return mProcessesInPlace;};
void SetProcessesInPlace(bool inProcessesInPlace) {mProcessesInPlace = inProcessesInPlace;};
-
+
typedef std::vector<AUKernelBase *> KernelList;
-
-
-protected:
+
+
+protected:
/*! @var mKernelList */
KernelList mKernelList;
@@ -209,13 +209,13 @@ protected:
bool IsInputSilent (AudioUnitRenderActionFlags inActionFlags, UInt32 inFramesToProcess)
{
bool inputSilent = (inActionFlags & kAudioUnitRenderAction_OutputIsSilence) != 0;
-
+
// take latency and tail time into account when propagating the silent bit
UInt32 silentTimeoutFrames = UInt32(GetSampleRate() * (GetLatency() + GetTailTime()));
mSilentTimeout.Process (inFramesToProcess, silentTimeoutFrames, inputSilent);
return inputSilent;
}
-
+
#if TARGET_OS_IPHONE
void SetOnlyOneKernel(bool inUseOnlyOneKernel) { mOnlyOneKernel = inUseOnlyOneKernel; } // set in ctor of subclass that wants it.
#endif
@@ -228,26 +228,26 @@ protected:
UInt32 inFramesToProcess );
CAStreamBasicDescription::CommonPCMFormat GetCommonPCMFormat() const { return mCommonPCMFormat; }
-
+
private:
/*! @var mBypassEffect */
bool mBypassEffect;
/*! @var mParamSRDep */
bool mParamSRDep;
-
+
/*! @var mProcessesInplace */
bool mProcessesInPlace;
-
+
/*! @var mSilentTimeout */
AUSilentTimeout mSilentTimeout;
/*! @var mMainOutput */
AUOutputElement * mMainOutput;
-
+
/*! @var mMainInput */
AUInputElement * mMainInput;
-
+
#if TARGET_OS_IPHONE
/*! @var mOnlyOneKernel */
bool mOnlyOneKernel;
@@ -299,16 +299,16 @@ public:
{
return mAudioUnit->GetSampleRate();
}
-
+
/*! @method GetParameter */
- AudioUnitParameterValue GetParameter (AudioUnitParameterID paramID)
+ AudioUnitParameterValue GetParameter (AudioUnitParameterID paramID)
{
return mAudioUnit->GetParameter(paramID);
}
-
+
void SetChannelNum (UInt32 inChan) { mChannelNum = inChan; }
UInt32 GetChannelNum () { return mChannelNum; }
-
+
protected:
/*! @var mAudioUnit */
AUEffectBase * mAudioUnit;
@@ -332,41 +332,41 @@ void AUEffectBase::ProcessBufferListsT(
if (inBuffer.mNumberBuffers == 1) {
if (inBuffer.mBuffers[0].mNumberChannels == 0)
throw CAException(kAudio_ParamError);
-
+
for (UInt32 channel = 0; channel < mKernelList.size(); ++channel) {
AUKernelBase *kernel = mKernelList[channel];
-
+
if (kernel == NULL) continue;
ioSilence = silentInput;
-
+
// process each interleaved channel individually
kernel->Process(
- (const T *)inBuffer.mBuffers[0].mData + channel,
+ (const T *)inBuffer.mBuffers[0].mData + channel,
(T *)outBuffer.mBuffers[0].mData + channel,
inFramesToProcess,
inBuffer.mBuffers[0].mNumberChannels,
ioSilence);
-
+
if (!ioSilence)
ioActionFlags &= ~kAudioUnitRenderAction_OutputIsSilence;
}
} else {
for (UInt32 channel = 0; channel < mKernelList.size(); ++channel) {
AUKernelBase *kernel = mKernelList[channel];
-
+
if (kernel == NULL) continue;
-
+
ioSilence = silentInput;
const AudioBuffer *srcBuffer = &inBuffer.mBuffers[channel];
AudioBuffer *destBuffer = &outBuffer.mBuffers[channel];
-
+
kernel->Process(
- (const T *)srcBuffer->mData,
- (T *)destBuffer->mData,
+ (const T *)srcBuffer->mData,
+ (T *)destBuffer->mData,
inFramesToProcess,
1,
ioSilence);
-
+
if (!ioSilence)
ioActionFlags &= ~kAudioUnitRenderAction_OutputIsSilence;
}
diff --git a/libs/appleutility/CoreAudio/AudioUnits/AUPublic/OtherBases/AUMIDIBase.cpp b/libs/appleutility/CoreAudio/AudioUnits/AUPublic/OtherBases/AUMIDIBase.cpp
index e5e358d685..520d76ab8d 100644
--- a/libs/appleutility/CoreAudio/AudioUnits/AUPublic/OtherBases/AUMIDIBase.cpp
+++ b/libs/appleutility/CoreAudio/AudioUnits/AUPublic/OtherBases/AUMIDIBase.cpp
@@ -2,14 +2,14 @@
File: AUMIDIBase.cpp
Abstract: AUMIDIBase.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 "AUMIDIBase.h"
#include <CoreMIDI/CoreMIDI.h>
@@ -64,18 +64,18 @@ enum
kMidiController_AllNotesOff = 123
};
-AUMIDIBase::AUMIDIBase(AUBase* inBase)
- : mAUBaseInstance (*inBase)
+AUMIDIBase::AUMIDIBase(AUBase* inBase)
+ : mAUBaseInstance (*inBase)
{
#if CA_AUTO_MIDI_MAP
mMapManager = new CAAUMIDIMapManager();
#endif
}
-AUMIDIBase::~AUMIDIBase()
+AUMIDIBase::~AUMIDIBase()
{
#if CA_AUTO_MIDI_MAP
- if (mMapManager)
+ if (mMapManager)
delete mMapManager;
#endif
}
@@ -88,7 +88,7 @@ OSStatus AUMIDIBase::DelegateGetPropertyInfo(AudioUnitPropertyID inID,
Boolean & outWritable)
{
OSStatus result = noErr;
-
+
switch (inID) {
#if !TARGET_OS_IPHONE
case kMusicDeviceProperty_MIDIXMLNames:
@@ -100,8 +100,8 @@ OSStatus AUMIDIBase::DelegateGetPropertyInfo(AudioUnitPropertyID inID,
} else
result = kAudioUnitErr_InvalidProperty;
break;
-#endif
-#if CA_AUTO_MIDI_MAP
+#endif
+#if CA_AUTO_MIDI_MAP
case kAudioUnitProperty_AllParameterMIDIMappings:
ca_require(inScope == kAudioUnitScope_Global, InvalidScope);
ca_require(inElement == 0, InvalidElement);
@@ -109,15 +109,15 @@ OSStatus AUMIDIBase::DelegateGetPropertyInfo(AudioUnitPropertyID inID,
outDataSize = sizeof (AUParameterMIDIMapping)*mMapManager->NumMaps();
result = noErr;
break;
-
+
case kAudioUnitProperty_HotMapParameterMIDIMapping:
ca_require(inScope == kAudioUnitScope_Global, InvalidScope);
ca_require(inElement == 0, InvalidElement);
outWritable = true;
- outDataSize = sizeof (AUParameterMIDIMapping);
+ outDataSize = sizeof (AUParameterMIDIMapping);
result = noErr;
break;
-
+
case kAudioUnitProperty_AddParameterMIDIMapping:
ca_require(inScope == kAudioUnitScope_Global, InvalidScope);
ca_require(inElement == 0, InvalidElement);
@@ -125,12 +125,12 @@ OSStatus AUMIDIBase::DelegateGetPropertyInfo(AudioUnitPropertyID inID,
outDataSize = sizeof (AUParameterMIDIMapping);
result = noErr;
break;
-
+
case kAudioUnitProperty_RemoveParameterMIDIMapping:
ca_require(inScope == kAudioUnitScope_Global, InvalidScope);
ca_require(inElement == 0, InvalidElement);
outWritable = true;
- outDataSize = sizeof (AUParameterMIDIMapping);
+ outDataSize = sizeof (AUParameterMIDIMapping);
result = noErr;
break;
#endif
@@ -155,7 +155,7 @@ OSStatus AUMIDIBase::DelegateGetProperty( AudioUnitPropertyID inID,
void * outData)
{
OSStatus result;
-
+
switch (inID) {
#if !TARGET_OS_IPHONE
case kMusicDeviceProperty_MIDIXMLNames:
@@ -163,7 +163,7 @@ OSStatus AUMIDIBase::DelegateGetProperty( AudioUnitPropertyID inID,
ca_require(inElement == 0, InvalidElement);
result = GetXMLNames((CFURLRef *)outData);
break;
-#endif
+#endif
#if CA_AUTO_MIDI_MAP
case kAudioUnitProperty_AllParameterMIDIMappings:{
ca_require(inScope == kAudioUnitScope_Global, InvalidScope);
@@ -175,7 +175,7 @@ OSStatus AUMIDIBase::DelegateGetProperty( AudioUnitPropertyID inID,
result = noErr;
break;
}
-
+
case kAudioUnitProperty_HotMapParameterMIDIMapping:{
ca_require(inScope == kAudioUnitScope_Global, InvalidScope);
ca_require(inElement == 0, InvalidElement);
@@ -185,7 +185,7 @@ OSStatus AUMIDIBase::DelegateGetProperty( AudioUnitPropertyID inID,
break;
}
#endif
-
+
default:
result = kAudioUnitErr_InvalidProperty;
break;
@@ -207,7 +207,7 @@ OSStatus AUMIDIBase::DelegateSetProperty( AudioUnitPropertyID inID,
UInt32 inDataSize)
{
OSStatus result;
-
+
switch (inID) {
#if CA_AUTO_MIDI_MAP
case kAudioUnitProperty_AddParameterMIDIMapping:{
@@ -215,11 +215,11 @@ OSStatus AUMIDIBase::DelegateSetProperty( AudioUnitPropertyID inID,
ca_require(inElement == 0, InvalidElement);
AUParameterMIDIMapping * maps = (AUParameterMIDIMapping*)inData;
mMapManager->SortedInsertToParamaterMaps (maps, (inDataSize / sizeof(AUParameterMIDIMapping)), mAUBaseInstance);
- mAUBaseInstance.PropertyChanged (kAudioUnitProperty_AllParameterMIDIMappings, kAudioUnitScope_Global, 0);
+ mAUBaseInstance.PropertyChanged (kAudioUnitProperty_AllParameterMIDIMappings, kAudioUnitScope_Global, 0);
result = noErr;
break;
}
-
+
case kAudioUnitProperty_RemoveParameterMIDIMapping:{
ca_require(inScope == kAudioUnitScope_Global, InvalidScope);
ca_require(inElement == 0, InvalidElement);
@@ -227,16 +227,16 @@ OSStatus AUMIDIBase::DelegateSetProperty( AudioUnitPropertyID inID,
bool didChange;
mMapManager->SortedRemoveFromParameterMaps(maps, (inDataSize / sizeof(AUParameterMIDIMapping)), didChange);
if (didChange)
- mAUBaseInstance.PropertyChanged (kAudioUnitProperty_AllParameterMIDIMappings, kAudioUnitScope_Global, 0);
+ mAUBaseInstance.PropertyChanged (kAudioUnitProperty_AllParameterMIDIMappings, kAudioUnitScope_Global, 0);
result = noErr;
break;
}
-
+
case kAudioUnitProperty_HotMapParameterMIDIMapping:{
ca_require(inScope == kAudioUnitScope_Global, InvalidScope);
ca_require(inElement == 0, InvalidElement);
AUParameterMIDIMapping & map = *((AUParameterMIDIMapping*)inData);
- mMapManager->SetHotMapping (map);
+ mMapManager->SetHotMapping (map);
result = noErr;
break;
}
@@ -249,7 +249,7 @@ OSStatus AUMIDIBase::DelegateSetProperty( AudioUnitPropertyID inID,
break;
}
#endif
-
+
default:
result = kAudioUnitErr_InvalidProperty;
break;
@@ -319,10 +319,10 @@ inline const Byte * NextMIDIEvent(const Byte *event, const Byte *end)
OSStatus AUMIDIBase::HandleMIDIPacketList(const MIDIPacketList *pktlist)
{
if (!mAUBaseInstance.IsInitialized()) return kAudioUnitErr_Uninitialized;
-
+
int nPackets = pktlist->numPackets;
const MIDIPacket *pkt = pktlist->packet;
-
+
while (nPackets-- > 0) {
const Byte *event = pkt->data, *packetEnd = event + pkt->length;
long startFrame = (long)pkt->timeStamp;
@@ -347,20 +347,20 @@ OSStatus AUMIDIBase::HandleMIDIPacketList(const MIDIPacketList *pktlist)
OSStatus AUMIDIBase::HandleMidiEvent(UInt8 status, UInt8 channel, UInt8 data1, UInt8 data2, UInt32 inStartFrame)
{
if (!mAUBaseInstance.IsInitialized()) return kAudioUnitErr_Uninitialized;
-
-#if CA_AUTO_MIDI_MAP
-// you potentially have a choice to make here - if a param mapping matches, do you still want to process the
+
+#if CA_AUTO_MIDI_MAP
+// you potentially have a choice to make here - if a param mapping matches, do you still want to process the
// MIDI event or not. The default behaviour is to continue on with the MIDI event.
if (mMapManager->HandleHotMapping (status, channel, data1, mAUBaseInstance)) {
mAUBaseInstance.PropertyChanged (kAudioUnitProperty_HotMapParameterMIDIMapping, kAudioUnitScope_Global, 0);
}
else {
mMapManager->FindParameterMapEventMatch(status, channel, data1, data2, inStartFrame, mAUBaseInstance);
- }
-#endif
-
+ }
+#endif
+
OSStatus result = noErr;
-
+
switch(status)
{
case kMidiMessage_NoteOn:
@@ -374,16 +374,16 @@ OSStatus AUMIDIBase::HandleMidiEvent(UInt8 status, UInt8 channel, UInt8 data1,
result = HandleNoteOff(channel, data1, data2, inStartFrame);
}
break;
-
+
case kMidiMessage_NoteOff:
result = HandleNoteOff(channel, data1, data2, inStartFrame);
break;
-
+
default:
result = HandleNonNoteEvent (status, channel, data1, data2, inStartFrame);
break;
}
-
+
return result;
}
@@ -396,15 +396,15 @@ OSStatus AUMIDIBase::HandleNonNoteEvent (UInt8 status, UInt8 channel, UInt8 data
case kMidiMessage_PitchWheel:
result = HandlePitchWheel(channel, data1, data2, inStartFrame);
break;
-
+
case kMidiMessage_ProgramChange:
result = HandleProgramChange(channel, data1);
break;
-
+
case kMidiMessage_ChannelPressure:
result = HandleChannelPressure(channel, data1, inStartFrame);
break;
-
+
case kMidiMessage_ControlChange:
{
switch (data1) {
@@ -419,7 +419,7 @@ OSStatus AUMIDIBase::HandleNonNoteEvent (UInt8 status, UInt8 channel, UInt8 data
case kMidiController_AllSoundOff:
result = HandleAllSoundOff(channel);
break;
-
+
default:
result = HandleControlChange(channel, data1, data2, inStartFrame);
break;
@@ -433,7 +433,7 @@ OSStatus AUMIDIBase::HandleNonNoteEvent (UInt8 status, UInt8 channel, UInt8 data
return result;
}
-OSStatus AUMIDIBase::SysEx (const UInt8 * inData,
+OSStatus AUMIDIBase::SysEx (const UInt8 * inData,
UInt32 inLength)
{
if (!mAUBaseInstance.IsInitialized()) return kAudioUnitErr_Uninitialized;
@@ -466,7 +466,7 @@ OSStatus AUMIDIBase::ComponentEntryDispatch( ComponentParameters * params,
if (This == NULL) return kAudio_ParamError;
OSStatus result;
-
+
switch (params->what) {
case kMusicDeviceMIDIEventSelect:
{
@@ -489,7 +489,7 @@ OSStatus AUMIDIBase::ComponentEntryDispatch( ComponentParameters * params,
result = badComponentSelector;
break;
}
-
+
return result;
}
#endif
diff --git a/libs/appleutility/CoreAudio/AudioUnits/AUPublic/OtherBases/AUMIDIBase.h b/libs/appleutility/CoreAudio/AudioUnits/AUPublic/OtherBases/AUMIDIBase.h
index 40c6a77695..223f50e406 100644
--- a/libs/appleutility/CoreAudio/AudioUnits/AUPublic/OtherBases/AUMIDIBase.h
+++ b/libs/appleutility/CoreAudio/AudioUnits/AUPublic/OtherBases/AUMIDIBase.h
@@ -2,14 +2,14 @@
File: AUMIDIBase.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 __AUMIDIBase_h__
#define __AUMIDIBase_h__
@@ -66,24 +66,24 @@ public:
AUMIDIBase(AUBase* inBase);
/*! @dtor ~AUMIDIBase */
virtual ~AUMIDIBase();
-
+
/*! @method MIDIEvent */
- virtual OSStatus MIDIEvent( UInt32 inStatus,
- UInt32 inData1,
- UInt32 inData2,
+ virtual OSStatus MIDIEvent( UInt32 inStatus,
+ UInt32 inData1,
+ UInt32 inData2,
UInt32 inOffsetSampleFrame)
{
UInt32 strippedStatus = inStatus & 0xf0;
UInt32 channel = inStatus & 0x0f;
-
+
return HandleMidiEvent(strippedStatus, channel, inData1, inData2, inOffsetSampleFrame);
}
-
+
/*! @method HandleMIDIPacketList */
OSStatus HandleMIDIPacketList(const MIDIPacketList *pktlist);
-
+
/*! @method SysEx */
- virtual OSStatus SysEx( const UInt8 * inData,
+ virtual OSStatus SysEx( const UInt8 * inData,
UInt32 inLength);
#if TARGET_API_MAC_OSX
@@ -99,7 +99,7 @@ public:
AudioUnitScope inScope,
AudioUnitElement inElement,
void * outData);
-
+
/*! @method DelegateSetProperty */
virtual OSStatus DelegateSetProperty( AudioUnitPropertyID inID,
AudioUnitScope inScope,
@@ -118,15 +118,15 @@ protected:
UInt32 inStartFrame);
/*! @method HandleNonNoteEvent */
- virtual OSStatus HandleNonNoteEvent ( UInt8 status,
- UInt8 channel,
- UInt8 data1,
- UInt8 data2,
+ virtual OSStatus HandleNonNoteEvent ( UInt8 status,
+ UInt8 channel,
+ UInt8 data1,
+ UInt8 data2,
UInt32 inStartFrame);
#if TARGET_API_MAC_OSX
/*! @method GetXMLNames */
- virtual OSStatus GetXMLNames(CFURLRef *outNameDocument)
+ virtual OSStatus GetXMLNames(CFURLRef *outNameDocument)
{ return kAudioUnitErr_InvalidProperty; } // if not overridden, it's unsupported
#endif
@@ -136,25 +136,25 @@ protected:
UInt8 inNoteNumber,
UInt8 inVelocity,
UInt32 inStartFrame) { return noErr; }
-
+
/*! @method HandleNoteOff */
virtual OSStatus HandleNoteOff( UInt8 inChannel,
UInt8 inNoteNumber,
UInt8 inVelocity,
UInt32 inStartFrame) { return noErr; }
-
+
/*! @method HandleControlChange */
virtual OSStatus HandleControlChange( UInt8 inChannel,
UInt8 inController,
UInt8 inValue,
UInt32 inStartFrame) { return noErr; }
-
+
/*! @method HandlePitchWheel */
virtual OSStatus HandlePitchWheel( UInt8 inChannel,
UInt8 inPitch1,
UInt8 inPitch2,
UInt32 inStartFrame) { return noErr; }
-
+
/*! @method HandleChannelPressure */
virtual OSStatus HandleChannelPressure( UInt8 inChannel,
UInt8 inValue,
@@ -172,15 +172,15 @@ protected:
/*! @method HandleResetAllControllers */
virtual OSStatus HandleResetAllControllers(UInt8 inChannel) { return noErr; }
-
+
/*! @method HandleAllNotesOff */
virtual OSStatus HandleAllNotesOff( UInt8 inChannel) { return noErr; }
-
+
/*! @method HandleAllSoundOff */
virtual OSStatus HandleAllSoundOff( UInt8 inChannel) { return noErr; }
-//System messages
+//System messages
/*! @method HandleSysEx */
virtual OSStatus HandleSysEx( const UInt8 * inData,
UInt32 inLength ) { return noErr; }
@@ -188,19 +188,19 @@ protected:
#if CA_AUTO_MIDI_MAP
/* map manager */
CAAUMIDIMapManager *GetMIDIMapManager() {return mMapManager;};
-
+
#endif
-
+
private:
/*! @var mAUBaseInstance */
AUBase & mAUBaseInstance;
-
+
#if CA_AUTO_MIDI_MAP
/* map manager */
CAAUMIDIMapManager * mMapManager;
#endif
-
+
public:
#if !CA_USE_AUDIO_PLUGIN_ONLY
// component dispatcher
diff --git a/libs/appleutility/CoreAudio/AudioUnits/AUPublic/OtherBases/AUMIDIEffectBase.cpp b/libs/appleutility/CoreAudio/AudioUnits/AUPublic/OtherBases/AUMIDIEffectBase.cpp
index dfe307c9eb..c60aa407ec 100644
--- a/libs/appleutility/CoreAudio/AudioUnits/AUPublic/OtherBases/AUMIDIEffectBase.cpp
+++ b/libs/appleutility/CoreAudio/AudioUnits/AUPublic/OtherBases/AUMIDIEffectBase.cpp
@@ -2,14 +2,14 @@
File: AUMIDIEffectBase.cpp
Abstract: AUMIDIEffectBase.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 "AUMIDIEffectBase.h"
@@ -61,7 +61,7 @@ static OSStatus AUMIDIEffectBaseMIDIEvent(void * inComponentStorage,
UInt32 inOffsetSampleFrame);
AUMIDIEffectBase::AUMIDIEffectBase( AudioComponentInstance inInstance,
- bool inProcessesInPlace )
+ bool inProcessesInPlace )
: AUEffectBase(inInstance, inProcessesInPlace),
AUMIDIBase(this)
{
@@ -74,12 +74,12 @@ OSStatus AUMIDIEffectBase::GetPropertyInfo(AudioUnitPropertyID inID,
Boolean & outWritable)
{
OSStatus result;
-
+
result = AUEffectBase::GetPropertyInfo (inID, inScope, inElement, outDataSize, outWritable);
-
+
if (result == kAudioUnitErr_InvalidProperty)
result = AUMIDIBase::DelegateGetPropertyInfo (inID, inScope, inElement, outDataSize, outWritable);
-
+
return result;
}
@@ -99,12 +99,12 @@ OSStatus AUMIDIEffectBase::GetProperty( AudioUnitPropertyID inID,
return kAudioUnitErr_InvalidElement;
}
#endif
-
+
result = AUEffectBase::GetProperty (inID, inScope, inElement, outData);
-
+
if (result == kAudioUnitErr_InvalidProperty)
result = AUMIDIBase::DelegateGetProperty (inID, inScope, inElement, outData);
-
+
return result;
}
@@ -116,10 +116,10 @@ OSStatus AUMIDIEffectBase::SetProperty( AudioUnitPropertyID inID,
{
OSStatus result = AUEffectBase::SetProperty (inID, inScope, inElement, inData, inDataSize);
-
+
if (result == kAudioUnitErr_InvalidProperty)
result = AUMIDIBase::DelegateSetProperty (inID, inScope, inElement, inData, inDataSize);
-
+
return result;
}
@@ -131,7 +131,7 @@ OSStatus AUMIDIEffectBase::ComponentEntryDispatch(ComponentParameters * para
if (This == NULL) return paramErr;
OSStatus result;
-
+
switch (params->what) {
case kMusicDeviceMIDIEventSelect:
case kMusicDeviceSysExSelect:
@@ -141,7 +141,7 @@ OSStatus AUMIDIEffectBase::ComponentEntryDispatch(ComponentParameters * para
result = AUEffectBase::ComponentEntryDispatch(params, This);
break;
}
-
+
return result;
}
#endif
diff --git a/libs/appleutility/CoreAudio/AudioUnits/AUPublic/OtherBases/AUMIDIEffectBase.h b/libs/appleutility/CoreAudio/AudioUnits/AUPublic/OtherBases/AUMIDIEffectBase.h
index b38f506d6c..744abd6fd8 100644
--- a/libs/appleutility/CoreAudio/AudioUnits/AUPublic/OtherBases/AUMIDIEffectBase.h
+++ b/libs/appleutility/CoreAudio/AudioUnits/AUPublic/OtherBases/AUMIDIEffectBase.h
@@ -2,14 +2,14 @@
File: AUMIDIEffectBase.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 __AUMIDIEffectBase_h__
#define __AUMIDIEffectBase_h__
@@ -67,7 +67,7 @@ public:
{
return AUMIDIBase::MIDIEvent (inStatus, inData1, inData2, inOffsetSampleFrame);
}
-
+
/*! @method SysEx */
virtual OSStatus SysEx(const UInt8 * inData,
UInt32 inLength)
diff --git a/libs/appleutility/CoreAudio/AudioUnits/AUPublic/OtherBases/AUOutputBase.cpp b/libs/appleutility/CoreAudio/AudioUnits/AUPublic/OtherBases/AUOutputBase.cpp
index 591c43ab8c..c2ed4cc925 100644
--- a/libs/appleutility/CoreAudio/AudioUnits/AUPublic/OtherBases/AUOutputBase.cpp
+++ b/libs/appleutility/CoreAudio/AudioUnits/AUPublic/OtherBases/AUOutputBase.cpp
@@ -2,14 +2,14 @@
File: AUOutputBase.cpp
Abstract: AUOutputBase.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.
-
+
*/
#if !CA_USE_AUDIO_PLUGIN_ONLY
#include "AUOutputBase.h"
@@ -52,7 +52,7 @@ OSStatus AUOutputBase::ComponentEntryDispatch(ComponentParameters *params, AUOu
if (This == NULL) return paramErr;
OSStatus result;
-
+
switch (params->what) {
case kAudioOutputUnitStartSelect:
{
@@ -70,7 +70,7 @@ OSStatus AUOutputBase::ComponentEntryDispatch(ComponentParameters *params, AUOu
result = badComponentSelector;
break;
}
-
+
return result;
}
#endif
diff --git a/libs/appleutility/CoreAudio/AudioUnits/AUPublic/OtherBases/AUOutputBase.h b/libs/appleutility/CoreAudio/AudioUnits/AUPublic/OtherBases/AUOutputBase.h
index 8e5399b911..f1a3c157a7 100644
--- a/libs/appleutility/CoreAudio/AudioUnits/AUPublic/OtherBases/AUOutputBase.h
+++ b/libs/appleutility/CoreAudio/AudioUnits/AUPublic/OtherBases/AUOutputBase.h
@@ -2,14 +2,14 @@
File: AUOutputBase.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 __AUOutputBase_h__
#define __AUOutputBase_h__
@@ -63,7 +63,7 @@ public:
// additional component entry points
/*! @method Start */
virtual OSStatus Start() = 0;
-
+
/*! @method Stop */
virtual OSStatus Stop() = 0;
diff --git a/libs/appleutility/CoreAudio/AudioUnits/AUPublic/OtherBases/AUPannerBase.cpp b/libs/appleutility/CoreAudio/AudioUnits/AUPublic/OtherBases/AUPannerBase.cpp
index f1e2f248ab..91e7d9cc7e 100644
--- a/libs/appleutility/CoreAudio/AudioUnits/AUPublic/OtherBases/AUPannerBase.cpp
+++ b/libs/appleutility/CoreAudio/AudioUnits/AUPublic/OtherBases/AUPannerBase.cpp
@@ -2,14 +2,14 @@
File: AUPannerBase.cpp
Abstract: AUPannerBase.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 "AUPannerBase.h"
#include "CABundleLocker.h"
@@ -51,13 +51,13 @@
static bool sLocalized = false;
-static CFStringRef kPanner_Azimuth_Name = CFSTR("azimuth");
-static CFStringRef kPanner_Elevation_Name = CFSTR("elevation");
+static CFStringRef kPanner_Azimuth_Name = CFSTR("azimuth");
+static CFStringRef kPanner_Elevation_Name = CFSTR("elevation");
static CFStringRef kPanner_Distance_Name = CFSTR("distance");
-static CFStringRef kPanner_CoordScale_Name = CFSTR("coordinate scale");
-static CFStringRef kPanner_RefDistance_Name = CFSTR("reference distance");
-static CFStringRef kPanner_Gain_Name = CFSTR("gain");
+static CFStringRef kPanner_CoordScale_Name = CFSTR("coordinate scale");
+static CFStringRef kPanner_RefDistance_Name = CFSTR("reference distance");
+static CFStringRef kPanner_Gain_Name = CFSTR("gain");
static Float32 kPannerParamDefault_Azimuth = 0.;
static Float32 kPannerParamDefault_Elevation = 0.;
@@ -75,30 +75,30 @@ AUPannerBase::AUPannerBase(AudioComponentInstance inAudioUnit)
{
CABundleLocker lock;
if (!sLocalized)
- {
+ {
CFBundleRef bundle = CFBundleGetBundleWithIdentifier( CFSTR("com.apple.audio.units.Components") );
if (bundle != NULL)
{
kPanner_Azimuth_Name = CFCopyLocalizedStringFromTableInBundle(kPanner_Azimuth_Name, CFSTR("AudioUnits"), bundle, CFSTR(""));
kPanner_Elevation_Name = CFCopyLocalizedStringFromTableInBundle(kPanner_Elevation_Name, CFSTR("AudioUnits"), bundle, CFSTR(""));
kPanner_Distance_Name = CFCopyLocalizedStringFromTableInBundle(kPanner_Distance_Name, CFSTR("AudioUnits"), bundle, CFSTR(""));
-
+
kPanner_CoordScale_Name = CFCopyLocalizedStringFromTableInBundle(kPanner_CoordScale_Name, CFSTR("AudioUnits"), bundle, CFSTR(""));
kPanner_RefDistance_Name = CFCopyLocalizedStringFromTableInBundle(kPanner_RefDistance_Name, CFSTR("AudioUnits"), bundle, CFSTR(""));
kPanner_Gain_Name = CFCopyLocalizedStringFromTableInBundle(kPanner_Gain_Name, CFSTR("AudioUnits"), bundle, CFSTR(""));
}
-
+
sLocalized = true;
}
}
-
+
CreateElements();
-
+
SetParameter(kPannerParam_Azimuth, kPannerParamDefault_Azimuth);
SetParameter(kPannerParam_Elevation, kPannerParamDefault_Elevation);
SetParameter(kPannerParam_Distance, kPannerParamDefault_Distance);
-
+
SetParameter(kPannerParam_CoordScale, kPannerParamDefault_CoordScale);
SetParameter(kPannerParam_RefDistance, kPannerParamDefault_RefDistance);
SetParameter(kPannerParam_Gain, kPannerParamDefault_Gain);
@@ -135,13 +135,13 @@ void AUPannerBase::AllocBypassMatrix()
static AudioChannelLayoutTag DefaultTagForNumberOfChannels(UInt32 inNumberChannels)
{
switch (inNumberChannels) {
- case 1: return kAudioChannelLayoutTag_Mono;
- case 2: return kAudioChannelLayoutTag_Stereo;
- case 4: return kAudioChannelLayoutTag_Quadraphonic;
- case 5: return kAudioChannelLayoutTag_AudioUnit_5_0;
- case 6: return kAudioChannelLayoutTag_AudioUnit_6_0;
- case 7: return kAudioChannelLayoutTag_AudioUnit_7_0;
- case 8: return kAudioChannelLayoutTag_AudioUnit_8;
+ case 1: return kAudioChannelLayoutTag_Mono;
+ case 2: return kAudioChannelLayoutTag_Stereo;
+ case 4: return kAudioChannelLayoutTag_Quadraphonic;
+ case 5: return kAudioChannelLayoutTag_AudioUnit_5_0;
+ case 6: return kAudioChannelLayoutTag_AudioUnit_6_0;
+ case 7: return kAudioChannelLayoutTag_AudioUnit_7_0;
+ case 8: return kAudioChannelLayoutTag_AudioUnit_8;
default: return 0xFFFF0000 | inNumberChannels;
}
@@ -153,7 +153,7 @@ static AudioChannelLayoutTag DefaultTagForNumberOfChannels(UInt32 inNumberChanne
OSStatus AUPannerBase::SetDefaultChannelLayoutsIfNone()
{
OSStatus err = noErr;
-
+
// if layout has not been set, then guess layout from number of channels
UInt32 inChannels = GetNumberOfInputChannels();
AudioChannelLayout inputLayoutSubstitute;
@@ -168,7 +168,7 @@ OSStatus AUPannerBase::SetDefaultChannelLayoutsIfNone()
err = SetAudioChannelLayout(kAudioUnitScope_Input, 0, &GetInputLayout());
if (err) return err;
}
-
+
// if layout has not been set, then guess layout from number of channels
UInt32 outChannels = GetNumberOfOutputChannels();
AudioChannelLayout outputLayoutSubstitute;
@@ -183,29 +183,29 @@ OSStatus AUPannerBase::SetDefaultChannelLayoutsIfNone()
err = SetAudioChannelLayout(kAudioUnitScope_Output, 0, &GetOutputLayout());
if (err) return err;
}
-
+
return err;
}
-
+
OSStatus AUPannerBase::UpdateBypassMatrix()
{
OSStatus err = SetDefaultChannelLayoutsIfNone();
if (err) return err;
-
+
UInt32 inChannels = GetNumberOfInputChannels();
- UInt32 outChannels = GetNumberOfOutputChannels();
-
+ UInt32 outChannels = GetNumberOfOutputChannels();
+
const AudioChannelLayout* inoutACL[2];
-
+
inoutACL[0] = &GetInputLayout();
inoutACL[1] = &GetOutputLayout();
mBypassMatrix.alloc(inChannels * outChannels, true);
-
+
UInt32 propSize = inChannels * outChannels * sizeof(Float32);
-
+
err = AudioFormatGetProperty(kAudioFormatProperty_MatrixMixMap, sizeof(inoutACL), inoutACL, &propSize, mBypassMatrix());
if (err) {
// if there is an error, use a diagonal matrix.
@@ -225,7 +225,7 @@ OSStatus AUPannerBase::UpdateBypassMatrix()
/*! @method Cleanup */
void AUPannerBase::Cleanup()
{
-
+
}
@@ -249,9 +249,9 @@ OSStatus AUPannerBase::GetParameterInfo( AudioUnitScope inScope,
outParameterInfo.flags = kAudioUnitParameterFlag_IsWritable
+ kAudioUnitParameterFlag_IsReadable;
-
+
if (inScope == kAudioUnitScope_Global) {
-
+
switch(inParameterID)
{
case kPannerParam_Azimuth:
@@ -279,7 +279,7 @@ OSStatus AUPannerBase::GetParameterInfo( AudioUnitScope inScope,
outParameterInfo.flags += kAudioUnitParameterFlag_IsHighResolution;
//outParameterInfo.flags += kAudioUnitParameterFlag_DisplayLogarithmic;
break;
-
+
case kPannerParam_CoordScale:
AUBase::FillInParameterName (outParameterInfo, kPanner_CoordScale_Name, false);
outParameterInfo.unit = kAudioUnitParameterUnit_Meters;
@@ -313,9 +313,9 @@ OSStatus AUPannerBase::GetParameterInfo( AudioUnitScope inScope,
} else {
result = kAudioUnitErr_InvalidParameter;
}
-
+
return result;
-}
+}
//_____________________________________________________________________________
//
@@ -324,15 +324,15 @@ OSStatus AUPannerBase::GetParameter( AudioUnitParameterID inParamID,
AudioUnitElement inElement,
Float32 & outValue)
{
- if (inScope != kAudioUnitScope_Global)
+ if (inScope != kAudioUnitScope_Global)
return kAudioUnitErr_InvalidScope;
-
+
outValue = Globals()->GetParameter(inParamID);
return noErr;
}
-
+
//_____________________________________________________________________________
//
OSStatus AUPannerBase::SetParameter( AudioUnitParameterID inParamID,
@@ -341,11 +341,11 @@ OSStatus AUPannerBase::SetParameter( AudioUnitParameterID inParamID,
Float32 inValue,
UInt32 inBufferOffsetInFrames)
{
- if (inScope != kAudioUnitScope_Global)
+ if (inScope != kAudioUnitScope_Global)
return kAudioUnitErr_InvalidScope;
Globals()->SetParameter(inParamID, inValue);
-
+
return noErr;
}
@@ -365,7 +365,7 @@ OSStatus AUPannerBase::GetPropertyInfo (AudioUnitPropertyID inID,
case kAudioUnitProperty_BypassEffect:
if (inScope != kAudioUnitScope_Global)
return kAudioUnitErr_InvalidScope;
-
+
outWritable = true;
outDataSize = sizeof (UInt32);
break;
@@ -384,7 +384,7 @@ OSStatus AUPannerBase::GetProperty (AudioUnitPropertyID inID,
void * outData)
{
OSStatus err = noErr;
- switch (inID)
+ switch (inID)
{
case kAudioUnitProperty_BypassEffect:
if (inScope != kAudioUnitScope_Global)
@@ -407,14 +407,14 @@ OSStatus AUPannerBase::SetProperty(AudioUnitPropertyID inID,
const void * inData,
UInt32 inDataSize)
{
- switch (inID)
+ switch (inID)
{
case kAudioUnitProperty_BypassEffect:
if (inDataSize < sizeof(UInt32))
return kAudioUnitErr_InvalidPropertyValue;
bool tempNewSetting = *((UInt32*)inData) != 0;
// we're changing the state of bypass
- if (tempNewSetting != IsBypassEffect())
+ if (tempNewSetting != IsBypassEffect())
{
if (!tempNewSetting && IsBypassEffect() && IsInitialized()) // turning bypass off and we're initialized
Reset(0, 0);
@@ -444,15 +444,15 @@ OSStatus AUPannerBase::ChangeStreamFormat (
const CAStreamBasicDescription & inPrevFormat,
const CAStreamBasicDescription & inNewFormat)
{
- if (inScope == kAudioUnitScope_Input && !InputChannelConfigIsSupported(inNewFormat.NumberChannels()))
+ if (inScope == kAudioUnitScope_Input && !InputChannelConfigIsSupported(inNewFormat.NumberChannels()))
return kAudioUnitErr_FormatNotSupported;
-
- if (inScope == kAudioUnitScope_Output && !OutputChannelConfigIsSupported(inNewFormat.NumberChannels()))
+
+ if (inScope == kAudioUnitScope_Output && !OutputChannelConfigIsSupported(inNewFormat.NumberChannels()))
return kAudioUnitErr_FormatNotSupported;
-
+
if (inNewFormat.NumberChannels() != inPrevFormat.NumberChannels())
RemoveAudioChannelLayout(inScope, inElement);
-
+
return AUBase::ChangeStreamFormat(inScope, inElement, inPrevFormat, inNewFormat);
}
@@ -463,9 +463,9 @@ OSStatus AUPannerBase::Render(AudioUnitRenderActionFlags & ioActionFlags,
const AudioTimeStamp & inTimeStamp,
UInt32 inNumberFrames)
{
- if (IsBypassEffect())
+ if (IsBypassEffect())
return BypassRender(ioActionFlags, inTimeStamp, inNumberFrames);
- else
+ else
return PannerRender(ioActionFlags, inTimeStamp, inNumberFrames);
}
@@ -483,16 +483,16 @@ OSStatus AUPannerBase::BypassRender(AudioUnitRenderActionFlags & ioActionFlags
AudioBufferList& outputBufferList = GetOutput(0)->GetBufferList();
AUBufferList::ZeroBuffer(outputBufferList);
-
- if (!isSilent)
+
+ if (!isSilent)
{
UInt32 inChannels = GetNumberOfInputChannels();
UInt32 outChannels = GetNumberOfOutputChannels();
Float32* bypass = mBypassMatrix();
for (UInt32 outChan = 0; outChan < outChannels; ++outChan)
{
- float* outData = GetOutput(0)->GetChannelData(outChan);
-
+ float* outData = GetOutput(0)->GetChannelData(outChan);
+
for (UInt32 inChan = 0; inChan < inChannels; ++inChan)
{
float* inData = GetInput(0)->GetChannelData(inChan);
@@ -510,13 +510,13 @@ UInt32 AUPannerBase::GetAudioChannelLayout( AudioUnitScope inScope,
AudioUnitElement inElement,
AudioChannelLayout * outLayoutPtr,
Boolean & outWritable)
-{
+{
SetDefaultChannelLayoutsIfNone();
-
+
outWritable = true;
-
+
CAAudioChannelLayout* caacl = NULL;
- switch (inScope)
+ switch (inScope)
{
case kAudioUnitScope_Input:
caacl = &mInputLayout;
@@ -527,14 +527,14 @@ UInt32 AUPannerBase::GetAudioChannelLayout( AudioUnitScope inScope,
default:
COMPONENT_THROW(kAudioUnitErr_InvalidScope);
}
-
+
if (inElement != 0)
COMPONENT_THROW(kAudioUnitErr_InvalidElement);
-
+
UInt32 size = caacl->IsValid() ? caacl->Size() : 0;
if (size > 0 && outLayoutPtr)
memcpy(outLayoutPtr, &caacl->Layout(), size);
-
+
return size;
}
@@ -544,7 +544,7 @@ OSStatus AUPannerBase::RemoveAudioChannelLayout( AudioUnitScope inScope,
AudioUnitElement inElement)
{
CAAudioChannelLayout* caacl = NULL;
- switch (inScope)
+ switch (inScope)
{
case kAudioUnitScope_Input:
caacl = &mInputLayout;
@@ -555,17 +555,17 @@ OSStatus AUPannerBase::RemoveAudioChannelLayout( AudioUnitScope inScope,
default:
return kAudioUnitErr_InvalidScope;
}
-
+
if (inElement != 0)
return kAudioUnitErr_InvalidElement;
-
+
*caacl = NULL;
return noErr;
}
//_____________________________________________________________________________
//
-OSStatus AUPannerBase::SetAudioChannelLayout( AudioUnitScope inScope,
+OSStatus AUPannerBase::SetAudioChannelLayout( AudioUnitScope inScope,
AudioUnitElement inElement,
const AudioChannelLayout * inLayout)
{
@@ -574,10 +574,10 @@ OSStatus AUPannerBase::SetAudioChannelLayout( AudioUnitScope inScope,
if (!ChannelLayoutTagIsSupported(inScope, inElement, inLayout->mChannelLayoutTag))
return kAudioUnitErr_FormatNotSupported;
-
+
CAAudioChannelLayout* caacl = NULL;
UInt32 currentChannels;
- switch (inScope)
+ switch (inScope)
{
case kAudioUnitScope_Input:
caacl = &mInputLayout;
@@ -590,28 +590,28 @@ OSStatus AUPannerBase::SetAudioChannelLayout( AudioUnitScope inScope,
default:
return kAudioUnitErr_InvalidScope;
}
-
+
if (inElement != 0)
return kAudioUnitErr_InvalidElement;
UInt32 numChannelsInLayout = CAAudioChannelLayout::NumberChannels(*inLayout);
if (currentChannels != numChannelsInLayout)
return kAudioUnitErr_InvalidPropertyValue;
-
+
*caacl = inLayout;
if (IsInitialized())
UpdateBypassMatrix();
-
+
return noErr;
}
//_____________________________________________________________________________
//
UInt32 AUPannerBase::GetChannelLayoutTags( AudioUnitScope inScope,
- AudioUnitElement inElement,
+ AudioUnitElement inElement,
AudioChannelLayoutTag* outTags)
{
- switch (inScope)
+ switch (inScope)
{
case kAudioUnitScope_Input:
if (outTags) {
@@ -687,20 +687,20 @@ bool AUPannerBase::OutputChannelConfigIsSupported(UInt32 inNumberChannels)
//_____________________________________________________________________________
//
-bool AUPannerBase::ChannelLayoutTagIsSupported( AudioUnitScope inScope,
- AudioUnitElement inElement,
+bool AUPannerBase::ChannelLayoutTagIsSupported( AudioUnitScope inScope,
+ AudioUnitElement inElement,
AudioChannelLayoutTag inTag)
{
UInt32 numTags = GetChannelLayoutTags(inScope, inElement, NULL);
CAAutoFree<AudioChannelLayoutTag> tags(numTags);
GetChannelLayoutTags(inScope, inElement, tags());
-
+
for (UInt32 i = 0; i < numTags; ++i)
{
if (tags[i] == inTag)
return true;
}
-
+
return false;
}
diff --git a/libs/appleutility/CoreAudio/AudioUnits/AUPublic/OtherBases/AUPannerBase.h b/libs/appleutility/CoreAudio/AudioUnits/AUPublic/OtherBases/AUPannerBase.h
index 3184830523..8804255e24 100644
--- a/libs/appleutility/CoreAudio/AudioUnits/AUPublic/OtherBases/AUPannerBase.h
+++ b/libs/appleutility/CoreAudio/AudioUnits/AUPublic/OtherBases/AUPannerBase.h
@@ -2,14 +2,14 @@
File: AUPannerBase.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 __AUPannerBase_h__
#define __AUPannerBase_h__
@@ -61,7 +61,7 @@ public:
AUPannerBase(AudioComponentInstance inAudioUnit);
/*! @dtor ~AUPannerBase */
virtual ~AUPannerBase();
-
+
/*! @method Initialize */
virtual OSStatus Initialize();
@@ -114,14 +114,14 @@ public:
const CAStreamBasicDescription & inPrevFormat,
const CAStreamBasicDescription & inNewFormat);
-
+
/*! @method IsBypassEffect */
// This is used for the property value - to reflect to the UI if an effect is bypassed
bool IsBypassEffect () { return mBypassEffect; }
-
+
/*! @method SetBypassEffect */
virtual void SetBypassEffect (bool inFlag) { mBypassEffect = inFlag; }
-
+
/*! @method Render */
virtual OSStatus Render(AudioUnitRenderActionFlags & ioActionFlags,
@@ -146,17 +146,17 @@ public:
Boolean & outWritable);
/*! @method SetAudioChannelLayout */
- virtual OSStatus SetAudioChannelLayout( AudioUnitScope inScope,
+ virtual OSStatus SetAudioChannelLayout( AudioUnitScope inScope,
AudioUnitElement inElement,
const AudioChannelLayout * inLayout);
/*! @method RemoveAudioChannelLayout */
- virtual OSStatus RemoveAudioChannelLayout( AudioUnitScope inScope,
+ virtual OSStatus RemoveAudioChannelLayout( AudioUnitScope inScope,
AudioUnitElement inElement);
/*! @method GetChannelLayoutTags */
virtual UInt32 GetChannelLayoutTags( AudioUnitScope inScope,
- AudioUnitElement inElement,
+ AudioUnitElement inElement,
AudioChannelLayoutTag* outTags);
/*! @method GetNumberOfInputChannels */
@@ -169,7 +169,7 @@ public:
AudioUnitScope inScope,
AudioUnitElement inElement,
Float32 & outValue);
-
+
/*! @method SetParameter */
virtual OSStatus SetParameter( AudioUnitParameterID inParamID,
AudioUnitScope inScope,
@@ -185,7 +185,7 @@ public:
OSStatus err = SetParameter(inParamID, kAudioUnitScope_Global, 0, inValue, 0);
if (err) throw err;
}
-
+
/*! @method GetParameter */
Float32 GetParameter( UInt32 inParamID )
{
@@ -219,8 +219,8 @@ public:
/*! @method GetCoordScale */
Float32 GetCoordScale() { return GetParameter(kPannerParam_CoordScale); }
/*! @method GetRefDistance */
- Float32 GetRefDistance() { return GetParameter(kPannerParam_RefDistance); }
-
+ Float32 GetRefDistance() { return GetParameter(kPannerParam_RefDistance); }
+
/*! @method SetGain */
void SetGain(Float32 inValue) { SetParameter(kPannerParam_Gain, inValue); }
/*! @method SetAzimuth */
@@ -233,7 +233,7 @@ public:
void SetCoordScale(Float32 inValue) { SetParameter(kPannerParam_CoordScale, inValue); }
/*! @method SetRefDistance */
void SetRefDistance(Float32 inValue) { SetParameter(kPannerParam_RefDistance, inValue); }
-
+
protected:
/*! @method ShouldBypassEffect */
// This is used in the render call to see if an effect is bypassed
@@ -248,17 +248,17 @@ protected:
/*! @method SetDefaultChannelLayoutsIfNone */
OSStatus SetDefaultChannelLayoutsIfNone();
-
+
/*! @method ChannelLayoutTagIsSupported */
- bool ChannelLayoutTagIsSupported( AudioUnitScope inScope,
- AudioUnitElement inElement,
+ bool ChannelLayoutTagIsSupported( AudioUnitScope inScope,
+ AudioUnitElement inElement,
AudioChannelLayoutTag inTag);
-
+
const AudioChannelLayout& GetInputLayout() const { return mInputLayout.Layout(); }
const AudioChannelLayout& GetOutputLayout() const { return mOutputLayout.Layout(); }
-
+
private:
-
+
/*! @var UpdateBypassMatrix */
bool mBypassEffect;
/*! @var mBypassMatrix */
diff --git a/libs/appleutility/CoreAudio/AudioUnits/AUPublic/OtherBases/MusicDeviceBase.cpp b/libs/appleutility/CoreAudio/AudioUnits/AUPublic/OtherBases/MusicDeviceBase.cpp
index 28e4d366bc..15e13e8d38 100644
--- a/libs/appleutility/CoreAudio/AudioUnits/AUPublic/OtherBases/MusicDeviceBase.cpp
+++ b/libs/appleutility/CoreAudio/AudioUnits/AUPublic/OtherBases/MusicDeviceBase.cpp
@@ -2,14 +2,14 @@
File: MusicDeviceBase.cpp
Abstract: MusicDeviceBase.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 "MusicDeviceBase.h"
@@ -90,10 +90,10 @@ static OSStatus MusicDeviceBaseStopNote(void * inComponentStorage,
#endif
-MusicDeviceBase::MusicDeviceBase(AudioComponentInstance inInstance,
+MusicDeviceBase::MusicDeviceBase(AudioComponentInstance inInstance,
UInt32 numInputs,
UInt32 numOutputs,
- UInt32 numGroups)
+ UInt32 numGroups)
: AUBase(inInstance, numInputs, numOutputs, numGroups),
AUMIDIBase(this)
{
@@ -106,8 +106,8 @@ OSStatus MusicDeviceBase::GetPropertyInfo(AudioUnitPropertyID inID,
Boolean & outWritable)
{
OSStatus result;
-
- switch (inID)
+
+ switch (inID)
{
#if !TARGET_OS_IPHONE
case kMusicDeviceProperty_InstrumentCount:
@@ -119,7 +119,7 @@ OSStatus MusicDeviceBase::GetPropertyInfo(AudioUnitPropertyID inID,
#endif
default:
result = AUBase::GetPropertyInfo (inID, inScope, inElement, outDataSize, outWritable);
-
+
if (result == kAudioUnitErr_InvalidProperty)
result = AUMIDIBase::DelegateGetPropertyInfo (inID, inScope, inElement, outDataSize, outWritable);
break;
@@ -134,7 +134,7 @@ OSStatus MusicDeviceBase::GetProperty( AudioUnitPropertyID inID,
{
OSStatus result;
- switch (inID)
+ switch (inID)
{
#if !CA_USE_AUDIO_PLUGIN_ONLY
case kAudioUnitProperty_FastDispatch:
@@ -146,7 +146,7 @@ OSStatus MusicDeviceBase::GetProperty( AudioUnitPropertyID inID,
else if (inElement == kMusicDeviceStartNoteSelect) {
*(TEMP_MusicDeviceStartNoteProc *)outData = MusicDeviceBaseStartNote;
return noErr;
- }
+ }
else if (inElement == kMusicDeviceStopNoteSelect) {
*(TEMP_MusicDeviceStopNoteProc *)outData = MusicDeviceBaseStopNote;
return noErr;
@@ -161,11 +161,11 @@ OSStatus MusicDeviceBase::GetProperty( AudioUnitPropertyID inID,
#endif
default:
result = AUBase::GetProperty (inID, inScope, inElement, outData);
-
+
if (result == kAudioUnitErr_InvalidProperty)
result = AUMIDIBase::DelegateGetProperty (inID, inScope, inElement, outData);
}
-
+
return result;
}
@@ -179,10 +179,10 @@ OSStatus MusicDeviceBase::SetProperty( AudioUnitPropertyID inID,
{
OSStatus result = AUBase::SetProperty (inID, inScope, inElement, inData, inDataSize);
-
+
if (result == kAudioUnitErr_InvalidProperty)
result = AUMIDIBase::DelegateSetProperty (inID, inScope, inElement, inData, inDataSize);
-
+
return result;
}
@@ -205,7 +205,7 @@ OSStatus MusicDeviceBase::HandleNoteOn( UInt8 inChannel,
params.mVelocity = inVelocity;
return StartNote (kMusicNoteEvent_UseGroupInstrument, inChannel, NULL, inStartFrame, params);
}
-
+
OSStatus MusicDeviceBase::HandleNoteOff( UInt8 inChannel,
UInt8 inNoteNumber,
UInt8 inVelocity,
@@ -214,17 +214,17 @@ OSStatus MusicDeviceBase::HandleNoteOff( UInt8 inChannel,
return StopNote (inChannel, inNoteNumber, inStartFrame);
}
-OSStatus
-MusicDeviceBase::HandleStartNoteMessage (MusicDeviceInstrumentID inInstrument,
- MusicDeviceGroupID inGroupID,
- NoteInstanceID * outNoteInstanceID,
- UInt32 inOffsetSampleFrame,
+OSStatus
+MusicDeviceBase::HandleStartNoteMessage (MusicDeviceInstrumentID inInstrument,
+ MusicDeviceGroupID inGroupID,
+ NoteInstanceID * outNoteInstanceID,
+ UInt32 inOffsetSampleFrame,
const MusicDeviceNoteParams * inParams)
{
if (inParams == NULL || outNoteInstanceID == NULL) return kAudio_ParamError;
if (!IsInitialized()) return kAudioUnitErr_Uninitialized;
-
+
return StartNote (inInstrument, inGroupID, outNoteInstanceID, inOffsetSampleFrame, *inParams);
}
@@ -251,7 +251,7 @@ OSStatus MusicDeviceBase::ComponentEntryDispatch( ComponentParameters * param
if (This == NULL) return kAudio_ParamError;
OSStatus result;
-
+
switch (params->what) {
case kMusicDeviceMIDIEventSelect:
case kMusicDeviceSysExSelect:
@@ -294,7 +294,7 @@ OSStatus MusicDeviceBase::ComponentEntryDispatch( ComponentParameters * param
result = AUBase::ComponentEntryDispatch(params, This);
break;
}
-
+
return result;
}
#endif
diff --git a/libs/appleutility/CoreAudio/AudioUnits/AUPublic/OtherBases/MusicDeviceBase.h b/libs/appleutility/CoreAudio/AudioUnits/AUPublic/OtherBases/MusicDeviceBase.h
index 4850b8f0cb..f7304a8eaa 100644
--- a/libs/appleutility/CoreAudio/AudioUnits/AUPublic/OtherBases/MusicDeviceBase.h
+++ b/libs/appleutility/CoreAudio/AudioUnits/AUPublic/OtherBases/MusicDeviceBase.h
@@ -2,14 +2,14 @@
File: MusicDeviceBase.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 __MusicDeviceBase_h__
#define __MusicDeviceBase_h__
@@ -57,23 +57,23 @@
class MusicDeviceBase : public AUBase, public AUMIDIBase {
public:
/*! @ctor MusicDeviceBase */
- MusicDeviceBase( AudioComponentInstance inInstance,
+ MusicDeviceBase( AudioComponentInstance inInstance,
UInt32 numInputs,
UInt32 numOutputs,
UInt32 numGroups = 0);
- virtual OSStatus MIDIEvent( UInt32 inStatus,
- UInt32 inData1,
- UInt32 inData2,
+ virtual OSStatus MIDIEvent( UInt32 inStatus,
+ UInt32 inData1,
+ UInt32 inData2,
UInt32 inOffsetSampleFrame)
{
return AUMIDIBase::MIDIEvent (inStatus, inData1, inData2, inOffsetSampleFrame);
}
/*! @method SysEx */
- virtual OSStatus SysEx( const UInt8 * inData,
- UInt32 inLength)
+ virtual OSStatus SysEx( const UInt8 * inData,
+ UInt32 inLength)
{
return AUMIDIBase::SysEx (inData, inLength);
}
@@ -90,7 +90,7 @@ public:
AudioUnitScope inScope,
AudioUnitElement inElement,
void * outData);
-
+
/*! @method SetProperty */
virtual OSStatus SetProperty( AudioUnitPropertyID inID,
AudioUnitScope inScope,
@@ -103,7 +103,7 @@ public:
UInt8 inNoteNumber,
UInt8 inVelocity,
UInt32 inStartFrame);
-
+
/*! @method HandleNoteOff */
virtual OSStatus HandleNoteOff( UInt8 inChannel,
UInt8 inNoteNumber,
diff --git a/libs/appleutility/CoreAudio/AudioUnits/AUPublic/Utility/AUBaseHelper.cpp b/libs/appleutility/CoreAudio/AudioUnits/AUPublic/Utility/AUBaseHelper.cpp
index 2316807138..65c6de8340 100644
--- a/libs/appleutility/CoreAudio/AudioUnits/AUPublic/Utility/AUBaseHelper.cpp
+++ b/libs/appleutility/CoreAudio/AudioUnits/AUPublic/Utility/AUBaseHelper.cpp
@@ -2,14 +2,14 @@
File: AUBaseHelper.cpp
Abstract: AUBaseHelper.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 "AUBaseHelper.h"
@@ -53,18 +53,18 @@
#endif
OSStatus GetFileRefPath (CFDictionaryRef parent, CFStringRef frKey, CFStringRef * fPath)
-{
+{
static CFStringRef kFRString = CFSTR (kAUPresetExternalFileRefs);
-
+
const void* frVal = CFDictionaryGetValue(parent, kFRString);
if (!frVal) return kAudioUnitErr_InvalidPropertyValue;
const void* frString = CFDictionaryGetValue ((CFDictionaryRef)frVal, frKey);
if (!frString) return kAudioUnitErr_InvalidPropertyValue;
-
+
if (fPath)
*fPath = (CFStringRef)frString;
-
+
return noErr;
}
@@ -74,7 +74,7 @@ CFMutableDictionaryRef CreateFileRefDict (CFStringRef fKey, CFStringRef fPath, C
fileRefDict = CFDictionaryCreateMutable (NULL, 0, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks);
CFDictionarySetValue (fileRefDict, fKey, fPath);
-
+
return fileRefDict;
}
@@ -113,11 +113,11 @@ void PrintAUParamEvent (AudioUnitParameterEvent& event, FILE* f)
fprintf (f, "\tEvent Type:%s,", (isRamp ? "ramp" : "immediate"));
if (isRamp)
fprintf (f, "start=%ld,dur=%ld,startValue=%f,endValue=%f\n",
- (long)event.eventValues.ramp.startBufferOffset, (long)event.eventValues.ramp.durationInFrames,
+ (long)event.eventValues.ramp.startBufferOffset, (long)event.eventValues.ramp.durationInFrames,
event.eventValues.ramp.startValue, event.eventValues.ramp.endValue);
else
- fprintf (f, "start=%ld,value=%f\n",
- (long)event.eventValues.immediate.bufferOffset,
+ fprintf (f, "start=%ld,value=%f\n",
+ (long)event.eventValues.immediate.bufferOffset,
event.eventValues.immediate.value);
fprintf (f, "- - - - - - - - - - - - - - - -\n");
}
diff --git a/libs/appleutility/CoreAudio/AudioUnits/AUPublic/Utility/AUBaseHelper.h b/libs/appleutility/CoreAudio/AudioUnits/AUPublic/Utility/AUBaseHelper.h
index 310a8df620..ad4cda627e 100644
--- a/libs/appleutility/CoreAudio/AudioUnits/AUPublic/Utility/AUBaseHelper.h
+++ b/libs/appleutility/CoreAudio/AudioUnits/AUPublic/Utility/AUBaseHelper.h
@@ -2,14 +2,14 @@
File: AUBaseHelper.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 __AUBaseHelper_h__
#define __AUBaseHelper_h__
diff --git a/libs/appleutility/CoreAudio/AudioUnits/AUPublic/Utility/AUBuffer.cpp b/libs/appleutility/CoreAudio/AudioUnits/AUPublic/Utility/AUBuffer.cpp
index 36bb41fa58..6164ae164e 100644
--- a/libs/appleutility/CoreAudio/AudioUnits/AUPublic/Utility/AUBuffer.cpp
+++ b/libs/appleutility/CoreAudio/AudioUnits/AUPublic/Utility/AUBuffer.cpp
@@ -2,14 +2,14 @@
File: AUBuffer.cpp
Abstract: AUBuffer.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 "AUBuffer.h"
#include <stdlib.h>
@@ -58,10 +58,10 @@ AUBufferList::~AUBufferList()
static UInt32 SafeMultiplyAddUInt32(UInt32 a, UInt32 b, UInt32 c)
{
if (a == 0 || b == 0) return c; // prevent zero divide
-
+
if (a > (0xFFFFFFFF - c) / b)
throw std::bad_alloc();
-
+
return a * b + c;
}
@@ -132,7 +132,7 @@ AudioBufferList & AUBufferList::PrepareBuffer(const CAStreamBasicDescription &fo
if (nStreams > mAllocatedStreams)
COMPONENT_THROW(kAudioUnitErr_FormatNotSupported);
}
-
+
AudioBufferList *abl = mPtrs;
abl->mNumberBuffers = nStreams;
AudioBuffer *buf = abl->mBuffers;
@@ -187,7 +187,7 @@ void AUBufferList::UseExternalBuffer(const CAStreamBasicDescription &format, co
Byte *oldMemory = mMemory;
mMemory = buf.buffer;
mAllocatedBytes = alignedSize;
- // from Allocate(): nBytes = nStreams * nFrames * format.mBytesPerFrame;
+ // from Allocate(): nBytes = nStreams * nFrames * format.mBytesPerFrame;
// thus: nFrames = nBytes / (nStreams * format.mBytesPerFrame)
mAllocatedFrames = mAllocatedBytes / (format.NumberChannelStreams() * format.mBytesPerFrame);
mExternalMemory = true;
diff --git a/libs/appleutility/CoreAudio/AudioUnits/AUPublic/Utility/AUBuffer.h b/libs/appleutility/CoreAudio/AudioUnits/AUPublic/Utility/AUBuffer.h
index 64ea4c3971..0bdea2300f 100644
--- a/libs/appleutility/CoreAudio/AudioUnits/AUPublic/Utility/AUBuffer.h
+++ b/libs/appleutility/CoreAudio/AudioUnits/AUPublic/Utility/AUBuffer.h
@@ -2,14 +2,14 @@
File: AUBuffer.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 __AUBuffer_h__
#define __AUBuffer_h__
@@ -75,7 +75,7 @@ class AUBufferList {
};
public:
/*! @ctor AUBufferList */
- AUBufferList() : mPtrState(kPtrsInvalid), mExternalMemory(false), mPtrs(NULL), mMemory(NULL),
+ AUBufferList() : mPtrState(kPtrsInvalid), mExternalMemory(false), mPtrs(NULL), mMemory(NULL),
mAllocatedStreams(0), mAllocatedFrames(0), mAllocatedBytes(0) { }
/*! @dtor ~AUBufferList */
~AUBufferList();
@@ -93,7 +93,7 @@ public:
memcpy(mPtrs, &abl, (char *)&abl.mBuffers[abl.mNumberBuffers] - (char *)&abl);
return *mPtrs;
}
-
+
/*! @method SetBuffer */
void SetBuffer(UInt32 index, const AudioBuffer &ab) {
if (mPtrState == kPtrsInvalid || index >= mPtrs->mNumberBuffers)
@@ -118,7 +118,7 @@ public:
COMPONENT_THROW(-1);
memcpy(&abl, mPtrs, (char *)&abl.mBuffers[abl.mNumberBuffers] - (char *)&abl);
}
-
+
/*! @method CopyBufferContentsTo */
void CopyBufferContentsTo(AudioBufferList &abl) const {
if (mPtrState == kPtrsInvalid)
@@ -134,12 +134,12 @@ public:
destbuf->mDataByteSize = srcbuf->mDataByteSize;
}
}
-
+
/*! @method Allocate */
void Allocate(const CAStreamBasicDescription &format, UInt32 nFrames);
/*! @method Deallocate */
void Deallocate();
-
+
/*! @method UseExternalBuffer */
void UseExternalBuffer(const CAStreamBasicDescription &format, const AudioUnitExternalBuffer &buf);
@@ -157,7 +157,7 @@ public:
/*! @method GetAllocatedFrames */
UInt32 GetAllocatedFrames() const { return mAllocatedFrames; }
-
+
private:
/*! @ctor AUBufferList */
AUBufferList(AUBufferList &) { } // prohibit copy constructor
@@ -184,34 +184,34 @@ private:
template <class T>
class TAUBuffer {
public:
- enum {
+ enum {
kAlignInterval = 0x10,
kAlignMask = kAlignInterval - 1
};
-
+
/*! @ctor TAUBuffer.0 */
TAUBuffer() : mMemObject(NULL), mAlignedBuffer(NULL), mBufferSizeBytes(0)
{
}
-
+
/*! @ctor TAUBuffer.1 */
TAUBuffer(UInt32 numElems, UInt32 numChannels) : mMemObject(NULL), mAlignedBuffer(NULL),
mBufferSizeBytes(0)
{
Allocate(numElems, numChannels);
}
-
+
/*! @dtor ~TAUBuffer */
~TAUBuffer()
{
Deallocate();
}
-
+
/*! @method Allocate */
void Allocate(UInt32 numElems) // can also re-allocate
{
UInt32 reqSize = numElems * sizeof(T);
-
+
if (mMemObject != NULL && reqSize == mBufferSizeBytes)
return; // already allocated
@@ -230,28 +230,28 @@ public:
{
if (mMemObject == NULL) return; // so this method has no effect if we're using
// an external buffer
-
+
free(mMemObject);
mMemObject = NULL;
mAlignedBuffer = NULL;
mBufferSizeBytes = 0;
}
-
+
/*! @method AllocateClear */
void AllocateClear(UInt32 numElems) // can also re-allocate
{
Allocate(numElems);
Clear();
}
-
+
/*! @method Clear */
void Clear()
{
memset(mAlignedBuffer, 0, mBufferSizeBytes);
}
-
+
// accessors
-
+
/*! @method operator T *()@ */
operator T *() { return mAlignedBuffer; }
diff --git a/libs/appleutility/CoreAudio/AudioUnits/AUPublic/Utility/AUInputFormatConverter.h b/libs/appleutility/CoreAudio/AudioUnits/AUPublic/Utility/AUInputFormatConverter.h
index f628a915e1..bc82c7f67a 100644
--- a/libs/appleutility/CoreAudio/AudioUnits/AUPublic/Utility/AUInputFormatConverter.h
+++ b/libs/appleutility/CoreAudio/AudioUnits/AUPublic/Utility/AUInputFormatConverter.h
@@ -2,14 +2,14 @@
File: AUInputFormatConverter.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 __AUInputFormatConverter_h__
#define __AUInputFormatConverter_h__
@@ -69,14 +69,14 @@ public:
strcpy(mTimestampGenerator.mDebugName, "AUConverter");
#endif
}
-
+
// need to subsequently call Initialize, with the desired formats
-
+
/*! @dtor ~AUInputFormatConverter */
~AUInputFormatConverter()
{
}
-
+
virtual OSStatus Initialize(const AudioStreamBasicDescription &src, const AudioStreamBasicDescription &dest)
{
OSStatus err = FormatConverterClient::Initialize(src, dest);
@@ -92,7 +92,7 @@ public:
mTimestampGenerator.Reset();
return FormatConverterClient::Reset();
}
-
+
void SetStartInputTimeAtZero(bool b)
{
mTimestampGenerator.SetStartInputAtZero(b);
@@ -119,13 +119,13 @@ public:
}
/*! @method FormatConverterInputProc */
- virtual OSStatus FormatConverterInputProc(
+ virtual OSStatus FormatConverterInputProc(
UInt32 & ioNumberDataPackets,
AudioBufferList & ioData,
AudioStreamPacketDescription** outDataPacketDescription)
{
OSStatus err = ca_noErr;
-
+
AudioUnitRenderActionFlags actionFlags = 0;
AUInputElement *input = mHost->GetInput(mHostBus);
*ioNumberDataPackets = std::min(*ioNumberDataPackets, This->mHost->GetMaxFramesPerSlice());
@@ -144,7 +144,7 @@ protected:
AUBase * mHost;
/*! @var mHostBus */
int mHostBus;
-
+
AUTimestampGenerator mTimestampGenerator;
bool mIsPCMToPCM;
bool mHasSRC;
diff --git a/libs/appleutility/CoreAudio/AudioUnits/AUPublic/Utility/AUMIDIDefs.h b/libs/appleutility/CoreAudio/AudioUnits/AUPublic/Utility/AUMIDIDefs.h
index e83c0e7e8d..4fa7a6259e 100644
--- a/libs/appleutility/CoreAudio/AudioUnits/AUPublic/Utility/AUMIDIDefs.h
+++ b/libs/appleutility/CoreAudio/AudioUnits/AUPublic/Utility/AUMIDIDefs.h
@@ -2,14 +2,14 @@
File: AUMIDIDefs.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 __AUMIDIDefs_h__
#define __AUMIDIDefs_h__
@@ -75,7 +75,7 @@ enum
kMidiController_Balance = 8,
kMidiController_Pan = 10,
kMidiController_Expression = 11,
-
+
// these controls have a (0-63) == off, (64-127) == on
kMidiController_Sustain = 64, //hold1
kMidiController_Portamento = 65,
@@ -91,7 +91,7 @@ enum
kMidiController_VibratoRate = 76,
kMidiController_VibratoDepth = 77,
kMidiController_VibratoDelay = 78,
-
+
// these controls have a 0-127 range and in MIDI they have no LSB (so fractional values are lost in MIDI)
kMidiController_ReverbLevel = 91,
kMidiController_ChorusLevel = 93,
@@ -109,7 +109,7 @@ enum
};
// RPN values
-enum
+enum
{
kMidiControllerValue_RPNPitchBendSensitivity = 0,
kMidiControllerValue_RPNChannelFineTuning = 1,
@@ -119,7 +119,7 @@ enum
};
// GM2 Sound Bank Constants
-enum
+enum
{
kGM2MelodicBank = 0x7900,
kGM2PercussionBank = 0x7800,
@@ -129,7 +129,7 @@ enum
kBankMSBMask = 0xff00
};
-enum
+enum
{
kMSBController_MidPoint = 0x40
};
diff --git a/libs/appleutility/CoreAudio/AudioUnits/AUPublic/Utility/AUSilentTimeout.h b/libs/appleutility/CoreAudio/AudioUnits/AUPublic/Utility/AUSilentTimeout.h
index 9fbd3e1f23..ad38819184 100644
--- a/libs/appleutility/CoreAudio/AudioUnits/AUPublic/Utility/AUSilentTimeout.h
+++ b/libs/appleutility/CoreAudio/AudioUnits/AUPublic/Utility/AUSilentTimeout.h
@@ -2,14 +2,14 @@
File: AUSilentTimeout.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 __AUSilentTimeout
#define __AUSilentTimeout
@@ -64,7 +64,7 @@ public:
mTimeoutCounter = inTimeoutLimit;
mResetTimer = false;
}
-
+
if(mTimeoutCounter > 0 )
{
mTimeoutCounter -= inFramesToProcess;
@@ -74,7 +74,7 @@ public:
else
{
// signal to reset the next time we receive silence
- mResetTimer = true;
+ mResetTimer = true;
}
}
diff --git a/libs/appleutility/CoreAudio/AudioUnits/AUPublic/Utility/AUTimestampGenerator.cpp b/libs/appleutility/CoreAudio/AudioUnits/AUPublic/Utility/AUTimestampGenerator.cpp
index 7c57a81ede..85dad84914 100644
--- a/libs/appleutility/CoreAudio/AudioUnits/AUPublic/Utility/AUTimestampGenerator.cpp
+++ b/libs/appleutility/CoreAudio/AudioUnits/AUPublic/Utility/AUTimestampGenerator.cpp
@@ -2,14 +2,14 @@
File: AUTimestampGenerator.cpp
Abstract: AUTimestampGenerator.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 "AUTimestampGenerator.h"
#include "CAMath.h"
@@ -68,12 +68,12 @@ void AUTimestampGenerator::AddOutputTime(const AudioTimeStamp &inTimeStamp, Floa
if (mState.mBypassed)
return;
-
+
if (mState.mHostTimeDiscontinuityCorrection && !(mState.mCurrentOutputTime.mFlags & kAudioTimeStampHostTimeValid) && (mState.mLastOutputTime.mFlags & kAudioTimeStampHostTimeValid)) {
// no host time here but we had one last time, interpolate one
double rateScalar = (mState.mCurrentOutputTime.mFlags & kAudioTimeStampRateScalarValid) ? mState.mCurrentOutputTime.mRateScalar : 1.0;
Float64 deltaSamples = mState.mCurrentOutputTime.mSampleTime - mState.mLastOutputTime.mSampleTime;
- mState.mCurrentOutputTime.mHostTime = mState.mLastOutputTime.mHostTime +
+ mState.mCurrentOutputTime.mHostTime = mState.mLastOutputTime.mHostTime +
UInt64(CAHostTimeBase::GetFrequency() * deltaSamples * rateScalar / outputSampleRate);
mState.mCurrentOutputTime.mFlags |= kAudioTimeStampHostTimeValid;
#if DEBUG
@@ -90,7 +90,7 @@ void AUTimestampGenerator::AddOutputTime(const AudioTimeStamp &inTimeStamp, Floa
mState.mCurrentOutputTime.mFlags |= kAudioTimeStampRateScalarValid;
}
}
-
+
if (mFirstTime) {
mFirstTime = false;
mState.mDiscontinuous = false;
@@ -120,16 +120,16 @@ const AudioTimeStamp & AUTimestampGenerator::GenerateInputTime(Float64 framesToA
return mState.mCurrentOutputTime;
double inputSampleTime;
-
+
mState.mCurrentInputTime.mFlags = kAudioTimeStampSampleTimeValid;
double rateScalar = 1.0;
-
+
// propagate rate scalar
if (mState.mCurrentOutputTime.mFlags & kAudioTimeStampRateScalarValid) {
mState.mCurrentInputTime.mFlags |= kAudioTimeStampRateScalarValid;
mState.mCurrentInputTime.mRateScalar = rateScalar = mState.mCurrentOutputTime.mRateScalar;
}
-
+
// propagate host time and sample time
if (mState.mCurrentOutputTime.mFlags & kAudioTimeStampHostTimeValid) {
mState.mCurrentInputTime.mFlags |= kAudioTimeStampHostTimeValid;
@@ -142,7 +142,7 @@ const AudioTimeStamp & AUTimestampGenerator::GenerateInputTime(Float64 framesToA
mState.mCurrentInputTime.mHostTime = mState.mCurrentOutputTime.mHostTime;
}
if (mState.mHostTimeDiscontinuityCorrection && mState.mDiscontinuous && (mState.mLastOutputTime.mFlags & kAudioTimeStampHostTimeValid)) {
- // we had a discontinuous output time, need to resync by interpolating
+ // we had a discontinuous output time, need to resync by interpolating
// a sample time that is appropriate to the host time
UInt64 deltaHostTime = mState.mCurrentOutputTime.mHostTime - mState.mLastOutputTime.mHostTime;
double deltaSeconds = double(deltaHostTime) * CAHostTimeBase::GetInverseFrequency();
@@ -168,28 +168,28 @@ const AudioTimeStamp & AUTimestampGenerator::GenerateInputTime(Float64 framesToA
// we had a discontinuous output time, need to resync by propagating the
// detected discontinuity, taking the rate scalar adjustment into account
inputSampleTime += floor(mState.mDiscontinuityDeltaSamples / mState.mRateScalarAdj + 0.5);
-
+
#if DEBUG
if (mVerbosity > 1)
printf("%-20.20s: adjusted input time: %.0f -> %.0f (SR=%.3f, rs=%.3f, delta=%.0f)\n", mDebugName, mState.mNextInputSampleTime, inputSampleTime, inputSampleRate, mState.mRateScalarAdj, mState.mDiscontinuityDeltaSamples);
#endif
-
+
mState.mDiscontinuityDeltaSamples = 0.;
}
-
-
+
+
// propagate word clock
if (mState.mCurrentOutputTime.mFlags & kAudioTimeStampWordClockTimeValid) {
mState.mCurrentInputTime.mFlags |= kAudioTimeStampWordClockTimeValid;
mState.mCurrentInputTime.mWordClockTime = mState.mCurrentOutputTime.mWordClockTime;
}
-
+
// propagate SMPTE time
if (mState.mCurrentOutputTime.mFlags & kAudioTimeStampSMPTETimeValid) {
mState.mCurrentInputTime.mFlags |= kAudioTimeStampSMPTETimeValid;
mState.mCurrentInputTime.mSMPTETime = mState.mCurrentOutputTime.mSMPTETime;
}
-
+
// store the input sample time and expected next input time
mState.mCurrentInputTime.mSampleTime = inputSampleTime;
mState.mNextInputSampleTime = inputSampleTime + framesToAdvance;
diff --git a/libs/appleutility/CoreAudio/AudioUnits/AUPublic/Utility/AUTimestampGenerator.h b/libs/appleutility/CoreAudio/AudioUnits/AUPublic/Utility/AUTimestampGenerator.h
index cfd8456dfb..333dc195f0 100644
--- a/libs/appleutility/CoreAudio/AudioUnits/AUPublic/Utility/AUTimestampGenerator.h
+++ b/libs/appleutility/CoreAudio/AudioUnits/AUPublic/Utility/AUTimestampGenerator.h
@@ -2,14 +2,14 @@
File: AUTimestampGenerator.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 __AUTimestampGenerator_h__
#define __AUTimestampGenerator_h__
@@ -76,14 +76,14 @@ public:
CAHostTimeBase::GetFrequency();
Reset();
}
-
+
void SetStartInputAtZero(bool b) { mState.mStartInputAtZero = b; }
bool GetStartInputAtZero() const { return mState.mStartInputAtZero; }
-
+
// bypassing is intended for a narrow special case. the upstream sample time will always be the same as the downstream time.
void SetBypassed(bool b) { mState.mBypassed = b; }
bool GetBypassed() const { return mState.mBypassed; }
-
+
// Call this to reset the timeline.
void Reset()
{
@@ -93,26 +93,26 @@ public:
mState.mNextOutputSampleTime = 0.;
mState.mLastOutputTime.mFlags = 0;
mState.mRateScalarAdj = 1.;
-
+
mFirstTime = true;
#if DEBUG
if (mVerbosity)
printf("%-20.20s: Reset\n", mDebugName);
#endif
}
-
+
// Call this once per render cycle with the downstream timestamp.
- // expectedDeltaFrames is the expected difference between the current and NEXT
+ // expectedDeltaFrames is the expected difference between the current and NEXT
// downstream timestamps.
// sampleRate is the OUTPUT sample rate.
void AddOutputTime(const AudioTimeStamp &inTimeStamp, Float64 expectedDeltaFrames, double outputSampleRate, double rateScalarAdj=1.0);
-
+
// Call this once per render cycle to obtain the upstream timestamp.
// framesToAdvance is the number of frames the input timeline is to be
// advanced during this render cycle.
// sampleRate is the INPUT sample rate.
const AudioTimeStamp & GenerateInputTime(Float64 framesToAdvance, double inputSampleRate, bool advanceHostTime = false);
-
+
// this can be called to override the setting of the next input sample time in GenerateInputTime
void Advance(Float64 framesToAdvance)
{
@@ -128,7 +128,7 @@ public:
Float64 mNextInputSampleTime;
Float64 mNextOutputSampleTime;
Float64 mInputSampleTimeForOutputPull;
-
+
AudioTimeStamp mLastOutputTime;
AudioTimeStamp mCurrentOutputTime;
@@ -137,21 +137,21 @@ public:
bool mDiscontinuous;
bool mBypassed;
Float64 mDiscontinuityDeltaSamples;
-
+
double mRateScalarAdj;
-
+
bool mHostTimeDiscontinuityCorrection; // If true, propagate timestamp discontinuities using host time.
};
-
+
void GetState(State& outState) const { outState = mState; }
void SetState(State const& inState) { mState = inState; mFirstTime = false; }
-
+
private:
-
+
struct State mState;
- bool mFirstTime;
-
+ bool mFirstTime;
+
#if DEBUG
public:
int mVerbosity;
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)
}