summaryrefslogtreecommitdiff
path: root/libs/appleutility/CoreAudio/AudioUnits/AUPublic/AUBase/AUPlugInDispatch.cpp
blob: 3bab198369e6756992dab8baa076cfc9f89ee523 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
/*
     File: AUPlugInDispatch.cpp
 Abstract: AUPlugInDispatch.h
  Version: 1.1
 
 Disclaimer: IMPORTANT:  This Apple software is supplied to you by Apple
 Inc. ("Apple") in consideration of your agreement to the following
 terms, and your use, installation, modification or redistribution of
 this Apple software constitutes acceptance of these terms.  If you do
 not agree with these terms, please do not use, install, modify or
 redistribute this Apple software.
 
 In consideration of your agreement to abide by the following terms, and
 subject to these terms, Apple grants you a personal, non-exclusive
 license, under Apple's copyrights in this original Apple software (the
 "Apple Software"), to use, reproduce, modify and redistribute the Apple
 Software, with or without modifications, in source and/or binary forms;
 provided that if you redistribute the Apple Software in its entirety and
 without modifications, you must retain this notice and the following
 text and disclaimers in all such redistributions of the Apple Software.
 Neither the name, trademarks, service marks or logos of Apple Inc. may
 be used to endorse or promote products derived from the Apple Software
 without specific prior written permission from Apple.  Except as
 expressly stated in this notice, no other rights or licenses, express or
 implied, are granted by Apple herein, including but not limited to any
 patent rights that may be infringed by your derivative works or by other
 works in which the Apple Software may be incorporated.
 
 The Apple Software is provided by Apple on an "AS IS" basis.  APPLE
 MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
 THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS
 FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND
 OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
 
 IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL
 OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION,
 MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED
 AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),
 STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE
 POSSIBILITY OF SUCH DAMAGE.
 
 Copyright (C) 2014 Apple Inc. All Rights Reserved.
 
*/
#include "AUPlugInDispatch.h"
#include "CAXException.h"
#include "ComponentBase.h"
#include "AUBase.h"

#define ACPI ((AudioComponentPlugInInstance *)self)
#define AUI	((AUBase *)&ACPI->mInstanceStorage)

#define AUI_LOCK CAMutex::Locker auLock(AUI->GetMutex());

// ------------------------------------------------------------------------------------------------
static OSStatus AUMethodInitialize(void *self)
{
	OSStatus result = noErr;
	try {
		AUI_LOCK
		result = AUI->DoInitialize();
	}
	COMPONENT_CATCH
	return result;
}

static OSStatus AUMethodUninitialize(void *self)
{
	OSStatus result = noErr;
	try {
		AUI_LOCK
		AUI->DoCleanup();
	}
	COMPONENT_CATCH
	return result;
}

static OSStatus AUMethodGetPropertyInfo(void *self, AudioUnitPropertyID prop, AudioUnitScope scope, AudioUnitElement elem, UInt32 *outDataSize, Boolean *outWritable)
{
	OSStatus result = noErr;
	try {
		UInt32 dataSize = 0;        // 13517289 GetPropetyInfo was returning an uninitialized value when there is an error. This is a problem for auval.
		Boolean writable = false;
		
		AUI_LOCK
		result = AUI->DispatchGetPropertyInfo(prop, scope, elem, dataSize, writable);
		if (outDataSize != NULL)
			*outDataSize = dataSize;
		if (outWritable != NULL)
			*outWritable = writable;
	}
	COMPONENT_CATCH
	return result;
}

