Skip to content

AudioToolbox tvOS xcode14.0 beta1

Manuel de la Pena edited this page Sep 6, 2022 · 5 revisions

#AudioToolbox.framework https://github.com/xamarin/xamarin-macios/pull/15877

diff -ruN /Applications/Xcode_13.3.0.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk/System/Library/Frameworks/AudioToolbox.framework/Headers/AUAudioUnit.h /Applications/Xcode_14.0.0-beta.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk/System/Library/Frameworks/AudioToolbox.framework/Headers/AUAudioUnit.h
--- /Applications/Xcode_13.3.0.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk/System/Library/Frameworks/AudioToolbox.framework/Headers/AUAudioUnit.h	2022-02-23 07:54:58.000000000 -0500
+++ /Applications/Xcode_14.0.0-beta.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk/System/Library/Frameworks/AudioToolbox.framework/Headers/AUAudioUnit.h	2022-05-31 14:51:09.000000000 -0400
@@ -12,6 +12,7 @@
 #ifdef __OBJC2__
 
 #import <AudioToolbox/AUParameters.h>
+#import <AudioToolbox/AudioUnitProperties.h>
 #import <Foundation/NSExtensionRequestHandling.h>
 #import <CoreMIDI/MIDIServices.h>
 
@@ -32,6 +33,8 @@
 
 @protocol AUAudioUnitFactory;
 
+@protocol AUMessageChannel;
+
 // =================================================================================================
 
 /*!	@typedef	AUAudioUnitStatus
@@ -39,14 +42,6 @@
 */
 typedef OSStatus AUAudioUnitStatus;
 
-/*!	@typedef	AUEventSampleTime
-	@brief		Expresses time as a sample count.
-	@discussion
-		Sample times are normally positive, but hosts can propagate HAL sample times through audio
-		units, and HAL sample times can be small negative numbers.
-*/
-typedef int64_t AUEventSampleTime;
-
 /*!	@var		AUEventSampleTimeImmediate
 	@brief		A special value of AUEventSampleTime indicating "immediately."
 	@discussion
@@ -1146,6 +1141,21 @@
 */
 @property (nonatomic, nullable) AUMIDICIProfileChangedBlock profileChangedBlock API_AVAILABLE(macos(10.14), ios(12.0)) __WATCHOS_PROHIBITED __TVOS_PROHIBITED;
 
+/*!	@method		messageChannelFor:
+	@brief		Returns an object for bidirectional communication between an Audio Unit and its host.
+	@discussion
+		Message channels provide a flexible way for custom data exchange between an Audio Unit and its host.
+		An Audio Unit can support multiple message channels which are identified by the `channelName`.
+		The message channel object's lifetime is managed by the host. Message channel objects should be designed
+		in such a way that they could outlive the AU that vended them.
+		For further details see discussion for `AUMessageChannel`.
+	@param	channelName
+		The name of the message channel to be returned by the Audio Unit if supported.
+	@return
+		An object that conforms to the `AUMessageChannel` protocol.
+*/
+- (id<AUMessageChannel>)messageChannelFor:(NSString *)channelName API_AVAILABLE(macos(13.0), ios(16.0)) __WATCHOS_PROHIBITED __TVOS_PROHIBITED;
+
 @end
 
 // =================================================================================================
@@ -1488,6 +1498,57 @@
 
 @end
 
+
+// =================================================================================================
+
+
+/*!	@typedef	CallHostBlock
+	@brief		Block that hosts provide to AU message channels to be called back by the AU.
+	@param	message
+		An NSDictionary with custom data. The allowed classes for key and value types are
+		NSArray, NSDictionary, NSOrderedSet, NSSet, NSString, NSData, NSNull, NSNumber, NSDate
+	@return
+		An NSDictionary with custom data. The allowed classes for key and value types are
+		NSArray, NSDictionary, NSOrderedSet, NSSet, NSString, NSData, NSNull, NSNumber, NSDate
+*/
+typedef NSDictionary * _Nonnull (^CallHostBlock)(NSDictionary *message);
+
+
+/*!	@protocol	AUMessageChannel
+	@brief		The protocol which objects returned from `[AUAudioUnit messageChannelFor:]` have to conform to.
+	@discussion
+		Audio Units and hosts that have special needs of communication, e.g. to exchange musical context required for better audio processing,
+		can implement a communication object to exchange messages in form of NSDictionaries. An Audio Unit would need to implement
+		a class conforming to the AUMessageChannel protocol and return an instance via `[AUAudioUnit messageChannelFor:]`. A host can query
+		the instance via the channel name.
+		The protocol offers a method to send messages to the AU and a block to send messages to the host.
+*/
+API_AVAILABLE(macos(13.0), ios(16.0)) __WATCHOS_PROHIBITED __TVOS_PROHIBITED
+@protocol AUMessageChannel
+
+@optional
+
+/*!	@method		callAudioUnit:
+	@brief		Calls the Audio Unit with custom data message.
+	@param	message
+		An NSDictionary with custom data. The allowed classes for key and value types are
+		NSArray, NSDictionary, NSOrderedSet, NSSet, NSString, NSData, NSNull, NSNumber, NSDate
+	@return
+		An NSDictionary with custom data. The allowed classes for key and value types are
+		NSArray, NSDictionary, NSOrderedSet, NSSet, NSString, NSData, NSNull, NSNumber, NSDate
+*/
+- (NSDictionary *)callAudioUnit:(NSDictionary *)message;
+
+/*!	@property	sendMessageToHostBlock
+	@brief		A callback for the AU to send a message to the host.
+	@discussion
+		The host has to set a block on this property.
+*/
+@property (NS_NONATOMIC_IOSONLY, copy, nullable) CallHostBlock callHostBlock;
+
+@end
+
+
 NS_ASSUME_NONNULL_END
 
 #endif // __OBJC2__
diff -ruN /Applications/Xcode_13.3.0.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk/System/Library/Frameworks/AudioToolbox.framework/Headers/AUAudioUnitImplementation.h /Applications/Xcode_14.0.0-beta.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk/System/Library/Frameworks/AudioToolbox.framework/Headers/AUAudioUnitImplementation.h
--- /Applications/Xcode_13.3.0.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk/System/Library/Frameworks/AudioToolbox.framework/Headers/AUAudioUnitImplementation.h	2022-02-23 07:11:49.000000000 -0500
+++ /Applications/Xcode_14.0.0-beta.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk/System/Library/Frameworks/AudioToolbox.framework/Headers/AUAudioUnitImplementation.h	2022-06-03 18:08:23.000000000 -0400
@@ -430,6 +430,20 @@
 */
 API_AVAILABLE(macos(10.11), ios(9.0), watchos(2.0), tvos(9.0))
 @interface AUAudioUnitV2Bridge : AUAudioUnit
