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 /** 48 * Copyright: Copyright Auburn Sounds 2016. 49 * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0) 50 * Authors: Guillaume Piolat 51 */ 52 module dplug.au.audiocomponentdispatch; 53 54 import derelict.carbon; 55 56 // Dispatcher for the Audio Component API 57 // Not implemented yet 58 59 import core.stdc.stdio; 60 61 62 struct AudioComponentPlugInInstance 63 { 64 AudioComponentPlugInInterface iface; 65 //AUClient auclient; 66 } 67 68 extern(C) nothrow 69 { 70 OSStatus audioComponentOpen(void *self, AudioComponentInstance mInstance) 71 { 72 /* 73 OSStatus result = noErr; 74 try { 75 ComponentInitLocker lock; 76 77 ComponentBase::sNewInstanceType = ComponentBase::kAudioComponentInstance; 78 ComponentBase *cb = (ComponentBase *)(*ACPI->mConstruct)(&ACPI->mInstanceStorage, compInstance); 79 cb->PostConstructor(); // allows base class to do additional initialization 80 // once the derived class is fully constructed 81 result = noErr; 82 } 83 COMPONENT_CATCH 84 if (result) 85 delete ACPI; 86 return result; 87 */ 88 import core.stdc.stdio; 89 printf("audioComponentOpen %p %p\n", self, mInstance); 90 return noErr; 91 } 92 93 OSStatus audioComponentClose(void *self) 94 { 95 /* 96 OSStatus result = noErr; 97 try { 98 if (ACImp) { 99 ACImp->PreDestructor(); 100 (*ACPI->mDestruct)(&ACPI->mInstanceStorage); 101 free(self); 102 } 103 } 104 COMPONENT_CATCH 105 return result; 106 */ 107 printf("audioComponentClose %p\n", self); 108 return noErr; 109 } 110 111 AudioComponentMethod audioComponentLookup(SInt16 selector) 112 { 113 switch(selector) 114 { 115 case kAudioUnitInitializeSelect: 116 return cast(AudioComponentMethod)&AUMethodInitialize; 117 case kAudioUnitUninitializeSelect: 118 return cast(AudioComponentMethod)&AUMethodUninitialize; 119 case kAudioUnitGetPropertyInfoSelect: 120 return cast(AudioComponentMethod)&AUMethodGetPropertyInfo; 121 case kAudioUnitGetPropertySelect: 122 return cast(AudioComponentMethod)&AUMethodGetProperty; 123 case kAudioUnitSetPropertySelect: 124 return cast(AudioComponentMethod)&AUMethodSetProperty; 125 case kAudioUnitAddPropertyListenerSelect: 126 return cast(AudioComponentMethod)&AUMethodAddPropertyListener; 127 case kAudioUnitRemovePropertyListenerSelect: 128 return cast(AudioComponentMethod)&AUMethodRemovePropertyListener; 129 case kAudioUnitRemovePropertyListenerWithUserDataSelect: 130 return cast(AudioComponentMethod)&AUMethodRemovePropertyListenerWithUserData; 131 case kAudioUnitAddRenderNotifySelect: 132 return cast(AudioComponentMethod)&AUMethodAddRenderNotify; 133 case kAudioUnitRemoveRenderNotifySelect: 134 return cast(AudioComponentMethod)&AUMethodRemoveRenderNotify; 135 case kAudioUnitGetParameterSelect: 136 return cast(AudioComponentMethod)&AUMethodGetParameter; 137 case kAudioUnitSetParameterSelect: 138 return cast(AudioComponentMethod)&AUMethodSetParameter; 139 case kAudioUnitScheduleParametersSelect: 140 return cast(AudioComponentMethod)&AUMethodScheduleParameters; 141 case kAudioUnitRenderSelect: 142 return cast(AudioComponentMethod)&AUMethodRender; 143 case kAudioUnitResetSelect: 144 return cast(AudioComponentMethod)&AUMethodReset; 145 146 default: 147 debug printf("unsupported audioComponentLookup selector %d\n", selector); 148 return null; 149 } 150 } 151 152 OSStatus AUMethodInitialize(void* self) 153 { 154 printf("FUTURE AUMethodInitialize\n"); 155 return noErr; 156 } 157 OSStatus AUMethodUninitialize(void* self) 158 { 159 printf("FUTURE AUMethodUninitialize\n"); 160 return noErr; 161 } 162 OSStatus AUMethodGetPropertyInfo(void* self) 163 { 164 printf("FUTURE AUMethodGetPropertyInfo\n"); 165 return noErr; 166 } 167 OSStatus AUMethodGetProperty(void* self) 168 { 169 printf("FUTURE AUMethodGetProperty\n"); 170 return noErr; 171 } 172 OSStatus AUMethodSetProperty(void* self) 173 { 174 printf("FUTURE AUMethodSetProperty\n"); 175 return noErr; 176 } 177 OSStatus AUMethodAddPropertyListener(void* self) 178 { 179 printf("FUTURE AUMethodAddPropertyListener\n"); 180 return noErr; 181 } 182 OSStatus AUMethodRemovePropertyListener(void* self) 183 { 184 printf("FUTURE AUMethodRemovePropertyListener\n"); 185 return noErr; 186 } 187 OSStatus AUMethodRemovePropertyListenerWithUserData(void* self) 188 { 189 printf("FUTURE AUMethodRemovePropertyListenerWithUserData\n"); 190 return noErr; 191 } 192 OSStatus AUMethodAddRenderNotify(void* self) 193 { 194 printf("FUTURE AUMethodAddRenderNotify\n"); 195 return noErr; 196 } 197 OSStatus AUMethodRemoveRenderNotify(void* self) 198 { 199 printf("FUTURE AUMethodRemoveRenderNotify\n"); 200 return noErr; 201 } 202 OSStatus AUMethodGetParameter(void* self) 203 { 204 printf("FUTURE AUMethodGetParameter\n"); 205 return noErr; 206 } 207 OSStatus AUMethodSetParameter(void* self) 208 { 209 printf("FUTURE AUMethodSetParameter\n"); 210 return noErr; 211 } 212 OSStatus AUMethodScheduleParameters(void* self) 213 { 214 printf("FUTURE AUMethodScheduleParameters\n"); 215 return noErr; 216 } 217 OSStatus AUMethodRender(void* self) 218 { 219 printf("FUTURE AUMethodRender\n"); 220 return noErr; 221 } 222 OSStatus AUMethodReset(void* self) 223 { 224 printf("FUTURE AUMethodReset\n"); 225 return noErr; 226 } 227 }