static OSStatus AUMethodGetProperty(void *self, AudioUnitPropertyID inID, AudioUnitScope inScope, AudioUnitElement inElement, void *outData, UInt32 *ioDataSize)
{
	OSStatus result = noErr;
	try {
		UInt32 actualPropertySize, clientBufferSize;
		Boolean writable;
		char *tempBuffer;
		void *destBuffer;
		
		AUI_LOCK
		if (ioDataSize == NULL) {
			ca_debug_string("AudioUnitGetProperty: null size pointer");
			result = kAudio_ParamError;
			goto finishGetProperty;
		}
		if (outData == NULL) {
			UInt32 dataSize;
			
			result = AUI->DispatchGetPropertyInfo(inID, inScope, inElement, dataSize, writable);
			*ioDataSize = dataSize;
			goto finishGetProperty;
		}
		
		clientBufferSize = *ioDataSize;
		if (clientBufferSize == 0)
		{
			ca_debug_string("AudioUnitGetProperty: *ioDataSize == 0 on entry");
			// $$$ or should we allow this as a shortcut for finding the size?
			result = kAudio_ParamError;
			goto finishGetProperty;
		}
		
		result = AUI->DispatchGetPropertyInfo(inID, inScope, inElement, actualPropertySize, writable);
		if (result != noErr) 
			goto finishGetProperty;
		
		if (clientBufferSize < actualPropertySize) 
		{
			tempBuffer = new char[actualPropertySize];
			destBuffer = tempBuffer;
		} else {
			tempBuffer = NULL;
			destBuffer = outData;
		}
		
		result = AUI->DispatchGetProperty(inID, inScope, inElement, destBuffer);
		
		if (result == noErr) {
			if (clientBufferSize < actualPropertySize && tempBuffer != NULL)
			{
				memcpy(outData, tempBuffer, clientBufferSize);
				delete[] tempBuffer;
				// ioDataSize remains correct, the number of bytes we wrote
			} else
				*ioDataSize = actualPropertySize;
		} else
			*ioDataSize = 0;
	}
	COMPONENT_CATCH
finishGetProperty:
	return result;
}

static OSStatus AUMethodSetProperty(void *self, AudioUnitPropertyID inID, AudioUnitScope inScope, AudioUnitElement inElement, const void *inData, UInt32 inDataSize)
{
	OSStatus result = noErr;
	try {
		AUI_LOCK
		if (inData && inDataSize)
			result = AUI->DispatchSetProperty(inID, inScope, inElement, inData, inDataSize);
		else {
			if (inData == NULL && inDataSize == 0) {
				result = AUI->DispatchRemovePropertyValue(inID, inScope, inElement);
			} else {
				if (inData == NULL) {
					ca_debug_string("AudioUnitSetProperty: inData == NULL");
					result = kAudio_ParamError;
					goto finishSetProperty;
				}

				if (inDataSize == 0) {
					ca_debug_string("AudioUnitSetProperty: inDataSize == 0");
					result = kAudio_ParamError;
					goto finishSetProperty;
				}
			}
		}
	}
	COMPONENT_CATCH
finishSetProperty:
	return result;
}

static OSStatus AUMethodAddPropertyListener(void *self, AudioUnitPropertyID prop, AudioUnitPropertyListenerProc proc, void *userData)
{
	OSStatus result = noErr;
	try {
		AUI_LOCK
		result = AUI->AddPropertyListener(prop, proc, userData);
	}
	COMPONENT_CATCH
	return result;
}

static OSStatus AUMethodRemovePropertyListener(void *self, AudioUnitPropertyID prop, AudioUnitPropertyListenerProc proc)
{
	OSStatus result = noErr;
	try {
		AUI_LOCK
		result = AUI->RemovePropertyListener(prop, proc, NULL, false);
	}
	COMPONENT_CATCH
	return result;
}

static OSStatus AUMethodRemovePropertyListenerWithUserData(void *self, AudioUnitPropertyID prop, AudioUnitPropertyListenerProc proc, void *userData)
{
	OSStatus result = noErr;
	try {
		AUI_LOCK
		result = AUI->RemovePropertyListener(prop, proc, userData, true);
	}
	COMPONENT_CATCH
	return result;
}

static OSStatus AUMethodAddRenderNotify(void *self, AURenderCallback proc, void *userData)
{
	OSStatus result = noErr;
	try {
		AUI_LOCK
		result = AUI->SetRenderNotification(proc, userData);
	}
	COMPONENT_CATCH
	return result;
}