+
+/*! @property audioUnit
+    @brief	  The underlying v2 AudioUnit
+	@discussion
+		We generally discourage interacting with the underlying v2 AudioUnit directly and
+		recommend using the v3 equivalent methods and properties from AUAudioUnitV2Bridge.
+		
+		In some rare cases it may be desirable to interact with the v2 AudioUnit.
+		For example, a v2 plugin may define custom properties that are not bridged to v3.
+		Implementors can sublcass AUAudioUnitV2Bridge and call the v2 API methods
+		AudioUnitGetProperty / AudioUnitSetProperty with the v2 AudioUnit.
+*/
+@property (nonatomic, readonly) AudioUnit audioUnit API_AVAILABLE(macos(11.0), ios(14.0), watchos(7.0), tvos(14.0));
+
 @end
 
 // =================================================================================================
diff -ruN /Applications/Xcode_13.3.0.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk/System/Library/Frameworks/AudioToolbox.framework/Headers/AUComponent.h /Applications/Xcode_14.0.0-beta.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk/System/Library/Frameworks/AudioToolbox.framework/Headers/AUComponent.h
--- /Applications/Xcode_13.3.0.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk/System/Library/Frameworks/AudioToolbox.framework/Headers/AUComponent.h	2022-02-23 10:55:28.000000000 -0500
+++ /Applications/Xcode_14.0.0-beta.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk/System/Library/Frameworks/AudioToolbox.framework/Headers/AUComponent.h	2022-05-31 15:01:46.000000000 -0400
@@ -453,7 +453,9 @@
 
     @constant       kAudioUnitSubType_Reverb2
                     A lite reverb that can be used to simulate various and different spaces
-
+ 
+	@constant       kAudioUnitSubType_AUSoundIsolation
+					An audio unit that can be used to isolate a specified sound type
 */
 CF_ENUM(UInt32) {
 	kAudioUnitSubType_PeakLimiter			= 'lmtr',
@@ -468,7 +470,8 @@
 	kAudioUnitSubType_Delay					= 'dely',
 	kAudioUnitSubType_SampleDelay			= 'sdly',
 	kAudioUnitSubType_NBandEQ				= 'nbeq',
-    kAudioUnitSubType_Reverb2               = 'rvb2'
+    kAudioUnitSubType_Reverb2               = 'rvb2',
+	kAudioUnitSubType_AUSoundIsolation API_AVAILABLE(macos(13.0), ios(16.0)) API_UNAVAILABLE(tvos) API_UNAVAILABLE(watchos) = 'vois',
 };
 
 #if !TARGET_OS_IPHONE
diff -ruN /Applications/Xcode_13.3.0.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk/System/Library/Frameworks/AudioToolbox.framework/Headers/AudioCodec.h /Applications/Xcode_14.0.0-beta.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk/System/Library/Frameworks/AudioToolbox.framework/Headers/AudioCodec.h
--- /Applications/Xcode_13.3.0.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk/System/Library/Frameworks/AudioToolbox.framework/Headers/AudioCodec.h	2022-02-23 07:58:09.000000000 -0500
+++ /Applications/Xcode_14.0.0-beta.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk/System/Library/Frameworks/AudioToolbox.framework/Headers/AudioCodec.h	2022-06-03 18:08:24.000000000 -0400
@@ -738,7 +738,10 @@
 						than the requested number of output packets may have been
 						produced. Check the value returned in ioNumberPackets for the
 						actual number produced. Note that not all formats have EOF
-						markers in them. 
+						markers in them.
+     @constant        kAudioCodecProduceOutputPacketSuccessConcealed
+                        No input packets were provided, but the decoder supports packet
+                        loss concealment, so output packets were still created.
 */
 CF_ENUM(UInt32)
 {
@@ -746,7 +749,8 @@
 	kAudioCodecProduceOutputPacketSuccess					= 2,	
 	kAudioCodecProduceOutputPacketSuccessHasMore			= 3,		
 	kAudioCodecProduceOutputPacketNeedsMoreInputData		= 4,		
-	kAudioCodecProduceOutputPacketAtEOF						= 5		
+	kAudioCodecProduceOutputPacketAtEOF						= 5,
+    kAudioCodecProduceOutputPacketSuccessConcealed          = 6
 };
 
 
diff -ruN /Applications/Xcode_13.3.0.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk/System/Library/Frameworks/AudioToolbox.framework/Headers/AudioComponent.h /Applications/Xcode_14.0.0-beta.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk/System/Library/Frameworks/AudioToolbox.framework/Headers/AudioComponent.h
--- /Applications/Xcode_13.3.0.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk/System/Library/Frameworks/AudioToolbox.framework/Headers/AudioComponent.h	2022-02-23 07:11:50.000000000 -0500
+++ /Applications/Xcode_14.0.0-beta.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk/System/Library/Frameworks/AudioToolbox.framework/Headers/AudioComponent.h	2022-05-31 14:51:09.000000000 -0400
@@ -606,7 +606,7 @@
 extern OSStatus
 AudioComponentCopyConfigurationInfo(    AudioComponent      inComponent,
                                         CFDictionaryRef __nullable * __nonnull outConfigurationInfo)
