1 /*
2 File: AUPlugInDispatch.cpp
3 Abstract: AUPlugInDispatch.h
4 Version: 1.01
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) 2012 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 // ------------------------------------------------------------------------------------------------
AUMethodInitialize(void * self)56 static OSStatus AUMethodInitialize(void *self)
57 {
58 OSStatus result = noErr;
59 try {
60 result = AUI->DoInitialize();
61 }
62 COMPONENT_CATCH
63 return result;
64 }
65
AUMethodUninitialize(void * self)66 static OSStatus AUMethodUninitialize(void *self)
67 {
68 OSStatus result = noErr;
69 try {
70 AUI->DoCleanup();
71 }
72 COMPONENT_CATCH
73 return result;
74 }
75
AUMethodGetPropertyInfo(void * self,AudioUnitPropertyID prop,AudioUnitScope scope,AudioUnitElement elem,UInt32 * outDataSize,Boolean * outWritable)76 static OSStatus AUMethodGetPropertyInfo(void *self, AudioUnitPropertyID prop, AudioUnitScope scope, AudioUnitElement elem, UInt32 *outDataSize, Boolean *outWritable)
77 {
78 OSStatus result = noErr;
79 try {
80 UInt32 dataSize;
81 Boolean writable;
82
83 result = AUI->DispatchGetPropertyInfo(prop, scope, elem, dataSize, writable);
84 if (outDataSize != NULL)
85 *outDataSize = dataSize;
86 if (outWritable != NULL)
87 *outWritable = writable;
88 }
89 COMPONENT_CATCH
90 return result;
91 }
92
AUMethodGetProperty(void * self,AudioUnitPropertyID inID,AudioUnitScope inScope,AudioUnitElement inElement,void * outData,UInt32 * ioDataSize)93 static OSStatus AUMethodGetProperty(void *self, AudioUnitPropertyID inID, AudioUnitScope inScope, AudioUnitElement inElement, void *outData, UInt32 *ioDataSize)
94 {
95 OSStatus result = noErr;
96 try {
97 UInt32 actualPropertySize, clientBufferSize;
98 Boolean writable;
99 char *tempBuffer;
100 void *destBuffer;
101
102 if (ioDataSize == NULL) {
103 ca_debug_string("AudioUnitGetProperty: null size pointer");
104 result = kAudio_ParamError;
105 goto finishGetProperty;
106 }
107 if (outData == NULL) {
108 UInt32 dataSize;
109
110 result = AUI->DispatchGetPropertyInfo(inID, inScope, inElement, dataSize, writable);
111 *ioDataSize = dataSize;
112 goto finishGetProperty;
113 }
114
115 clientBufferSize = *ioDataSize;
116 if (clientBufferSize == 0)
117 {
118 ca_debug_string("AudioUnitGetProperty: *ioDataSize == 0 on entry");
119 // $$$ or should we allow this as a shortcut for finding the size?
120 result = kAudio_ParamError;
121 goto finishGetProperty;
122 }
123
124 result = AUI->DispatchGetPropertyInfo(inID, inScope, inElement, actualPropertySize, writable);
125 if (result != noErr)
126 goto finishGetProperty;
127
128 if (clientBufferSize < actualPropertySize)
129 {
130 tempBuffer = new char[actualPropertySize];
131 destBuffer = tempBuffer;
132 } else {
133 tempBuffer = NULL;
134 destBuffer = outData;
135 }
136
137 result = AUI->DispatchGetProperty(inID, inScope, inElement, destBuffer);
138
139 if (result == noErr) {
140 if (tempBuffer && clientBufferSize < actualPropertySize)
141 {
142 memcpy(outData, tempBuffer, clientBufferSize);
143 delete[] tempBuffer;
144 // ioDataSize remains correct, the number of bytes we wrote
145 } else
146 *ioDataSize = actualPropertySize;
147 } else
148 *ioDataSize = 0;
149 }
150 COMPONENT_CATCH
151 finishGetProperty:
152 return result;
153 }
154
AUMethodSetProperty(void * self,AudioUnitPropertyID inID,AudioUnitScope inScope,AudioUnitElement inElement,const void * inData,UInt32 inDataSize)155 static OSStatus AUMethodSetProperty(void *self, AudioUnitPropertyID inID, AudioUnitScope inScope, AudioUnitElement inElement, const void *inData, UInt32 inDataSize)
156 {
157 OSStatus result = noErr;
158 try {
159 if (inData && inDataSize)
160 result = AUI->DispatchSetProperty(inID, inScope, inElement, inData, inDataSize);
161 else {
162 if (inData == NULL && inDataSize == 0) {
163 result = AUI->DispatchRemovePropertyValue(inID, inScope, inElement);
164 } else {
165 if (inData == NULL) {
166 ca_debug_string("AudioUnitSetProperty: inData == NULL");
167 result = kAudio_ParamError;
168 goto finishSetProperty;
169 }
170
171 if (inDataSize == 0) {
172 ca_debug_string("AudioUnitSetProperty: inDataSize == 0");
173 result = kAudio_ParamError;
174 goto finishSetProperty;
175 }
176 }
177 }
178 }
179 COMPONENT_CATCH
180 finishSetProperty:
181 return result;
182 }
183
AUMethodAddPropertyListener(void * self,AudioUnitPropertyID prop,AudioUnitPropertyListenerProc proc,void * userData)184 static OSStatus AUMethodAddPropertyListener(void *self, AudioUnitPropertyID prop, AudioUnitPropertyListenerProc proc, void *userData)
185 {
186 OSStatus result = noErr;
187 try {
188 result = AUI->AddPropertyListener(prop, proc, userData);
189 }
190 COMPONENT_CATCH
191 return result;
192 }
193
AUMethodRemovePropertyListener(void * self,AudioUnitPropertyID prop,AudioUnitPropertyListenerProc proc)194 static OSStatus AUMethodRemovePropertyListener(void *self, AudioUnitPropertyID prop, AudioUnitPropertyListenerProc proc)
195 {
196 OSStatus result = noErr;
197 try {
198 result = AUI->RemovePropertyListener(prop, proc, NULL, false);
199 }
200 COMPONENT_CATCH
201 return result;
202 }
203
AUMethodRemovePropertyListenerWithUserData(void * self,AudioUnitPropertyID prop,AudioUnitPropertyListenerProc proc,void * userData)204 static OSStatus AUMethodRemovePropertyListenerWithUserData(void *self, AudioUnitPropertyID prop, AudioUnitPropertyListenerProc proc, void *userData)
205 {
206 OSStatus result = noErr;
207 try {
208 result = AUI->RemovePropertyListener(prop, proc, userData, true);
209 }
210 COMPONENT_CATCH
211 return result;
212 }
213
AUMethodAddRenderNotify(void * self,AURenderCallback proc,void * userData)214 static OSStatus AUMethodAddRenderNotify(void *self, AURenderCallback proc, void *userData)
215 {
216 OSStatus result = noErr;
217 try {
218 result = AUI->SetRenderNotification(proc, userData);
219 }
220 COMPONENT_CATCH
221 return result;
222 }
223
AUMethodRemoveRenderNotify(void * self,AURenderCallback proc,void * userData)224 static OSStatus AUMethodRemoveRenderNotify(void *self, AURenderCallback proc, void *userData)
225 {
226 OSStatus result = noErr;
227 try {
228 result = AUI->RemoveRenderNotification(proc, userData);
229 }
230 COMPONENT_CATCH
231 return result;
232 }
233
AUMethodGetParameter(void * self,AudioUnitParameterID param,AudioUnitScope scope,AudioUnitElement elem,AudioUnitParameterValue * value)234 static OSStatus AUMethodGetParameter(void *self, AudioUnitParameterID param, AudioUnitScope scope, AudioUnitElement elem, AudioUnitParameterValue *value)
235 {
236 OSStatus result = noErr;
237 try {
238 result = (value == NULL ? kAudio_ParamError : AUI->GetParameter(param, scope, elem, *value));
239 }
240 COMPONENT_CATCH
241 return result;
242 }
243
AUMethodSetParameter(void * self,AudioUnitParameterID param,AudioUnitScope scope,AudioUnitElement elem,AudioUnitParameterValue value,UInt32 bufferOffset)244 static OSStatus AUMethodSetParameter(void *self, AudioUnitParameterID param, AudioUnitScope scope, AudioUnitElement elem, AudioUnitParameterValue value, UInt32 bufferOffset)
245 {
246 OSStatus result = noErr;
247 try {
248 result = AUI->SetParameter(param, scope, elem, value, bufferOffset);
249 }
250 COMPONENT_CATCH
251 return result;
252 }
253
AUMethodScheduleParameters(void * self,const AudioUnitParameterEvent * events,UInt32 numEvents)254 static OSStatus AUMethodScheduleParameters(void *self, const AudioUnitParameterEvent *events, UInt32 numEvents)
255 {
256 OSStatus result = noErr;
257 try {
258 result = AUI->ScheduleParameter(events, numEvents);
259 }
260 COMPONENT_CATCH
261 return result;
262 }
263
AUMethodRender(void * self,AudioUnitRenderActionFlags * ioActionFlags,const AudioTimeStamp * inTimeStamp,UInt32 inOutputBusNumber,UInt32 inNumberFrames,AudioBufferList * ioData)264 static OSStatus AUMethodRender(void *self, AudioUnitRenderActionFlags *ioActionFlags, const AudioTimeStamp *inTimeStamp, UInt32 inOutputBusNumber, UInt32 inNumberFrames, AudioBufferList *ioData)
265 {
266 OSStatus result = noErr;
267
268 #if !TARGET_OS_IPHONE
269 try {
270 #endif
271 AudioUnitRenderActionFlags tempFlags;
272
273 if (inTimeStamp == NULL || ioData == NULL)
274 result = kAudio_ParamError;
275 else {
276 if (ioActionFlags == NULL) {
277 tempFlags = 0;
278 ioActionFlags = &tempFlags;
279 }
280 result = AUI->DoRender(*ioActionFlags, *inTimeStamp, inOutputBusNumber, inNumberFrames, *ioData);
281 }
282
283 #if !TARGET_OS_IPHONE
284 }
285 COMPONENT_CATCH
286 #endif
287
288 return result;
289 }
290
AUMethodComplexRender(void * self,AudioUnitRenderActionFlags * ioActionFlags,const AudioTimeStamp * inTimeStamp,UInt32 inOutputBusNumber,UInt32 inNumberOfPackets,UInt32 * outNumberOfPackets,AudioStreamPacketDescription * outPacketDescriptions,AudioBufferList * ioData,void * outMetadata,UInt32 * outMetadataByteSize)291 static OSStatus AUMethodComplexRender(void *self, AudioUnitRenderActionFlags *ioActionFlags, const AudioTimeStamp *inTimeStamp, UInt32 inOutputBusNumber, UInt32 inNumberOfPackets, UInt32 *outNumberOfPackets, AudioStreamPacketDescription *outPacketDescriptions, AudioBufferList *ioData, void *outMetadata, UInt32 *outMetadataByteSize)
292 {
293 OSStatus result = noErr;
294
295 #if !TARGET_OS_IPHONE
296 try {
297 #endif
298 AudioUnitRenderActionFlags tempFlags;
299
300 if (inTimeStamp == NULL || ioData == NULL)
301 result = kAudio_ParamError;
302 else {
303 if (ioActionFlags == NULL) {
304 tempFlags = 0;
305 ioActionFlags = &tempFlags;
306 }
307 result = AUI->ComplexRender(*ioActionFlags, *inTimeStamp, inOutputBusNumber, inNumberOfPackets, outNumberOfPackets, outPacketDescriptions, *ioData, outMetadata, outMetadataByteSize);
308 }
309
310 #if !TARGET_OS_IPHONE
311 }
312 COMPONENT_CATCH
313 #endif
314
315 return result;
316 }
317
AUMethodReset(void * self,AudioUnitScope scope,AudioUnitElement elem)318 static OSStatus AUMethodReset(void *self, AudioUnitScope scope, AudioUnitElement elem)
319 {
320 OSStatus result = noErr;
321 try {
322 result = AUI->Reset(scope, elem);
323 }
324 COMPONENT_CATCH
325 return result;
326 }
327
AUMethodProcess(void * self,AudioUnitRenderActionFlags * ioActionFlags,const AudioTimeStamp * inTimeStamp,UInt32 inNumberFrames,AudioBufferList * ioData)328 static OSStatus AUMethodProcess (void *self, AudioUnitRenderActionFlags *ioActionFlags, const AudioTimeStamp *inTimeStamp, UInt32 inNumberFrames, AudioBufferList *ioData)
329 {
330 OSStatus result = noErr;
331
332 #if !TARGET_OS_IPHONE
333 try {
334 #endif
335 bool doParamCheck = true;
336
337 AudioUnitRenderActionFlags tempFlags;
338
339 if (ioActionFlags == NULL) {
340 tempFlags = 0;
341 ioActionFlags = &tempFlags;
342 } else {
343 if (*ioActionFlags & (1 << 9)/*kAudioUnitRenderAction_DoNotCheckRenderArgs*/)
344 doParamCheck = false;
345 }
346
347 if (doParamCheck && (inTimeStamp == NULL || ioData == NULL))
348 result = kAudio_ParamError;
349 else {
350 result = AUI->DoProcess(*ioActionFlags, *inTimeStamp, inNumberFrames, *ioData);
351 }
352
353 #if !TARGET_OS_IPHONE
354 }
355 COMPONENT_CATCH
356 #endif
357
358 return result;
359 }
360
AUMethodProcessMultiple(void * self,AudioUnitRenderActionFlags * ioActionFlags,const AudioTimeStamp * inTimeStamp,UInt32 inNumberFrames,UInt32 inNumberInputBufferLists,const AudioBufferList ** inInputBufferLists,UInt32 inNumberOutputBufferLists,AudioBufferList ** ioOutputBufferLists)361 static OSStatus AUMethodProcessMultiple (void *self, AudioUnitRenderActionFlags *ioActionFlags, const AudioTimeStamp *inTimeStamp, UInt32 inNumberFrames, UInt32 inNumberInputBufferLists, const AudioBufferList **inInputBufferLists, UInt32 inNumberOutputBufferLists, AudioBufferList **ioOutputBufferLists)
362 {
363 OSStatus result = noErr;
364
365 #if !TARGET_OS_IPHONE
366 try {
367 #endif
368 bool doParamCheck = true;
369
370 AudioUnitRenderActionFlags tempFlags;
371
372 if (ioActionFlags == NULL) {
373 tempFlags = 0;
374 ioActionFlags = &tempFlags;
375 } else {
376 if (*ioActionFlags & (1 << 9)/*kAudioUnitRenderAction_DoNotCheckRenderArgs*/)
377 doParamCheck = false;
378 }
379
380 if (doParamCheck && (inTimeStamp == NULL || inInputBufferLists == NULL || ioOutputBufferLists == NULL))
381 result = kAudio_ParamError;
382 else {
383 result = AUI->DoProcessMultiple(*ioActionFlags, *inTimeStamp, inNumberFrames, inNumberInputBufferLists, inInputBufferLists, inNumberOutputBufferLists, ioOutputBufferLists);
384 }
385
386 #if !TARGET_OS_IPHONE
387 }
388 COMPONENT_CATCH
389 #endif
390
391 return result;
392 }
393 // ------------------------------------------------------------------------------------------------
394
AUMethodStart(void * self)395 static OSStatus AUMethodStart(void *self)
396 {
397 OSStatus result = noErr;
398 try {
399 result = AUI->Start();
400 }
401 COMPONENT_CATCH
402 return result;
403 }
404
AUMethodStop(void * self)405 static OSStatus AUMethodStop(void *self)
406 {
407 OSStatus result = noErr;
408 try {
409 result = AUI->Stop();
410 }
411 COMPONENT_CATCH
412 return result;
413 }
414
415 // ------------------------------------------------------------------------------------------------
416
417 #if !CA_BASIC_AU_FEATURES
418 // I don't know what I'm doing here; conflicts with the multiple inheritence in MusicDeviceBase.
AUMethodMIDIEvent(void * self,UInt32 inStatus,UInt32 inData1,UInt32 inData2,UInt32 inOffsetSampleFrame)419 static OSStatus AUMethodMIDIEvent(void *self, UInt32 inStatus, UInt32 inData1, UInt32 inData2, UInt32 inOffsetSampleFrame)
420 {
421 OSStatus result = noErr;
422 try {
423 result = AUI->MIDIEvent(inStatus, inData1, inData2, inOffsetSampleFrame);
424 }
425 COMPONENT_CATCH
426 return result;
427 }
428
AUMethodSysEx(void * self,const UInt8 * inData,UInt32 inLength)429 static OSStatus AUMethodSysEx(void *self, const UInt8 *inData, UInt32 inLength)
430 {
431 OSStatus result = noErr;
432 try {
433 result = AUI->SysEx(inData, inLength);
434 }
435 COMPONENT_CATCH
436 return result;
437 }
438
AUMethodStartNote(void * self,MusicDeviceInstrumentID inInstrument,MusicDeviceGroupID inGroupID,NoteInstanceID * outNoteInstanceID,UInt32 inOffsetSampleFrame,const MusicDeviceNoteParams * inParams)439 static OSStatus AUMethodStartNote(void *self, MusicDeviceInstrumentID inInstrument, MusicDeviceGroupID inGroupID, NoteInstanceID *outNoteInstanceID, UInt32 inOffsetSampleFrame, const MusicDeviceNoteParams *inParams)
440 {
441 OSStatus result = noErr;
442 try {
443 if (inParams == NULL || outNoteInstanceID == NULL)
444 result = kAudio_ParamError;
445 else
446 result = AUI->StartNote(inInstrument, inGroupID, outNoteInstanceID, inOffsetSampleFrame, *inParams);
447 }
448 COMPONENT_CATCH
449 return result;
450 }
451
AUMethodStopNote(void * self,MusicDeviceGroupID inGroupID,NoteInstanceID inNoteInstanceID,UInt32 inOffsetSampleFrame)452 static OSStatus AUMethodStopNote(void *self, MusicDeviceGroupID inGroupID, NoteInstanceID inNoteInstanceID, UInt32 inOffsetSampleFrame)
453 {
454 OSStatus result = noErr;
455 try {
456 result = AUI->StopNote(inGroupID, inNoteInstanceID, inOffsetSampleFrame);
457 }
458 COMPONENT_CATCH
459 return result;
460 }
461
462 #if !TARGET_OS_IPHONE
AUMethodPrepareInstrument(void * self,MusicDeviceInstrumentID inInstrument)463 static OSStatus AUMethodPrepareInstrument (void *self, MusicDeviceInstrumentID inInstrument)
464 {
465 OSStatus result = noErr;
466 try {
467 result = AUI->PrepareInstrument(inInstrument);
468 }
469 COMPONENT_CATCH
470 return result;
471 }
472
AUMethodReleaseInstrument(void * self,MusicDeviceInstrumentID inInstrument)473 static OSStatus AUMethodReleaseInstrument (void *self, MusicDeviceInstrumentID inInstrument)
474 {
475 OSStatus result = noErr;
476 try {
477 result = AUI->ReleaseInstrument(inInstrument);
478 }
479 COMPONENT_CATCH
480 return result;
481 }
482 #endif // TARGET_OS_IPHONE
483 #endif // CA_BASIC_AU_FEATURES
484
485
486 //- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
487 #pragma mark -
488 #pragma mark Lookup Methods
489
Lookup(SInt16 selector)490 AudioComponentMethod AUBaseLookup::Lookup (SInt16 selector)
491 {
492 switch (selector) {
493 case kAudioUnitInitializeSelect: return (AudioComponentMethod)AUMethodInitialize;
494 case kAudioUnitUninitializeSelect: return (AudioComponentMethod)AUMethodUninitialize;
495 case kAudioUnitGetPropertyInfoSelect: return (AudioComponentMethod)AUMethodGetPropertyInfo;
496 case kAudioUnitGetPropertySelect: return (AudioComponentMethod)AUMethodGetProperty;
497 case kAudioUnitSetPropertySelect: return (AudioComponentMethod)AUMethodSetProperty;
498 case kAudioUnitAddPropertyListenerSelect:return (AudioComponentMethod)AUMethodAddPropertyListener;
499 case kAudioUnitRemovePropertyListenerSelect:
500 return (AudioComponentMethod)AUMethodRemovePropertyListener;
501 case kAudioUnitRemovePropertyListenerWithUserDataSelect:
502 return (AudioComponentMethod)AUMethodRemovePropertyListenerWithUserData;
503 case kAudioUnitAddRenderNotifySelect: return (AudioComponentMethod)AUMethodAddRenderNotify;
504 case kAudioUnitRemoveRenderNotifySelect:return (AudioComponentMethod)AUMethodRemoveRenderNotify;
505 case kAudioUnitGetParameterSelect: return (AudioComponentMethod)AUMethodGetParameter;
506 case kAudioUnitSetParameterSelect: return (AudioComponentMethod)AUMethodSetParameter;
507 case kAudioUnitScheduleParametersSelect:return (AudioComponentMethod)AUMethodScheduleParameters;
508 case kAudioUnitRenderSelect: return (AudioComponentMethod)AUMethodRender;
509 case kAudioUnitResetSelect: return (AudioComponentMethod)AUMethodReset;
510 default:
511 break;
512 }
513 return NULL;
514 }
515
Lookup(SInt16 selector)516 AudioComponentMethod AUOutputLookup::Lookup (SInt16 selector)
517 {
518 AudioComponentMethod method = AUBaseLookup::Lookup(selector);
519 if (method) return method;
520
521 switch (selector) {
522 case kAudioOutputUnitStartSelect: return (AudioComponentMethod)AUMethodStart;
523 case kAudioOutputUnitStopSelect: return (AudioComponentMethod)AUMethodStop;
524 default:
525 break;
526 }
527 return NULL;
528 }
529
Lookup(SInt16 selector)530 AudioComponentMethod AUComplexOutputLookup::Lookup (SInt16 selector)
531 {
532 AudioComponentMethod method = AUBaseLookup::Lookup(selector);
533 if (method) return method;
534
535 method = AUOutputLookup::Lookup(selector);
536 if (method) return method;
537
538 if (selector == kAudioUnitComplexRenderSelect)
539 return (AudioComponentMethod)AUMethodComplexRender;
540 return NULL;
541 }
542
Lookup(SInt16 selector)543 AudioComponentMethod AUBaseProcessLookup::Lookup (SInt16 selector)
544 {
545 AudioComponentMethod method = AUBaseLookup::Lookup(selector);
546 if (method) return method;
547
548 if (selector == kAudioUnitProcessSelect)
549 return (AudioComponentMethod)AUMethodProcess;
550
551 return NULL;
552 }
553
Lookup(SInt16 selector)554 AudioComponentMethod AUBaseProcessMultipleLookup::Lookup (SInt16 selector)
555 {
556 AudioComponentMethod method = AUBaseLookup::Lookup(selector);
557 if (method) return method;
558
559 method = AUBaseProcessLookup::Lookup(selector);
560 if (method) return method;
561
562 if (selector == kAudioUnitProcessMultipleSelect)
563 return (AudioComponentMethod)AUMethodProcessMultiple;
564
565 return NULL;
566 }
567
568 #if !CA_BASIC_AU_FEATURES
MIDI_Lookup(SInt16 selector)569 inline AudioComponentMethod MIDI_Lookup (SInt16 selector)
570 {
571 switch (selector) {
572 case kMusicDeviceMIDIEventSelect: return (AudioComponentMethod)AUMethodMIDIEvent;
573 case kMusicDeviceSysExSelect: return (AudioComponentMethod)AUMethodSysEx;
574 default:
575 break;
576 }
577 return NULL;
578 }
579
Lookup(SInt16 selector)580 AudioComponentMethod AUMIDILookup::Lookup (SInt16 selector)
581 {
582 AudioComponentMethod method = AUBaseLookup::Lookup(selector);
583 if (method) return method;
584
585 return MIDI_Lookup(selector);
586 }
587
Lookup(SInt16 selector)588 AudioComponentMethod AUMIDIProcessLookup::Lookup (SInt16 selector)
589 {
590 AudioComponentMethod method = AUBaseProcessLookup::Lookup(selector);
591 if (method) return method;
592
593 return MIDI_Lookup(selector);
594 }
595
Lookup(SInt16 selector)596 AudioComponentMethod AUMusicLookup::Lookup (SInt16 selector)
597 {
598 AudioComponentMethod method = AUBaseLookup::Lookup(selector);
599 if (method) return method;
600
601 switch (selector) {
602 case kMusicDeviceStartNoteSelect: return (AudioComponentMethod)AUMethodStartNote;
603 case kMusicDeviceStopNoteSelect: return (AudioComponentMethod)AUMethodStopNote;
604 #if !TARGET_OS_IPHONE
605 case kMusicDevicePrepareInstrumentSelect: return (AudioComponentMethod)AUMethodPrepareInstrument;
606 case kMusicDeviceReleaseInstrumentSelect: return (AudioComponentMethod)AUMethodReleaseInstrument;
607 #endif
608 default:
609 break;
610 }
611 return MIDI_Lookup (selector);
612 }
613
614 #endif
615
616