alternative new version of the AppleUtility library
[ardour.git] / libs / appleutility / CoreAudio / AudioUnits / AUPublic / AUBase / AUPlugInDispatch.cpp
1 /*
2      File: AUPlugInDispatch.cpp
3  Abstract: AUPlugInDispatch.h
4   Version: 1.1
5  
6  Disclaimer: IMPORTANT:  This Apple software is supplied to you by Apple
7  Inc. ("Apple") in consideration of your agreement to the following
8  terms, and your use, installation, modification or redistribution of
9  this Apple software constitutes acceptance of these terms.  If you do
10  not agree with these terms, please do not use, install, modify or
11  redistribute this Apple software.
12  
13  In consideration of your agreement to abide by the following terms, and
14  subject to these terms, Apple grants you a personal, non-exclusive
15  license, under Apple's copyrights in this original Apple software (the
16  "Apple Software"), to use, reproduce, modify and redistribute the Apple
17  Software, with or without modifications, in source and/or binary forms;
18  provided that if you redistribute the Apple Software in its entirety and
19  without modifications, you must retain this notice and the following
20  text and disclaimers in all such redistributions of the Apple Software.
21  Neither the name, trademarks, service marks or logos of Apple Inc. may
22  be used to endorse or promote products derived from the Apple Software
23  without specific prior written permission from Apple.  Except as
24  expressly stated in this notice, no other rights or licenses, express or
25  implied, are granted by Apple herein, including but not limited to any
26  patent rights that may be infringed by your derivative works or by other
27  works in which the Apple Software may be incorporated.
28  
29  The Apple Software is provided by Apple on an "AS IS" basis.  APPLE
30  MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
31  THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS
32  FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND
33  OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
34  
35  IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL
36  OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
37  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
38  INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION,
39  MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED
40  AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),
41  STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE
42  POSSIBILITY OF SUCH DAMAGE.
43  
44  Copyright (C) 2014 Apple Inc. All Rights Reserved.
45  
46 */
47 #include "AUPlugInDispatch.h"
48 #include "CAXException.h"
49 #include "ComponentBase.h"
50 #include "AUBase.h"
51
52 #define ACPI ((AudioComponentPlugInInstance *)self)
53 #define AUI     ((AUBase *)&ACPI->mInstanceStorage)
54
55 #define AUI_LOCK CAMutex::Locker auLock(AUI->GetMutex());
56
57 // ------------------------------------------------------------------------------------------------
58 static OSStatus AUMethodInitialize(void *self)
59 {
60         OSStatus result = noErr;
61         try {
62                 AUI_LOCK
63                 result = AUI->DoInitialize();
64         }
65         COMPONENT_CATCH
66         return result;
67 }
68
69 static OSStatus AUMethodUninitialize(void *self)
70 {
71         OSStatus result = noErr;
72         try {
73                 AUI_LOCK
74                 AUI->DoCleanup();
75         }
76         COMPONENT_CATCH
77         return result;
78 }
79
80 static OSStatus AUMethodGetPropertyInfo(void *self, AudioUnitPropertyID prop, AudioUnitScope scope, AudioUnitElement elem, UInt32 *outDataSize, Boolean *outWritable)
81 {
82         OSStatus result = noErr;
83         try {
84                 UInt32 dataSize = 0;        // 13517289 GetPropetyInfo was returning an uninitialized value when there is an error. This is a problem for auval.
85                 Boolean writable = false;
86                 
87                 AUI_LOCK
88                 result = AUI->DispatchGetPropertyInfo(prop, scope, elem, dataSize, writable);
89                 if (outDataSize != NULL)
90                         *outDataSize = dataSize;
91                 if (outWritable != NULL)
92                         *outWritable = writable;
93         }
94         COMPONENT_CATCH
95         return result;
96 }
97
98 static OSStatus AUMethodGetProperty(void *self, AudioUnitPropertyID inID, AudioUnitScope inScope, AudioUnitElement inElement, void *outData, UInt32 *ioDataSize)
99 {
100         OSStatus result = noErr;
101         try {
102                 UInt32 actualPropertySize, clientBufferSize;
103                 Boolean writable;
104                 char *tempBuffer;
105                 void *destBuffer;
106                 
107                 AUI_LOCK
108                 if (ioDataSize == NULL) {
109                         ca_debug_string("AudioUnitGetProperty: null size pointer");
110                         result = kAudio_ParamError;
111                         goto finishGetProperty;
112                 }
113                 if (outData == NULL) {
114                         UInt32 dataSize;
115                         
116                         result = AUI->DispatchGetPropertyInfo(inID, inScope, inElement, dataSize, writable);
117                         *ioDataSize = dataSize;
118                         goto finishGetProperty;
119                 }
120                 
121                 clientBufferSize = *ioDataSize;
122                 if (clientBufferSize == 0)
123                 {
124                         ca_debug_string("AudioUnitGetProperty: *ioDataSize == 0 on entry");
125                         // $$$ or should we allow this as a shortcut for finding the size?
126                         result = kAudio_ParamError;
127                         goto finishGetProperty;
128                 }
129                 
130                 result = AUI->DispatchGetPropertyInfo(inID, inScope, inElement, actualPropertySize, writable);
131                 if (result != noErr) 
132                         goto finishGetProperty;
133                 
134                 if (clientBufferSize < actualPropertySize) 
135                 {
136                         tempBuffer = new char[actualPropertySize];
137                         destBuffer = tempBuffer;
138                 } else {
139                         tempBuffer = NULL;
140                         destBuffer = outData;
141                 }
142                 
143                 result = AUI->DispatchGetProperty(inID, inScope, inElement, destBuffer);
144                 
145                 if (result == noErr) {
146                         if (clientBufferSize < actualPropertySize && tempBuffer != NULL)
147                         {
148                                 memcpy(outData, tempBuffer, clientBufferSize);
149                                 delete[] tempBuffer;
150                                 // ioDataSize remains correct, the number of bytes we wrote
151                         } else
152                                 *ioDataSize = actualPropertySize;
153                 } else
154                         *ioDataSize = 0;
155         }
156         COMPONENT_CATCH
157 finishGetProperty:
158         return result;
159 }
160
161 static OSStatus AUMethodSetProperty(void *self, AudioUnitPropertyID inID, AudioUnitScope inScope, AudioUnitElement inElement, const void *inData, UInt32 inDataSize)
162 {
163         OSStatus result = noErr;
164         try {
165                 AUI_LOCK
166                 if (inData && inDataSize)
167                         result = AUI->DispatchSetProperty(inID, inScope, inElement, inData, inDataSize);
168                 else {
169                         if (inData == NULL && inDataSize == 0) {
170                                 result = AUI->DispatchRemovePropertyValue(inID, inScope, inElement);
171                         } else {
172                                 if (inData == NULL) {
173                                         ca_debug_string("AudioUnitSetProperty: inData == NULL");
174                                         result = kAudio_ParamError;
175                                         goto finishSetProperty;
176                                 }
177
178                                 if (inDataSize == 0) {
179                                         ca_debug_string("AudioUnitSetProperty: inDataSize == 0");
180                                         result = kAudio_ParamError;
181                                         goto finishSetProperty;
182                                 }
183                         }
184                 }
185         }
186         COMPONENT_CATCH
187 finishSetProperty:
188         return result;
189 }
190
191 static OSStatus AUMethodAddPropertyListener(void *self, AudioUnitPropertyID prop, AudioUnitPropertyListenerProc proc, void *userData)
192 {
193         OSStatus result = noErr;
194         try {
195                 AUI_LOCK
196                 result = AUI->AddPropertyListener(prop, proc, userData);
197         }
198         COMPONENT_CATCH
199         return result;
200 }
201
202 static OSStatus AUMethodRemovePropertyListener(void *self, AudioUnitPropertyID prop, AudioUnitPropertyListenerProc proc)
203 {
204         OSStatus result = noErr;
205         try {
206                 AUI_LOCK
207                 result = AUI->RemovePropertyListener(prop, proc, NULL, false);
208         }
209         COMPONENT_CATCH
210         return result;
211 }
212
213 static OSStatus AUMethodRemovePropertyListenerWithUserData(void *self, AudioUnitPropertyID prop, AudioUnitPropertyListenerProc proc, void *userData)
214 {
215         OSStatus result = noErr;
216         try {
217                 AUI_LOCK
218                 result = AUI->RemovePropertyListener(prop, proc, userData, true);
219         }
220         COMPONENT_CATCH
221         return result;
222 }
223
224 static OSStatus AUMethodAddRenderNotify(void *self, AURenderCallback proc, void *userData)
225 {
226         OSStatus result = noErr;
227         try {
228                 AUI_LOCK
229                 result = AUI->SetRenderNotification(proc, userData);
230         }
231         COMPONENT_CATCH
232         return result;
233 }
234
235 static OSStatus AUMethodRemoveRenderNotify(void *self, AURenderCallback proc, void *userData)
236 {
237         OSStatus result = noErr;
238         try {
239                 AUI_LOCK
240                 result = AUI->RemoveRenderNotification(proc, userData);
241         }
242         COMPONENT_CATCH
243         return result;
244 }
245
246 static OSStatus AUMethodGetParameter(void *self, AudioUnitParameterID param, AudioUnitScope scope, AudioUnitElement elem, AudioUnitParameterValue *value)
247 {
248         OSStatus result = noErr;
249         try {
250                 AUI_LOCK
251                 result = (value == NULL ? kAudio_ParamError : AUI->GetParameter(param, scope, elem, *value));
252         }
253         COMPONENT_CATCH
254         return result;
255 }
256
257 static OSStatus AUMethodSetParameter(void *self, AudioUnitParameterID param, AudioUnitScope scope, AudioUnitElement elem, AudioUnitParameterValue value, UInt32 bufferOffset)
258 {
259         OSStatus result = noErr;
260         try {
261                 // this is a (potentially) realtime method; no lock
262                 result = AUI->SetParameter(param, scope, elem, value, bufferOffset);
263         }
264         COMPONENT_CATCH
265         return result;
266 }
267
268 static OSStatus AUMethodScheduleParameters(void *self, const AudioUnitParameterEvent *events, UInt32 numEvents)
269 {
270         OSStatus result = noErr;
271         try {
272                 // this is a (potentially) realtime method; no lock
273                 result = AUI->ScheduleParameter(events, numEvents);
274         }
275         COMPONENT_CATCH
276         return result;
277 }
278
279 static OSStatus AUMethodRender(void *self, AudioUnitRenderActionFlags *ioActionFlags, const AudioTimeStamp *inTimeStamp, UInt32 inOutputBusNumber, UInt32 inNumberFrames, AudioBufferList *ioData)
280 {
281         OSStatus result = noErr;
282
283 #if !TARGET_OS_IPHONE
284         try {
285 #endif
286                 // this is a processing method; no lock
287                 AudioUnitRenderActionFlags tempFlags;
288                 
289                 if (inTimeStamp == NULL || ioData == NULL)
290                         result = kAudio_ParamError;
291                 else {
292                         if (ioActionFlags == NULL) {
293                                 tempFlags = 0;
294                                 ioActionFlags = &tempFlags;
295                         }
296                         result = AUI->DoRender(*ioActionFlags, *inTimeStamp, inOutputBusNumber, inNumberFrames, *ioData);
297                 }
298
299 #if !TARGET_OS_IPHONE
300         }
301         COMPONENT_CATCH
302 #endif
303
304         return result;
305 }
306
307 static OSStatus AUMethodComplexRender(void *self, AudioUnitRenderActionFlags *ioActionFlags, const AudioTimeStamp *inTimeStamp, UInt32 inOutputBusNumber, UInt32 inNumberOfPackets, UInt32 *outNumberOfPackets, AudioStreamPacketDescription *outPacketDescriptions, AudioBufferList *ioData, void *outMetadata, UInt32 *outMetadataByteSize)
308 {
309         OSStatus result = noErr;
310
311 #if !TARGET_OS_IPHONE
312         try {
313 #endif
314                 // this is a processing method; no lock
315                 AudioUnitRenderActionFlags tempFlags;
316                 
317                 if (inTimeStamp == NULL || ioData == NULL)
318                         result = kAudio_ParamError;
319                 else {
320                         if (ioActionFlags == NULL) {
321                                 tempFlags = 0;
322                                 ioActionFlags = &tempFlags;
323                         }
324                         result = AUI->ComplexRender(*ioActionFlags, *inTimeStamp, inOutputBusNumber, inNumberOfPackets, outNumberOfPackets, outPacketDescriptions, *ioData, outMetadata, outMetadataByteSize);
325                 }
326
327 #if !TARGET_OS_IPHONE
328         }
329         COMPONENT_CATCH
330 #endif
331
332         return result;
333 }
334
335 static OSStatus AUMethodReset(void *self, AudioUnitScope scope, AudioUnitElement elem)
336 {
337         OSStatus result = noErr;
338         try {
339                 AUI_LOCK
340                 result = AUI->Reset(scope, elem);
341         }
342         COMPONENT_CATCH
343         return result;
344 }
345
346 static OSStatus AUMethodProcess (void *self, AudioUnitRenderActionFlags *ioActionFlags, const AudioTimeStamp *inTimeStamp, UInt32 inNumberFrames, AudioBufferList *ioData)
347 {
348         OSStatus result = noErr;
349
350 #if !TARGET_OS_IPHONE
351         try {
352 #endif
353                 // this is a processing method; no lock
354                 bool doParamCheck = true;
355
356                 AudioUnitRenderActionFlags tempFlags;
357
358                 if (ioActionFlags == NULL) {
359                         tempFlags = 0;
360                         ioActionFlags = &tempFlags;
361                 } else {
362                         if (*ioActionFlags & (1 << 9)/*kAudioUnitRenderAction_DoNotCheckRenderArgs*/)
363                                 doParamCheck = false;
364                 }
365                 
366                 if (doParamCheck && (inTimeStamp == NULL || ioData == NULL))
367                         result = kAudio_ParamError;
368                 else {
369                         result = AUI->DoProcess(*ioActionFlags, *inTimeStamp, inNumberFrames, *ioData);
370                 }
371
372 #if !TARGET_OS_IPHONE
373         }
374         COMPONENT_CATCH
375 #endif
376
377         return result;
378 }
379
380 static OSStatus AUMethodProcessMultiple (void *self, AudioUnitRenderActionFlags *ioActionFlags, const AudioTimeStamp *inTimeStamp, UInt32 inNumberFrames, UInt32 inNumberInputBufferLists, const AudioBufferList **inInputBufferLists, UInt32 inNumberOutputBufferLists, AudioBufferList **ioOutputBufferLists)
381 {
382         OSStatus result = noErr;
383         
384 #if !TARGET_OS_IPHONE
385         try {
386 #endif
387                 // this is a processing method; no lock
388                 bool doParamCheck = true;
389                 
390                 AudioUnitRenderActionFlags tempFlags;
391                 
392                 if (ioActionFlags == NULL) {
393                         tempFlags = 0;
394                         ioActionFlags = &tempFlags;
395                 } else {
396                         if (*ioActionFlags & (1 << 9)/*kAudioUnitRenderAction_DoNotCheckRenderArgs*/)
397                                 doParamCheck = false;
398                 }
399
400                 if (doParamCheck && (inTimeStamp == NULL || inInputBufferLists == NULL || ioOutputBufferLists == NULL))
401                         result = kAudio_ParamError;
402                 else {
403                         result = AUI->DoProcessMultiple(*ioActionFlags, *inTimeStamp, inNumberFrames, inNumberInputBufferLists, inInputBufferLists, inNumberOutputBufferLists, ioOutputBufferLists);
404                 }
405                 
406 #if !TARGET_OS_IPHONE
407         }
408         COMPONENT_CATCH
409 #endif
410
411         return result;
412 }
413 // ------------------------------------------------------------------------------------------------
414
415 static OSStatus AUMethodStart(void *self)
416 {
417         OSStatus result = noErr;
418         try {
419                 AUI_LOCK
420                 result = AUI->Start();
421         }
422         COMPONENT_CATCH
423         return result;
424 }
425
426 static OSStatus AUMethodStop(void *self)
427 {
428         OSStatus result = noErr;
429         try {
430                 AUI_LOCK
431                 result = AUI->Stop();
432         }
433         COMPONENT_CATCH
434         return result;
435 }
436
437 // ------------------------------------------------------------------------------------------------
438
439 #if !CA_BASIC_AU_FEATURES
440 // I don't know what I'm doing here; conflicts with the multiple inheritence in MusicDeviceBase.
441 static OSStatus AUMethodMIDIEvent(void *self, UInt32 inStatus, UInt32 inData1, UInt32 inData2, UInt32 inOffsetSampleFrame)
442 {
443         OSStatus result = noErr;
444         try {
445                 // this is a potential render-time method; no lock
446                 result = AUI->MIDIEvent(inStatus, inData1, inData2, inOffsetSampleFrame);
447         }
448         COMPONENT_CATCH
449         return result;
450 }
451
452 static OSStatus AUMethodSysEx(void *self, const UInt8 *inData, UInt32 inLength)
453 {
454         OSStatus result = noErr;
455         try {
456                 // this is a potential render-time method; no lock
457                 result = AUI->SysEx(inData, inLength);
458         }
459         COMPONENT_CATCH
460         return result;
461 }
462
463 static OSStatus AUMethodStartNote(void *self, MusicDeviceInstrumentID inInstrument, MusicDeviceGroupID inGroupID, NoteInstanceID *outNoteInstanceID, UInt32 inOffsetSampleFrame, const MusicDeviceNoteParams *inParams)
464 {
465         OSStatus result = noErr;
466         try {
467                 // this is a potential render-time method; no lock
468                 if (inParams == NULL || outNoteInstanceID == NULL) 
469                         result = kAudio_ParamError;
470                 else
471                         result = AUI->StartNote(inInstrument, inGroupID, outNoteInstanceID, inOffsetSampleFrame, *inParams);
472         }
473         COMPONENT_CATCH
474         return result;
475 }
476
477 static OSStatus AUMethodStopNote(void *self, MusicDeviceGroupID inGroupID, NoteInstanceID inNoteInstanceID, UInt32 inOffsetSampleFrame)
478 {
479         OSStatus result = noErr;
480         try {
481                 // this is a potential render-time method; no lock
482                 result = AUI->StopNote(inGroupID, inNoteInstanceID, inOffsetSampleFrame);
483         }
484         COMPONENT_CATCH
485         return result;
486 }
487
488 #if !TARGET_OS_IPHONE
489 static OSStatus AUMethodPrepareInstrument (void *self, MusicDeviceInstrumentID inInstrument)
490 {
491         OSStatus result = noErr;
492         try {
493                 // this is a potential render-time method; no lock
494                 result = AUI->PrepareInstrument(inInstrument);
495         }
496         COMPONENT_CATCH
497         return result;
498 }
499
500 static OSStatus AUMethodReleaseInstrument (void *self, MusicDeviceInstrumentID inInstrument)
501 {
502         OSStatus result = noErr;
503         try {
504                 // this is a potential render-time method; no lock
505                 result = AUI->ReleaseInstrument(inInstrument);
506         }
507         COMPONENT_CATCH
508         return result;
509 }
510 #endif // TARGET_OS_IPHONE
511 #endif // CA_BASIC_AU_FEATURES
512
513
514 //- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
515 #pragma mark -
516 #pragma mark Lookup Methods
517
518 AudioComponentMethod AUBaseLookup::Lookup (SInt16 selector)
519 {
520         switch (selector) {
521                 case kAudioUnitInitializeSelect:                return (AudioComponentMethod)AUMethodInitialize;
522                 case kAudioUnitUninitializeSelect:              return (AudioComponentMethod)AUMethodUninitialize;
523                 case kAudioUnitGetPropertyInfoSelect:   return (AudioComponentMethod)AUMethodGetPropertyInfo;
524                 case kAudioUnitGetPropertySelect:               return (AudioComponentMethod)AUMethodGetProperty;
525                 case kAudioUnitSetPropertySelect:               return (AudioComponentMethod)AUMethodSetProperty;
526                 case kAudioUnitAddPropertyListenerSelect:return (AudioComponentMethod)AUMethodAddPropertyListener;
527                 case kAudioUnitRemovePropertyListenerSelect:
528                                                                                                 return (AudioComponentMethod)AUMethodRemovePropertyListener;
529                 case kAudioUnitRemovePropertyListenerWithUserDataSelect:
530                                                                                                 return (AudioComponentMethod)AUMethodRemovePropertyListenerWithUserData;
531                 case kAudioUnitAddRenderNotifySelect:   return (AudioComponentMethod)AUMethodAddRenderNotify;
532                 case kAudioUnitRemoveRenderNotifySelect:return (AudioComponentMethod)AUMethodRemoveRenderNotify;
533                 case kAudioUnitGetParameterSelect:              return (AudioComponentMethod)AUMethodGetParameter;
534                 case kAudioUnitSetParameterSelect:              return (AudioComponentMethod)AUMethodSetParameter;
535                 case kAudioUnitScheduleParametersSelect:return (AudioComponentMethod)AUMethodScheduleParameters;
536                 case kAudioUnitRenderSelect:                    return (AudioComponentMethod)AUMethodRender;
537                 case kAudioUnitResetSelect:                             return (AudioComponentMethod)AUMethodReset;
538                 default:
539                         break;
540         }
541         return NULL;
542 }
543
544 AudioComponentMethod AUOutputLookup::Lookup (SInt16 selector)
545 {
546         AudioComponentMethod method = AUBaseLookup::Lookup(selector);
547         if (method) return method;
548
549         switch (selector) {
550                 case kAudioOutputUnitStartSelect:       return (AudioComponentMethod)AUMethodStart;
551                 case kAudioOutputUnitStopSelect:        return (AudioComponentMethod)AUMethodStop;
552                 default:
553                         break;
554         }
555         return NULL;
556 }
557
558 AudioComponentMethod AUComplexOutputLookup::Lookup (SInt16 selector)
559 {
560         AudioComponentMethod method = AUBaseLookup::Lookup(selector);
561         if (method) return method;
562         
563         method = AUOutputLookup::Lookup(selector);
564         if (method) return method;
565         
566         if (selector == kAudioUnitComplexRenderSelect)
567                 return (AudioComponentMethod)AUMethodComplexRender;
568         return NULL;
569 }
570
571 AudioComponentMethod AUBaseProcessLookup::Lookup (SInt16 selector)
572 {
573         AudioComponentMethod method = AUBaseLookup::Lookup(selector);
574         if (method) return method;
575         
576         if (selector == kAudioUnitProcessSelect)
577                 return (AudioComponentMethod)AUMethodProcess;
578         
579         return NULL;
580 }
581
582 AudioComponentMethod AUBaseProcessMultipleLookup::Lookup (SInt16 selector)
583 {
584         AudioComponentMethod method = AUBaseLookup::Lookup(selector);
585         if (method) return method;
586     
587         if (selector == kAudioUnitProcessMultipleSelect)
588                 return (AudioComponentMethod)AUMethodProcessMultiple;
589         
590         return NULL;
591 }
592
593 AudioComponentMethod AUBaseProcessAndMultipleLookup::Lookup (SInt16 selector)
594 {
595         AudioComponentMethod method = AUBaseLookup::Lookup(selector);
596         if (method) return method;
597
598         method = AUBaseProcessMultipleLookup::Lookup(selector);
599         if (method) return method;
600     
601         method = AUBaseProcessLookup::Lookup(selector);
602         if (method) return method;
603
604         return NULL;
605 }
606
607 #if !CA_BASIC_AU_FEATURES
608 inline AudioComponentMethod MIDI_Lookup (SInt16 selector)
609 {
610         switch (selector) {
611                 case kMusicDeviceMIDIEventSelect:       return (AudioComponentMethod)AUMethodMIDIEvent;
612                 case kMusicDeviceSysExSelect:           return (AudioComponentMethod)AUMethodSysEx;
613                 default:
614                         break;
615         }
616         return NULL;
617 }
618
619 AudioComponentMethod AUMIDILookup::Lookup (SInt16 selector)
620 {
621         AudioComponentMethod method = AUBaseLookup::Lookup(selector);
622         if (method) return method;
623         
624         return MIDI_Lookup(selector);
625 }
626
627 AudioComponentMethod AUMIDIProcessLookup::Lookup (SInt16 selector)
628 {
629         AudioComponentMethod method = AUBaseProcessLookup::Lookup(selector);
630         if (method) return method;
631         
632         return MIDI_Lookup(selector);
633 }
634
635 AudioComponentMethod AUMusicLookup::Lookup (SInt16 selector)
636 {
637         AudioComponentMethod method = AUBaseLookup::Lookup(selector);
638         if (method) return method;
639
640         switch (selector) {
641                 case kMusicDeviceStartNoteSelect:       return (AudioComponentMethod)AUMethodStartNote;
642                 case kMusicDeviceStopNoteSelect:        return (AudioComponentMethod)AUMethodStopNote;
643 #if !TARGET_OS_IPHONE
644                 case kMusicDevicePrepareInstrumentSelect:       return (AudioComponentMethod)AUMethodPrepareInstrument;
645                 case kMusicDeviceReleaseInstrumentSelect:       return (AudioComponentMethod)AUMethodReleaseInstrument;
646 #endif
647                 default:                
648                         break;
649         }
650         return MIDI_Lookup (selector);
651 }
652
653 AudioComponentMethod AUAuxBaseLookup::Lookup (SInt16 selector)
654 {
655         switch (selector) {
656                 case kAudioUnitGetPropertyInfoSelect:   return (AudioComponentMethod)AUMethodGetPropertyInfo;
657                 case kAudioUnitGetPropertySelect:               return (AudioComponentMethod)AUMethodGetProperty;
658                 case kAudioUnitSetPropertySelect:               return (AudioComponentMethod)AUMethodSetProperty;
659             
660                 case kAudioUnitGetParameterSelect:              return (AudioComponentMethod)AUMethodGetParameter;
661                 case kAudioUnitSetParameterSelect:              return (AudioComponentMethod)AUMethodSetParameter;
662             
663                 default:
664                         break;
665         }
666         return NULL;
667 }
668 #endif
669