-                                                    API_AVAILABLE(macos(10.7)) API_UNAVAILABLE(ios, watchos, tvos);
+                                                    API_AVAILABLE(macos(10.7), ios(16.0)) API_UNAVAILABLE(watchos, tvos);
 
 /*!
 	 @enum		 AudioComponentValidationResult
@@ -658,8 +658,50 @@
 AudioComponentValidate( AudioComponent					inComponent,
 						CFDictionaryRef __nullable		inValidationParameters,
 						AudioComponentValidationResult *outValidationResult)
-                                                    API_AVAILABLE(macos(10.7)) API_UNAVAILABLE(ios, watchos, tvos);
-	
+                                                    API_AVAILABLE(macos(10.7), ios(16.0)) API_UNAVAILABLE(watchos, tvos);
+
+/*!
+	@function		AudioComponentValidateWithResults
+	@abstract		Tests a specified AudioComponent for API and behavioral conformance
+					asynchronously, returning detailed validation results.
+	@discussion		Currently, only AudioUnits can can be validated. The `inCompletionHandler` callback
+					has two parameters, an `AudioComponentValidationResult` with result of the validation,
+					and a `CFDictionaryRef` which contains the details of this result.
+					This dictionary may contain the following entries:
+						"Output"
+							An array of strings, with the same content as if the AU was validated on auval.
+						"Result"
+							An `AudioComponentValidationResult` with the result of the validation
+							process. The same as what's in the `AudioComponentValidationResult`
+							in the `inCompletionHandler` and what `AudioComponentValidate`
+							currently returns.
+						"Tests"
+							An array in which each value is a dictionary and may contain:
+								"Name"
+									A descriptive name of the test.
+								"Result"
+									An `AudioComponentValidationResult` with the result of the
+									specific test.
+								"Output"
+									An array of strings with output generated by the test.
+						"WasCached"
+							`YES` if the returned result was cached from previous runs.
+	@param			inComponent
+						The AudioComponent to validate.
+	@param			inValidationParameters
+						A CFDictionaryRef that contains parameters for the validation operation.
+						Passing NULL for this argument tells the system to use the default
+						parameters.
+	@param			inCompletionHandler
+						Completion callback. See discussion section.
+	@result			an OSStatus result code.
+*/
+extern OSStatus
+AudioComponentValidateWithResults(AudioComponent				inComponent,
+								  CFDictionaryRef __nullable	inValidationParameters,
+								  void 							(^inCompletionHandler)(AudioComponentValidationResult, CFDictionaryRef))
+													API_AVAILABLE(macos(13.0), ios(16.0)) API_UNAVAILABLE(watchos, tvos);
+
 /*!
 	@define		kAudioComponentValidationParameter_TimeOut
 	@discussion This is a number that indicates the time in seconds to wait for a validation
diff -ruN /Applications/Xcode_13.3.0.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk/System/Library/Frameworks/AudioToolbox.framework/Headers/AudioConverter.h /Applications/Xcode_14.0.0-beta.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk/System/Library/Frameworks/AudioToolbox.framework/Headers/AudioConverter.h
--- /Applications/Xcode_13.3.0.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk/System/Library/Frameworks/AudioToolbox.framework/Headers/AudioConverter.h	2022-02-23 07:08:43.000000000 -0500
+++ /Applications/Xcode_14.0.0-beta.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk/System/Library/Frameworks/AudioToolbox.framework/Headers/AudioConverter.h	2022-06-03 18:08:24.000000000 -0400
@@ -662,6 +662,8 @@
                     number of packets of audio data actually being provided for input, or 0 if
                     there is no more input.
     @param      ioData
+                    This points to an audio buffer list to be filled in by the callback to refer to the
+                    buffer(s) provided by the callback.
                     On exit, the members of ioData should be set to point to the audio data
                     being provided for input.
     @param      outDataPacketDescription
@@ -675,12 +677,29 @@
 	
 	The AudioConverter requests a minimum number of packets (*ioNumberDataPackets).
 	The callback may return one or more packets. If this is less than the minimum,
-	the callback will simply be called again in the near future.
+	the callback will simply be called again in the near future. Note that ioNumberDataPackets counts
+	packets in terms of the converter's input format (not its output format).
 
-	The callback manipulates the members of ioData to point to one or more buffers
+	The callback may be asked to provide multiple input packets in a single call, even for compressed
+	formats.  The callback must update the number of packets pointed to by ioNumberDataPackets
+	to indicate the number of packets actually being provided, and if the packets require packet
+	descriptions, these must be filled into the array pointed to by outDataPacketDescription, one
+	packet description per packet.
+
+	The callback is given an audio buffer list pointed to by ioData.  This buffer list may refer to
+	existing buffers owned and allocated by the audio converter, in which case the callback may
+	use them and copy input audio data into them.  However, the buffer list may also be empty
+	(mDataByteSize == 0 and/or mData == NULL), in which case the callback must provide its own
+	buffers.  The callback manipulates the members of ioData to point to one or more buffers
 	of audio data (multiple buffers are used with non-interleaved PCM data). The
-	callback is responsible for not freeing or altering this buffer until it is
-	called again.
+	callback is responsible for not freeing or altering this buffer until it is called again.
+
+	For input data that varies from one packet to another in either size (bytes per packet)
+	or duration (frames per packet), such as when decoding compressed audio, the callback
+	should expect outDataPacketDescription to be non-null and point to array of packet descriptions,
+	which the callback must fill in, one for every packet provided by the callback.  Each packet must
+	have a valid packet description, regardless of whether or not these descriptions are different
+	from each other.  Packet descriptions are required even if there is only one packet.
 
 	If the callback returns an error, it must return zero packets of data.
 	AudioConverterFillComplexBuffer will stop producing output and return whatever
@@ -725,6 +744,12 @@
 
 	Produces a buffer list of output data from an AudioConverter. The supplied input
 	callback function is called whenever necessary.
+	
+	If the output format uses packet descriptions, such as most compressed formats where packets
+	vary in size or duration, the caller is expected to provide a buffer for holding packet descriptions,
+	pointed to by outPacketDescription.  The array must have the capacity to hold a packet description
+	for each output packet that may be written.  A packet description array is expected even if only
+	a single output packet is to be written.
 */
 extern OSStatus
 AudioConverterFillComplexBuffer(    AudioConverterRef                   inAudioConverter,
diff -ruN /Applications/Xcode_13.3.0.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk/System/Library/Frameworks/AudioToolbox.framework/Headers/AudioQueue.h /Applications/Xcode_14.0.0-beta.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk/System/Library/Frameworks/AudioToolbox.framework/Headers/AudioQueue.h
--- /Applications/Xcode_13.3.0.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk/System/Library/Frameworks/AudioToolbox.framework/Headers/AudioQueue.h	2022-02-23 07:58:08.000000000 -0500
+++ /Applications/Xcode_14.0.0-beta.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk/System/Library/Frameworks/AudioToolbox.framework/Headers/AudioQueue.h	2022-05-31 15:01:45.000000000 -0400
@@ -135,8 +135,8 @@
     				Access to the required codec is not permitted (possibly due to incompatible
     				AudioSession settings on iOS).
     @constant   kAudioQueueErr_QueueInvalidated
-    				On iOS, the audio server has exited, causing this audio queue to have become
-    				invalid.
+    				On iOS derived platforms (excluding Catalyst), the audio server has exited,
+    				causing this audio queue to have become invalid.
     @constant   kAudioQueueErr_TooManyTaps
     				There can only be one processing tap per audio queue.
     @constant   kAudioQueueErr_InvalidTapContext
@@ -1625,7 +1625,8 @@
     @param      inTime
         A pointer to a structure containing the time to be translated.
     @param      outTime
-        A pointer to the the translated time.
+        On entry, mFlags indicate the desired translations. On exit, mFlags indicates which
+        of the requested translated fields were successfully populated.
     @result
         An OSStatus result code.
 */
diff -ruN /Applications/Xcode_13.3.0.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk/System/Library/Frameworks/AudioToolbox.framework/Headers/AudioToolbox.h /Applications/Xcode_14.0.0-beta.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk/System/Library/Frameworks/AudioToolbox.framework/Headers/AudioToolbox.h
--- /Applications/Xcode_13.3.0.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk/System/Library/Frameworks/AudioToolbox.framework/Headers/AudioToolbox.h	2022-02-23 07:08:43.000000000 -0500
+++ /Applications/Xcode_14.0.0-beta.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk/System/Library/Frameworks/AudioToolbox.framework/Headers/AudioToolbox.h	2022-06-03 18:08:24.000000000 -0400
@@ -15,8 +15,11 @@
 #include <TargetConditionals.h>
 
 #include <AudioToolbox/AudioCodec.h>
+#include <AudioToolbox/AUAudioUnit.h>
+#include <AudioToolbox/AUAudioUnitImplementation.h>
 #include <AudioToolbox/AUComponent.h>
 #include <AudioToolbox/AUGraph.h>
+#include <AudioToolbox/AUParameters.h>
 #include <AudioToolbox/AudioComponent.h>
 #include <AudioToolbox/AudioConverter.h>
 #include <AudioToolbox/AudioFile.h>
@@ -27,6 +30,7 @@
 #include <AudioToolbox/AudioServices.h>
 #include <AudioToolbox/AudioUnitParameters.h>
 #include <AudioToolbox/AudioUnitProperties.h>
+#include <AudioToolbox/AudioUnitUtilities.h>
 #include <AudioToolbox/AudioWorkInterval.h>
 #include <AudioToolbox/CAFFile.h>
 #include <AudioToolbox/CAShow.h>
@@ -37,18 +41,10 @@
 #if !TARGET_OS_IPHONE
 	// macOS only
 	#include <AudioToolbox/AudioFileComponent.h>
-	#include <AudioToolbox/AudioUnitUtilities.h>
 	#include <AudioToolbox/AUMIDIController.h>
 	#include <AudioToolbox/CoreAudioClock.h>
 #endif
 
-#ifdef __OBJC2__
-	// iOS (all architectures), macOS 64-bit only
-	#import <AudioToolbox/AUAudioUnit.h>
-	#import <AudioToolbox/AUAudioUnitImplementation.h>
-	#import <AudioToolbox/AUParameters.h>
-#endif
-
 #if TARGET_OS_OSX || TARGET_OS_IOS
 	#include <AudioToolbox/AudioSession.h>
 #endif
diff -ruN /Applications/Xcode_13.3.0.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk/System/Library/Frameworks/AudioToolbox.framework/Headers/AudioUnitParameters.h /Applications/Xcode_14.0.0-beta.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk/System/Library/Frameworks/AudioToolbox.framework/Headers/AudioUnitParameters.h
--- /Applications/Xcode_13.3.0.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk/System/Library/Frameworks/AudioToolbox.framework/Headers/AudioUnitParameters.h	2022-02-23 07:58:08.000000000 -0500
+++ /Applications/Xcode_14.0.0-beta.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk/System/Library/Frameworks/AudioToolbox.framework/Headers/AudioUnitParameters.h	2022-05-31 15:01:45.000000000 -0400
@@ -355,7 +355,14 @@
 		// or reverberant sound, sometimes also called loss of presence.
 		// However the flip side is that it can sound more stuttery for some content.
 		// Global, Boolean, 0->1, 1
-	kNewTimePitchParam_EnablePeakLocking			= 6
+	kNewTimePitchParam_EnablePeakLocking			= 6,
+    
+    // Transient preservation uses group delay to identify transients
+    // It resets the phase at points of transients to avoid smearing
+    // It also reduces the stretch factor at those points to avoid smearing
+    // This needs to be compensated at other frames, which can be problematic
+    // Global, Boolean, 0->1, 1
+    kNewTimePitchParam_EnableTransientPreservation  = 7
 };
 
 // Parameters for the AUSampler unit
