MPH_to.c revision a361b51914aeb5f8f65c7ecad719d1e01f90913b
1/* 2 * Copyright (C) 2010 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17// Map minimal perfect hash of an interface ID to its class index. 18 19#include "MPH.h" 20 21// If defined, then compile with C99 such as GNU C, not GNU C++ or non-GNU C. 22//#define USE_DESIGNATED_INITIALIZERS 23 24// It is critical that all entries are populated with either a specific index 25// or -1. Do not let the compiler use a default initializer of zero, because 26// that actually maps to the IObject index. For non-USE_DESIGNATED_INITIALIZERS 27// builds, we use the automagically-generated MPH_to_*.h files for this reason. 28 29// A good test is to use the GNU C compiler with -S option (for assembler output), 30// and compile both with and without USE_DESIGNATED_INITIALIZERS. The resulting .s 31// files should be identical for both compilations. 32 33// Important note: if you add any interfaces here, be sure to also 34// update the #define for the corresponding INTERFACES_<Class>. 35 36// IObject is the first interface in a class, so the index for MPH_OBJECT must be zero. 37// Don't cross streams, otherwise bad things happen. 38 39 40const signed char MPH_to_3DGroup[MPH_MAX] = { 41#ifdef USE_DESIGNATED_INITIALIZERS 42 [0 ... MPH_MAX-1] = -1, 43 [MPH_OBJECT] = 0, 44 [MPH_DYNAMICINTERFACEMANAGEMENT] = 1, 45 [MPH_3DLOCATION] = 2, 46 [MPH_3DDOPPLER] = 3, 47 [MPH_3DSOURCE] = 4, 48 [MPH_3DMACROSCOPIC] = 5 49#else 50#include "MPH_to_3DGroup.h" 51#endif 52}; 53 54const signed char MPH_to_AudioPlayer[MPH_MAX] = { 55#ifdef USE_DESIGNATED_INITIALIZERS 56 [0 ... MPH_MAX-1] = -1, 57 [MPH_OBJECT] = 0, 58 [MPH_DYNAMICINTERFACEMANAGEMENT] = 1, 59 [MPH_PLAY] = 2, 60 [MPH_3DDOPPLER] = 3, 61 [MPH_3DGROUPING] = 4, 62 [MPH_3DLOCATION] = 5, 63 [MPH_3DSOURCE] = 6, 64 [MPH_BUFFERQUEUE] = 7, 65 [MPH_EFFECTSEND] = 8, 66 [MPH_MUTESOLO] = 9, 67 [MPH_METADATAEXTRACTION] = 10, 68 [MPH_METADATATRAVERSAL] = 11, 69 [MPH_PREFETCHSTATUS] = 12, 70 [MPH_RATEPITCH] = 13, 71 [MPH_SEEK] = 14, 72 [MPH_VOLUME] = 15, 73 [MPH_3DMACROSCOPIC] = 16, 74 [MPH_BASSBOOST] = 17, 75 [MPH_DYNAMICSOURCE] = 18, 76 [MPH_ENVIRONMENTALREVERB] = 19, 77 [MPH_EQUALIZER] = 20, 78 [MPH_PITCH] = 21, 79 [MPH_PRESETREVERB] = 22, 80 [MPH_PLAYBACKRATE] = 23, 81 [MPH_VIRTUALIZER] = 24, 82 [MPH_VISUALIZATION] = 25, 83#ifdef ANDROID 84 [MPH_ANDROIDEFFECT] = 26, 85 [MPH_ANDROIDEFFECTSEND] = 27, 86 [MPH_ANDROIDCONFIGURATION] = 28, 87 [MPH_ANDROIDSIMPLEBUFFERQUEUE] = 7, // alias for [MPH_BUFFERQUEUE] 88 [MPH_ANDROIDBUFFERQUEUE] = 29 89#endif 90#else 91#include "MPH_to_AudioPlayer.h" 92#endif 93}; 94 95const signed char MPH_to_AudioRecorder[MPH_MAX] = { 96#ifdef USE_DESIGNATED_INITIALIZERS 97 [0 ... MPH_MAX-1] = -1, 98 [MPH_OBJECT] = 0, 99 [MPH_DYNAMICINTERFACEMANAGEMENT] = 1, 100 [MPH_RECORD] = 2, 101 [MPH_AUDIOENCODER] = 3, 102 [MPH_BASSBOOST] = 4, 103 [MPH_DYNAMICSOURCE] = 5, 104 [MPH_EQUALIZER] = 6, 105 [MPH_VISUALIZATION] = 7, 106 [MPH_VOLUME] = 8, 107#ifdef ANDROID 108 [MPH_ANDROIDSIMPLEBUFFERQUEUE] = 9, // this is not an alias 109 [MPH_ANDROIDCONFIGURATION] = 10 110#endif 111#else 112#include "MPH_to_AudioRecorder.h" 113#endif 114}; 115 116const signed char MPH_to_Engine[MPH_MAX] = { 117#ifdef USE_DESIGNATED_INITIALIZERS 118 [0 ... MPH_MAX-1] = -1, 119 [MPH_OBJECT] = 0, 120 [MPH_DYNAMICINTERFACEMANAGEMENT] = 1, 121 [MPH_ENGINE] = 2, 122 [MPH_ENGINECAPABILITIES] = 3, 123 [MPH_THREADSYNC] = 4, 124 [MPH_AUDIOIODEVICECAPABILITIES] = 5, 125 [MPH_AUDIODECODERCAPABILITIES] = 6, 126 [MPH_AUDIOENCODERCAPABILITIES] = 7, 127 [MPH_3DCOMMIT] = 8, 128 [MPH_DEVICEVOLUME] = 9, 129 [MPH_XAENGINE] = 10, 130#ifdef ANDROID 131 [MPH_ANDROIDEFFECTCAPABILITIES] = 11 132#endif 133#else 134#include "MPH_to_Engine.h" 135#endif 136}; 137 138const signed char MPH_to_LEDDevice[MPH_MAX] = { 139#ifdef USE_DESIGNATED_INITIALIZERS 140 [0 ... MPH_MAX-1] = -1, 141 [MPH_OBJECT] = 0, 142 [MPH_DYNAMICINTERFACEMANAGEMENT] = 1, 143 [MPH_LED] = 2 144#else 145#include "MPH_to_LEDDevice.h" 146#endif 147}; 148 149const signed char MPH_to_Listener[MPH_MAX] = { 150#ifdef USE_DESIGNATED_INITIALIZERS 151 [0 ... MPH_MAX-1] = -1, 152 [MPH_OBJECT] = 0, 153 [MPH_DYNAMICINTERFACEMANAGEMENT] = 1, 154 [MPH_3DDOPPLER] = 2, 155 [MPH_3DLOCATION] = 3 156#else 157#include "MPH_to_Listener.h" 158#endif 159}; 160 161const signed char MPH_to_MetadataExtractor[MPH_MAX] = { 162#ifdef USE_DESIGNATED_INITIALIZERS 163 [0 ... MPH_MAX-1] = -1, 164 [MPH_OBJECT] = 0, 165 [MPH_DYNAMICINTERFACEMANAGEMENT] = 1, 166 [MPH_DYNAMICSOURCE] = 2, 167 [MPH_METADATAEXTRACTION] = 3, 168 [MPH_METADATATRAVERSAL] = 4 169#else 170#include "MPH_to_MetadataExtractor.h" 171#endif 172}; 173 174const signed char MPH_to_MidiPlayer[MPH_MAX] = { 175#ifdef USE_DESIGNATED_INITIALIZERS 176 [0 ... MPH_MAX-1] = -1, 177 [MPH_OBJECT] = 0, 178 [MPH_DYNAMICINTERFACEMANAGEMENT] = 1, 179 [MPH_PLAY] = 2, 180 [MPH_3DDOPPLER] = 3, 181 [MPH_3DGROUPING] = 4, 182 [MPH_3DLOCATION] = 5, 183 [MPH_3DSOURCE] = 6, 184 [MPH_BUFFERQUEUE] = 7, 185 [MPH_EFFECTSEND] = 8, 186 [MPH_MUTESOLO] = 9, 187 [MPH_METADATAEXTRACTION] = 10, 188 [MPH_METADATATRAVERSAL] = 11, 189 [MPH_MIDIMESSAGE] = 12, 190 [MPH_MIDITIME] = 13, 191 [MPH_MIDITEMPO] = 14, 192 [MPH_MIDIMUTESOLO] = 15, 193 [MPH_PREFETCHSTATUS] = 16, 194 [MPH_SEEK] = 17, 195 [MPH_VOLUME] = 18, 196 [MPH_3DMACROSCOPIC] = 19, 197 [MPH_BASSBOOST] = 20, 198 [MPH_DYNAMICSOURCE] = 21, 199 [MPH_ENVIRONMENTALREVERB] = 22, 200 [MPH_EQUALIZER] = 23, 201 [MPH_PITCH] = 24, 202 [MPH_PRESETREVERB] = 25, 203 [MPH_PLAYBACKRATE] = 26, 204 [MPH_VIRTUALIZER] = 27, 205 [MPH_VISUALIZATION] = 28, 206#else 207#include "MPH_to_MidiPlayer.h" 208#endif 209}; 210 211const signed char MPH_to_OutputMix[MPH_MAX] = { 212#ifdef USE_DESIGNATED_INITIALIZERS 213 [0 ... MPH_MAX-1] = -1, 214 [MPH_OBJECT] = 0, 215 [MPH_DYNAMICINTERFACEMANAGEMENT] = 1, 216 [MPH_OUTPUTMIX] = 2, 217#ifdef USE_OUTPUTMIXEXT 218 [MPH_OUTPUTMIXEXT] = 3, 219#endif 220 [MPH_ENVIRONMENTALREVERB] = 4, 221 [MPH_EQUALIZER] = 5, 222 [MPH_PRESETREVERB] = 6, 223 [MPH_VIRTUALIZER] = 7, 224 [MPH_VOLUME] = 8, 225 [MPH_BASSBOOST] = 9, 226 [MPH_VISUALIZATION] = 10, 227#ifdef ANDROID 228 [MPH_ANDROIDEFFECT] = 11 229#endif 230#else 231#include "MPH_to_OutputMix.h" 232#endif 233}; 234 235const signed char MPH_to_Vibra[MPH_MAX] = { 236#ifdef USE_DESIGNATED_INITIALIZERS 237 [0 ... MPH_MAX-1] = -1, 238 [MPH_OBJECT] = 0, 239 [MPH_DYNAMICINTERFACEMANAGEMENT] = 1, 240 [MPH_VIBRA] = 2 241#else 242#include "MPH_to_Vibra.h" 243#endif 244}; 245 246const signed char MPH_to_MediaPlayer[MPH_MAX] = { 247#ifdef USE_DESIGNATED_INITIALIZERS 248 [0 ... MPH_MAX-1] = -1, 249 [MPH_XAOBJECT] = 0, 250 [MPH_XADYNAMICINTERFACEMANAGEMENT] = 1, 251 [MPH_XAPLAY] = 2, 252 [MPH_XASTREAMINFORMATION] = 3, 253 [MPH_XAVOLUME] = 4, 254 [MPH_ANDROIDBUFFERQUEUE] = 5, 255 // FIXME more TBD 256#else 257#include "MPH_to_MediaPlayer.h" 258#endif 259}; 260