static OSStatus AUMethodRemoveRenderNotify(void *self, AURenderCallback proc, void *userData)
{
	OSStatus result = noErr;
	try {
		AUI_LOCK
		result = AUI->RemoveRenderNotification(proc, userData);
	}
	COMPONENT_CATCH
	return result;
}

static OSStatus AUMethodGetParameter(void *self, AudioUnitParameterID param, AudioUnitScope scope, AudioUnitElement elem, AudioUnitParameterValue *value)
{
	OSStatus result = noErr;
	try {
		AUI_LOCK
		result = (value == NULL ? kAudio_ParamError : AUI->GetParameter(param, scope, elem, *value));
	}
	COMPONENT_CATCH
	return result;
}

static OSStatus AUMethodSetParameter(void *self, AudioUnitParameterID param, AudioUnitScope scope, AudioUnitElement elem, AudioUnitParameterValue value, UInt32 bufferOffset)
{
	OSStatus result = noErr;
	try {
		// this is a (potentially) realtime method; no lock
		result = AUI->SetParameter(param, scope, elem, value, bufferOffset);
	}
	COMPONENT_CATCH
	return result;
}

static OSStatus AUMethodScheduleParameters(void *self, const AudioUnitParameterEvent *events, UInt32 numEvents)
{
	OSStatus result = noErr;
	try {
		// this is a (potentially) realtime method; no lock
		result = AUI->ScheduleParameter(events, numEvents);
	}
	COMPONENT_CATCH
	return result;
}

static OSStatus AUMethodRender(void *self, AudioUnitRenderActionFlags *ioActionFlags, const AudioTimeStamp *inTimeStamp, UInt32 inOutputBusNumber, UInt32 inNumberFrames, AudioBufferList *ioData)
{
	OSStatus result = noErr;

#if !TARGET_OS_IPHONE
	try {
#endif
		// this is a processing method; no lock
		AudioUnitRenderActionFlags tempFlags;
		
		if (inTimeStamp == NULL || ioData == NULL)
			result = kAudio_ParamError;
		else {
			if (ioActionFlags == NULL) {
				tempFlags = 0;
				ioActionFlags = &tempFlags;
			}
			result = AUI->DoRender(*ioActionFlags, *inTimeStamp, inOutputBusNumber, inNumberFrames, *ioData);
		}

#if !TARGET_OS_IPHONE
	}
	COMPONENT_CATCH
#endif

	return result;
}

static OSStatus AUMethodComplexRender(void *self, AudioUnitRenderActionFlags *ioActionFlags, const AudioTimeStamp *inTimeStamp, UInt32 inOutputBusNumber, UInt32 inNumberOfPackets, UInt32 *outNumberOfPackets, AudioStreamPacketDescription *outPacketDescriptions, AudioBufferList *ioData, void *outMetadata, UInt32 *outMetadataByteSize)
{
	OSStatus result = noErr;

#if !TARGET_OS_IPHONE
	try {
#endif
		// this is a processing method; no lock
		AudioUnitRenderActionFlags tempFlags;
		
		if (inTimeStamp == NULL || ioData == NULL)
			result = kAudio_ParamError;
		else {
			if (ioActionFlags == NULL) {
				tempFlags = 0;
				ioActionFlags = &tempFlags;
			}
			result = AUI->ComplexRender(*ioActionFlags, *inTimeStamp, inOutputBusNumber, inNumberOfPackets, outNumberOfPackets, outPacketDescriptions, *ioData, outMetadata, outMetadataByteSize);
		}

#if !TARGET_OS_IPHONE
	}
	COMPONENT_CATCH
#endif

	return result;
}

static OSStatus AUMethodReset(void *self, AudioUnitScope scope, AudioUnitElement elem)
{
	OSStatus result = noErr;
	try {
		AUI_LOCK
		result = AUI->Reset(scope, elem);
	}
	COMPONENT_CATCH
	return result;
}

