/* * Copyright (C) 2026 Amlogic Corporation. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef __AUDIO_EFFECT_PARAMS_H_ #define __AUDIO_EFFECT_PARAMS_H_ #include #include #include "Virtualx.h" #ifdef __cplusplus extern "C" { #endif //-----------Balance typedef------------------------------- //Warning:balance is used for 51 bands #define BALANCE_MAX_BANDS 51 #define HPEQ_MAX_BANDS 9 #define BITS 16 #define MAXbit (1 << (BITS - 1)) #define INT2FLOAT(a) ((float)a / MAXbit) #define FLOAT2INT(a) (int)((float)a * MAXbit) typedef enum { BALANCE_PARAM_LEVEL = 0, BALANCE_PARAM_ENABLE, BALANCE_PARAM_LEVEL_NUM, BALANCE_PARAM_INDEX, } Balanceparams; typedef struct aml_balance_param_s { effect_param_t param; uint32_t command; union { int32_t v; float f; float index[BALANCE_MAX_BANDS]; }; } aml_balance_param_t; //-------------VirtualSurround typedef-------------------------- typedef enum { VIRTUALSURROUND_PARAM_ENABLE, VIRTUALSURROUND_PARAM_EFFECTLEVEL, } Virtualsurroundparams; typedef struct aml_virtualsurround_param_s { effect_param_t param; uint32_t command; union { int32_t v; float f; }; } aml_virtualsurround_param_t; //-------------TrebleBass typedef-------------------------- typedef enum { TREBASS_PARAM_INVALID = -1, TREBASS_PARAM_BASS_LEVEL, TREBASS_PARAM_TREBLE_LEVEL, TREBASS_PARAM_ENABLE, } TREBASSparams; typedef struct aml_treblebass_param_s { effect_param_t param; uint32_t command; union { uint32_t v; float f; }; } aml_treblebass_param_t; //-------------Hpeq typedef-------------------------- typedef enum { HPEQ_PARAM_INVALID = -1, HPEQ_PARAM_ENABLE, HPEQ_PARAM_BAND_NUMBER, HPEQ_PARAM_EFFECT_MODE, HPEQ_PARAM_EFFECT_CUSTOM, HPEQ_PARAM_GAIN_RANGE, } HPEQparams; typedef struct aml_hpeq_param_s { effect_param_t param; uint32_t command; union { uint32_t v; float f; signed char band[HPEQ_MAX_BANDS]; }; } aml_hpeq_param_t; //-------------Avl typedef-------------------------- typedef enum { AVL_PARAM_ENABLE, AVL_PARAM_PEAK_LEVEL, AVL_PARAM_DYNAMIC_THRESHOLD, AVL_PARAM_NOISE_THRESHOLD, AVL_PARAM_RESPONSE_TIME, AVL_PARAM_RELEASE_TIME, AVL_PARAM_SOURCE_IN, } Avlparams; typedef struct aml_avl_param_s { effect_param_t param; uint32_t command; union { int32_t v; float f; }; } aml_avl_param_t; typedef struct Virtualx_param_s { effect_param_t param; uint32_t command; union { int32_t v; float f; float params[VX_MAX_PARAM_SIZE]; }; } Virtualx_param_t; //-------------DBX typedef-------------------------- typedef enum { DBX_PARAM_ENABLE = 0, DBX_PARAM_MODE = 1, DBX_Read_Param = 2, DBX_Write_Param = 3, DBX_Read_Coeff = 4, DBX_Write_Coeff = 5, DBX_Write_VCF = 6, DBX_Mute = 7, DBX_Version = 8, DBX_Total_Immersion = 9, } DBXparams; typedef struct aml_dbx_param_s { effect_param_t param; uint32_t command; union { int32_t v; int32_t value[2];//index & value of setting parameter int32_t dbx_mode[3];//dbx mode & Total Volume & Total Surround }; } aml_dbx_param_t; //-------------DPE typedef-------------------------- #define ARCHITECTURE_PARAM_NUM 9 #define LIMITER_PARAM_NUM 8 #define INPUT_GAIN_PARAM_NUM 1 #define MBC_PARAM_NUM 3 #define MBC_BAND_PARAM_NUM 12 /* enumerated parameters for dynamics processing effect */ typedef enum { DP_PARAM_ENABLE = 0x05, DP_PARAM_GET_CHANNEL_COUNT = 0x10, DP_PARAM_INPUT_GAIN = 0x20, DP_PARAM_ENGINE_ARCHITECTURE = 0x30, DP_PARAM_PRE_EQ = 0x40, DP_PARAM_PRE_EQ_BAND = 0x45, DP_PARAM_MBC = 0x50, DP_PARAM_MBC_BAND = 0x55, DP_PARAM_POST_EQ = 0x60, DP_PARAM_POST_EQ_BAND = 0x65, DP_PARAM_LIMITER = 0x70, DP_PARAM_SET_Threshold = 0X75, DP_PARAM_SET_AttackTime = 0X80, DP_PARAM_SET_ReleaseTime = 0x85, } Dpeparams; typedef struct aml_dpe_param_s { effect_param_t param; uint32_t command[2]; union { int32_t v; float f; float limiter[MBC_BAND_PARAM_NUM]; }; } aml_dpe_param_t; typedef struct cmd_param_str { const char *param; int key; int userId; } VX_Cmd_Param; typedef struct Virtualx_v4_param_s { effect_param_t param; /* 3 (void *) data of param start*/ /* 3.1 psize of low level param */ uint32_t command; /* 3.2 vsize of low level value */ union { int32_t v; float f; char str[VX4_MAX_PARAM_VALUE_STR_LEN]; float params[VX4_MAX_PARAM_SIZE]; }; } Virtualx_v4_param_t; #ifdef __cplusplus } #endif #endif /* __AUDIO_EFFECT_PARAMS_H_ */