MPH_to.c revision b0ab2dee391dd2cb257faeaba252ee6ecccc5f03
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. To test this, try defining END to 27// generate an extra entry, and verify that you get one error message per class. 28//#define END , (-1) // for testing 29#define END // for production 30 31// Another good test is to use the GNU C compiler with -S option (for assembler output), 32// and compile both with and without USE_DESIGNATED_INITIALIZERS. The resulting .s 33// files should be identical for both compilations. 34 35// Important note: if you add any interfaces here, be sure to also 36// update the #define for the corresponding INTERFACES_<Class>. 37 38// IObject is the first interface in a class, so the index for MPH_OBJECT must be zero. 39// Don't cross streams, otherwise bad things happen. 40 41 42const signed char MPH_to_3DGroup[MPH_MAX] = { 43#ifdef USE_DESIGNATED_INITIALIZERS 44 [0 ... MPH_MAX-1] = -1, 45 [MPH_OBJECT] = 0, 46 [MPH_DYNAMICINTERFACEMANAGEMENT] = 1, 47 [MPH_3DLOCATION] = 2, 48 [MPH_3DDOPPLER] = 3, 49 [MPH_3DSOURCE] = 4, 50 [MPH_3DMACROSCOPIC] = 5 51#else 52#include "MPH_to_3DGroup.h" 53#endif 54}; 55 56const signed char MPH_to_AudioPlayer[MPH_MAX] = { 57#ifdef USE_DESIGNATED_INITIALIZERS 58 [0 ... MPH_MAX-1] = -1, 59 [MPH_OBJECT] = 0, 60 [MPH_DYNAMICINTERFACEMANAGEMENT] = 1, 61 [MPH_PLAY] = 2, 62 [MPH_3DDOPPLER] = 3, 63 [MPH_3DGROUPING] = 4, 64 [MPH_3DLOCATION] = 5, 65 [MPH_3DSOURCE] = 6, 66 [MPH_BUFFERQUEUE] = 7, 67 [MPH_EFFECTSEND] = 8, 68 [MPH_MUTESOLO] = 9, 69 [MPH_METADATAEXTRACTION] = 10, 70 [MPH_METADATATRAVERSAL] = 11, 71 [MPH_PREFETCHSTATUS] = 12, 72 [MPH_RATEPITCH] = 13, 73 [MPH_SEEK] = 14, 74 [MPH_VOLUME] = 15, 75 [MPH_3DMACROSCOPIC] = 16, 76 [MPH_BASSBOOST] = 17, 77 [MPH_DYNAMICSOURCE] = 18, 78 [MPH_ENVIRONMENTALREVERB] = 19, 79 [MPH_EQUALIZER] = 20, 80 [MPH_PITCH] = 21, 81 [MPH_PRESETREVERB] = 22, 82 [MPH_PLAYBACKRATE] = 23, 83 [MPH_VIRTUALIZER] = 24, 84 [MPH_VISUALIZATION] = 25, 85#ifdef ANDROID 86 [MPH_ANDROIDEFFECT] = 26, 87 [MPH_ANDROIDEFFECTSEND] = 27, 88 [MPH_ANDROIDCONFIGURATION] = 28, 89 [MPH_ANDROIDSIMPLEBUFFERQUEUE] = 7, // alias for [MPH_BUFFERQUEUE] 90 [MPH_ANDROIDSTREAMSOURCE] = 29 91#endif 92#else 93#include "MPH_to_AudioPlayer.h" 94#endif 95}; 96 97const signed char MPH_to_AudioRecorder[MPH_MAX] = { 98#ifdef USE_DESIGNATED_INITIALIZERS 99 [0 ... MPH_MAX-1] = -1, 100 [MPH_OBJECT] = 0, 101 [MPH_DYNAMICINTERFACEMANAGEMENT] = 1, 102 [MPH_RECORD] = 2, 103 [MPH_AUDIOENCODER] = 3, 104 [MPH_BASSBOOST] = 4, 105 [MPH_DYNAMICSOURCE] = 5, 106 [MPH_EQUALIZER] = 6, 107 [MPH_VISUALIZATION] = 7, 108 [MPH_VOLUME] = 8, 109#ifdef ANDROID 110 [MPH_ANDROIDSIMPLEBUFFERQUEUE] = 9, // this is not an alias 111 [MPH_ANDROIDCONFIGURATION] = 10 112#endif 113#else 114#include "MPH_to_AudioRecorder.h" 115#endif 116}; 117 118const signed char MPH_to_Engine[MPH_MAX] = { 119#ifdef USE_DESIGNATED_INITIALIZERS 120 [0 ... MPH_MAX-1] = -1, 121 [MPH_OBJECT] = 0, 122 [MPH_DYNAMICINTERFACEMANAGEMENT] = 1, 123 [MPH_ENGINE] = 2, 124 [MPH_ENGINECAPABILITIES] = 3, 125 [MPH_THREADSYNC] = 4, 126 [MPH_AUDIOIODEVICECAPABILITIES] = 5, 127 [MPH_AUDIODECODERCAPABILITIES] = 6, 128 [MPH_AUDIOENCODERCAPABILITIES] = 7, 129 [MPH_3DCOMMIT] = 8, 130 [MPH_DEVICEVOLUME] = 9, 131#ifdef ANDROID 132 [MPH_ANDROIDEFFECTCAPABILITIES] = 10 133#endif 134#else 135#include "MPH_to_Engine.h" 136#endif 137}; 138 139const signed char MPH_to_LEDDevice[MPH_MAX] = { 140#ifdef USE_DESIGNATED_INITIALIZERS 141 [0 ... MPH_MAX-1] = -1, 142 [MPH_OBJECT] = 0, 143 [MPH_DYNAMICINTERFACEMANAGEMENT] = 1, 144 [MPH_LED] = 2 145#else 146#include "MPH_to_LEDDevice.h" 147#endif 148}; 149 150const signed char MPH_to_Listener[MPH_MAX] = { 151#ifdef USE_DESIGNATED_INITIALIZERS 152 [0 ... MPH_MAX-1] = -1, 153 [MPH_OBJECT] = 0, 154 [MPH_DYNAMICINTERFACEMANAGEMENT] = 1, 155 [MPH_3DDOPPLER] = 2, 156 [MPH_3DLOCATION] = 3 157#else 158#include "MPH_to_Listener.h" 159#endif 160}; 161 162const signed char MPH_to_MetadataExtractor[MPH_MAX] = { 163#ifdef USE_DESIGNATED_INITIALIZERS 164 [0 ... MPH_MAX-1] = -1, 165 [MPH_OBJECT] = 0, 166 [MPH_DYNAMICINTERFACEMANAGEMENT] = 1, 167 [MPH_DYNAMICSOURCE] = 2, 168 [MPH_METADATAEXTRACTION] = 3, 169 [MPH_METADATATRAVERSAL] = 4 170#else 171#include "MPH_to_MetadataExtractor.h" 172#endif 173}; 174 175const signed char MPH_to_MidiPlayer[MPH_MAX] = { 176#ifdef USE_DESIGNATED_INITIALIZERS 177 [0 ... MPH_MAX-1] = -1, 178 [MPH_OBJECT] = 0, 179 [MPH_DYNAMICINTERFACEMANAGEMENT] = 1, 180 [MPH_PLAY] = 2, 181 [MPH_3DDOPPLER] = 3, 182 [MPH_3DGROUPING] = 4, 183 [MPH_3DLOCATION] = 5, 184 [MPH_3DSOURCE] = 6, 185 [MPH_BUFFERQUEUE] = 7, 186 [MPH_EFFECTSEND] = 8, 187 [MPH_MUTESOLO] = 9, 188 [MPH_METADATAEXTRACTION] = 10, 189 [MPH_METADATATRAVERSAL] = 11, 190 [MPH_MIDIMESSAGE] = 12, 191 [MPH_MIDITIME] = 13, 192 [MPH_MIDITEMPO] = 14, 193 [MPH_MIDIMUTESOLO] = 15, 194 [MPH_PREFETCHSTATUS] = 16, 195 [MPH_SEEK] = 17, 196 [MPH_VOLUME] = 18, 197 [MPH_3DMACROSCOPIC] = 19, 198 [MPH_BASSBOOST] = 20, 199 [MPH_DYNAMICSOURCE] = 21, 200 [MPH_ENVIRONMENTALREVERB] = 22, 201 [MPH_EQUALIZER] = 23, 202 [MPH_PITCH] = 24, 203 [MPH_PRESETREVERB] = 25, 204 [MPH_PLAYBACKRATE] = 26, 205 [MPH_VIRTUALIZER] = 27, 206 [MPH_VISUALIZATION] = 28, 207#else 208#include "MPH_to_MidiPlayer.h" 209#endif 210}; 211 212const signed char MPH_to_OutputMix[MPH_MAX] = { 213#ifdef USE_DESIGNATED_INITIALIZERS 214 [0 ... MPH_MAX-1] = -1, 215 [MPH_OBJECT] = 0, 216 [MPH_DYNAMICINTERFACEMANAGEMENT] = 1, 217 [MPH_OUTPUTMIX] = 2, 218#ifdef USE_OUTPUTMIXEXT 219 [MPH_OUTPUTMIXEXT] = 3, 220#endif 221 [MPH_ENVIRONMENTALREVERB] = 4, 222 [MPH_EQUALIZER] = 5, 223 [MPH_PRESETREVERB] = 6, 224 [MPH_VIRTUALIZER] = 7, 225 [MPH_VOLUME] = 8, 226 [MPH_BASSBOOST] = 9, 227 [MPH_VISUALIZATION] = 10, 228#ifdef ANDROID 229 [MPH_ANDROIDEFFECT] = 11 230#endif 231#else 232#include "MPH_to_OutputMix.h" 233#endif 234}; 235 236const signed char MPH_to_Vibra[MPH_MAX] = { 237#ifdef USE_DESIGNATED_INITIALIZERS 238 [0 ... MPH_MAX-1] = -1, 239 [MPH_OBJECT] = 0, 240 [MPH_DYNAMICINTERFACEMANAGEMENT] = 1, 241 [MPH_VIBRA] = 2 242#else 243#include "MPH_to_Vibra.h" 244#endif 245}; 246