static OSStatus AUMethodProcess (void *self, AudioUnitRenderActionFlags *ioActionFlags, const AudioTimeStamp *inTimeStamp, UInt32 inNumberFrames, AudioBufferList *ioData)
{
	OSStatus result = noErr;

#if !TARGET_OS_IPHONE
	try {
#endif
		// this is a processing method; no lock
		bool doParamCheck = true;

		AudioUnitRenderActionFlags tempFlags;

		if (ioActionFlags == NULL) {
			tempFlags = 0;
			ioActionFlags = &tempFlags;
		} else {
			if (*ioActionFlags & (1 << 9)/*kAudioUnitRenderAction_DoNotCheckRenderArgs*/)
				doParamCheck = false;
		}
		
		if (doParamCheck && (inTimeStamp == NULL || ioData == NULL))
			result = kAudio_ParamError;
		else {
			result = AUI->DoProcess(*ioActionFlags, *inTimeStamp, inNumberFrames, *ioData);
		}

#if !TARGET_OS_IPHONE
	}
	COMPONENT_CATCH
#endif

	return result;
}

static OSStatus AUMethodProcessMultiple (void *self, AudioUnitRenderActionFlags *ioActionFlags, const AudioTimeStamp *inTimeStamp, UInt32 inNumberFrames, UInt32 inNumberInputBufferLists, const AudioBufferList **inInputBufferLists, UInt32 inNumberOutputBufferLists, AudioBufferList **ioOutputBufferLists)
{
	OSStatus result = noErr;
	
#if !TARGET_OS_IPHONE
	try {
#endif
		// this is a processing method; no lock
		bool doParamCheck = true;
		
		AudioUnitRenderActionFlags tempFlags;
		
		if (ioActionFlags == NULL) {
			tempFlags = 0;
			ioActionFlags = &tempFlags;
		} else {
			if (*ioActionFlags & (1 << 9)/*kAudioUnitRenderAction_DoNotCheckRenderArgs*/)
				doParamCheck = false;
		}

		if (doParamCheck && (inTimeStamp == NULL || inInputBufferLists == NULL || ioOutputBufferLists == NULL))
			result = kAudio_ParamError;
		else {
			result = AUI->DoProcessMultiple(*ioActionFlags, *inTimeStamp, inNumberFrames, inNumberInputBufferLists, inInputBufferLists, inNumberOutputBufferLists, ioOutputBufferLists);
		}
		
#if !TARGET_OS_IPHONE
	}
	COMPONENT_CATCH
#endif

	return result;
}
// ------------------------------------------------------------------------------------------------

static OSStatus AUMethodStart(void *self)
{
	OSStatus result = noErr;
	try {
		AUI_LOCK
		result = AUI->Start();
	}
	COMPONENT_CATCH
	return result;
}

static OSStatus AUMethodStop(void *self)
{
	OSStatus result = noErr;
	try {
		AUI_LOCK
		result = AUI->Stop();
	}
	COMPONENT_CATCH
	return result;
}

// ------------------------------------------------------------------------------------------------

#if !CA_BASIC_AU_FEATURES
// I don't know what I'm doing here; conflicts with the multiple inheritence in MusicDeviceBase.
static OSStatus AUMethodMIDIEvent(void *self, UInt32 inStatus, UInt32 inData1, UInt32 inData2, UInt32 inOffsetSampleFrame)
{
	OSStatus result = noErr;
	try {
		// this is a potential render-time method; no lock
		result = AUI->MIDIEvent(inStatus, inData1, inData2, inOffsetSampleFrame);
	}
	COMPONENT_CATCH
	return result;
}

static OSStatus AUMethodSysEx(void *self, const UInt8 *inData, UInt32 inLength)
{
	OSStatus result = noErr;
	try {
		// this is a potential render-time method; no lock
		result = AUI->SysEx(inData, inLength);
	}
	COMPONENT_CATCH
	return result;
}

