Eric Laurent | 9630925 | 2011-06-17 09:02:12 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2011 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 | #ifndef ANDROID_EFFECT_VISUALIZER_H_ |
| 18 | #define ANDROID_EFFECT_VISUALIZER_H_ |
| 19 | |
| 20 | #include <hardware/audio_effect.h> |
| 21 | |
| 22 | #if __cplusplus |
| 23 | extern "C" { |
| 24 | #endif |
| 25 | |
| 26 | #ifndef OPENSL_ES_H_ |
| 27 | static const effect_uuid_t SL_IID_VISUALIZATION_ = |
| 28 | { 0xe46b26a0, 0xdddd, 0x11db, 0x8afd, { 0x00, 0x02, 0xa5, 0xd5, 0xc5, 0x1b } }; |
| 29 | const effect_uuid_t * const SL_IID_VISUALIZATION = &SL_IID_VISUALIZATION_; |
| 30 | #endif //OPENSL_ES_H_ |
| 31 | |
| 32 | #define VISUALIZER_CAPTURE_SIZE_MAX 1024 // maximum capture size in samples |
| 33 | #define VISUALIZER_CAPTURE_SIZE_MIN 128 // minimum capture size in samples |
| 34 | |
Jean-Michel Trivi | 9408133 | 2012-04-15 17:20:23 -0700 | [diff] [blame] | 35 | // to keep in sync with frameworks/base/media/java/android/media/audiofx/Visualizer.java |
| 36 | #define VISUALIZER_SCALING_MODE_NORMALIZED 0 |
| 37 | #define VISUALIZER_SCALING_MODE_AS_PLAYED 1 |
| 38 | |
Jean-Michel Trivi | 6885c47 | 2013-09-20 12:14:40 -0700 | [diff] [blame] | 39 | #define MEASUREMENT_MODE_NONE 0x0 |
| 40 | #define MEASUREMENT_MODE_PEAK_RMS 0x1 |
| 41 | |
| 42 | #define MEASUREMENT_IDX_PEAK 0 |
| 43 | #define MEASUREMENT_IDX_RMS 1 |
rago | 0e64393 | 2016-08-23 11:09:52 -0700 | [diff] [blame] | 44 | #define MEASUREMENT_COUNT 2 |
Jean-Michel Trivi | 6885c47 | 2013-09-20 12:14:40 -0700 | [diff] [blame] | 45 | |
Eric Laurent | 9630925 | 2011-06-17 09:02:12 -0700 | [diff] [blame] | 46 | /* enumerated parameters for Visualizer effect */ |
| 47 | typedef enum |
| 48 | { |
Jean-Michel Trivi | 9408133 | 2012-04-15 17:20:23 -0700 | [diff] [blame] | 49 | VISUALIZER_PARAM_CAPTURE_SIZE, // Sets the number PCM samples in the capture. |
| 50 | VISUALIZER_PARAM_SCALING_MODE, // Sets the way the captured data is scaled |
Marco Nelissen | ab0deb6 | 2012-06-07 07:23:06 -0700 | [diff] [blame] | 51 | VISUALIZER_PARAM_LATENCY, // Informs the visualizer about the downstream latency |
Jean-Michel Trivi | 6885c47 | 2013-09-20 12:14:40 -0700 | [diff] [blame] | 52 | VISUALIZER_PARAM_MEASUREMENT_MODE, // Sets which measurements are to be made |
Eric Laurent | 9630925 | 2011-06-17 09:02:12 -0700 | [diff] [blame] | 53 | } t_visualizer_params; |
| 54 | |
| 55 | /* commands */ |
| 56 | typedef enum |
| 57 | { |
| 58 | VISUALIZER_CMD_CAPTURE = EFFECT_CMD_FIRST_PROPRIETARY, // Gets the latest PCM capture. |
Jean-Michel Trivi | 6885c47 | 2013-09-20 12:14:40 -0700 | [diff] [blame] | 59 | VISUALIZER_CMD_MEASURE, // Gets the current measurements |
Eric Laurent | 9630925 | 2011-06-17 09:02:12 -0700 | [diff] [blame] | 60 | }t_visualizer_cmds; |
| 61 | |
| 62 | // VISUALIZER_CMD_CAPTURE retrieves the latest PCM snapshot captured by the visualizer engine. |
| 63 | // It returns the number of samples specified by VISUALIZER_PARAM_CAPTURE_SIZE |
| 64 | // in 8 bit unsigned format (0 = 0x80) |
| 65 | |
Jean-Michel Trivi | 6885c47 | 2013-09-20 12:14:40 -0700 | [diff] [blame] | 66 | // VISUALIZER_CMD_MEASURE retrieves the lastest measurements as int32_t saved in the |
| 67 | // MEASUREMENT_IDX_* array index order. |
| 68 | |
Eric Laurent | 9630925 | 2011-06-17 09:02:12 -0700 | [diff] [blame] | 69 | #if __cplusplus |
| 70 | } // extern "C" |
| 71 | #endif |
| 72 | |
| 73 | |
| 74 | #endif /*ANDROID_EFFECT_VISUALIZER_H_*/ |