MPH_to.c revision 8ca039e1f9d95f8b14a59e135426882e3470e9d9
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_ANDROIDBUFFERQUEUE] = 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 [MPH_XAENGINE] = 10, 132#ifdef ANDROID 133 [MPH_ANDROIDEFFECTCAPABILITIES] = 11 134#endif 135#else 136#include "MPH_to_Engine.h" 137#endif 138}; 139 140const signed char MPH_to_LEDDevice[MPH_MAX] = { 141#ifdef USE_DESIGNATED_INITIALIZERS 142 [0 ... MPH_MAX-1] = -1, 143 [MPH_OBJECT] = 0, 144 [MPH_DYNAMICINTERFACEMANAGEMENT] = 1, 145 [MPH_LED] = 2 146#else 147#include "MPH_to_LEDDevice.h" 148#endif 149}; 150 151const signed char MPH_to_Listener[MPH_MAX] = { 152#ifdef USE_DESIGNATED_INITIALIZERS 153 [0 ... MPH_MAX-1] = -1, 154 [MPH_OBJECT] = 0, 155 [MPH_DYNAMICINTERFACEMANAGEMENT] = 1, 156 [MPH_3DDOPPLER] = 2, 157 [MPH_3DLOCATION] = 3 158#else 159#include "MPH_to_Listener.h" 160#endif 161}; 162 163const signed char MPH_to_MetadataExtractor[MPH_MAX] = { 164#ifdef USE_DESIGNATED_INITIALIZERS 165 [0 ... MPH_MAX-1] = -1, 166 [MPH_OBJECT] = 0, 167 [MPH_DYNAMICINTERFACEMANAGEMENT] = 1, 168 [MPH_DYNAMICSOURCE] = 2, 169 [MPH_METADATAEXTRACTION] = 3, 170 [MPH_METADATATRAVERSAL] = 4 171#else 172#include "MPH_to_MetadataExtractor.h" 173#endif 174}; 175 176const signed char MPH_to_MidiPlayer[MPH_MAX] = { 177#ifdef USE_DESIGNATED_INITIALIZERS 178 [0 ... MPH_MAX-1] = -1, 179 [MPH_OBJECT] = 0, 180 [MPH_DYNAMICINTERFACEMANAGEMENT] = 1, 181 [MPH_PLAY] = 2, 182 [MPH_3DDOPPLER] = 3, 183 [MPH_3DGROUPING] = 4, 184 [MPH_3DLOCATION] = 5, 185 [MPH_3DSOURCE] = 6, 186 [MPH_BUFFERQUEUE] = 7, 187 [MPH_EFFECTSEND] = 8, 188 [MPH_MUTESOLO] = 9, 189 [MPH_METADATAEXTRACTION] = 10, 190 [MPH_METADATATRAVERSAL] = 11, 191 [MPH_MIDIMESSAGE] = 12, 192 [MPH_MIDITIME] = 13, 193 [MPH_MIDITEMPO] = 14, 194 [MPH_MIDIMUTESOLO] = 15, 195 [MPH_PREFETCHSTATUS] = 16, 196 [MPH_SEEK] = 17, 197 [MPH_VOLUME] = 18, 198 [MPH_3DMACROSCOPIC] = 19, 199 [MPH_BASSBOOST] = 20, 200 [MPH_DYNAMICSOURCE] = 21, 201 [MPH_ENVIRONMENTALREVERB] = 22, 202 [MPH_EQUALIZER] = 23, 203 [MPH_PITCH] = 24, 204 [MPH_PRESETREVERB] = 25, 205 [MPH_PLAYBACKRATE] = 26, 206 [MPH_VIRTUALIZER] = 27, 207 [MPH_VISUALIZATION] = 28, 208#else 209#include "MPH_to_MidiPlayer.h" 210#endif 211}; 212 213const signed char MPH_to_OutputMix[MPH_MAX] = { 214#ifdef USE_DESIGNATED_INITIALIZERS 215 [0 ... MPH_MAX-1] = -1, 216 [MPH_OBJECT] = 0, 217 [MPH_DYNAMICINTERFACEMANAGEMENT] = 1, 218 [MPH_OUTPUTMIX] = 2, 219#ifdef USE_OUTPUTMIXEXT 220 [MPH_OUTPUTMIXEXT] = 3, 221#endif 222 [MPH_ENVIRONMENTALREVERB] = 4, 223 [MPH_EQUALIZER] = 5, 224 [MPH_PRESETREVERB] = 6, 225 [MPH_VIRTUALIZER] = 7, 226 [MPH_VOLUME] = 8, 227 [MPH_BASSBOOST] = 9, 228 [MPH_VISUALIZATION] = 10, 229#ifdef ANDROID 230 [MPH_ANDROIDEFFECT] = 11 231#endif 232#else 233#include "MPH_to_OutputMix.h" 234#endif 235}; 236 237const signed char MPH_to_Vibra[MPH_MAX] = { 238#ifdef USE_DESIGNATED_INITIALIZERS 239 [0 ... MPH_MAX-1] = -1, 240 [MPH_OBJECT] = 0, 241 [MPH_DYNAMICINTERFACEMANAGEMENT] = 1, 242 [MPH_VIBRA] = 2 243#else 244#include "MPH_to_Vibra.h" 245#endif 246}; 247 248const signed char MPH_to_MediaPlayer[MPH_MAX] = { 249#ifdef USE_DESIGNATED_INITIALIZERS 250 [0 ... MPH_MAX-1] = -1, 251 [MPH_OBJECT] = 0, 252 [MPH_DYNAMICINTERFACEMANAGEMENT] = 1, 253 [MPH_XAPLAY] = 2, 254 [MPH_ANDROIDBUFFERQUEUE] = 3, 255 // FIXME more TBD 256#else 257#include "MPH_to_MediaPlayer.h" 258#endif 259}; 260