static OSStatus AUMethodStartNote(void *self, MusicDeviceInstrumentID inInstrument, MusicDeviceGroupID inGroupID, NoteInstanceID *outNoteInstanceID, UInt32 inOffsetSampleFrame, const MusicDeviceNoteParams *inParams)
{
	OSStatus result = noErr;
	try {
		// this is a potential render-time method; no lock
		if (inParams == NULL || outNoteInstanceID == NULL) 
			result = kAudio_ParamError;
		else
			result = AUI->StartNote(inInstrument, inGroupID, outNoteInstanceID, inOffsetSampleFrame, *inParams);
	}
	COMPONENT_CATCH
	return result;
}

static OSStatus AUMethodStopNote(void *self, MusicDeviceGroupID inGroupID, NoteInstanceID inNoteInstanceID, UInt32 inOffsetSampleFrame)
{
	OSStatus result = noErr;
	try {
		// this is a potential render-time method; no lock
		result = AUI->StopNote(inGroupID, inNoteInstanceID, inOffsetSampleFrame);
	}
	COMPONENT_CATCH
	return result;
}

#if !TARGET_OS_IPHONE
static OSStatus AUMethodPrepareInstrument (void *self, MusicDeviceInstrumentID inInstrument)
{
	OSStatus result = noErr;
	try {
		// this is a potential render-time method; no lock
		result = AUI->PrepareInstrument(inInstrument);
	}
	COMPONENT_CATCH
	return result;
}

static OSStatus AUMethodReleaseInstrument (void *self, MusicDeviceInstrumentID inInstrument)
{
	OSStatus result = noErr;
	try {
		// this is a potential render-time method; no lock
		result = AUI->ReleaseInstrument(inInstrument);
	}
	COMPONENT_CATCH
	return result;
}
#endif // TARGET_OS_IPHONE
#endif // CA_BASIC_AU_FEATURES


//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#pragma mark -
#pragma mark Lookup Methods

AudioComponentMethod AUBaseLookup::Lookup (SInt16 selector)
{
	switch (selector) {
		case kAudioUnitInitializeSelect:		return (AudioComponentMethod)AUMethodInitialize;
		case kAudioUnitUninitializeSelect:		return (AudioComponentMethod)AUMethodUninitialize;
		case kAudioUnitGetPropertyInfoSelect:	return (AudioComponentMethod)AUMethodGetPropertyInfo;
		case kAudioUnitGetPropertySelect:		return (AudioComponentMethod)AUMethodGetProperty;
		case kAudioUnitSetPropertySelect:		return (AudioComponentMethod)AUMethodSetProperty;
		case kAudioUnitAddPropertyListenerSelect:return (AudioComponentMethod)AUMethodAddPropertyListener;
		case kAudioUnitRemovePropertyListenerSelect:
												return (AudioComponentMethod)AUMethodRemovePropertyListener;
		case kAudioUnitRemovePropertyListenerWithUserDataSelect:
												return (AudioComponentMethod)AUMethodRemovePropertyListenerWithUserData;
		case kAudioUnitAddRenderNotifySelect:	return (AudioComponentMethod)AUMethodAddRenderNotify;
		case kAudioUnitRemoveRenderNotifySelect:return (AudioComponentMethod)AUMethodRemoveRenderNotify;
		case kAudioUnitGetParameterSelect:		return (AudioComponentMethod)AUMethodGetParameter;
		case kAudioUnitSetParameterSelect:		return (AudioComponentMethod)AUMethodSetParameter;
		case kAudioUnitScheduleParametersSelect:return (AudioComponentMethod)AUMethodScheduleParameters;
		case kAudioUnitRenderSelect:			return (AudioComponentMethod)AUMethodRender;
		case kAudioUnitResetSelect:				return (AudioComponentMethod)AUMethodReset;
		default:
			break;
	}
	return NULL;
}

AudioComponentMethod AUOutputLookup::Lookup (SInt16 selector)
{
	AudioComponentMethod method = AUBaseLookup::Lookup(selector);
	if (method) return method;

	switch (selector) {
		case kAudioOutputUnitStartSelect:	return (AudioComponentMethod)AUMethodStart;
		case kAudioOutputUnitStopSelect:	return (AudioComponentMethod)AUMethodStop;
		default:
			break;
	}
	return NULL;
}

