1 {!
2 @file AUComponent.h
3 @framework AudioUnit.framework
4 @copyright (c) 2002-2015 Apple, Inc. All rights reserved.
5 @brief C interfaces for working with Audio Units.
6
7 @discussion
8
9 An audio unit is a plugin that can be loaded into an application's process and used to process
10 or generate audio. An audio unit is an AudioComponent type and so the AudioComponent APIs are
11 used to find specific types of audio units, open and close them.
12
13 Audio units use a general notion of description to specify an unique instance. The Type is the
14 general category of an audio unit. The SubType is an unique identifier specified by the
15 Manufacturer (provider) of the audio unit. The IDs that are used for Type are specified by
16 Apple, the Manufacturer ID should be specified by an unique identifier
17 (as registered with apple). See AudioComponentDescription.
18
19 Audio unit types are of the following (see below for more information)
20
21 kAudioUnitType_Output = 'auou',
22 kAudioUnitType_MusicDevice = 'aumu',
23 kAudioUnitType_MusicEffect = 'aumf',
24 kAudioUnitType_FormatConverter = 'aufc',
25 kAudioUnitType_Effect = 'aufx',
26 kAudioUnitType_Mixer = 'aumx',
27 kAudioUnitType_Panner = 'aupn',
28 kAudioUnitType_OfflineEffect = 'auol',
29 kAudioUnitType_Generator = 'augn',
30
31 An audio unit's general operations are:
32 - Open an audio unit (AudioComponentInstanceNew)
33 - Configure it based on the context (AudioUnitSetProperty)
34 - Initialize the audio unit (AudioUnitInitialize)
35 - at this point the audio unit is in a state where it can render audio
36 - Render audio (AudioUnitRender)
37
38 An important part of a render operation for an audio unit is to manipulate the various controls
39 that the unit provides to change the render effects; for instance to change the decay time of
40 a reverb, the cut off frequency of a filter, etc. These are called parameters, and
41 AudioUnitGetParameter and AudioUnitSetParameter are used to interact with these.
42
43 If any reconfiguration of the audio unit is required, then:
44 - Uninitialize (AudioUnitUninitialize)
45 - Configure it based on the context (AudioUnitSetProperty)
46 - Initialize the audio unit (AudioUnitInitialize)
47
48 Once the host is finished with an audio unit, it closes it:
49 - Dispose the audio unit (AudioComponentInstanceDispose)
50
51 Audio units can be used programmatically (for instance, mixers can be used to render audio for a
52 game, a generator to play audio files, etc), or they can be hosted in Digital Audio Workstation
53 (DAW) applications such as Logic, Garage Band, etc. In the DAW case, it is common for an audio
54 unit to provide a custom view to allow the user to interact with what can be complex DSP
55 operations that the audio unit performs. The view is retrieved from an audio unit through
56 AudioUnitGetProperty and then the host instantiates it (see <AudioToolbox/AUCocoaUIView.h>).
57 }
58 { Pascal Translation: Gorazd Krosl <gorazd_1957@yahoo.ca>, October 2009 }
59 { Pascal Translation Update: Jonas Maebe <jonas@freepascal.org>, October 2012 }
60 { Pascal Translation Update: Jonas Maebe <jonas@freepascal.org>, July 2019 }
61 {
62 Modified for use with Free Pascal
63 Version 308
64 Please report any bugs to <gpc@microbizz.nl>
65 }
66
67 {$ifc not defined MACOSALLINCLUDE or not MACOSALLINCLUDE}
68 {$mode macpas}
69 {$modeswitch cblocks}
70 {$packenum 1}
71 {$macro on}
72 {$inline on}
73 {$calling mwpascal}
74
75 unit AUComponent;
76 interface
77 {$setc UNIVERSAL_INTERFACES_VERSION := $0400}
78 {$setc GAP_INTERFACES_VERSION := $0308}
79
80 {$ifc not defined USE_CFSTR_CONSTANT_MACROS}
81 {$setc USE_CFSTR_CONSTANT_MACROS := TRUE}
82 {$endc}
83
84 {$ifc defined CPUPOWERPC and defined CPUI386}
85 {$error Conflicting initial definitions for CPUPOWERPC and CPUI386}
86 {$endc}
87 {$ifc defined FPC_BIG_ENDIAN and defined FPC_LITTLE_ENDIAN}
88 {$error Conflicting initial definitions for FPC_BIG_ENDIAN and FPC_LITTLE_ENDIAN}
89 {$endc}
90
91 {$ifc not defined __ppc__ and defined CPUPOWERPC32}
92 {$setc __ppc__ := 1}
93 {$elsec}
94 {$setc __ppc__ := 0}
95 {$endc}
96 {$ifc not defined __ppc64__ and defined CPUPOWERPC64}
97 {$setc __ppc64__ := 1}
98 {$elsec}
99 {$setc __ppc64__ := 0}
100 {$endc}
101 {$ifc not defined __i386__ and defined CPUI386}
102 {$setc __i386__ := 1}
103 {$elsec}
104 {$setc __i386__ := 0}
105 {$endc}
106 {$ifc not defined __x86_64__ and defined CPUX86_64}
107 {$setc __x86_64__ := 1}
108 {$elsec}
109 {$setc __x86_64__ := 0}
110 {$endc}
111 {$ifc not defined __arm__ and defined CPUARM}
112 {$setc __arm__ := 1}
113 {$elsec}
114 {$setc __arm__ := 0}
115 {$endc}
116 {$ifc not defined __arm64__ and defined CPUAARCH64}
117 {$setc __arm64__ := 1}
118 {$elsec}
119 {$setc __arm64__ := 0}
120 {$endc}
121
122 {$ifc defined cpu64}
123 {$setc __LP64__ := 1}
124 {$elsec}
125 {$setc __LP64__ := 0}
126 {$endc}
127
128
129 {$ifc defined __ppc__ and __ppc__ and defined __i386__ and __i386__}
130 {$error Conflicting definitions for __ppc__ and __i386__}
131 {$endc}
132
133 {$ifc defined __ppc__ and __ppc__}
134 {$setc TARGET_CPU_PPC := TRUE}
135 {$setc TARGET_CPU_PPC64 := FALSE}
136 {$setc TARGET_CPU_X86 := FALSE}
137 {$setc TARGET_CPU_X86_64 := FALSE}
138 {$setc TARGET_CPU_ARM := FALSE}
139 {$setc TARGET_CPU_ARM64 := FALSE}
140 {$setc TARGET_OS_MAC := TRUE}
141 {$setc TARGET_OS_IPHONE := FALSE}
142 {$setc TARGET_IPHONE_SIMULATOR := FALSE}
143 {$setc TARGET_OS_EMBEDDED := FALSE}
144 {$elifc defined __ppc64__ and __ppc64__}
145 {$setc TARGET_CPU_PPC := FALSE}
146 {$setc TARGET_CPU_PPC64 := TRUE}
147 {$setc TARGET_CPU_X86 := FALSE}
148 {$setc TARGET_CPU_X86_64 := FALSE}
149 {$setc TARGET_CPU_ARM := FALSE}
150 {$setc TARGET_CPU_ARM64 := FALSE}
151 {$setc TARGET_OS_MAC := TRUE}
152 {$setc TARGET_OS_IPHONE := FALSE}
153 {$setc TARGET_IPHONE_SIMULATOR := FALSE}
154 {$setc TARGET_OS_EMBEDDED := FALSE}
155 {$elifc defined __i386__ and __i386__}
156 {$setc TARGET_CPU_PPC := FALSE}
157 {$setc TARGET_CPU_PPC64 := FALSE}
158 {$setc TARGET_CPU_X86 := TRUE}
159 {$setc TARGET_CPU_X86_64 := FALSE}
160 {$setc TARGET_CPU_ARM := FALSE}
161 {$setc TARGET_CPU_ARM64 := FALSE}
162 {$ifc defined iphonesim}
163 {$setc TARGET_OS_MAC := FALSE}
164 {$setc TARGET_OS_IPHONE := TRUE}
165 {$setc TARGET_IPHONE_SIMULATOR := TRUE}
166 {$elsec}
167 {$setc TARGET_OS_MAC := TRUE}
168 {$setc TARGET_OS_IPHONE := FALSE}
169 {$setc TARGET_IPHONE_SIMULATOR := FALSE}
170 {$endc}
171 {$setc TARGET_OS_EMBEDDED := FALSE}
172 {$elifc defined __x86_64__ and __x86_64__}
173 {$setc TARGET_CPU_PPC := FALSE}
174 {$setc TARGET_CPU_PPC64 := FALSE}
175 {$setc TARGET_CPU_X86 := FALSE}
176 {$setc TARGET_CPU_X86_64 := TRUE}
177 {$setc TARGET_CPU_ARM := FALSE}
178 {$setc TARGET_CPU_ARM64 := FALSE}
179 {$ifc defined iphonesim}
180 {$setc TARGET_OS_MAC := FALSE}
181 {$setc TARGET_OS_IPHONE := TRUE}
182 {$setc TARGET_IPHONE_SIMULATOR := TRUE}
183 {$elsec}
184 {$setc TARGET_OS_MAC := TRUE}
185 {$setc TARGET_OS_IPHONE := FALSE}
186 {$setc TARGET_IPHONE_SIMULATOR := FALSE}
187 {$endc}
188 {$setc TARGET_OS_EMBEDDED := FALSE}
189 {$elifc defined __arm__ and __arm__}
190 {$setc TARGET_CPU_PPC := FALSE}
191 {$setc TARGET_CPU_PPC64 := FALSE}
192 {$setc TARGET_CPU_X86 := FALSE}
193 {$setc TARGET_CPU_X86_64 := FALSE}
194 {$setc TARGET_CPU_ARM := TRUE}
195 {$setc TARGET_CPU_ARM64 := FALSE}
196 {$setc TARGET_OS_MAC := FALSE}
197 {$setc TARGET_OS_IPHONE := TRUE}
198 {$setc TARGET_IPHONE_SIMULATOR := FALSE}
199 {$setc TARGET_OS_EMBEDDED := TRUE}
200 {$elifc defined __arm64__ and __arm64__}
201 {$setc TARGET_CPU_PPC := FALSE}
202 {$setc TARGET_CPU_PPC64 := FALSE}
203 {$setc TARGET_CPU_X86 := FALSE}
204 {$setc TARGET_CPU_X86_64 := FALSE}
205 {$setc TARGET_CPU_ARM := FALSE}
206 {$setc TARGET_CPU_ARM64 := TRUE}
207 {$ifc defined ios}
208 {$setc TARGET_OS_MAC := FALSE}
209 {$setc TARGET_OS_IPHONE := TRUE}
210 {$setc TARGET_OS_EMBEDDED := TRUE}
211 {$elsec}
212 {$setc TARGET_OS_MAC := TRUE}
213 {$setc TARGET_OS_IPHONE := FALSE}
214 {$setc TARGET_OS_EMBEDDED := FALSE}
215 {$endc}
216 {$setc TARGET_IPHONE_SIMULATOR := FALSE}
217 {$elsec}
218 {$error __ppc__ nor __ppc64__ nor __i386__ nor __x86_64__ nor __arm__ nor __arm64__ is defined.}
219 {$endc}
220
221 {$ifc defined __LP64__ and __LP64__ }
222 {$setc TARGET_CPU_64 := TRUE}
223 {$elsec}
224 {$setc TARGET_CPU_64 := FALSE}
225 {$endc}
226
227 {$ifc defined FPC_BIG_ENDIAN}
228 {$setc TARGET_RT_BIG_ENDIAN := TRUE}
229 {$setc TARGET_RT_LITTLE_ENDIAN := FALSE}
230 {$elifc defined FPC_LITTLE_ENDIAN}
231 {$setc TARGET_RT_BIG_ENDIAN := FALSE}
232 {$setc TARGET_RT_LITTLE_ENDIAN := TRUE}
233 {$elsec}
234 {$error Neither FPC_BIG_ENDIAN nor FPC_LITTLE_ENDIAN are defined.}
235 {$endc}
236 {$setc ACCESSOR_CALLS_ARE_FUNCTIONS := TRUE}
237 {$setc CALL_NOT_IN_CARBON := FALSE}
238 {$setc OLDROUTINENAMES := FALSE}
239 {$setc OPAQUE_TOOLBOX_STRUCTS := TRUE}
240 {$setc OPAQUE_UPP_TYPES := TRUE}
241 {$setc OTCARBONAPPLICATION := TRUE}
242 {$setc OTKERNEL := FALSE}
243 {$setc PM_USE_SESSION_APIS := TRUE}
244 {$setc TARGET_API_MAC_CARBON := TRUE}
245 {$setc TARGET_API_MAC_OS8 := FALSE}
246 {$setc TARGET_API_MAC_OSX := TRUE}
247 {$setc TARGET_CARBON := TRUE}
248 {$setc TARGET_CPU_68K := FALSE}
249 {$setc TARGET_CPU_MIPS := FALSE}
250 {$setc TARGET_CPU_SPARC := FALSE}
251 {$setc TARGET_OS_UNIX := FALSE}
252 {$setc TARGET_OS_WIN32 := FALSE}
253 {$setc TARGET_RT_MAC_68881 := FALSE}
254 {$setc TARGET_RT_MAC_CFM := FALSE}
255 {$setc TARGET_RT_MAC_MACHO := TRUE}
256 {$setc TYPED_FUNCTION_POINTERS := TRUE}
257 {$setc TYPE_BOOL := FALSE}
258 {$setc TYPE_EXTENDED := FALSE}
259 {$setc TYPE_LONGLONG := TRUE}
260 uses MacTypes,AudioComponents,CFBase,CFArray,CFDate,CoreAudioTypes;
261 {$endc} {not MACOSALLINCLUDE}
262
263 {$ALIGN POWER}
264
265
266 //=====================================================================================================================
267 //#pragma mark Overview
268
269 //CF_ASSUME_NONNULL_BEGIN
270
271 //#define AU_SUPPORT_INTERAPP_AUDIO (TARGET_OS_IPHONE && !(0 && !TARGET_IPHONE_SIMULATOR && !TARGET_OS_EMBEDDED))
272
273
274 //================================================================================================
275 //#pragma mark -
276 //#pragma mark Audio Unit Types
277 {!
278 @typedef AudioUnit
279 @discussion An audio unit is of type AudioComponentInstance as defined in
280 AudioComponent.h
281 }
282 type
283 AudioUnit = AudioComponentInstance;
284
285
286 {!
287 @enum Audio Unit Types
288 @abstract different types of audio units
289 @discussion Audio units are classified into different types, where those types perform
290 different roles and functions.
291 There are some general categories of functionality that apply across different
292 types of audio units:
293 (1) Real-time usage
294 The audio unit will complete its operations in less time than is
295 represented by the render buffer. All audio units with the exception of
296 the OfflineEffect should meet this criteria
297 (2) Real-time I/O
298 Will request the same amount of audio input as it is being asked to
299 produce for output. Effects, Panners, Mixers and MusicDevices are required
300 to adhere to this restriction. FormatConverter's can with some constraints
301 be used in this situation (for instance, sample rate conversion, float-int),
302 but the host of the audio unit is responsible for insuring this.
303 (3) UI versus Programmatic usage
304 UI usage covers the case of using an audio unit in a Digital Audio
305 Workstation (DAW) with appropriate UI (for example a filter in Garage Band
306 or Logic). Effects, Panners, MusicDevices are all expected to be usable
307 within this context.
308 Programmatic usage is where an audio unit is used by a host app as part of
309 a general signal processing chain.
310 For instance, a mixer audio unit can be used to take several different
311 audio sources in a game and mix them together. Mixers, Output units are
312 for programmatic usage. FormatConverter and Generator types are generally
313 programmatic audio units, but if they can be used in a UI situation, they
314 specify a custom view. The app can then use that to decide that, with
315 appropriate constraints, the audio unit could be presented in a DAW type
316 application. For instance, the AUConverter audio unit from apple can do
317 sample rate conversion, etc, but has not general utility for a user in a
318 DAW app. Apple's Varispeed or AUTimePitch audio units can be used to change
319 the playback rate and pitch and so could be used to good affect by a user
320 in a DAW type environment, as well as just providing this general
321 functionality to any program.
322
323 @constant kAudioUnitType_Output
324 An output unit can be used as the head of an AUGraph. Apple provides a number
325 of output units that interface directly with an audio device
326
327 @constant kAudioUnitType_MusicDevice
328 Used to describe software musical instruments such as samplers and
329 synthesisers. They respond to MIDI and create notes, which are then controlled
330 through parameters or MIDI control messages. See <AudioToolbox/MusicDevice.h>
331
332 @constant kAudioUnitType_MusicEffect
333 Is an effect that is also able to respond directly to MIDI control messages,
334 typically through the mapping of these MIDI messages to different parameters
335 of the effect's DSP algorithm.
336
337 @constant kAudioUnitType_FormatConverter
338 A format converter is a general category for audio units that can change the
339 format (for instance, sample rate conversion) from an input to an output, as
340 well as other, non-I/O type manipulations (like a deferred render or varispeed
341 type of operation). As such, a format converter can ask for as much or as
342 little audio input to produce a given output. They are still expected to
343 complete their rendering within the time represented by the output buffer.
344 For format converters that have some utility as an "audio effect or processor",
345 it is quite common to provide an offline version of this audio unit as well.
346 For instance, Apple ships a format converter (for use in a "real-time" like
347 situation) and an offline version (for processing audio files) of the Time
348 Pitch and Varispeed audio units.
349
350 @constant kAudioUnitType_Effect
351 An audio unit that will process some x number of audio input samples to produce
352 x number of audio output samples. The common case for an effect is to have a
353 single input to a single output, though some effects take side-chain inputs as
354 well. Effects can be run in "offline" contexts (such as processing a file), but
355 they are expected to run in real-time. A delay unit or reverb is a good
356 example of this.
357
358 @constant kAudioUnitType_Mixer
359 An audio unit that takes some number of inputs, mixing them to provide 1 or
360 more audio outputs. A stere mixer (mono and stereo inputs to produce one
361 stereo output) is an example of this.
362
363 @constant kAudioUnitType_Panner
364 A panner is a specialised effect that will pan a single audio input to a single
365 output. Panner units are required to support a collection of standardised
366 parameters that specify the panning coordinates (aside from whatever custom
367 parameters the panner may provide). A surround panner is an example of this
368
369 @constant kAudioUnitType_Generator
370 A generator will have no audio input, but will just produce audio output. In
371 some ways it is similar to a MusicDevice, except that a generator provides no
372 MIDI input, or notion of "notes". A tone generator is a good example of this.
373
374 @constant kAudioUnitType_OfflineEffect
375 An offline effect is used to process data from a file and is also used to
376 publish a capability that cannot be run in real-time. For instance, the process
377 of normalisation requires seeing the entire audio input before the scalar to
378 apply in the normalisation process can be estimated. As such, offline effects
379 also have a notion of a priming stage that can be performed before the actual
380 rendering/processing phase is executed.
381
382 @constant kAudioUnitType_MIDIProcessor
383 Plugins of this type process midi input and produce midi output. They do not produce audio.
384
385 }
386 const
387 kAudioUnitType_Output = FourCharCode('auou');
388 kAudioUnitType_MusicDevice = FourCharCode('aumu');
389 kAudioUnitType_MusicEffect = FourCharCode('aumf');
390 kAudioUnitType_FormatConverter = FourCharCode('aufc');
391 kAudioUnitType_Effect = FourCharCode('aufx');
392 kAudioUnitType_Mixer = FourCharCode('aumx');
393 kAudioUnitType_Panner = FourCharCode('aupn');
394 kAudioUnitType_Generator = FourCharCode('augn');
395 kAudioUnitType_OfflineEffect = FourCharCode('auol');
396 kAudioUnitType_MIDIProcessor = FourCharCode('aumi');
397
398 {$ifc TARGET_OS_IPHONE and not TARGET_IPHONE_SIMULATOR}
399 {!
400 @enum Audio Unit Types (for inter-app audio)
401 @abstract types of inter-app audio units
402
403 @constant kAudioUnitType_RemoteEffect
404 @constant kAudioUnitType_RemoteGenerator
405 @constant kAudioUnitType_RemoteInstrument
406 @constant kAudioUnitType_RemoteMusicEffect
407
408 @discussion
409 These Audio Unit types are identical to the corresponding "non-remote" types (e.g.
410 kAudioUnitType_Effect, etc.), with the exception that they are the types that must be
411 used for AudioUnits defined by applications calling AudioOutputUnitPublish.
412
413 When Audio Components of these types are instantiated via AudioComponentInstanceNew,
414 a connection is made to the process which published the component via AudioOutputUnitPublish.
415
416 When using Audio Units which are instances of these components, one must take care to
417 initialize the unit only immediately before beginning a series of render operations, and
418 uninitialize it immediately afterwards, since while initialized, the Audio Unit's background
419 process is being kept awake and is consuming system resources.
420
421 When using AudioUnitGetProperty and AudioUnitSetProperty, only Apple-defined properties
422 are supported.
423
424 For kAudioUnitProperty_HostCallbacks, hosts can set this property on any remote audio unit.
425 This will cause the host callbacks to be called on each render cycle and the results
426 communicated to the remote AU's process. The owner of the published AU ("node") can *get*
427 this property on its output units, obtaining the structure of function pointers, and call
428 the host callbacks during the render cycle.
429 }
430 const
431 kAudioUnitType_RemoteEffect = FourCharCode('aurx');
432 kAudioUnitType_RemoteGenerator = FourCharCode('aurg');
433 kAudioUnitType_RemoteInstrument = FourCharCode('auri');
434 kAudioUnitType_RemoteMusicEffect = FourCharCode('aurm');
435 {$endc} {TARGET_OS_IPHONE and not TARGET_IPHONE_SIMULATOR}
436
437 //================================================================================================
438 //#pragma mark -
439 //#pragma mark Apple Audio Units
440 {!
441 @enum Apple audio unit manufacturer ID.
442 @discussion the unique ID used to identifier audio units provided by Apple, Inc.
443 }
444 const
445 kAudioUnitManufacturer_Apple = FourCharCode('appl');
446
447 {!
448 @enum Apple input/output audio unit sub types
449 @discussion These are the subtypes for the various input/output units that Apple ships. Input/output
450 units add an additional notion of Start and Stop.
451 see <AudioToolbox/AudioOutputUnit.h>
452
453 @constant kAudioUnitSubType_GenericOutput
454 A generic output unit provides the start/stop API, and provides the basic
455 services to convert Linear PCM formats.
456
457 @constant kAudioUnitSubType_VoiceProcessingIO
458 - Available on OS X and with iOS 3.0 or greater
459 This audio unit can do input as well as output. Bus 0 is used for the output
460 side, bus 1 is used to get audio input (thus, on the iPhone, it works in a
461 very similar way to the Remote I/O). This audio unit does signal processing on
462 the incoming audio (taking out any of the audio that is played from the device
463 at a given time from the incoming audio).
464 }
465 const
466 kAudioUnitSubType_GenericOutput = FourCharCode('genr');
467 kAudioUnitSubType_VoiceProcessingIO = FourCharCode('vpio');
468
469 {!
470 @enum Apple input/output audio unit sub types (OS X)
471 @constant kAudioUnitSubType_HALOutput
472 - desktop only
473 The audio unit that interfaces to any audio device. The user specifies which
474 audio device to track. The audio unit can do input from the device as well as
475 output to the device. Bus 0 is used for the output side, bus 1 is used
476 to get audio input from the device.
477
478 @constant kAudioUnitSubType_DefaultOutput
479 - desktop only
480 A specialisation of AUHAL that is used to track the user's selection of the
481 default device as set in the Sound Prefs
482
483 @constant kAudioUnitSubType_SystemOutput
484 - desktop only
485 A specialisation of AUHAL that is used to track the user's selection of the
486 device to use for sound effects, alerts
487 and other UI sounds.
488
489 }
490 const
491 {$ifc not TARGET_OS_IPHONE}
492 kAudioUnitSubType_HALOutput = FourCharCode('ahal');
493 kAudioUnitSubType_DefaultOutput = FourCharCode('def ');
494 kAudioUnitSubType_SystemOutput = FourCharCode('sys ');
495 {$endc} { not TARGET_OS_IPHONE }
496
497 {!
498 @enum Apple music instrument audio unit sub types
499
500 @constant kAudioUnitSubType_DLSSynth
501 - desktop only
502 A multi-timbral music device that can use sample banks in either DLS or
503 SoundFont formats. It fully supports GM-MIDI and the basic extensions of
504 GS-MIDI.
505 @constant kAudioUnitSubType_Sampler
506 A mono-timbral music device which is a sampler synthesizer and supports full
507 interactive editing of all state.
508 @constant kAudioUnitSubType_MIDISynth
509 A fully GM-compatible multi-timbral music device which is a sampler synthesizer.
510 It can load instruments from sample banks in either DLS or SoundFont formats.
511 }
512 //#if !TARGET_OS_IPHONE
513 {$ifc not TARGET_OS_IPHONE}
514 const
515 kAudioUnitSubType_DLSSynth = FourCharCode('dls ');
516 //#endif
517 {$endc} { not TARGET_OS_IPHONE }
518 kAudioUnitSubType_Sampler = FourCharCode('samp');
519 kAudioUnitSubType_MIDISynth = FourCharCode('msyn');
520
521 {!
522 @enum Apple converter audio unit sub types
523 @discussion These are the subtypes for the various converter units that apple ships.
524 Except for AUConverter, which is available on both desktop and iPhone, these
525 audio units are only available on the desktop.
526
527 @constant kAudioUnitSubType_AUConverter
528 An audio unit that uses an AudioConverter to do Linear PCM conversions (sample
529 rate, bit depth, interleaving).
530
531 @constant kAudioUnitSubType_Varispeed
532 An audio unit that can be used to control playback rate (as the rate is faster,
533 the pitch is higher). It provides a generic view, so can be used in both a UI
534 and programmatic context. It also comes in an Offline version so can be used
535 to process audio files.
536
537 @constant kAudioUnitSubType_DeferredRenderer
538 An audio unit that is used to get its input from a separate thread than the
539 thread that its render method is called. It thus allows an application to
540 introduce multiple threads into a rendering graph. There is a buffer sized
541 delay introduced between the input and output
542
543 @constant kAudioUnitSubType_Splitter
544 An audio unit that provides 2 output buses and 1 input bus. The audio unit
545 splits (duplicates) the input signal to the two output buses
546
547 @constant kAudioUnitSubType_MultiSplitter
548 An audio unit that sends its input bus to any number of output buses.
549 Every output bus gets all channels of the input bus.
550 This unit's implementation is lighter weight than kAudioUnitSubType_Splitter
551 even for two output buses, and is recommended over kAudioUnitSubType_Splitter.
552
553 @constant kAudioUnitSubType_Merger
554 An audio unit that provides 2 input buses and 2 output bus. The audio unit
555 merges the two inputs to the single output
556
557 @constant kAudioUnitSubType_NewTimePitch
558 An audio unit that provides good quality time stretching and pitch shifting
559 while still being very fast.
560
561 @constant kAudioUnitSubType_AUiPodTimeOther
562 An audio unit that provides time domain time stretching.
563
564 }
565 const
566 kAudioUnitSubType_AUConverter = FourCharCode('conv');
567 kAudioUnitSubType_Varispeed = FourCharCode('vari');
568 kAudioUnitSubType_DeferredRenderer = FourCharCode('defr');
569 kAudioUnitSubType_Splitter = FourCharCode('splt');
570 kAudioUnitSubType_MultiSplitter = FourCharCode('mspl');
571 kAudioUnitSubType_Merger = FourCharCode('merg');
572 kAudioUnitSubType_NewTimePitch = FourCharCode('nutp');
573 kAudioUnitSubType_AUiPodTimeOther = FourCharCode('ipto');
574 kAudioUnitSubType_RoundTripAAC = FourCharCode('raac');
575
576 {!
577 @enum Apple converter audio unit sub types (OS X only)
578 @constant kAudioUnitSubType_TimePitch
579 An audio unit that can be used to have independent control of both playback
580 rate and pitch. It provides a generic view, so can be used in both a UI and
581 programmatic context. It also comes in an Offline version so can be used to
582 process audio files.
583
584 }
585 {$ifc TARGET_OS_MAC}
586 const
587 kAudioUnitSubType_TimePitch = FourCharCode('tmpt');
588 {$endc} {TARGET_OS_MAC}
589
590 {!
591 @enum Apple effect audio unit sub types
592 @discussion These are the subtypes for the various effect units that apple ships
593
594 @constant kAudioUnitSubType_Delay
595 - desktop only
596 A delay audio unit
597
598 @constant kAudioUnitSubType_LowPassFilter
599 A filter that passes frequencies below a specified cut-off frequency
600
601 @constant kAudioUnitSubType_HighPassFilter
602 A filter that passes frequencies above a specified cut-off frequency
603
604 @constant kAudioUnitSubType_BandPassFilter
605 A filter that passes frequencies between a low and high cut-off frequency.
606
607 @constant kAudioUnitSubType_HighShelfFilter
608 A filter that can be used to implement a "treble" control
609
610 @constant kAudioUnitSubType_LowShelfFilter
611 A filter that can be used to implement a "bass" control
612
613 @constant kAudioUnitSubType_ParametricEQ
614 A parametric EQ filter
615
616 @constant kAudioUnitSubType_PeakLimiter
617 A peak limiter
618
619 @constant kAudioUnitSubType_DynamicsProcessor
620 A dynamics compressor/expander
621
622 @constant kAudioUnitSubType_SampleDelay
623 - desktop only
624 A delay that is used to delay the input a specified number of samples until
625 the output
626
627 @constant kAudioUnitSubType_Distortion
628 A distortion audio unit
629
630 @constant kAudioUnitSubType_NBandEQ
631 A generalized N-band graphic EQ with specifiable filter types per-band
632
633 }
634 const
635 kAudioUnitSubType_PeakLimiter = FourCharCode('lmtr');
636 kAudioUnitSubType_DynamicsProcessor = FourCharCode('dcmp');
637 kAudioUnitSubType_LowPassFilter = FourCharCode('lpas');
638 kAudioUnitSubType_HighPassFilter = FourCharCode('hpas');
639 kAudioUnitSubType_BandPassFilter = FourCharCode('bpas');
640 kAudioUnitSubType_HighShelfFilter = FourCharCode('hshf');
641 kAudioUnitSubType_LowShelfFilter = FourCharCode('lshf');
642 kAudioUnitSubType_ParametricEQ = FourCharCode('pmeq');
643 kAudioUnitSubType_Distortion = FourCharCode('dist');
644 {$ifc TARGET_OS_MAC}
645 kAudioUnitSubType_Delay = FourCharCode('dely');
646 kAudioUnitSubType_SampleDelay = FourCharCode('sdly');
647 {$endc} {TARGET_OS_MAC}
648 kAudioUnitSubType_NBandEQ = FourCharCode('nbeq');
649
650 {!
651 @enum Apple effect audio unit sub types (OS X only)
652 @constant kAudioUnitSubType_GraphicEQ
653 A 10 or 31 band Graphic EQ
654 @constant kAudioUnitSubType_MultiBandCompressor
655 A 4 band compressor/expander
656 @constant kAudioUnitSubType_MatrixReverb
657 A reverb that can be used to simulate various and different spaces
658 @constant kAudioUnitSubType_Pitch
659 An audio unit used to change the pitch
660 @constant kAudioUnitSubType_AUFilter
661 A filter unit that combines 5 different filters (low, 3 mids, high)
662 @constant kAudioUnitSubType_NetSend
663 An audio unit that is used in conjunction with _NetReceive to send audio
664 across the network (or between different applications)
665 @constant kAudioUnitSubType_RogerBeep
666 An audio unit that can be used to emit a short tone in gaps between speech
667 - similar to the tones used in a walkie-talkie
668 }
669 const
670 kAudioUnitSubType_GraphicEQ = FourCharCode('greq');
671 kAudioUnitSubType_MultiBandCompressor = FourCharCode('mcmp');
672 kAudioUnitSubType_MatrixReverb = FourCharCode('mrev');
673 kAudioUnitSubType_Pitch = FourCharCode('tmpt');
674 kAudioUnitSubType_AUFilter = FourCharCode('filt');
675 kAudioUnitSubType_NetSend = FourCharCode('nsnd');
676 kAudioUnitSubType_RogerBeep = FourCharCode('rogr');
677
678
679 {!
680 @enum Apple mixer audio unit sub types
681 @discussion These are the subtypes for the various mixer units that apple ships
682
683 @constant kAudioUnitSubType_MultiChannelMixer
684 Can have any number of inputs, with any number of channels on any input to one
685 output bus with any number of channels.
686
687 @constant kAudioUnitSubType_SpatialMixer
688 Inputs that are mono will be panned around using 3D coordinates and parameters.
689 Stereo inputs are passed directly through to the output.
690 A single output is presented with 2, 4, 5, 6, 7 or 8 channels.
691 There is also a built in reverb.
692
693 @constant kAudioUnitSubType_MatrixMixer
694 Any number of input and output buses with any number of channels on any bus.
695 The mix is presented as a matrix of channels that can be controlled through
696 input volume per channel, "cross-point" volume (a given input channel to a
697 given output channel), output volume per channel and a global volume across
698 the whole matrix
699
700
701 }
702 const
703 kAudioUnitSubType_MultiChannelMixer = FourCharCode('mcmx');
704 kAudioUnitSubType_MatrixMixer = FourCharCode('mxmx');
705 kAudioUnitSubType_SpatialMixer = FourCharCode('3dem');
706
707 {!
708 @enum Apple mixer audio unit sub types (OS X only)
709 @constant kAudioUnitSubType_StereoMixer
710 Inputs can be mono or stereo. Single stereo output
711
712 @constant kAudioUnitSubType_3DMixer
713 (deprecated, use kAudioUnitSubType_SpatialMixer instead)
714 Inputs can be mono, in which case they can be panned around using 3D
715 coordinates and parameters.
716 Stereo inputs are passed directly through to the output.
717 4 channel "ambisonic" inputs will be rendered to the output configuration
718 A single output of 2, 4, 5, 6, 7 or 8 channels.
719 }
720 const
721 kAudioUnitSubType_StereoMixer = FourCharCode('smxr');
722 kAudioUnitSubType_3DMixer = FourCharCode('3dmx'); (* API_DEPRECATED("no longer supported", macos(10.3, 10.10)) API_UNAVAILABLE(ios, watchos, tvos)
723 *)
724 // use kAudioUnitSubType_SpatialMixer instead
725
726 {!
727 @enum Apple panner audio unit sub types
728 @discussion These are the subtypes for the various panner units that apple ships
729
730 @constant kAudioUnitSubType_SphericalHeadPanner
731 - desktop only
732 A panner unit that uses the spherical head model to pan to a stereo output
733
734 @constant kAudioUnitSubType_VectorPanner
735 - desktop only
736 A panner unit that uses a moving pan between the two closes, adjacent channels
737 in a 3D space to a
738 surround output
739
740 @constant kAudioUnitSubType_SoundFieldPanner
741 - desktop only
742 A panner unit that uses a sound-field notion to pan to a surround output
743
744 @constant kAudioUnitSubType_HRTFPanner
745 - desktop only
746 A panner unit that uses a generic "HRTF" model to pan to a stereo output
747 }
748 {$if TARGET_OS_MAC}
749 const
750 kAudioUnitSubType_SphericalHeadPanner = FourCharCode('sphr');
751 kAudioUnitSubType_VectorPanner = FourCharCode('vbas');
752 kAudioUnitSubType_SoundFieldPanner = FourCharCode('ambi');
753 kAudioUnitSubType_HRTFPanner = FourCharCode('hrtf');
754 {$endc} { TARGET_OS_MAC }
755
756 {!
757 @enum Apple generator audio unit sub types
758 @discussion These are the subtypes for the various generator units that apple ships
759
760 @constant kAudioUnitSubType_ScheduledSoundPlayer
761 A generator unit that can be used to schedule slices of audio to be played at
762 a specified time. The audio is scheduled using the time stamps for the render
763 operation, and can be scheduled from any thread.
764
765 @constant kAudioUnitSubType_AudioFilePlayer
766 A generator unit that is used to play a file. It presents a custom UI so can
767 be used in a UI context as well
768
769 @constant kAudioUnitSubType_NetReceive
770 - desktop only
771 A generator unit that is paired with _NetSend to receive the audio that unit
772 sends. It presents a custom UI so can be used in a UI context as well
773 }
774 const
775 {$ifc TARGET_OS_MAC}
776 kAudioUnitSubType_NetReceive = FourCharCode('nrcv');
777 {$endc} { TARGET_OS_MAC }
778 kAudioUnitSubType_ScheduledSoundPlayer = FourCharCode('sspl');
779 kAudioUnitSubType_AudioFilePlayer = FourCharCode('afpl');
780
781 //=====================================================================================================================
782 //#pragma mark -
783 //#pragma mark Audio Unit Constants and typedefs
784 {!
785 @enum AudioUnitRenderActionFlags
786 @discussion These flags can be set in a callback from an audio unit during an audio unit
787 render operation from either the RenderNotify Proc or the render input
788 callback.
789
790 @constant kAudioUnitRenderAction_PreRender
791 Called on a render notification Proc - which is called either before or after
792 the render operation of the audio unit. If this flag is set, the proc is being
793 called before the render operation is performed.
794
795 @constant kAudioUnitRenderAction_PostRender
796 Called on a render notification Proc - which is called either before or after
797 the render operation of the audio unit. If this flag is set, the proc is being
798 called after the render operation is completed.
799
800 @constant kAudioUnitRenderAction_OutputIsSilence
801 This flag can be set in a render input callback (or in the audio unit's render
802 operation itself) and is used to indicate that the render buffer contains only
803 silence. It can then be used by the caller as a hint to whether the buffer
804 needs to be processed or not.
805
806 @constant kAudioOfflineUnitRenderAction_Preflight
807 This is used with offline audio units (of type 'auol'). It is used when an
808 offline unit is being preflighted, which is performed prior to the actual
809 offline rendering actions are performed. It is used for those cases where the
810 offline process needs it (for example, with an offline unit that normalises an
811 audio file, it needs to see all of the audio data first before it can perform
812 its normalisation)
813
814 @constant kAudioOfflineUnitRenderAction_Render
815 Once an offline unit has been successfully preflighted, it is then put into
816 its render mode. So this flag is set to indicate to the audio unit that it is
817 now in that state and that it should perform its processing on the input data.
818
819 @constant kAudioOfflineUnitRenderAction_Complete
820 This flag is set when an offline unit has completed either its preflight or
821 performed render operations
822
823 @constant kAudioUnitRenderAction_PostRenderError
824 If this flag is set on the post-render call an error was returned by the
825 AUs render operation. In this case, the error can be retrieved through the
826 lastRenderError property and the audio data in ioData handed to the post-render
827 notification will be invalid.
828 @constant kAudioUnitRenderAction_DoNotCheckRenderArgs
829 If this flag is set, then checks that are done on the arguments provided to render
830 are not performed. This can be useful to use to save computation time in
831 situations where you are sure you are providing the correct arguments
832 and structures to the various render calls
833 }
834 type
835 AudioUnitRenderActionFlags = UInt32;
836 AudioUnitRenderActionFlagsPtr = ^AudioUnitRenderActionFlags;
837 const
838 kAudioUnitRenderAction_PreRender = 1 shl 2;
839 kAudioUnitRenderAction_PostRender = 1 shl 3;
840 kAudioUnitRenderAction_OutputIsSilence = 1 shl 4;
841 kAudioOfflineUnitRenderAction_Preflight = 1 shl 5;
842 kAudioOfflineUnitRenderAction_Render = 1 shl 6;
843 kAudioOfflineUnitRenderAction_Complete = 1 shl 7;
844 kAudioUnitRenderAction_PostRenderError = 1 shl 8;
845 kAudioUnitRenderAction_DoNotCheckRenderArgs = 1 shl 9;
846
847 {!
848 @enum Audio unit errors
849 @discussion These are the various errors that can be returned by AudioUnit... API calls
850
851 @constant kAudioUnitErr_InvalidProperty
852 The property is not supported
853 @constant kAudioUnitErr_InvalidParameter
854 The parameter is not supported
855 @constant kAudioUnitErr_InvalidElement
856 The specified element is not valid
857 @constant kAudioUnitErr_NoConnection
858 There is no connection (generally an audio unit is asked to render but it has
859 not input from which to gather data)
860 @constant kAudioUnitErr_FailedInitialization
861 The audio unit is unable to be initialized
862 @constant kAudioUnitErr_TooManyFramesToProcess
863 When an audio unit is initialized it has a value which specifies the max
864 number of frames it will be asked to render at any given time. If an audio
865 unit is asked to render more than this, this error is returned.
866 @constant kAudioUnitErr_InvalidFile
867 If an audio unit uses external files as a data source, this error is returned
868 if a file is invalid (Apple's DLS synth returns this error)
869 @constant kAudioUnitErr_UnknownFileType
870 If an audio unit uses external files as a data source, this error is returned
871 if a file is invalid (Apple's DLS synth returns this error)
872 @constant kAudioUnitErr_FileNotSpecified
873 If an audio unit uses external files as a data source, this error is returned
874 if a file hasn't been set on it
875 (Apple's DLS synth returns this error)
876 @constant kAudioUnitErr_FormatNotSupported
877 Returned if an input or output format is not supported
878 @constant kAudioUnitErr_Uninitialized
879 Returned if an operation requires an audio unit to be initialized and it is
880 not.
881 @constant kAudioUnitErr_InvalidScope
882 The specified scope is invalid
883 @constant kAudioUnitErr_PropertyNotWritable
884 The property cannot be written
885 @constant kAudioUnitErr_CannotDoInCurrentContext
886 Returned when an audio unit is in a state where it can't perform the requested
887 action now - but it could later. Its usually used to guard a render operation
888 when a reconfiguration of its internal state is being performed.
889 @constant kAudioUnitErr_InvalidPropertyValue
890 The property is valid, but the value of the property being provided is not
891 @constant kAudioUnitErr_PropertyNotInUse
892 Returned when a property is valid, but it hasn't been set to a valid value at
893 this time.
894 @constant kAudioUnitErr_Initialized
895 Indicates the operation cannot be performed because the audio unit is
896 initialized.
897 @constant kAudioUnitErr_InvalidOfflineRender
898 Used to indicate that the offline render operation is invalid. For instance,
899 when the audio unit needs to be pre-flighted,
900 but it hasn't been.
901 @constant kAudioUnitErr_Unauthorized
902 Returned by either Open or Initialize, this error is used to indicate that the
903 audio unit is not authorised, that it cannot be used. A host can then present
904 a UI to notify the user the audio unit is not able to be used in its current
905 state.
906 @constant kAudioUnitErr_MIDIOutputBufferFull
907 Returned during the render call, if the audio unit produces more MIDI output,
908 than the default allocated buffer. The audio unit can provide a size hint, in
909 case it needs a larger buffer. See the documentation for AUAudioUnit's
910 MIDIOutputBufferSizeHint property.
911 @constant kAudioComponentErr_InstanceInvalidated
912 The component instance's implementation is not available, most likely because the process
913 that published it is no longer running.
914 @constant kAudioUnitErr_RenderTimeout
915 The audio unit did not satisfy the render request in time.
916 @constant kAudioUnitErr_ExtensionNotFound
917 The specified identifier did not match any Audio Unit Extensions.
918 @constant kAudioUnitErr_InvalidParameterValue
919 The parameter value is not supported, e.g. the value specified is NaN or
920 infinite.
921 }
922 const
923 kAudioUnitErr_InvalidProperty = -10879;
924 kAudioUnitErr_InvalidParameter = -10878;
925 kAudioUnitErr_InvalidElement = -10877;
926 kAudioUnitErr_NoConnection = -10876;
927 kAudioUnitErr_FailedInitialization = -10875;
928 kAudioUnitErr_TooManyFramesToProcess = -10874;
929 kAudioUnitErr_InvalidFile = -10871;
930 kAudioUnitErr_UnknownFileType = -10870;
931 kAudioUnitErr_FileNotSpecified = -10869;
932 kAudioUnitErr_FormatNotSupported = -10868;
933 kAudioUnitErr_Uninitialized = -10867;
934 kAudioUnitErr_InvalidScope = -10866;
935 kAudioUnitErr_PropertyNotWritable = -10865;
936 kAudioUnitErr_CannotDoInCurrentContext = -10863;
937 kAudioUnitErr_InvalidPropertyValue = -10851;
938 kAudioUnitErr_PropertyNotInUse = -10850;
939 kAudioUnitErr_Initialized = -10849;
940 kAudioUnitErr_InvalidOfflineRender = -10848;
941 kAudioUnitErr_Unauthorized = -10847;
942 kAudioUnitErr_MIDIOutputBufferFull = -66753;
943 kAudioComponentErr_InstanceTimedOut = -66754;
944 kAudioComponentErr_InstanceInvalidated = -66749;
945 kAudioUnitErr_RenderTimeout = -66745;
946 kAudioUnitErr_ExtensionNotFound = -66744;
947 kAudioUnitErr_InvalidParameterValue = -66743;
948
949
950 {$ifc TARGET_OS_IPHONE and not TARGET_IPHONE_SIMULATOR}
951 {!
952 @enum AudioComponent errors for inter-app audio
953
954 @constant kAudioComponentErr_DuplicateDescription
955 a non-unique component description was provided to AudioOutputUnitPublish
956 @constant kAudioComponentErr_UnsupportedType
957 an unsupported component type was provided to AudioOutputUnitPublish
958 @constant kAudioComponentErr_TooManyInstances
959 components published via AudioOutputUnitPublish may only have one instance
960 @constant kAudioComponentErr_NotPermitted
961 app needs "inter-app-audio" entitlement or host app needs "audio" in its UIBackgroundModes.
962 Or app is trying to register a component not declared in its Info.plist.
963 @constant kAudioComponentErr_InitializationTimedOut
964 host did not render in a timely manner; must uninitialize and reinitialize.
965 @constant kAudioComponentErr_InvalidFormat
966 inter-app AU element formats must have sample rates matching the hardware.
967 }
968 const
969 kAudioComponentErr_DuplicateDescription = -66752;
970 kAudioComponentErr_UnsupportedType = -66751;
971 kAudioComponentErr_TooManyInstances = -66750;
972 kAudioComponentErr_NotPermitted = -66748;
973 kAudioComponentErr_InitializationTimedOut = -66747;
974 kAudioComponentErr_InvalidFormat = -66746;
975 {$endc} {TARGET_OS_IPHONE and not TARGET_IPHONE_SIMULATOR}
976
977 {!
978 @typedef AudioUnitPropertyID
979 @discussion Type used for audio unit properties.
980 Properties are used to describe the state of an audio unit (for instance,
981 the input or output audio format)
982 }
983 type
984 AudioUnitPropertyID = UInt32;
985 {!
986 @typedef AudioUnitScope
987 @discussion Type used for audio unit scopes. Apple reserves the 0 < 1024 range for
988 audio unit scope identifiers.
989 Scopes are used to delineate a major attribute of an audio unit
990 (for instance, global, input, output)
991 }
992 type
993 AudioUnitScope = UInt32;
994 {!
995 @typedef AudioUnitElement
996 @discussion Type used for audio unit elements.
997 Scopes can have one or more member, and a member of a scope is
998 addressed / described by its element
999 For instance, input bus 1 is input scope, element 1
1000 }
1001 type
1002 AudioUnitElement = UInt32;
1003 {!
1004 @typedef AudioUnitParameterID
1005 @discussion Type used for audio unit parameters.
1006 Parameters are typically used to control and set render state
1007 (for instance, filter cut-off frequency)
1008 }
1009 type
1010 AudioUnitParameterID = UInt32;
1011 {!
1012 @typedef AudioUnitParameterValue
1013 @discussion Type used for audio unit parameter values.
1014 The value of a given parameter is specified using this type
1015 (typically a Float32)
1016 }
1017 type
1018 AudioUnitParameterValue = Float32;
1019 AudioUnitParameterValuePtr = ^AudioUnitParameterValue;
1020
1021 {!
1022 @enum AUParameterEventType
1023 @discussion The type of a parameter event (see AudioUnitScheduleParameter)
1024
1025 @constant kParameterEvent_Immediate
1026 The parameter event describes an immediate change to the parameter value to
1027 the new value
1028 @constant kParameterEvent_Ramped
1029 The parameter event describes a change to the parameter value that should
1030 be applied over the specified period of time
1031 }
1032 type
1033 AUParameterEventType = UInt32;
1034 AUParameterEventTypePtr = ^AUParameterEventType;
1035 const
1036 kParameterEvent_Immediate = 1;
1037 kParameterEvent_Ramped = 2;
1038
1039 {!
1040 @struct AudioUnitParameterEvent
1041 @discussion A parameter event describes a change to a parameter's value, where the type of
1042 the event describes how that change is to be applied (see AUParameterEventType).
1043 A parameter is uniquely defined through the triplet of scope, element and
1044 parameterID.
1045
1046 See AudioUnitScheduleParameters
1047
1048 @field scope
1049 The scope for the parameter
1050 @field element
1051 The element for the parameter
1052 @field parameter
1053 The parameterID for the parameter
1054
1055 @field eventType
1056 The event type. This field further defines how the union described by
1057 eventValues is to be interpreted.
1058
1059 @field eventValues
1060 If the parameter event type is _Immediate, then the immediate struct of this
1061 union should be used.
1062 If the parameter event type is _Ramped, then the ramp struct of this union
1063 should be used.
1064
1065 }
1066 type
1067 AudioUnitParameterEventRampRec = record
1068 startBufferOffset: SInt32;
1069 durationInFrames: UInt32;
1070 startValue: AudioUnitParameterValue;
1071 endValue: AudioUnitParameterValue;
1072 end;
1073 AudioUnitParameterEventImmediateRec = record
1074 bufferOffset: UInt32;
1075 value: AudioUnitParameterValue;
1076 end;
1077 AudioUnitParameterEventEventValues = record
1078 case UInt8 of
1079 0: (ramp : AudioUnitParameterEventRampRec);
1080 1: (immediate : AudioUnitParameterEventImmediateRec);
1081 end;
1082
1083 AudioUnitParameterEvent = record
1084 scope: AudioUnitScope;
1085 element: AudioUnitElement;
1086 parameter: AudioUnitParameterID;
1087
1088 eventType: AUParameterEventType;
1089 eventValues: AudioUnitParameterEventEventValues;
1090 end;
1091 AudioUnitParameterEventPtr = ^AudioUnitParameterEvent;
1092
1093 {!
1094 @struct AudioUnitParameter
1095 @discussion An audio unit parameter is defined by the triplet of audio unit scope, element
1096 and parameterID. This struct is used with the functions in AudioUnitUtilities.h
1097 to deal with audio unit parameters, but is included in this header file for
1098 completeness.
1099
1100 @field mAudioUnit
1101 The audio unit instance to which the specified parameter applies.
1102 @field mParameterID
1103 The parameterID for the parameter
1104 @field mScope
1105 The scope for the parameter
1106 @field mElement
1107 The element for the parameter
1108 }
1109 type
1110 AudioUnitParameter = record
1111 mAudioUnit: AudioUnit;
1112 mParameterID: AudioUnitParameterID;
1113 mScope: AudioUnitScope;
1114 mElement: AudioUnitElement;
1115 end;
1116 AudioUnitParameterPtr = ^AudioUnitParameter;
1117
1118 {!
1119 @struct AudioUnitProperty
1120 @discussion An audio unit property is defined by the triplet of audio unit scope, element
1121 and propertyID. This struct is used with the functions in AudioUnitUtilities.h
1122 to deal with audio unit properties, but is included in this header file for
1123 completeness.
1124
1125 @field mAudioUnit
1126 The audio unit instance which the specified property applies too
1127 @field mPropertyID
1128 The propertyID for the property
1129 @field mScope
1130 The scope for the property
1131 @field mElement
1132 The element for the property
1133 }
1134 type
1135 AudioUnitProperty = record
1136 mAudioUnit: AudioUnit;
1137 mPropertyID: AudioUnitPropertyID;
1138 mScope: AudioUnitScope;
1139 mElement: AudioUnitElement;
1140 end;
1141 AudioUnitPropertyPtr = ^AudioUnitProperty;
1142
1143
1144 {!
1145 @typedef AURenderCallback
1146 @discussion This is the prototype for a function callback Proc that is used both with the
1147 AudioUnit render notification API and the render input callback. See
1148 kAudioUnitProperty_SetRenderCallback property or AudioUnitAddRenderNotify.
1149 This callback is part of the process of a call to AudioUnitRender. As a
1150 notification it is called either before or after the audio unit's render
1151 operations. As a render input callback, it is called to provide input data for
1152 the particular input bus the callback is attached too.
1153
1154 @param inRefCon
1155 The client data that is provided either with the AURenderCallbackStruct or as
1156 specified with the Add API call
1157 @param ioActionFlags
1158 Flags used to describe more about the context of this call (pre or post in the
1159 notify case for instance)
1160 @param inTimeStamp
1161 The times stamp associated with this call of audio unit render
1162 @param inBusNumber
1163 The bus number associated with this call of audio unit render
1164 @param inNumberFrames
1165 The number of sample frames that will be represented in the audio data in the
1166 provided ioData parameter
1167 @param ioData
1168 The AudioBufferList that will be used to contain the rendered or provided
1169 audio data. These buffers will be aligned to 16 byte boundaries (which is
1170 normally what malloc will return). Can be null in the notification that
1171 input is available.
1172 }
1173 type
inRefConnull1174 AURenderCallback = function( inRefCon: UnivPtr; var ioActionFlags: AudioUnitRenderActionFlags; const (*var*) inTimeStamp: AudioTimeStamp; inBusNumber: UInt32; inNumberFrames: UInt32; ioData: AudioBufferListPtr ): OSStatus;
1175
1176 {!
1177 @typedef AudioUnitPropertyListenerProc
1178 @discussion This is the prototype for a function callback Proc that is registered with an
1179 audio unit to notify the caller of any changes to a value of an audio unit
1180 property. See AudioUnitAddPropertyListener
1181
1182 @param inRefCon
1183 The client data that is provided with the add property listener registration
1184 @param inUnit
1185 The audio unit upon which the specified property value has changed
1186 @param inID
1187 The property whose value has changed
1188 @param inScope
1189 The scope of the property whose value has changed
1190 @param inElement
1191 The element ID on the scope of the property whose value has changed
1192 }
1193 type
1194 AudioUnitPropertyListenerProc = procedure( inRefCon: UnivPtr; inUnit: AudioUnit; inID: AudioUnitPropertyID; inScope: AudioUnitScope; inElement: AudioUnitElement );
1195
1196 {!
1197 @typedef AUInputSamplesInOutputCallback
1198 @discussion This is the prototype for a function callback Proc that is registered with an
1199 audio unit to notify the caller of for the user of a varispeed or AUTimePitch
1200 audio unit where it is not clear what input sample is represented in the
1201 rendered output samples.
1202
1203 @param inRefCon
1204 The client data that is provided with the add property listener registration
1205 @param inOutputTimeStamp
1206 The time stamp that corresponds to the first sample of audio data produced in
1207 AudioUnitRender (its output data)
1208 @param inInputSample
1209 The sample number of the input that is represented in the first sample of that
1210 output time stamp
1211 @param inNumberInputSamples
1212 The number of input samples that are represented in an output buffer
1213 }
1214 type
1215 AUInputSamplesInOutputCallback = procedure( inRefCon: UnivPtr; const (*var*) inOutputTimeStamp: AudioTimeStamp; inInputSample: Float64; inNumberInputSamples: Float64 );
1216
1217 {!
1218 @constant kAudioComponentRegistrationsChangedNotification
1219 @abstract Notification generated when the set of available AudioComponents changes.
1220 @discussion
1221 Register for this notification name with [NSNotificationCenter defaultCenter] or
1222 CFNotificationCenterGetLocalCenter(), using an object of NULL.
1223 }
1224 var kAudioComponentRegistrationsChangedNotification: CFStringRef; external name '_kAudioComponentRegistrationsChangedNotification'; (* attribute const *)
1225 (* API_AVAILABLE(macos(10.11), ios(7.0), watchos(2.0), tvos(9.0)) *)
1226
1227 {!
1228 @constant kAudioComponentInstanceInvalidationNotification
1229 @abstract Notification generated when an audio unit extension process exits abnormally.
1230 @discussion
1231 Register for this notification name with [NSNotificationCenter defaultCenter] or
1232 CFNotificationCenterGetLocalCenter(). The "object" refers to an AUAudioUnit instance to
1233 be observed, or can be nil to observe all instances. The notification's userInfo
1234 dictionary contains a key, "audioUnit", an NSValue whose pointerValue is the
1235 AudioUnit or AudioComponentInstance which is wrapping the AUAudioUnit communicating with the
1236 extension process. (This may be null if there is no such component instance.) For example:
1237
1238 [[NSNotificationCenter defaultCenter] addObserverForName:(NSString *)kAudioComponentInstanceInvalidationNotification object:nil queue:nil usingBlock:^(NSNotification *note) (
1239 AUAudioUnit *auAudioUnit = (AUAudioUnit *)note.object;
1240 NSValue *val = note.userInfo[@"audioUnit"];
1241 AudioUnit audioUnit = (AudioUnit)val.pointerValue;
1242 NSLog(@"Received kAudioComponentInstanceInvalidationNotification: auAudioUnit %@, audioUnit %p", auAudioUnit, audioUnit);
1243 )];
1244 }
1245 var kAudioComponentInstanceInvalidationNotification: CFStringRef; external name '_kAudioComponentInstanceInvalidationNotification'; (* attribute const *)
1246 (* API_AVAILABLE(macos(10.11), ios(9.0), watchos(2.0), tvos(9.0)) *)
1247
1248
1249 //================================================================================================
1250 //#pragma mark -
1251 //#pragma mark Functions
1252
1253 {!
1254 @function AudioUnitInitialize
1255 @abstract initialize an audio unit
1256 @discussion Upon success, the audio unit has been successfully initialized. This means
1257 that the formats for input and output are valid and can be supported and it
1258 has based its allocations on the max number of frames that it is able to
1259 render at any given time. Once initialized, it is in a state where it can be
1260 asked to render.
1261
1262 In common practice, major state of an audio unit (such as its I/O formats,
1263 memory allocations) cannot be changed while an audio unit is initialized.
1264
1265 @param inUnit
1266 The audio unit to initialize
1267 @result noErr, or an error representing the reasons why the audio unit was not able
1268 to be initialized successfully
1269 }
AudioUnitInitializenull1270 function AudioUnitInitialize( inUnit: AudioUnit ): OSStatus; external name '_AudioUnitInitialize';
1271 (* API_AVAILABLE(macos(10.0), ios(2.0), watchos(2.0), tvos(9.0)) *)
1272
1273 {!
1274 @function AudioUnitUninitialize
1275 @abstract uninitialize an audio unit
1276 @discussion Once an audio unit has been initialized, to change its state in response to
1277 some kind of environmental change, the audio unit should be uninitialized.
1278 This will have the effect of the audio unit de-allocating its resources.
1279 The caller can then reconfigure the audio unit to match the new environment
1280 (for instance, the sample rate to process audio is different than it was) and
1281 then re-initialize the audio unit when those changes have been applied.
1282
1283 @param inUnit
1284 The audio unit to uninitialize
1285 @result noErr, or an error representing the reasons why the audio unit was not able
1286 to be initialized successfully. Typically this call won't return an error
1287 unless the audio unit in question is no longer valid.
1288 }
AudioUnitUninitializenull1289 function AudioUnitUninitialize( inUnit: AudioUnit ): OSStatus; external name '_AudioUnitUninitialize';
1290 (* API_AVAILABLE(macos(10.0), ios(2.0), watchos(2.0), tvos(9.0)) *)
1291
1292
1293 {!
1294 @function AudioUnitGetPropertyInfo
1295 @abstract retrieves information about a specified property
1296 @discussion The API can be used to retrieve both the size of the property, and whether it
1297 is writable or not. In order to get a general answer on the capability of an
1298 audio unit, this function should be called before the audio unit
1299 is initialized (as some properties are writable when the audio unit is
1300 initialized, and others not)
1301
1302 @param inUnit
1303 the audio unit
1304 @param inID
1305 the property identifier
1306 @param inScope
1307 the scope of the property
1308 @param inElement
1309 the element of the scope
1310 @param outDataSize
1311 if not null, then will retrieve the maximum size for the property. if null,
1312 then it is ignored
1313 @param outWritable
1314 if not null, then will retrieve whether the property can be written or not.
1315 if null, then it is ignored
1316
1317 @result noErr, or various audio unit errors related to properties
1318 }
AudioUnitGetPropertyInfonull1319 function AudioUnitGetPropertyInfo( inUnit: AudioUnit; inID: AudioUnitPropertyID; inScope: AudioUnitScope; inElement: AudioUnitElement; outDataSize: UInt32Ptr; outWritable: BooleanPtr ): OSStatus; external name '_AudioUnitGetPropertyInfo';
1320 (* API_AVAILABLE(macos(10.0), ios(2.0), watchos(2.0), tvos(9.0)) *)
1321
1322 {!
1323 @function AudioUnitGetProperty
1324 @abstract retrieves the value of a specified property
1325 @discussion The API can is used to retrieve the value of the property. Property values for
1326 audio units are always passed by reference
1327
1328 @param inUnit
1329 the audio unit
1330 @param inID
1331 the property identifier
1332 @param inScope
1333 the scope of the property
1334 @param inElement
1335 the element of the scope
1336 @param outData
1337 used to retrieve the value of the property. It should point to memory at least
1338 as large as the value described by ioDataSize
1339 @param ioDataSize
1340 on input contains the size of the data pointed to by outData, on output, the
1341 size of the data that was returned.
1342
1343 @result noErr, or various audio unit errors related to properties
1344 }
AudioUnitGetPropertynull1345 function AudioUnitGetProperty( inUnit: AudioUnit; inID: AudioUnitPropertyID; inScope: AudioUnitScope; inElement: AudioUnitElement; outData: UnivPtr; var ioDataSize: UInt32 ): OSStatus; external name '_AudioUnitGetProperty';
1346 (* API_AVAILABLE(macos(10.0), ios(2.0), watchos(2.0), tvos(9.0)) *)
1347
1348 {!
1349 @function AudioUnitSetProperty
1350 @abstract sets the value of a specified property
1351 @discussion The API can is used to set the value of the property. Property values for
1352 audio units are always passed by reference
1353
1354 @param inUnit
1355 the audio unit
1356 @param inID
1357 the property identifier
1358 @param inScope
1359 the scope of the property
1360 @param inElement
1361 the element of the scope
1362 @param inData
1363 if not null, then is the new value for the property that will be set. If null,
1364 then inDataSize should be zero, and the call is then used to remove a
1365 previously set value for a property. This removal is only valid for
1366 some properties, as most properties will always have a default value if not
1367 set.
1368 @param inDataSize
1369 the size of the data being provided in inData
1370
1371 @result noErr, or various audio unit errors related to properties
1372 }
AudioUnitSetPropertynull1373 function AudioUnitSetProperty( inUnit: AudioUnit; inID: AudioUnitPropertyID; inScope: AudioUnitScope; inElement: AudioUnitElement; inData: {const} UnivPtr; inDataSize: UInt32 ): OSStatus; external name '_AudioUnitSetProperty';
1374 (* API_AVAILABLE(macos(10.0), ios(2.0), watchos(2.0), tvos(9.0)) *)
1375
1376 {!
1377 @function AudioUnitAddPropertyListener
1378 @abstract registration call to receive notifications for when a property changes
1379 @discussion When an audio unit property value changes, a notification callback can be
1380 called by the audio unit to inform interested parties that this event has
1381 occurred. The notification is defined by the tuple of inProc and
1382 inProcUserData as paired to the specified property ID, so the previously
1383 defined AudioUnitRemovePropertyListener is deprecated because it didn't allow
1384 for the provision of the inProcUserData to remove a given listener (so,
1385 you should use AudioUnitRemovePropertyListenerWithUserData).
1386
1387 @param inUnit
1388 the audio unit
1389 @param inID
1390 the property identifier
1391 @param inProc
1392 the procedure to call when the property changes (on any scope or element)
1393 @param inProcUserData
1394 the user data to provide with the callback
1395
1396 @result noErr, or various audio unit errors related to properties
1397 }
AudioUnitAddPropertyListenernull1398 function AudioUnitAddPropertyListener( inUnit: AudioUnit; inID: AudioUnitPropertyID; inProc: AudioUnitPropertyListenerProc; inProcUserData: UnivPtr ): OSStatus; external name '_AudioUnitAddPropertyListener';
1399 (* API_AVAILABLE(macos(10.0), ios(2.0), watchos(2.0), tvos(9.0)) *)
1400
1401 {!
1402 @function AudioUnitRemovePropertyListenerWithUserData
1403 @abstract remove a previously registered property listener
1404 @discussion Removes a previously registered property listener as specified by the inProc
1405 and inProcUser data as paired to the property identifier
1406
1407 @param inUnit
1408 the audio unit
1409 @param inID
1410 the property identifier
1411 @param inProc
1412 the procedure previously registered
1413 @param inProcUserData
1414 the user data paired with the provided inProc
1415
1416 @result noErr, or various audio unit errors related to properties
1417 }
AudioUnitRemovePropertyListenerWithUserDatanull1418 function AudioUnitRemovePropertyListenerWithUserData( inUnit: AudioUnit; inID: AudioUnitPropertyID; inProc: AudioUnitPropertyListenerProc; inProcUserData: UnivPtr ): OSStatus; external name '_AudioUnitRemovePropertyListenerWithUserData';
1419 (* API_AVAILABLE(macos(10.5), ios(2.0), watchos(2.0), tvos(9.0)) *)
1420
1421 {!
1422 @function AudioUnitAddRenderNotify
1423 @abstract a notification callback to call when an audio unit is asked to render
1424 @discussion allows an application to register a callback with an audio unit for whenever
1425 the audio unit is asked to render. The callback is called both before the
1426 audio unit performs its render operations (the render flag's pre-render bit
1427 is set) and after the audio unit has completed its render operations (the
1428 render flag's post-render bit is set). On post-render, the audio buffer list
1429 (ioData) will contain valid audio data that was rendered by the audio unit.
1430
1431 The inProc and inProcUserData are treated as a tuple entity, so when wanting
1432 to remove one, both the inProc and its inProcUserData must be specified
1433
1434 @param inUnit
1435 the audio unit
1436 @param inProc
1437 an AURenderCallback proc
1438 @param inProcUserData
1439 the user data that will be provided with the proc when it is called
1440
1441 @result noErr, or an audio unit error code
1442 }
AudioUnitAddRenderNotifynull1443 function AudioUnitAddRenderNotify( inUnit: AudioUnit; inProc: AURenderCallback; inProcUserData: UnivPtr ): OSStatus; external name '_AudioUnitAddRenderNotify';
1444 (* API_AVAILABLE(macos(10.2), ios(2.0), watchos(2.0), tvos(9.0)) *)
1445
1446 {!
1447 @function AudioUnitRemoveRenderNotify
1448 @abstract remove a previously registered render notification proc
1449
1450 @param inUnit
1451 the audio unit
1452 @param inProc
1453 an AURenderCallback proc
1454 @param inProcUserData
1455 the user data that was provided with the proc when it was previously
1456 registered
1457
1458 @result noErr, or an audio unit error code
1459 }
AudioUnitRemoveRenderNotifynull1460 function AudioUnitRemoveRenderNotify( inUnit: AudioUnit; inProc: AURenderCallback; inProcUserData: UnivPtr ): OSStatus; external name '_AudioUnitRemoveRenderNotify';
1461 (* API_AVAILABLE(macos(10.2), ios(2.0), watchos(2.0), tvos(9.0)) *)
1462
1463 {!
1464 @function AudioUnitGetParameter
1465 @abstract Get the value of a parameter
1466 @discussion Get the value of a parameter as specified by its ID, scope and element.
1467
1468 @param inUnit
1469 the audio unit
1470 @param inID
1471 the parameter ID
1472 @param inScope
1473 the scope for the parameter
1474 @param inElement
1475 the element on the scope for the parameter
1476 @param outValue
1477 Must be non-null, and upon success will contain the current value for the
1478 specified parameter
1479
1480 @result noErr, or an audio unit error code (such as InvalidParameter)
1481 }
AudioUnitGetParameternull1482 function AudioUnitGetParameter( inUnit: AudioUnit; inID: AudioUnitParameterID; inScope: AudioUnitScope; inElement: AudioUnitElement; var outValue: AudioUnitParameterValue ): OSStatus; external name '_AudioUnitGetParameter';
1483 (* API_AVAILABLE(macos(10.0), ios(2.0), watchos(2.0), tvos(9.0)) *)
1484
1485 {!
1486 @function AudioUnitSetParameter
1487 @abstract Set the value of a parameter
1488 @discussion Set the value of a parameter as specified by its ID, scope and element.
1489 Parameter IDs are consistent across all of the elements in a scope - so for a
1490 mixer, the "input volume" parameter can be applied on any input, and the
1491 particular input is specified by the elementID.
1492
1493 @param inUnit
1494 the audio unit
1495 @param inID
1496 the parameter ID
1497 @param inScope
1498 the scope for the parameter
1499 @param inElement
1500 the element on the scope for the parameter
1501 @param inValue
1502 the new value for the parameter.
1503 @param inBufferOffsetInFrames
1504 generally should be set to zero - see AudioUnitScheduleParameters
1505
1506 @result noErr, or an audio unit error code (such as InvalidParameter)
1507 }
AudioUnitSetParameternull1508 function AudioUnitSetParameter( inUnit: AudioUnit; inID: AudioUnitParameterID; inScope: AudioUnitScope; inElement: AudioUnitElement; inValue: AudioUnitParameterValue; inBufferOffsetInFrames: UInt32 ): OSStatus; external name '_AudioUnitSetParameter';
1509 (* API_AVAILABLE(macos(10.0), ios(2.0), watchos(2.0), tvos(9.0)) *)
1510
1511 {!
1512 @function AudioUnitScheduleParameters
1513 @abstract Schedule changes to the value of a parameter
1514 @discussion This API is used to schedule intra-buffer changes to the value of a parameter
1515 (immediate) or to ramp a parameter from a start value to an end value for a
1516 specified number of samples (ramp)
1517
1518 The API allows for the scheduling of multiple parameter events with the one
1519 call. All of the parameter events must apply to the current (and only apply to
1520 the current) audio unit render call, so the events are scheduled as a part of
1521 the pre-render notification callback.
1522
1523 When scheduling an immediate parameter event, the new value at the specified
1524 sample buffer offset is provided
1525
1526 When scheduling a ramped parameter, the ramp is scheduled each audio unit
1527 render for the duration of the ramp. Each schedule of the the new audio unit
1528 render specifies the progress of the ramp.
1529
1530 Parameters that can have events scheduled to them will indicate this through
1531 their parameter info struct
1532
1533 @param inUnit
1534 the audio unit
1535 @param inParameterEvent
1536 a pointer to an array of parameter event structs
1537 @param inNumParamEvents
1538 the number of parameter event structs pointed to by inParameterEvent
1539
1540 @result noErr, or an audio unit error code (such as InvalidParameter)
1541 }
AudioUnitScheduleParametersnull1542 function AudioUnitScheduleParameters( inUnit: AudioUnit; const inParameterEvent: AudioUnitParameterEventPtr; inNumParamEvents: UInt32 ): OSStatus; external name '_AudioUnitScheduleParameters';
1543 (* API_AVAILABLE(macos(10.2), ios(2.0), watchos(2.0), tvos(9.0)) *)
1544
1545 {!
1546 @function AudioUnitRender
1547 @abstract the render operation where ioData will contain the results of the audio unit's
1548 render operations
1549 @discussion an audio unit will render the amount of audio data described by
1550 inNumberOfFrames and the results of that render will be contained within
1551 ioData. The caller should provide audio time stamps where at least the sample
1552 time is valid and it is incrementing sequentially from its previous call
1553 (so, the next time stamp will be the current time stamp + inNumberFrames)
1554 If the sample time is not incrementing sequentially, the audio unit will infer
1555 that there is some discontinuity with the timeline it is rendering for
1556
1557 The caller must provide a valid ioData AudioBufferList that matches the
1558 expected topology for the current audio format for the given bus. The buffer
1559 list can be of two variants:
1560 (1) If the mData pointers are non-null then the audio unit will render its
1561 output into those buffers. These buffers should be aligned to 16 byte
1562 boundaries (which is normally what malloc will return).
1563 (2) If the mData pointers are null, then the audio unit can provide pointers
1564 to its own buffers. In this case the audio unit is required to keep those
1565 buffers valid for the duration of the calling thread's I/O cycle
1566
1567 @param inUnit
1568 the audio unit
1569 @param ioActionFlags
1570 any appropriate action flags for the render operation
1571 @param inTimeStamp
1572 the time stamp that applies to this particular render operation. when
1573 rendering for multiple output buses the time stamp will generally be the same
1574 for each output bus, so the audio unit is able to determine without doubt that
1575 this the same render operation
1576 @param inOutputBusNumber
1577 the output bus to render for
1578 @param inNumberFrames
1579 the number of sample frames to render
1580 @param ioData
1581 the audio buffer list that the audio unit is to render into.
1582
1583 @result noErr, or an audio unit render error
1584 }
AudioUnitRendernull1585 function AudioUnitRender( inUnit: AudioUnit; ioActionFlags: AudioUnitRenderActionFlagsPtr; const (*var*) inTimeStamp: AudioTimeStamp; inOutputBusNumber: UInt32; inNumberFrames: UInt32; ioData: AudioBufferListPtr ): OSStatus; external name '_AudioUnitRender';
1586 (* API_AVAILABLE(macos(10.2), ios(2.0), watchos(2.0), tvos(9.0)) *)
1587
1588 {$ifc TARGET_OS_MAC}
AudioUnitProcessnull1589 function AudioUnitProcess( inUnit: AudioUnit; ioActionFlags: AudioUnitRenderActionFlagsPtr; const (*var*) inTimeStamp: AudioTimeStamp; inNumberFrames: UInt32; var ioData: AudioBufferList ): OSStatus; external name '_AudioUnitProcess';
1590 (* API_AVAILABLE(macos(10.7), ios(6.0), watchos(2.0), tvos(9.0)) *)
1591
AudioUnitProcessMultiplenull1592 function AudioUnitProcessMultiple( inUnit: AudioUnit; ioActionFlags: AudioUnitRenderActionFlagsPtr; const (*var*) inTimeStamp: AudioTimeStamp; inNumberFrames: UInt32; inNumberInputBufferLists: UInt32; {const} inInputBufferLists: AudioBufferListPtrPtr; inNumberOutputBufferLists: UInt32; ioOutputBufferLists: AudioBufferListPtrPtr ): OSStatus; external name '_AudioUnitProcessMultiple';
1593 (* API_AVAILABLE(macos(10.7), ios(6.0), watchos(2.0), tvos(9.0)) *)
1594 {$endc} {TARGET_OS_MAC}
1595
1596 {!
1597 @function AudioUnitReset
1598 @abstract reset an audio unit's render state
1599 @discussion This call will clear any render state of an audio unit. For instance, with a
1600 delay or reverb type of audio unit reset will clear any of the delay lines
1601 maintained within the audio unit. Typically, this call is made when an
1602 audio unit was previously rendering, and was taken out of the render chain
1603 (say, the track it is in was muted) and is being added back in (unmuted).
1604 The host should reset the audio unit before adding it back so that it doesn't
1605 produce audio from its delay lines that is no longer valid.
1606
1607 The call should only clear memory, it should NOT allocate or free memory
1608 resources (this is done in the Initialize calls).
1609
1610 @param inUnit
1611 the audio unit
1612 @param inScope
1613 the scope - typically this is set to GlobalScope
1614 @param inElement
1615 the element - typically this is set to 0
1616
1617 @result noErr, or an audio unit error
1618 }
AudioUnitResetnull1619 function AudioUnitReset( inUnit: AudioUnit; inScope: AudioUnitScope; inElement: AudioUnitElement ): OSStatus; external name '_AudioUnitReset';
1620 (* API_AVAILABLE(macos(10.0), ios(2.0), watchos(2.0), tvos(9.0)) *)
1621
1622 {$ifc TARGET_OS_IPHONE and not TARGET_IPHONE_SIMULATOR}
1623 {!
1624 @function AudioOutputUnitPublish
1625
1626 @abstract Register an audio output unit as available to be used as an audio unit by
1627 other applications.
1628
1629 @param inOutputUnit
1630 The audio output unit to be published.
1631 @param inDesc
1632 The AudioComponentDescription under which to register the application.
1633 @param inName
1634 The application or component name.
1635 @result An OSStatus result code.
1636
1637 @discussion
1638 This allows a publishing application to register its audio (input/)output unit as being able
1639 to be redirected and repurposed as an audio unit effect, generator, music device or music
1640 effect by another host application.
1641 }
AudioOutputUnitPublishnull1642 function AudioOutputUnitPublish( const (*var*) inDesc: AudioComponentDescription; inName: CFStringRef; inVersion: UInt32; inOutputUnit: AudioUnit ): OSStatus; external name '_AudioOutputUnitPublish';
1643 (* API_AVAILABLE(ios(7.0), watchos(2.0), tvos(9.0)) API_UNAVAILABLE(macos) *)
1644
1645
1646 {!
1647 @function AudioComponentGetLastActiveTime
1648 @abstract Fetches the time at which the application publishing the component was last active.
1649 @discussion
1650 Inter-app audio hosts can use this to sort the list of available nodes by how recently
1651 the user interacted with them.
1652
1653 @param inComponent
1654 The AudioComponent being queried.
1655 @result The CFAbsoluteTime at which the node was last active (0 if never).
1656 }
AudioComponentGetLastActiveTimenull1657 function AudioComponentGetLastActiveTime( comp: AudioComponent ): CFAbsoluteTime; external name '_AudioComponentGetLastActiveTime';
1658 (* API_AVAILABLE(ios(7.0), watchos(2.0), tvos(9.0)) API_UNAVAILABLE(macos) *)
1659 {$endc} {TARGET_OS_IPHONE and not TARGET_IPHONE_SIMULATOR}
1660
1661 {$ifc TARGET_CPU_64 or TARGET_OS_IPHONE}
1662 {!
1663 @function AudioUnitExtensionSetComponentList
1664 @abstract Allows the implementor of an audio unit extension to dynamically modify the
1665 list of component registrations for the extension.
1666 @param extensionIdentifier
1667 The bundle ID of the audio unit extension.
1668 @param audioComponentInfo
1669 An array of dictionaries, one for each component, in the same format as
1670 described in AudioComponent.h for the Info.plist key "AudioComponents".
1671 @result An OSStatus result code.
1672 @discussion
1673 Note that the bundle ID of the process calling this API must prefix (or match)
1674 the provided extension identifier.
1675 }
AudioUnitExtensionSetComponentListnull1676 function AudioUnitExtensionSetComponentList(extensionIdentifier: CFStringRef; audioComponentInfo: CFArrayRef {__nullable}): OSStatus; external name '_AudioUnitExtensionSetComponentList';
1677 (* API_AVAILABLE(macos(10.13), ios(11.0)) __TVOS_PROHIBITED __WATCHOS_PROHIBITED *)
1678
1679 {!
1680 @function AudioUnitExtensionCopyComponentList
1681 @abstract Returns the component registrations for a given audio unit extension.
1682 @param extensionIdentifier
1683 The bundle ID of the audio unit extension.
1684 @result An array of dictionaries, one for each component, in the same format as
1685 described in AudioComponent.h for the Info.plist key "AudioComponents".
1686 The caller should release this value when done with it.
1687 }
AudioUnitExtensionCopyComponentListnull1688 function AudioUnitExtensionCopyComponentList(extensionIdentifier: CFStringRef): CFArrayRef {__nullable}; external name '_AudioUnitExtensionCopyComponentList';
1689 (* API_AVAILABLE(macos(10.13), ios(11.0)) __TVOS_PROHIBITED __WATCHOS_PROHIBITED *)
1690 {$endc} {TARGET_CPU_64 or TARGET_OS_IPHONE}
1691
1692
1693 {!
1694 @enum AudioUnitRange
1695 @discussion the range of selectors that are used to dispatch through to the various audio
1696 unit API
1697
1698 @constant kAudioUnitRange
1699 @constant kAudioUnitInitializeSelect
1700 @constant kAudioUnitUninitializeSelect
1701 @constant kAudioUnitGetPropertyInfoSelect
1702 @constant kAudioUnitGetPropertySelect
1703 @constant kAudioUnitSetPropertySelect
1704 @constant kAudioUnitAddPropertyListenerSelect
1705 @constant kAudioUnitRemovePropertyListenerSelect
1706 @constant kAudioUnitRemovePropertyListenerWithUserDataSelect
1707 @constant kAudioUnitAddRenderNotifySelect
1708 @constant kAudioUnitRemoveRenderNotifySelect
1709 @constant kAudioUnitGetParameterSelect
1710 @constant kAudioUnitSetParameterSelect
1711 @constant kAudioUnitScheduleParametersSelect
1712 @constant kAudioUnitRenderSelect
1713 @constant kAudioUnitResetSelect
1714 @constant kAudioUnitComplexRenderSelect
1715 @constant kAudioUnitProcessSelect
1716 @constant kAudioUnitProcessMultipleSelect
1717 }
1718 const
1719 kAudioUnitRange = $0000; // range of selectors for audio units
1720 kAudioUnitInitializeSelect = $0001;
1721 kAudioUnitUninitializeSelect = $0002;
1722 kAudioUnitGetPropertyInfoSelect = $0003;
1723 kAudioUnitGetPropertySelect = $0004;
1724 kAudioUnitSetPropertySelect = $0005;
1725 kAudioUnitAddPropertyListenerSelect = $000A;
1726 kAudioUnitRemovePropertyListenerSelect = $000B;
1727 kAudioUnitRemovePropertyListenerWithUserDataSelect = $0012;
1728 kAudioUnitAddRenderNotifySelect = $000F;
1729 kAudioUnitRemoveRenderNotifySelect = $0010;
1730 kAudioUnitGetParameterSelect = $0006;
1731 kAudioUnitSetParameterSelect = $0007;
1732 kAudioUnitScheduleParametersSelect = $0011;
1733 kAudioUnitRenderSelect = $000E;
1734 kAudioUnitResetSelect = $0009;
1735 kAudioUnitComplexRenderSelect = $0013;
1736 kAudioUnitProcessSelect = $0014;
1737 kAudioUnitProcessMultipleSelect = $0015;
1738
1739 //================================================================================================
1740 //#pragma mark -
prototypesnull1741 //#pragma mark Dispatch function prototypes
1742
1743 type
1744 AudioUnitInitializeProc = function( self: UnivPtr ): OSStatus;
1745
1746 type
selfnull1747 AudioUnitUninitializeProc = function( self: UnivPtr ): OSStatus;
1748
1749 type
selfnull1750 AudioUnitGetPropertyInfoProc = function( self: UnivPtr; prop: AudioUnitPropertyID; scope: AudioUnitScope; elem: AudioUnitElement; outDataSize: UInt32Ptr; outWritable: BooleanPtr ): OSStatus;
1751
1752 type
selfnull1753 AudioUnitGetPropertyProc = function( self: UnivPtr; inID: AudioUnitPropertyID; inScope: AudioUnitScope; inElement: AudioUnitElement; outData: UnivPtr; var ioDataSize: UInt32 ): OSStatus;
1754
1755 type
selfnull1756 AudioUnitSetPropertyProc = function( self: UnivPtr; inID: AudioUnitPropertyID; inScope: AudioUnitScope; inElement: AudioUnitElement; inData: {const} UnivPtr; inDataSize: UInt32 ): OSStatus;
1757
1758 type
selfnull1759 AudioUnitAddPropertyListenerProc = function( self: UnivPtr; prop: AudioUnitPropertyID; proc: AudioUnitPropertyListenerProc; userData: UnivPtr ): OSStatus;
1760
1761 type
selfnull1762 AudioUnitRemovePropertyListenerProc = function( self: UnivPtr; prop: AudioUnitPropertyID; proc: AudioUnitPropertyListenerProc ): OSStatus;
1763
1764 type
selfnull1765 AudioUnitRemovePropertyListenerWithUserDataProc = function( self: UnivPtr; prop: AudioUnitPropertyID; proc: AudioUnitPropertyListenerProc; userData: UnivPtr ): OSStatus;
1766
1767 type
selfnull1768 AudioUnitAddRenderNotifyProc = function( self: UnivPtr; proc: AURenderCallback; userData: UnivPtr ): OSStatus;
1769
1770 type
selfnull1771 AudioUnitRemoveRenderNotifyProc = function( self: UnivPtr; proc: AURenderCallback; userData: UnivPtr ): OSStatus;
1772
1773 type
selfnull1774 AudioUnitScheduleParametersProc = function( self: UnivPtr; const (*var*) events: AudioUnitParameterEvent; numEvents: UInt32 ): OSStatus;
1775
1776 type
selfnull1777 AudioUnitResetProc = function( self: UnivPtr; inScope: AudioUnitScope; inElement: AudioUnitElement ): OSStatus;
1778
1779 type
selfnull1780 AudioUnitComplexRenderProc = function( self: UnivPtr; ioActionFlags: AudioUnitRenderActionFlagsPtr; const (*var*) inTimeStamp: AudioTimeStamp; inOutputBusNumber: UInt32; inNumberOfPackets: UInt32; var outNumberOfPackets: UInt32; var outPacketDescriptions: AudioStreamPacketDescription; var ioData: AudioBufferList; outMetadata: UnivPtr; var outMetadataByteSize: UInt32 ): OSStatus;
1781
1782 type
selfnull1783 AudioUnitProcessProc = function( self: UnivPtr; ioActionFlags: AudioUnitRenderActionFlagsPtr; const (*var*) inTimeStamp: AudioTimeStamp; inNumberFrames: UInt32; var ioData: AudioBufferList ): OSStatus;
1784
1785 type
selfnull1786 AudioUnitProcessMultipleProc = function( self: UnivPtr; ioActionFlags: AudioUnitRenderActionFlagsPtr; const (*var*) inTimeStamp: AudioTimeStamp; inNumberFrames: UInt32; inNumberInputBufferLists: UInt32; {const} inInputBufferLists: AudioBufferListPtrPtr; inNumberOutputBufferLists: UInt32; ioOutputBufferLists: AudioBufferListPtrPtr ): OSStatus;
1787
1788
1789 {!
1790 @typedef AudioUnitGetParameterProc
1791 @discussion This proc can be exported through the FastDispatch property or is used as the prototype for
1792 an audio component dispatch for this selector.
1793
1794 The arguments are the same as are provided to the corresponding API call
1795
1796 @param inComponentStorage
1797 For a component manager component, this is the component instance storage
1798 pointer
1799 @param inID
1800 @param inScope
1801 @param inElement
1802 @param outValue
1803 }
1804 type
inComponentStoragenull1805 AudioUnitGetParameterProc = function( inComponentStorage: UnivPtr; inID: AudioUnitParameterID; inScope: AudioUnitScope; inElement: AudioUnitElement; var outValue: AudioUnitParameterValue ): OSStatus;
1806
1807 {!
1808 @typedef AudioUnitSetParameterProc
1809 @discussion This proc can be exported through the FastDispatch property or is used as the prototype for
1810 an audio component dispatch for this selector.
1811
1812 The arguments are the same as are provided to the corresponding API call
1813
1814 @param inComponentStorage
1815 For a component manager component, this is the component instance storage
1816 pointer
1817 @param inID
1818 @param inScope
1819 @param inElement
1820 @param inValue
1821 @param inBufferOffsetInFrames
1822 }
1823 type
inComponentStoragenull1824 AudioUnitSetParameterProc = function( inComponentStorage: UnivPtr; inID: AudioUnitParameterID; inScope: AudioUnitScope; inElement: AudioUnitElement; inValue: AudioUnitParameterValue; inBufferOffsetInFrames: UInt32 ): OSStatus;
1825
1826 {!
1827 @typedef AudioUnitRenderProc
1828 @discussion This proc can be exported through the FastDispatch property or is used as the prototype for
1829 an audio component dispatch for this selector.
1830
1831 The arguments are the same as are provided to the corresponding API call
1832
1833 @param inComponentStorage
1834 For a component manager component, this is the component instance storage
1835 pointer
1836 @param ioActionFlags
1837 @param inTimeStamp
1838 @param inOutputBusNumber
1839 @param inNumberFrames
1840 @param ioData
1841 }
1842 type
inComponentStoragenull1843 AudioUnitRenderProc = function( inComponentStorage: UnivPtr; ioActionFlags: AudioUnitRenderActionFlagsPtr; const (*var*) inTimeStamp: AudioTimeStamp; inOutputBusNumber: UInt32; inNumberFrames: UInt32; var ioData: AudioBufferList ): OSStatus;
1844
1845
1846 //=====================================================================================================================
1847 //#pragma mark -
1848 //#pragma mark Deprecated
1849 {!
1850 @enum deprecated - Audio unit errors
1851 @discussion These are the various errors that can be returned by AudioUnit... API calls
1852
1853 @constant kAudioUnitErr_IllegalInstrument
1854 Apple's DLS synth returns this error if information about a particular
1855 instrument patch is requested, but is not valid.
1856 @constant kAudioUnitErr_InstrumentTypeNotFound
1857 Apple's DLS synth returns this error if information about a particular
1858 instrument patch is requested, but is not valid.
1859 }
1860 const
1861 kAudioUnitErr_IllegalInstrument = -10873;
1862 kAudioUnitErr_InstrumentTypeNotFound = -10872;
1863
1864 //#if !__LP64__ && !TARGET_OS_IPHONE
1865 {$ifc not TARGET_CPU_64 and not TARGET_OS_IPHONE}
1866 // this call is deprecated and replaced by AudioUnitRemovePropertyListenerWithUserData
pointernull1867 // this allows apps to use the same function pointer more than once
1868 // you provide the same function ptr and user data as provided when you add a property listener
1869 function AudioUnitRemovePropertyListener( inUnit: AudioUnit; inID: AudioUnitPropertyID; inProc: AudioUnitPropertyListenerProc ): OSStatus; external name '_AudioUnitRemovePropertyListener';
1870 (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0,__MAC_10_5, __IPHONE_NA, __IPHONE_NA) *)
1871 //#endif
1872 {$endc}
1873
1874 {$ifc not defined MACOSALLINCLUDE or not MACOSALLINCLUDE}
1875
1876 end.
1877 {$endc} {not MACOSALLINCLUDE}
1878