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 #include "MPH_to.h" 21 22 // If defined, then compile with C99 such as GNU C, not GNU C++ or non-GNU C. 23 //#define USE_DESIGNATED_INITIALIZERS 24 25 // It is critical that all entries are populated with either a specific index 26 // or -1. Do not let the compiler use a default initializer of zero, because 27 // that actually maps to the IObject index. To test this, try defining END to 28 // generate an extra entry, and verify that you get one error message per class. 29 //#define END , (-1) // for testing 30 #define END // for production 31 32 // Another good test is to use the GNU C compiler with -S option (for assembler output), 33 // and compile both with and without USE_DESIGNATED_INITIALIZERS. The resulting .s 34 // files should be identical for both compilations. 35 36 // Important note: if you add any interfaces here, be sure to also 37 // update the #define for the corresponding INTERFACES_<Class>. 38 39 // IObject is the first interface in a class, so the index for MPH_OBJECT must be zero. 40 // Don't cross streams, otherwise bad things happen. 41 42 43 #if USE_PROFILES & USE_PROFILES_GAME 44 const signed char MPH_to_3DGroup[MPH_MAX] = { 45 #ifdef USE_DESIGNATED_INITIALIZERS 46 [0 ... MPH_MAX-1] = -1, 47 [MPH_OBJECT] = 0, 48 [MPH_DYNAMICINTERFACEMANAGEMENT] = 1, 49 [MPH_3DLOCATION] = 2, 50 [MPH_3DDOPPLER] = 3, 51 [MPH_3DSOURCE] = 4, 52 [MPH_3DMACROSCOPIC] = 5 53 #else 54 -1, 55 3, // MPH_3DDOPPLER 56 -1, 57 2, // MPH_3DLOCATION 58 5, // MPH_3DMACROSCOPIC 59 4, // MPH_3DSOURCE 60 -1, -1, -1, -1, -1, -1, -1, 61 1, // MPH_DYNAMICINTERFACEMANAGEMENT 62 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 63 0, // MPH_OBJECT 64 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 65 -1, // MPH_OUTPUTMIXEXT 66 -1, // MPH_ANDROIDEFFECT 67 -1, // MPH_ANDROIDEFFECTCAPABILITIES 68 -1, // MPH_ANDROIDEFFECTSEND 69 -1, // MPH_ANDROIDCONFIGURATION 70 -1 // MPH_ANDROIDSIMPLEBUFFERQUEUE 71 END 72 #endif 73 }; 74 #endif 75 76 const signed char MPH_to_AudioPlayer[MPH_MAX] = { 77 #ifdef USE_DESIGNATED_INITIALIZERS 78 [0 ... MPH_MAX-1] = -1, 79 [MPH_OBJECT] = 0, 80 [MPH_DYNAMICINTERFACEMANAGEMENT] = 1, 81 [MPH_PLAY] = 2, 82 [MPH_3DDOPPLER] = 3, 83 [MPH_3DGROUPING] = 4, 84 [MPH_3DLOCATION] = 5, 85 [MPH_3DSOURCE] = 6, 86 [MPH_BUFFERQUEUE] = 7, 87 [MPH_EFFECTSEND] = 8, 88 [MPH_MUTESOLO] = 9, 89 [MPH_METADATAEXTRACTION] = 10, 90 [MPH_METADATATRAVERSAL] = 11, 91 [MPH_PREFETCHSTATUS] = 12, 92 [MPH_RATEPITCH] = 13, 93 [MPH_SEEK] = 14, 94 [MPH_VOLUME] = 15, 95 [MPH_3DMACROSCOPIC] = 16, 96 [MPH_BASSBOOST] = 17, 97 [MPH_DYNAMICSOURCE] = 18, 98 [MPH_ENVIRONMENTALREVERB] = 19, 99 [MPH_EQUALIZER] = 20, 100 [MPH_PITCH] = 21, 101 [MPH_PRESETREVERB] = 22, 102 [MPH_PLAYBACKRATE] = 23, 103 [MPH_VIRTUALIZER] = 24, 104 [MPH_VISUALIZATION] = 25, 105 #ifdef ANDROID 106 [MPH_ANDROIDEFFECT] = 26, 107 [MPH_ANDROIDEFFECTSEND] = 27, 108 [MPH_ANDROIDCONFIGURATION] = 28, 109 [MPH_ANDROIDSIMPLEBUFFERQUEUE] = 7 // alias for [MPH_BUFFERQUEUE] 110 #endif 111 #else 112 -1, 113 3, // MPH_3DDOPPLER 114 4, // MPH_3DGROUPING 115 5, // MPH_3DLOCATION 116 16, // MPH_3DMACROSCOPIC 117 6, // MPH_3DSOURCE 118 -1, -1, -1, -1, 119 17, // MPH_BASSBOOST 120 7, // MPH_BUFFERQUEUE 121 -1, 122 1, // MPH_DYNAMICINTERFACEMANAGEMENT 123 18, // MPH_DYNAMICSOURCE 124 8, // MPH_EFFECTSEND 125 -1, -1, 126 19, // MPH_ENVIRONMENTALREVERB 127 20, // MPH_EQUALIZER 128 -1, 129 10, // MPH_METADATAEXTRACTION 130 11, // MPH_METADATATRAVERSAL 131 -1, -1, -1, -1, 132 9, // MPH_MUTESOLO 133 -1, 134 0, // MPH_OBJECT 135 -1, 136 21, // MPH_PITCH 137 2, // MPH_PLAY 138 23, // MPH_PLAYBACKRATE 139 12, // MPH_PREFETCHSTATUS 140 22, // MPH_PRESETREVERB 141 13, // MPH_RATEPITCH 142 -1, 143 14, // MPH_SEEK 144 -1, -1, 145 24, // MPH_VIRTUALIZER 146 25, // MPH_VISUALIZATION 147 15, // MPH_VOLUME 148 -1, // not using MPH_OUTPUTMIXEXT 149 #ifdef ANDROID 150 26, // MPH_ANDROIDEFFECT 151 -1, // MPH_ANDROIDEFFECTCAPABILITIES 152 27, // MPH_ANDROIDEFFECTSEND 153 28, // MPH_ANDROIDCONFIGURATION 154 7 // MPH_SIMPLEBUFFERQUEUE // alias for [MPH_BUFFERQUEUE] 155 #else 156 -1, // not using MPH_ANDROIDEFFECT 157 -1, // not using MPH_ANDROIDEFFECTCAPABILITIES 158 -1, // not using MPH_ANDROIDEFFECTSEND 159 -1, // not using MPH_ANDROIDCONFIGURATION 160 -1 // not using MPH_ANDROIDSIMPLEBUFFERQUEUE 161 #endif 162 END 163 #endif 164 }; 165 166 #if (USE_PROFILES & USE_PROFILES_OPTIONAL) || defined(ANDROID) 167 const signed char MPH_to_AudioRecorder[MPH_MAX] = { 168 #ifdef USE_DESIGNATED_INITIALIZERS 169 [0 ... MPH_MAX-1] = -1, 170 [MPH_OBJECT] = 0, 171 [MPH_DYNAMICINTERFACEMANAGEMENT] = 1, 172 [MPH_RECORD] = 2, 173 [MPH_AUDIOENCODER] = 3, 174 [MPH_BASSBOOST] = 4, 175 [MPH_DYNAMICSOURCE] = 5, 176 [MPH_EQUALIZER] = 6, 177 [MPH_VISUALIZATION] = 7, 178 [MPH_VOLUME] = 8, 179 #ifdef ANDROID 180 [MPH_ANDROIDSIMPLEBUFFERQUEUE] = 9, // this is not an alias 181 [MPH_ANDROIDCONFIGURATION] = 10 182 #endif 183 #else 184 -1, -1, -1, -1, -1, -1, -1, 185 3, // MPH_AUDIOENCODER 186 -1, -1, 187 4, // MPH_BASSBOOST 188 -1, // MPH_BUFFERQUEUE (application must specify MPH_ANDROIDSIMPLEBUFFERQUEUE) 189 -1, 190 1, // MPH_DYNAMICINTERFACEMANAGEMENT 191 5, // MPH_DYNAMICSOURCE 192 -1, -1, -1, -1, 193 6, // MPH_EQUALIZER 194 -1, -1, -1, -1, -1, -1, -1, -1, -1, 195 0, // MPH_OBJECT 196 -1, -1, -1, -1, -1, -1, -1, 197 2, // MPH_RECORD 198 -1, -1, -1, -1, 199 7, // MPH_VISUALIZATION 200 8, // MPH_VOLUME 201 -1, // not using MPH_OUTPUTMIXEXT 202 -1, // not using MPH_ANDROIDEFFECT 203 -1, // not using MPH_ANDROIDEFFECTCAPABILITIES 204 -1, // not using MPH_ANDROIDEFFECTSEND 205 #ifdef ANDROID 206 10, // MPH_ANDROIDCONFIGURATION 207 9 // MPH_ANDROIDSIMPLEBUFFERQUEUE (this is not an alias) 208 #else 209 -1, // not using MPH_ANDROIDCONFIGURATION 210 -1 // not using MPH_ANDROIDSIMPLEBUFFERQUEUE 211 #endif 212 END 213 #endif 214 }; 215 #endif 216 217 const signed char MPH_to_Engine[MPH_MAX] = { 218 #ifdef USE_DESIGNATED_INITIALIZERS 219 [0 ... MPH_MAX-1] = -1, 220 [MPH_OBJECT] = 0, 221 [MPH_DYNAMICINTERFACEMANAGEMENT] = 1, 222 [MPH_ENGINE] = 2, 223 [MPH_ENGINECAPABILITIES] = 3, 224 [MPH_THREADSYNC] = 4, 225 [MPH_AUDIOIODEVICECAPABILITIES] = 5, 226 [MPH_AUDIODECODERCAPABILITIES] = 6, 227 [MPH_AUDIOENCODERCAPABILITIES] = 7, 228 [MPH_3DCOMMIT] = 8, 229 [MPH_DEVICEVOLUME] = 9, 230 #ifdef ANDROID 231 [MPH_ANDROIDEFFECTCAPABILITIES] = 10 232 #endif 233 #else 234 8, // MPH_3DCOMMIT 235 -1, -1, -1, -1, -1, 236 6, // MPH_AUDIODECODERCAPABILITIES 237 -1, 238 7, // MPH_AUDIOENCODERCAPABILITIES 239 5, // MPH_AUDIOIODEVICECAPABILITIES 240 -1, -1, 241 9, // MPH_DEVICEVOLUME 242 1, // MPH_DYNAMICINTERFACEMANAGEMENT 243 -1, -1, 244 2, // MPH_ENGINE 245 3, // MPH_ENGINECAPABILITIES 246 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 247 0, // MPH_OBJECT 248 -1, -1, -1, -1, -1, -1, -1, -1, -1, 249 4, // MPH_THREADSYNC 250 -1, -1, -1, -1, 251 -1, // MPH_OUTPUTMIXEXT 252 #ifdef ANDROID 253 -1, // MPH_ANDROIDEFFECT 254 10, // MPH_ANDROIDEFFECTCAPABILITIES 255 -1, // MPH_ANDROIDEFFECTSEND 256 -1, // MPH_ANDROIDCONFIGURATION 257 -1 // MPH_ANDROIDSIMPLEBUFFERQUEUE 258 #else 259 -1, // MPH_ANDROIDEFFECT 260 -1, // MPH_ANDROIDEFFECTCAPABILITIES 261 -1, // MPH_ANDROIDEFFECTSEND 262 -1, // MPH_ANDROIDCONFIGURATION 263 -1 // MPH_ANDROIDSIMPLEBUFFERQUEUE 264 #endif 265 END 266 #endif 267 }; 268 269 #if USE_PROFILES & USE_PROFILES_OPTIONAL 270 const signed char MPH_to_LEDDevice[MPH_MAX] = { 271 #ifdef USE_DESIGNATED_INITIALIZERS 272 [0 ... MPH_MAX-1] = -1, 273 [MPH_OBJECT] = 0, 274 [MPH_DYNAMICINTERFACEMANAGEMENT] = 1, 275 [MPH_LED] = 2 276 #else 277 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 278 1, // MPH_DYNAMICINTERFACEMANAGEMENT 279 -1, -1, -1, -1, -1, -1, 280 2, // MPH_LED 281 -1, -1, -1, -1, -1, -1, -1, -1, 282 0, // MPH_OBJECT 283 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 284 -1, // MPH_OUTPUTMIXEXT 285 -1, // MPH_ANDROIDEFFECT 286 -1, // MPH_ANDROIDEFFECTCAPABILITIES 287 -1, // MPH_ANDROIDEFFECTSEND 288 -1, // MPH_ANDROIDCONFIGURATION 289 -1 // MPH_ANDROIDSIMPLEBUFFERQUEUE 290 END 291 #endif 292 }; 293 #endif 294 295 #if USE_PROFILES & USE_PROFILES_GAME 296 const signed char MPH_to_Listener[MPH_MAX] = { 297 #ifdef USE_DESIGNATED_INITIALIZERS 298 [0 ... MPH_MAX-1] = -1, 299 [MPH_OBJECT] = 0, 300 [MPH_DYNAMICINTERFACEMANAGEMENT] = 1, 301 [MPH_3DDOPPLER] = 2, 302 [MPH_3DLOCATION] = 3 303 #else 304 -1, 305 2, // MPH_3DDOPPLER 306 -1, 307 3, // MPH_3DLOCATION 308 -1, -1, -1, -1, -1, -1, -1, -1, -1, 309 1, // MPH_DYNAMICINTERFACEMANAGEMENT 310 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 311 0, // MPH_OBJECT 312 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 313 -1, // MPH_OUTPUTMIXEXT 314 -1, // MPH_ANDROIDEFFECT 315 -1, // MPH_ANDROIDEFFECTCAPABILITIES 316 -1, // MPH_ANDROIDEFFECTSEND 317 -1, // MPH_ANDROIDCONFIGURATION 318 -1 // MPH_ANDROIDSIMPLEBUFFERQUEUE 319 END 320 #endif 321 }; 322 #endif 323 324 #if USE_PROFILES & (USE_PROFILES_GAME | USE_PROFILES_MUSIC) 325 const signed char MPH_to_MetadataExtractor[MPH_MAX] = { 326 #ifdef USE_DESIGNATED_INITIALIZERS 327 [0 ... MPH_MAX-1] = -1, 328 [MPH_OBJECT] = 0, 329 [MPH_DYNAMICINTERFACEMANAGEMENT] = 1, 330 [MPH_DYNAMICSOURCE] = 2, 331 [MPH_METADATAEXTRACTION] = 3, 332 [MPH_METADATATRAVERSAL] = 4 333 #else 334 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 335 1, // MPH_DYNAMICINTERFACEMANAGEMENT 336 2, // MPH_DYNAMICSOURCE 337 -1, -1, -1, -1, -1, -1, 338 3, // MPH_METADATAEXTRACTION 339 4, // MPH_METADATATRAVERSAL 340 -1, -1, -1, -1, -1, -1, 341 0, // MPH_OBJECT 342 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 343 -1, // MPH_OUTPUTMIXEXT 344 -1, // MPH_ANDROIDEFFECT 345 -1, // MPH_ANDROIDEFFECTCAPABILITIES 346 -1, // MPH_ANDROIDEFFECTSEND 347 -1, // MPH_ANDROIDCONFIGURATION 348 -1 // MPH_ANDROIDSIMPLEBUFFERQUEUE 349 END 350 #endif 351 }; 352 #endif 353 354 #if USE_PROFILES & USE_PROFILES_GAME 355 const signed char MPH_to_MidiPlayer[MPH_MAX] = { 356 #ifdef USE_DESIGNATED_INITIALIZERS 357 [0 ... MPH_MAX-1] = -1, 358 [MPH_OBJECT] = 0, 359 [MPH_DYNAMICINTERFACEMANAGEMENT] = 1, 360 [MPH_PLAY] = 2, 361 [MPH_3DDOPPLER] = 3, 362 [MPH_3DGROUPING] = 4, 363 [MPH_3DLOCATION] = 5, 364 [MPH_3DSOURCE] = 6, 365 [MPH_BUFFERQUEUE] = 7, 366 [MPH_EFFECTSEND] = 8, 367 [MPH_MUTESOLO] = 9, 368 [MPH_METADATAEXTRACTION] = 10, 369 [MPH_METADATATRAVERSAL] = 11, 370 [MPH_MIDIMESSAGE] = 12, 371 [MPH_MIDITIME] = 13, 372 [MPH_MIDITEMPO] = 14, 373 [MPH_MIDIMUTESOLO] = 15, 374 [MPH_PREFETCHSTATUS] = 16, 375 [MPH_SEEK] = 17, 376 [MPH_VOLUME] = 18, 377 [MPH_3DMACROSCOPIC] = 19, 378 [MPH_BASSBOOST] = 20, 379 [MPH_DYNAMICSOURCE] = 21, 380 [MPH_ENVIRONMENTALREVERB] = 22, 381 [MPH_EQUALIZER] = 23, 382 [MPH_PITCH] = 24, 383 [MPH_PRESETREVERB] = 25, 384 [MPH_PLAYBACKRATE] = 26, 385 [MPH_VIRTUALIZER] = 27, 386 [MPH_VISUALIZATION] = 28, 387 #else 388 -1, 389 3, // MPH_3DDOPPLER 390 4, // MPH_3DGROUPING 391 5, // MPH_3DLOCATION 392 19, // MPH_3DMACROSCOPIC 393 6, // MPH_3DSOURCE 394 -1, -1, -1, -1, 395 20, // MPH_BASSBOOST 396 7, // MPH_BUFFERQUEUE 397 -1, 398 1, // MPH_DYNAMICINTERFACEMANAGEMENT 399 21, // MPH_DYNAMICSOURCE 400 8, // MPH_EFFECTSEND 401 -1, -1, 402 22, // MPH_ENVIRONMENTALREVERB 403 23, // MPH_EQUALIZER 404 -1, 405 10, // MPH_METADATAEXTRACTION 406 11, // MPH_METADATATRAVERSAL 407 12, // MPH_MIDIMESSAGE 408 15, // MPH_MIDIMUTESOLO 409 14, // MPH_MIDITEMPO 410 13, // MPH_MIDITIME 411 9, // MPH_MUTESOLO 412 -1, 413 0, // MPH_OBJECT 414 -1, 415 24, // MPH_PITCH 416 2, // MPH_PLAY 417 26, // MPH_PLAYBACKRATE 418 16, // MPH_PREFETCHSTATUS 419 25, // MPH_PRESETREVERB 420 -1, -1, 421 17, // MPH_SEEK 422 -1, -1, 423 27, // MPH_VIRTUALIZER 424 28, // MPH_VISUALIZATION 425 18, // MPH_VOLUME 426 -1, // MPH_OUTPUTMIXEXT 427 -1, // MPH_ANDROIDEFFECT 428 -1, // MPH_ANDROIDEFFECTCAPABILITIES 429 -1, // MPH_ANDROIDEFFECTSEND 430 -1, // MPH_ANDROIDCONFIGURATION 431 -1 // MPH_ANDROIDSIMPLEBUFFERQUEUE 432 END 433 #endif 434 }; 435 #endif 436 437 const signed char MPH_to_OutputMix[MPH_MAX] = { 438 #ifdef USE_DESIGNATED_INITIALIZERS 439 [0 ... MPH_MAX-1] = -1, 440 [MPH_OBJECT] = 0, 441 [MPH_DYNAMICINTERFACEMANAGEMENT] = 1, 442 [MPH_OUTPUTMIX] = 2, 443 #ifdef USE_OUTPUTMIXEXT 444 [MPH_OUTPUTMIXEXT] = 3, 445 #endif 446 [MPH_ENVIRONMENTALREVERB] = 4, 447 [MPH_EQUALIZER] = 5, 448 [MPH_PRESETREVERB] = 6, 449 [MPH_VIRTUALIZER] = 7, 450 [MPH_VOLUME] = 8, 451 [MPH_BASSBOOST] = 9, 452 [MPH_VISUALIZATION] = 10, 453 #ifdef ANDROID 454 [MPH_ANDROIDEFFECT] = 11 455 #endif 456 #else 457 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 458 9, // MPH_BASSBOOST 459 -1, -1, 460 1, // MPH_DYNAMICINTERFACEMANAGEMENT 461 -1, -1, -1, -1, 462 4, // MPH_ENVIRONMENTALREVERB 463 5, // MPH_EQUALIZER 464 -1, -1, -1, -1, -1, -1, -1, -1, -1, 465 0, // MPH_OBJECT 466 2, // MPH_OUTPUTMIX 467 -1, -1, -1, -1, 468 6, // MPH_PRESETREVERB 469 -1, -1, -1, -1, -1, 470 7, // MPH_VIRTUALIZER 471 10, // MPH_VISUALIZATION 472 8, // MPH_VOLUME 473 #ifdef USE_OUTPUTMIXEXT 474 3, // MPH_OUTPUTMIXEXT 475 #else 476 -1, 477 #endif 478 #ifdef ANDROID 479 11, // MPH_ANDROIDEFFECT 480 #else 481 -1, 482 #endif 483 -1, // MPH_ANDROIDEFFECTCAPABILITIES 484 -1, // MPH_ANDROIDEFFECTSEND 485 -1, // MPH_ANDROIDCONFIGURATION 486 -1 // MPH_ANDROIDSIMPLEBUFFERQUEUE 487 END 488 #endif 489 }; 490 491 #if USE_PROFILES & USE_PROFILES_OPTIONAL 492 const signed char MPH_to_Vibra[MPH_MAX] = { 493 #ifdef USE_DESIGNATED_INITIALIZERS 494 [0 ... MPH_MAX-1] = -1, 495 [MPH_OBJECT] = 0, 496 [MPH_DYNAMICINTERFACEMANAGEMENT] = 1, 497 [MPH_VIBRA] = 2 498 #else 499 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 500 1, // MPH_DYNAMICINTERFACEMANAGEMENT 501 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 502 0, // MPH_OBJECT 503 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 504 2, // MPH_VIBRA 505 -1, -1, -1, 506 -1, // MPH_OUTPUTMIXEXT 507 -1, // MPH_ANDROIDEFFECT 508 -1, // MPH_ANDROIDEFFECTCAPABILITIES 509 -1, // MPH_ANDROIDEFFECTSEND 510 -1, // MPH_ANDROIDCONFIGURATION 511 -1 // MPH_ANDROIDSIMPLEBUFFERQUEUE 512 END 513 #endif 514 }; 515 #endif 516