@@ -693,6 +700,25 @@
 #endif
 };
 
+// Parameters for the AUSoundIsolation unit
+CF_ENUM(AudioUnitParameterID) {
+    // Global, Percent, 0->100, 100
+    kAUSoundIsolationParam_WetDryMixPercent API_AVAILABLE(macos(13.0), ios(16.0)) API_UNAVAILABLE(tvos) API_UNAVAILABLE(watchos) = 0,
+    // Global, Indexed, 1->1, 1
+    kAUSoundIsolationParam_SoundToIsolate API_AVAILABLE(macos(13.0), ios(16.0)) API_UNAVAILABLE(tvos) API_UNAVAILABLE(watchos) = 1,
+};
+
+/*!
+ @enum          AUSoundIsolation sound types
+ @brief         Constants available as values for parameter kAUSoundIsolation_SoundToIsolate.
+ 
+ @constant      kAUSoundIsolationSoundType_Voice
+ Isolate voice signal from the input signal.
+ */
+CF_ENUM(long) {
+    kAUSoundIsolationSoundType_Voice API_AVAILABLE(macos(13.0), ios(16.0)) API_UNAVAILABLE(tvos) API_UNAVAILABLE(watchos) = 1
+};
+
 #pragma mark Apple Specific - Desktop
 
 #if !TARGET_OS_IPHONE
diff -ruN /Applications/Xcode_13.3.0.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk/System/Library/Frameworks/AudioToolbox.framework/Headers/AudioUnitProperties.h /Applications/Xcode_14.0.0-beta.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk/System/Library/Frameworks/AudioToolbox.framework/Headers/AudioUnitProperties.h
--- /Applications/Xcode_13.3.0.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk/System/Library/Frameworks/AudioToolbox.framework/Headers/AudioUnitProperties.h	2022-02-23 07:58:08.000000000 -0500
+++ /Applications/Xcode_14.0.0-beta.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk/System/Library/Frameworks/AudioToolbox.framework/Headers/AudioUnitProperties.h	2022-05-31 14:51:08.000000000 -0400
@@ -1390,7 +1390,7 @@
 	@struct         MIDIEventList
 	@abstract       Forward declaration of MIDIEventList found in <CoreMIDI/MIDIServices.h>
 */
-typedef struct MIDIEventList MIDIEventList;
+struct MIDIEventList;
 
 /*!    @typedef    AUEventSampleTime
 	@brief        Expresses time as a sample count.
@@ -1816,6 +1816,21 @@
 
 #define kAudioUnitConfigurationInfo_SupportedChannelLayoutTags	"SupportedChannelLayoutTags"
 
+/*!
+ @define		kAudioUnitConfigurationInfo_MIDIProtocol
+ @discussion	A signed 32-bit integer representing the audio unit's MIDI protocol. This should be one of the
+				values in the MIDIProtocolID enum (see <CoreMIDI/MIDIServices.h>).
+ */
+
+#define kAudioUnitConfigurationInfo_MIDIProtocol	"MIDIProtocol"
+
+/*!
+ @define		kAudioUnitConfigurationInfo_MigrateFromPlugin
+ @discussion	An array of NSData representing byte encoded AudioUnitOtherPluginDescs to migrate from.
+ */
+
+#define kAudioUnitConfigurationInfo_MigrateFromPlugin	"MigrateFromPlugin"
+
 #pragma mark -
 #pragma mark OS X Availability
 