AudioComponentMethod AUComplexOutputLookup::Lookup (SInt16 selector)
{
	AudioComponentMethod method = AUBaseLookup::Lookup(selector);
	if (method) return method;
	
	method = AUOutputLookup::Lookup(selector);
	if (method) return method;
	
	if (selector == kAudioUnitComplexRenderSelect)
		return (AudioComponentMethod)AUMethodComplexRender;
	return NULL;
}

AudioComponentMethod AUBaseProcessLookup::Lookup (SInt16 selector)
{
	AudioComponentMethod method = AUBaseLookup::Lookup(selector);
	if (method) return method;
	
	if (selector == kAudioUnitProcessSelect)
		return (AudioComponentMethod)AUMethodProcess;
	
	return NULL;
}

AudioComponentMethod AUBaseProcessMultipleLookup::Lookup (SInt16 selector)
{
	AudioComponentMethod method = AUBaseLookup::Lookup(selector);
	if (method) return method;
    
	if (selector == kAudioUnitProcessMultipleSelect)
		return (AudioComponentMethod)AUMethodProcessMultiple;
	
	return NULL;
}

AudioComponentMethod AUBaseProcessAndMultipleLookup::Lookup (SInt16 selector)
{
	AudioComponentMethod method = AUBaseLookup::Lookup(selector);
	if (method) return method;

	method = AUBaseProcessMultipleLookup::Lookup(selector);
	if (method) return method;
    
	method = AUBaseProcessLookup::Lookup(selector);
	if (method) return method;

	return NULL;
}

#if !CA_BASIC_AU_FEATURES
inline AudioComponentMethod MIDI_Lookup (SInt16 selector)
{
	switch (selector) {
		case kMusicDeviceMIDIEventSelect:	return (AudioComponentMethod)AUMethodMIDIEvent;
		case kMusicDeviceSysExSelect:		return (AudioComponentMethod)AUMethodSysEx;
		default:
			break;
	}
	return NULL;
}

AudioComponentMethod AUMIDILookup::Lookup (SInt16 selector)
{
	AudioComponentMethod method = AUBaseLookup::Lookup(selector);
	if (method) return method;
	
	return MIDI_Lookup(selector);
}

AudioComponentMethod AUMIDIProcessLookup::Lookup (SInt16 selector)
{
	AudioComponentMethod method = AUBaseProcessLookup::Lookup(selector);
	if (method) return method;
	
	return MIDI_Lookup(selector);
}

AudioComponentMethod AUMusicLookup::Lookup (SInt16 selector)
{
	AudioComponentMethod method = AUBaseLookup::Lookup(selector);
	if (method) return method;

	switch (selector) {
		case kMusicDeviceStartNoteSelect:	return (AudioComponentMethod)AUMethodStartNote;
		case kMusicDeviceStopNoteSelect:	return (AudioComponentMethod)AUMethodStopNote;
#if !TARGET_OS_IPHONE
		case kMusicDevicePrepareInstrumentSelect:	return (AudioComponentMethod)AUMethodPrepareInstrument;
		case kMusicDeviceReleaseInstrumentSelect:	return (AudioComponentMethod)AUMethodReleaseInstrument;
#endif
		default:		
			break;
	}
	return MIDI_Lookup (selector);
}

AudioComponentMethod AUAuxBaseLookup::Lookup (SInt16 selector)
{
	switch (selector) {
		case kAudioUnitGetPropertyInfoSelect:	return (AudioComponentMethod)AUMethodGetPropertyInfo;
		case kAudioUnitGetPropertySelect:		return (AudioComponentMethod)AUMethodGetProperty;
		case kAudioUnitSetPropertySelect:		return (AudioComponentMethod)AUMethodSetProperty;
            
		case kAudioUnitGetParameterSelect:		return (AudioComponentMethod)AUMethodGetParameter;
		case kAudioUnitSetParameterSelect:		return (AudioComponentMethod)AUMethodSetParameter;
            
		default:
			break;
	}
	return NULL;
}
#endif