@@ -2621,7 +2636,7 @@
  */
 CF_ENUM(AudioUnitPropertyID) {
 	kAUVoiceIOProperty_MutedSpeechActivityEventListener = 2106
-} API_AVAILABLE(ios(15.0)) API_UNAVAILABLE(macos, watchos, tvos);
+} API_AVAILABLE(ios(15.0)) API_UNAVAILABLE(macos, watchos, tvos, macCatalyst);
 
 #pragma mark - AUVoiceProcessing unit deprecated properties
 
diff -ruN /Applications/Xcode_13.3.0.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk/System/Library/Frameworks/AudioToolbox.framework/Headers/AudioUnitUtilities.h /Applications/Xcode_14.0.0-beta.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk/System/Library/Frameworks/AudioToolbox.framework/Headers/AudioUnitUtilities.h
--- /Applications/Xcode_13.3.0.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk/System/Library/Frameworks/AudioToolbox.framework/Headers/AudioUnitUtilities.h	1969-12-31 19:00:00.000000000 -0500
+++ /Applications/Xcode_14.0.0-beta.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk/System/Library/Frameworks/AudioToolbox.framework/Headers/AudioUnitUtilities.h	2022-06-03 18:06:03.000000000 -0400
@@ -0,0 +1,606 @@
+#if (defined(__USE_PUBLIC_HEADERS__) && __USE_PUBLIC_HEADERS__) || (defined(USE_AUDIOTOOLBOX_PUBLIC_HEADERS) && USE_AUDIOTOOLBOX_PUBLIC_HEADERS) || !__has_include(<AudioToolboxCore/AudioUnitUtilities.h>)
+/*!
+	@file		AudioUnitUtilities.h
+	@framework	AudioToolbox.framework
+	@copyright	(c) 2002-2015 by Apple, Inc., all rights reserved.
+	@abstract	Higher-level utility functions for the use of AudioUnit clients.
+
+    @discussion
+
+	The AU Parameter Listener is designed to provide notifications when an Audio Unit's parameters
+	or other state changes.  It makes it unnecessary for UI components to continually poll an Audio
+	Unit to determine if a parameter value has been changed. In order for this notification
+	mechanism to work properly, parameter values should be changed using the AUParameterSet call
+	(discussed below). This also makes it unnecessary for an Audio Unit to provide and support a
+	notification mechanism, particularly as AudioUnitSetParameter may be received by an Audio Unit
+	during the render process.
+
+	The AUEventListener API's extend the AUParameterListener API's by supporting event types
+	other than parameter changes. Events, including parameter changes are delivered serially to the 
+	listener, preserving the time order of the events and parameter changes.
+
+	There are also some utilities for converting between non-linear and linear value ranges. These
+	are useful for displaying a non-linear parameter (such as one whose units are in Hertz or
+	decibels) using a linear control mechanism, such as a slider, to ensure that the user has a
+	wider perceived range of control over the parameter value.
+*/
+
+#ifndef AudioToolbox_AudioUnitUtilities_h
+#define AudioToolbox_AudioUnitUtilities_h
+
+#include <Availability.h>
+#include <AudioToolbox/AudioUnit.h>
+#ifdef __BLOCKS__
+    #include <dispatch/dispatch.h>
+#endif
+
+CF_ASSUME_NONNULL_BEGIN
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* ============================================================================= */
+
+/*!
+    @constant   kAUParameterListener_AnyParameter
+                    A wildcard value for an AudioUnitParameterID. Note that this is
+                    only valid when sending a notification (with AUParameterListenerNotify),
+                    not when registering to receive one.
+*/
+CF_ENUM(AudioUnitParameterID) {
+    kAUParameterListener_AnyParameter = 0xFFFFFFFF
+};
+
+/*!
+    @enum       AudioUnitEventType
+    
+    @abstract   Types of Audio Unit Events.
+    
+    @constant   kAudioUnitEvent_ParameterValueChange
+                    The event is a change to a parameter value
+    @constant   kAudioUnitEvent_BeginParameterChangeGesture
+                    The event signifies a gesture (e.g. mouse-down) beginning a potential series of
+                    related parameter value change events.
+    @constant   kAudioUnitEvent_EndParameterChangeGesture
+                    The event signifies a gesture (e.g. mouse-up) ending a series of related
+                    parameter value change events.
+    @constant   kAudioUnitEvent_PropertyChange
+                    The event is a change to a property value.
+*/
+typedef CF_ENUM(UInt32, AudioUnitEventType) {
+    kAudioUnitEvent_ParameterValueChange        = 0,
+    kAudioUnitEvent_BeginParameterChangeGesture = 1,
+    kAudioUnitEvent_EndParameterChangeGesture   = 2,
+    kAudioUnitEvent_PropertyChange              = 3
+};
+
+/* ============================================================================= */
+
+/*!
+    @typedef        AUParameterListenerRef
+    @abstract       An object which receives notifications of Audio Unit parameter value changes.
+*/
+typedef struct AUListenerBase *AUParameterListenerRef;
+    // opaque
+    // old-style listener, may not be passed to new functions
+
+/*!
+    @typedef        AUEventListenerRef
+    @abstract       An object which receives Audio Unit events.
+    @discussion     An AUEventListenerRef may be passed to API's taking an AUEventListenerRef
+                    as an argument.
+*/
+typedef AUParameterListenerRef AUEventListenerRef;
+    // new-style listener, can be passed to both old and new functions
+
+/*!
+    @struct     AudioUnitEvent
+    @abstract   Describes a change to an Audio Unit's state.
+    @var        mEventType
+        The type of event.
+    @var        mArgument
+        Specifies the parameter or property which has changed.
+*/  
+struct AudioUnitEvent {
+    AudioUnitEventType                  mEventType;
+    union {
+        AudioUnitParameter  mParameter; // for parameter value change, begin and end gesture
+        AudioUnitProperty   mProperty;  // for kAudioUnitEvent_PropertyChange
+    }                                   mArgument;
+};
+typedef struct AudioUnitEvent AudioUnitEvent;
+
+#ifdef __BLOCKS__
+/*!
+    @typedef    AUParameterListenerBlock
+    @abstract   A block called when a parameter value changes.
+    @param  inObject
+                The object which generated the parameter change.
+    @param  inParameter
+                Signifies the parameter whose value changed.
+    @param  inValue
+                The parameter's new value.
+*/
+typedef void (^AUParameterListenerBlock)(   void * __nullable           inObject,
+                                            const AudioUnitParameter *  inParameter,
+                                            AudioUnitParameterValue     inValue);
+
+/*!
+    @typedef    AUEventListenerBlock
+    @abstract   A block called when an Audio Unit event occurs.
+    @param  inObject
+                The object which generated the parameter change.
+    @param  inEvent
+                The event which occurred.
+    @param  inEventHostTime
+                The host time at which the event occurred.
+    @param  inParameterValue
+                If the event is parameter change, the parameter's new value (otherwise, undefined).
+*/
+typedef void (^AUEventListenerBlock)(       void * __nullable           inObject,
+                                            const AudioUnitEvent *      inEvent,
+                                            UInt64                      inEventHostTime,
+                                            AudioUnitParameterValue     inParameterValue);
+#endif
+
+/*!
+    @typedef    AUParameterListenerProc
+    @abstract   A function called when a parameter value changes.
+    @param  inUserData
+                The value passed to AUListenerCreate when the callback function was installed.
+    @param  inObject
+                The object which generated the parameter change.
+    @param  inParameter
+                Signifies the parameter whose value changed.
+    @param  inValue
+                The parameter's new value.
+*/
+typedef void (*AUParameterListenerProc)(    void * __nullable           inUserData,
+                                            void * __nullable           inObject,
+                                            const AudioUnitParameter *  inParameter,
+                                            AudioUnitParameterValue     inValue);
+
+/*!
+    @typedef    AUEventListenerProc
+    @abstract   A function called when an Audio Unit event occurs.
+    @param  inUserData
+                The value passed to AUListenerCreate when the callback function was installed.
+    @param  inObject
+                The object which generated the parameter change.
+    @param  inEvent
+                The event which occurred.
+    @param  inEventHostTime
+                The host time at which the event occurred.
+    @param  inParameterValue
+                If the event is parameter change, the parameter's new value (otherwise, undefined).
+*/
+typedef void (*AUEventListenerProc)(void * __nullable           inUserData,
+                                    void * __nullable           inObject,
+                                    const AudioUnitEvent *      inEvent,
+                                    UInt64                      inEventHostTime,
+                                    AudioUnitParameterValue     inParameterValue);
+
+
+/* ============================================================================= */
+
+/*!
+    @functiongroup  AUListener
+*/
+
+#ifdef __BLOCKS__
+/*!
+    @function   AUListenerCreateWithDispatchQueue
+    @abstract   Create an object for fielding notifications when AudioUnit parameter values change.
+    @param      outListener
+                    On successful return, an AUParameterListenerRef.
+    @param      inNotificationInterval
+                    The minimum time interval, in seconds, at which the callback will be called.
+                    If multiple parameter value changes occur within this time interval, the
+                    listener will only receive a notification for the last value change that
+                    occurred before the callback.  If inNotificationInterval is 0, the inRunLoop
+                    and inRunLoopMode arguments are ignored, and the callback will be issued
+                    immediately, on the thread on which the parameter was changed.
+    @param      inDispatchQueue
+                    Dispatch queue on which the callback is called.
+    @param      inBlock
+                    Block called when the parameter's value changes.
+    @discussion 
+        Note that only parameter changes issued through AUParameterSet will generate
+        notifications to listeners; thus, in most cases, AudioUnit clients should use
+        AUParameterSet in preference to AudioUnitSetParameterValue.
+*/
+extern OSStatus
+AUListenerCreateWithDispatchQueue(  AUParameterListenerRef __nullable * __nonnull outListener,
+                                    Float32                                       inNotificationInterval,
+                                    dispatch_queue_t                              inDispatchQueue,
+                                    AUParameterListenerBlock                      inBlock)        API_AVAILABLE(macos(10.6), ios(6.0), watchos(2.0), tvos(9.0));
+#endif
+
+/*!
+    @function   AUListenerCreate
+    @abstract   Create an object for fielding notifications when AudioUnit parameter values change.
+    @param      inProc
+                    Function called when the parameter's value changes.
+    @param      inUserData
+                    A reference value for the use of the callback function.
+    @param      inRunLoop
+                    The run loop on which the callback is called.  If NULL,
+                    CFRunLoopGetCurrent() is used.
+    @param      inRunLoopMode
+                    The run loop mode in which the callback's underlying run loop source will be
+                    attached.  If NULL, kCFRunLoopDefaultMode is used.
+    @param      inNotificationInterval
+                    The minimum time interval, in seconds, at which the callback will be called.
+                    If multiple parameter value changes occur within this time interval, the
+                    listener will only receive a notification for the last value change that
+                    occurred before the callback.  If inNotificationInterval is 0, the inRunLoop
+                    and inRunLoopMode arguments are ignored, and the callback will be issued
+                    immediately, on the thread on which the parameter was changed.
+    @param      outListener
+                    On successful return, an AUParameterListenerRef.
+    @discussion 
+        Note that only parameter changes issued through AUParameterSet will generate
+        notifications to listeners; thus, in most cases, AudioUnit clients should use
+        AUParameterSet in preference to AudioUnitSetParameter.
+*/
+extern OSStatus
+AUListenerCreate(                   AUParameterListenerProc         inProc,
+                                    void *                          inUserData,
+                                    CFRunLoopRef __nullable         inRunLoop,
+                                    CFStringRef __nullable          inRunLoopMode,
+                                    Float32                         inNotificationInterval,
+                                    AUParameterListenerRef __nullable * __nonnull outListener)    API_AVAILABLE(macos(10.2), ios(6.0), watchos(2.0), tvos(9.0));
+
+/*!
+    @function   AUListenerDispose
+    @abstract   Dispose a parameter listener object.
+    @param      inListener
+                    The parameter listener to dispose.
+*/
+extern OSStatus
+AUListenerDispose(                  AUParameterListenerRef          inListener)     API_AVAILABLE(macos(10.2), ios(6.0), watchos(2.0), tvos(9.0));
+
+/*!
+    @function   AUListenerAddParameter
+    @abstract   Connect a parameter to a listener.
+    @param      inListener
+                    The parameter listener which will receive the callback.
+    @param      inObject
+                    The object which is interested in the value of the parameter.  This will be
+                    passed as the inObject parameter to the listener callback function when the
+                    parameter changes.
+    @param      inParameter
+                    The parameter whose value changes are to generate callbacks.
+    @discussion 
+        Associates an arbitrary object (often a user interface widget) with an
+        AudioUnitParameter, and delivers notifications to the specified listener, telling it
+        that the object needs to be informed of the parameter's value change.
+*/
+extern OSStatus
+AUListenerAddParameter(             AUParameterListenerRef          inListener, 
+                                    void * __nullable               inObject,
+                                    const AudioUnitParameter *      inParameter)    API_AVAILABLE(macos(10.2), ios(6.0), watchos(2.0), tvos(9.0));
+
+/*!
+    @function   AUListenerRemoveParameter
+    @abstract   Remove a parameter/listener connection.
+    @param      inListener
+                    The parameter listener to stop receiving callbacks.
+    @param      inObject
+                    The object which is no longer interested in the value of the parameter.
+    @param      inParameter
+                    The parameter whose value changes are to stop generating callbacks.
+*/
+extern OSStatus
+AUListenerRemoveParameter(          AUParameterListenerRef          inListener, 
+                                    void * __nullable               inObject,
+                                    const AudioUnitParameter *      inParameter)    API_AVAILABLE(macos(10.2), ios(6.0), watchos(2.0), tvos(9.0));
+
+
+
+/*!
+    @function   AUParameterSet
+    @abstract   Set an AudioUnit parameter value and notify listeners.
+    @param      inSendingListener
+                    A parameter listener generating the change and which does not want to
+                    receive a callback as a result of it. May be NULL.
+    @param      inSendingObject
+                    The object generating the change and which does not want to receive a
+                    callback as a result of it. NULL is treated specially when inListener is
+                    non-null; it signifies that none of the specified listener's objects will
+                    receive notifications.
+    @param      inParameter
+                    The parameter being changed.
+    @param      inValue
+                    The new value of the parameter.
+	@param		inBufferOffsetInFrames
+					The offset into the next rendered buffer at which the parameter change will take
+					effect.
+    @discussion 
+        Calls AudioUnitSetParameter, and performs/schedules notification callbacks to all
+        parameter listeners, for that parameter -- except that no callback will be generated to
+        the inListener/inObject pair.
+*/
+extern OSStatus
+AUParameterSet(                     AUParameterListenerRef __nullable inSendingListener,
+                                    void * __nullable                 inSendingObject,
+                                    const AudioUnitParameter *        inParameter,
+                                    AudioUnitParameterValue           inValue,
+                                    UInt32                            inBufferOffsetInFrames)
+                                                                                    API_AVAILABLE(macos(10.2), ios(6.0), watchos(2.0), tvos(9.0));
+
+/*!
+    @function   AUParameterListenerNotify
+    @abstract   Notify listeners of a past parameter change.
+    @param      inSendingListener
+                    A parameter listener generating the change and which does not want to
+                    receive a callback as a result of it. May be NULL.
+    @param      inSendingObject
+                    The object generating the change and which does not want to receive a
+                    callback as a result of it. NULL is treated specially when inListener is
+                    non-null; it signifies that none of the specified listener's objects will
+                    receive notifications.
+    @param      inParameter
+                    The parameter which was changed.
+    @discussion 
+        Performs and schedules the notification callbacks of AUParameterSet, without
+        actually setting an AudioUnit parameter value.
+        
+        Clients scheduling ramped parameter changes to AudioUnits must make this call
+        dynamically during playback in order for AudioUnitViews to be updated.  When the view's
+        listener receives a notification, it will be passed the current value of the parameter.
+
+        A special meaning is applied if the mParameterID value of inParameter is equal to
+        kAUParameterListener_AnyParameter. In this case, ANY listener for ANY parameter value
+        changes on the specified AudioUnit will be notified of the current value of that
+        parameter.
+*/
+extern OSStatus
+AUParameterListenerNotify(          AUParameterListenerRef __nullable inSendingListener,
+                                    void * __nullable                 inSendingObject,
+                                    const AudioUnitParameter *        inParameter)    API_AVAILABLE(macos(10.2), ios(6.0), watchos(2.0), tvos(9.0));
+
+/* ============================================================================= */
+
+/*!
+    @functiongroup  AUEventListener
+*/
+
+#ifdef __BLOCKS__
+/*!
+    @function   AUEventListenerCreateWithDispatchQueue
+    @abstract   Creates an Audio Unit event listener.
+    @param      outListener
+                    On successful return, an AUEventListenerRef.
+    @param      inNotificationInterval
+                    The minimum time interval, in seconds, at which the callback will be called.
+    @param      inValueChangeGranularity
+                    Determines how parameter value changes occurring within this interval are
+                    queued; when an event follows a previous one by a smaller time interval than
+                    the granularity, then the listener will only be notified for the second
+                    parameter change.
+    @param      inDispatchQueue
+                    The dispatch queue on which the callback is called.
+    @param      inBlock
+                    Block called when an event occurs.
+    
+    @discussion
+        AUEventListener is a specialization of AUParameterListener; use AUListenerDispose to
+        dispose of an AUEventListener. You may use AUListenerAddParameter and
+        AUListenerRemoveParameter with AUEventListerRef's, in addition to
+        AUEventListenerAddEventType / AUEventListenerRemoveEventType.
+
+        Some examples illustrating inNotificationInterval and inValueChangeGranularity:
+
+        [1] a UI receiver: inNotificationInterval = 100 ms, inValueChangeGranularity = 100 ms.
+            User interfaces almost never care about previous values, only the current one,
+            and don't wish to perform redraws too often.
+
+        [2] An automation recorder: inNotificationInterval = 200 ms, inValueChangeGranularity = 10 ms.
+            Automation systems typically wish to record events with a high degree of timing precision,
+            but do not need to be woken up for each event.
+        
+        In case [1], the listener will be called within 100 ms (the notification interval) of an
+        event. It will only receive one notification for any number of value changes to the
+        parameter concerned, occurring within a 100 ms window (the granularity).
+
+        In case [2], the listener will be received within 200 ms (the notification interval) of
+        an event It can receive more than one notification per parameter, for the last of each
+        group of value changes occurring within a 10 ms window (the granularity).
+
+        In both cases, thread scheduling latencies may result in more events being delivered to
+        the listener callback than the theoretical maximum (notification interval /
+        granularity).
+*/
+extern OSStatus
+AUEventListenerCreateWithDispatchQueue(
+                                    AUEventListenerRef __nullable * __nonnull outListener,
+                                    Float32                                   inNotificationInterval,     // seconds
+                                    Float32                                   inValueChangeGranularity,   // seconds
+                                    dispatch_queue_t                          inDispatchQueue,
+                                    AUEventListenerBlock                      inBlock)            API_AVAILABLE(macos(10.6), ios(6.0), watchos(2.0), tvos(9.0));
+#endif
+
+/*!
+    @function   AUEventListenerCreate
+    @abstract   Creates an Audio Unit event listener.
+    @param      inProc
+                    Function called when an event occurs.
+    @param      inUserData
+                    A reference value for the use of the callback function.
+    @param      inRunLoop
+                    The run loop on which the callback is called.  If NULL,
+                    CFRunLoopGetCurrent() is used.
+    @param      inRunLoopMode
+                    The run loop mode in which the callback's underlying run loop source will be
+                    attached.  If NULL, kCFRunLoopDefaultMode is used.
+    @param      inNotificationInterval
+                    The minimum time interval, in seconds, at which the callback will be called.
+    @param      inValueChangeGranularity
+                    Determines how parameter value changes occurring within this interval are
+                    queued; when an event follows a previous one by a smaller time interval than
+                    the granularity, then the listener will only be notified for the second
+                    parameter change.
+    @param      outListener
+                    On successful return, an AUEventListenerRef.
+    
+    @discussion
+        See the discussion of AUEventListenerCreateWithDispatchQueue.
+*/
+extern OSStatus
+AUEventListenerCreate(              AUEventListenerProc                       inProc,
+                                    void * __nullable                         inUserData,
+                                    CFRunLoopRef __nullable                   inRunLoop,
+                                    CFStringRef __nullable                    inRunLoopMode,
+                                    Float32                                   inNotificationInterval,
+                                    Float32                                   inValueChangeGranularity,
+                                    AUEventListenerRef __nullable * __nonnull outListener)        API_AVAILABLE(macos(10.3), ios(6.0), watchos(2.0), tvos(9.0));
+
+/*!
+    @function   AUEventListenerAddEventType
+    @abstract   Begin delivering a particular type of events to a listener.
+    @param      inListener
+                    The parameter listener which will receive the events.
+    @param      inObject
+                    The object which is interested in the value of the parameter.  This will be
+                    passed as the inObject parameter to the listener callback function when the
+                    parameter changes.
+    @param      inEvent
+                    The type of event to listen for.
+    @result     An OSStatus error code.
+*/
+extern OSStatus
+AUEventListenerAddEventType(        AUEventListenerRef          inListener,
+                                    void * __nullable           inObject,
+                                    const AudioUnitEvent *      inEvent)        API_AVAILABLE(macos(10.3), ios(6.0), watchos(2.0), tvos(9.0));
+    
+/*!
+    @function   AUEventListenerRemoveEventType
+    @abstract   Stop delivering a particular type of events to a listener.
+    @param      inListener
+                    The parameter listener to stop receiving events.
+    @param      inObject
+                    The object which is no longer interested in the value of the parameter.
+    @param      inEvent
+                    The type of event to stop listening for.
+    @result     An OSStatus error code.
+*/
+extern OSStatus
+AUEventListenerRemoveEventType(     AUEventListenerRef          inListener,
+                                    void * __nullable           inObject,
+                                    const AudioUnitEvent *      inEvent)        API_AVAILABLE(macos(10.3), ios(6.0), watchos(2.0), tvos(9.0));           
+
+/*!
+    @function   AUEventListenerNotify
+    @abstract   Deliver an AudioUnitEvent to all listeners registered to receive it.
+    @discussion This is only to be used for notifications about parameter changes (and gestures).
+                It can not be used for notifying changes to property values as these are 
+                internal to an audio unit and should not be issued outside of the audio unit itself.
+    @param      inSendingListener
+                    A parameter listener generating the change and which does not want to
+                    receive a callback as a result of it. May be NULL.
+    @param      inSendingObject
+                    The object generating the change and which does not want to receive a
+                    callback as a result of it. NULL is treated specially when inListener is
+                    non-null; it signifies that none of the specified listener's objects will
+                    receive notifications.
+    @param      inEvent
+                    The event to be delivered.
+    @result     An OSStatus error code.
+*/
+extern OSStatus
+AUEventListenerNotify(              AUEventListenerRef __nullable  inSendingListener,
+                                    void * __nullable              inSendingObject,
+                                    const AudioUnitEvent *         inEvent)        API_AVAILABLE(macos(10.3), ios(6.0), watchos(2.0), tvos(9.0));
+                                    
+/* ============================================================================= */
+
+/*!
+    @functiongroup  Parameter value utilities
+*/
+
+
+/*!
+    @function   AUParameterValueFromLinear
+    @abstract   Converts a linear value to a parameter value according to the parameter's units.
+    
+    @param      inLinearValue
+                    The linear value (0.0-1.0) to convert.
+    @param      inParameter
+                    The parameter, including its Audio Unit, that will define the conversion of
+                    the supplied linear value to a value that is natural to that parameter.
+    @result
+                The converted parameter value, in the parameter's natural units.
+*/
+extern AudioUnitParameterValue
+AUParameterValueFromLinear(         Float32                     inLinearValue,
+                                    const AudioUnitParameter *  inParameter)    API_AVAILABLE(macos(10.2), ios(6.0), watchos(2.0), tvos(9.0));
+
+/*!
+    @function   AUParameterValueToLinear
+    @abstract   Converts a parameter value to a linear value according to the parameter's units.
+    
+    @param      inParameterValue
+                    The value in the natural units of the specified parameter.
+        
+    @param      inParameter
+                    The parameter, including its Audio Unit, that will define the conversion of
+                    the supplied parameter value to a corresponding linear value.
+    @result
+                A number 0.0-1.0.
+*/
+extern Float32
+AUParameterValueToLinear(           AudioUnitParameterValue     inParameterValue,
+                                    const AudioUnitParameter *  inParameter)    API_AVAILABLE(macos(10.2), ios(6.0), watchos(2.0), tvos(9.0));
+                                        // returns 0-1
+
+/*!
+    @function   AUParameterFormatValue
+    @abstract   Format a parameter value into a string.
+    @param      inParameterValue
+                    The parameter value to be formatted.
+    @param      inParameter
+                    The Audio Unit, scope, element, and parameter whose value this is.
+    @param      inTextBuffer
+                    The character array to receive the formatted text.  Should be at least 32
+                    characters.
+    @param      inDigits
+                    The resolution of the string (see example above).
+    @result
+                `inTextBuffer`
+
+    @discussion 
+        Formats a floating point value into a string.  Computes a power of 10 to which the value
+        will be rounded and displayed as follows:  if the the parameter is logarithmic (Hertz),
+        the number of significant digits is inDigits - pow10(inParameterValue) + 1.  Otherwise,
+        it is inDigits - pow10(maxValue - minValue) + 1.
+
+        Example for inDigits=3:
+
+        pow10 | range        |  digits after decimal place display
+        ------|--------------|------------------------------------
+        -2    | .0100-.0999  |  4
+        -1    | .100-.999    |  3
+        0     | 1.00-9.99    |  2
+        1     | 10.0-99.9    |  1
+        2     | 100-999      |  0
+        3     | 1000-9990    |  -1
+        4     | 10000-99900  |  -2
+*/                              
+extern char *
+AUParameterFormatValue(             Float64                     inParameterValue,
+                                    const AudioUnitParameter *  inParameter,
+                                    char *                      inTextBuffer,
+                                    UInt32                      inDigits)       API_AVAILABLE(macos(10.2), ios(6.0), watchos(2.0), tvos(9.0));
+
+#ifdef __cplusplus
+}
+#endif
+
+CF_ASSUME_NONNULL_END
+
+#endif // AudioToolbox_AudioUnitUtilities_h
+#else
+#include <AudioToolboxCore/AudioUnitUtilities.h>
+#endif
Clone this wiki locally