| 1 | /*************************************************************************** |
|---|
| 2 | * (c)2004-2011 Broadcom Corporation |
|---|
| 3 | * |
|---|
| 4 | * This program is the proprietary software of Broadcom Corporation and/or its licensors, |
|---|
| 5 | * and may only be used, duplicated, modified or distributed pursuant to the terms and |
|---|
| 6 | * conditions of a separate, written license agreement executed between you and Broadcom |
|---|
| 7 | * (an "Authorized License"). Except as set forth in an Authorized License, Broadcom grants |
|---|
| 8 | * no license (express or implied), right to use, or waiver of any kind with respect to the |
|---|
| 9 | * Software, and Broadcom expressly reserves all rights in and to the Software and all |
|---|
| 10 | * intellectual property rights therein. IF YOU HAVE NO AUTHORIZED LICENSE, THEN YOU |
|---|
| 11 | * HAVE NO RIGHT TO USE THIS SOFTWARE IN ANY WAY, AND SHOULD IMMEDIATELY |
|---|
| 12 | * NOTIFY BROADCOM AND DISCONTINUE ALL USE OF THE SOFTWARE. |
|---|
| 13 | * |
|---|
| 14 | * Except as expressly set forth in the Authorized License, |
|---|
| 15 | * |
|---|
| 16 | * 1. This program, including its structure, sequence and organization, constitutes the valuable trade |
|---|
| 17 | * secrets of Broadcom, and you shall use all reasonable efforts to protect the confidentiality thereof, |
|---|
| 18 | * and to use this information only in connection with your use of Broadcom integrated circuit products. |
|---|
| 19 | * |
|---|
| 20 | * 2. TO THE MAXIMUM EXTENT PERMITTED BY LAW, THE SOFTWARE IS PROVIDED "AS IS" |
|---|
| 21 | * AND WITH ALL FAULTS AND BROADCOM MAKES NO PROMISES, REPRESENTATIONS OR |
|---|
| 22 | * WARRANTIES, EITHER EXPRESS, IMPLIED, STATUTORY, OR OTHERWISE, WITH RESPECT TO |
|---|
| 23 | * THE SOFTWARE. BROADCOM SPECIFICALLY DISCLAIMS ANY AND ALL IMPLIED WARRANTIES |
|---|
| 24 | * OF TITLE, MERCHANTABILITY, NONINFRINGEMENT, FITNESS FOR A PARTICULAR PURPOSE, |
|---|
| 25 | * LACK OF VIRUSES, ACCURACY OR COMPLETENESS, QUIET ENJOYMENT, QUIET POSSESSION |
|---|
| 26 | * OR CORRESPONDENCE TO DESCRIPTION. YOU ASSUME THE ENTIRE RISK ARISING OUT OF |
|---|
| 27 | * USE OR PERFORMANCE OF THE SOFTWARE. |
|---|
| 28 | * |
|---|
| 29 | * 3. TO THE MAXIMUM EXTENT PERMITTED BY LAW, IN NO EVENT SHALL BROADCOM OR ITS |
|---|
| 30 | * LICENSORS BE LIABLE FOR (i) CONSEQUENTIAL, INCIDENTAL, SPECIAL, INDIRECT, OR |
|---|
| 31 | * EXEMPLARY DAMAGES WHATSOEVER ARISING OUT OF OR IN ANY WAY RELATING TO YOUR |
|---|
| 32 | * USE OF OR INABILITY TO USE THE SOFTWARE EVEN IF BROADCOM HAS BEEN ADVISED OF |
|---|
| 33 | * THE POSSIBILITY OF SUCH DAMAGES; OR (ii) ANY AMOUNT IN EXCESS OF THE AMOUNT |
|---|
| 34 | * ACTUALLY PAID FOR THE SOFTWARE ITSELF OR U.S. $1, WHICHEVER IS GREATER. THESE |
|---|
| 35 | * LIMITATIONS SHALL APPLY NOTWITHSTANDING ANY FAILURE OF ESSENTIAL PURPOSE OF |
|---|
| 36 | * ANY LIMITED REMEDY. |
|---|
| 37 | * |
|---|
| 38 | * $brcm_Workfile: bape_audyssey_adv.c $ |
|---|
| 39 | * $brcm_Revision: Hydra_Software_Devel/1 $ |
|---|
| 40 | * $brcm_Date: 5/14/11 11:22a $ |
|---|
| 41 | * |
|---|
| 42 | * API Description: |
|---|
| 43 | * API name: AudysseyAdv |
|---|
| 44 | * Specific APIs related to Audyssey ADV Audio Processing |
|---|
| 45 | * |
|---|
| 46 | * Revision History: |
|---|
| 47 | * |
|---|
| 48 | * $brcm_Log: /magnum/portinginterface/ape/7422/bape_audyssey_adv.c $ |
|---|
| 49 | * |
|---|
| 50 | * Hydra_Software_Devel/1 5/14/11 11:22a jgarrett |
|---|
| 51 | * SWDTV-6762: Adding Audyssey ADV/ABX |
|---|
| 52 | * |
|---|
| 53 | ***************************************************************************/ |
|---|
| 54 | |
|---|
| 55 | #include "bape.h" |
|---|
| 56 | #include "bape_priv.h" |
|---|
| 57 | #include "bdsp_raaga.h" |
|---|
| 58 | |
|---|
| 59 | BDBG_MODULE(bape_audyssey_adv); |
|---|
| 60 | |
|---|
| 61 | BDBG_OBJECT_ID(BAPE_AudysseyAdv); |
|---|
| 62 | |
|---|
| 63 | typedef struct BAPE_AudysseyAdv |
|---|
| 64 | { |
|---|
| 65 | BDBG_OBJECT(BAPE_AudysseyAdv) |
|---|
| 66 | BAPE_PathNode node; |
|---|
| 67 | BAPE_AudysseyAdvSettings settings; |
|---|
| 68 | BAPE_Connector input; |
|---|
| 69 | } BAPE_AudysseyAdv; |
|---|
| 70 | |
|---|
| 71 | static BERR_Code BAPE_AudysseyAdv_P_ConnectorSupported(struct BAPE_PathNode *pNode, BAPE_PathConnector *pConnector); |
|---|
| 72 | static BERR_Code BAPE_AudysseyAdv_P_AllocatePathFromInput(struct BAPE_PathNode *pNode, struct BAPE_PathConnection *pConnection); |
|---|
| 73 | static BERR_Code BAPE_AudysseyAdv_P_ConfigPathFromInput(struct BAPE_PathNode *pNode, struct BAPE_PathConnection *pConnection); |
|---|
| 74 | static BERR_Code BAPE_AudysseyAdv_P_ApplyDspSettings(BAPE_AudysseyAdvHandle handle, BDSP_TaskHandle task, unsigned branchId, unsigned stageId); |
|---|
| 75 | static void BAPE_AudysseyAdv_P_StopPathFromInput(struct BAPE_PathNode *pNode, struct BAPE_PathConnection *pConnection); |
|---|
| 76 | static void BAPE_AudysseyAdv_P_RemoveInputCallback(struct BAPE_PathNode *pNode, BAPE_PathConnector *pConnector); |
|---|
| 77 | |
|---|
| 78 | void BAPE_AudysseyAdv_GetDefaultSettings( |
|---|
| 79 | BAPE_AudysseyAdvSettings *pSettings /* [out] default settings */ |
|---|
| 80 | ) |
|---|
| 81 | { |
|---|
| 82 | BDSP_Raaga_Audio_AudysseyVolUserConfig dspSettings; |
|---|
| 83 | unsigned i; |
|---|
| 84 | |
|---|
| 85 | BDBG_ASSERT(NULL != pSettings); |
|---|
| 86 | BKNI_Memset(pSettings, 0, sizeof(*pSettings)); |
|---|
| 87 | BDSP_Raaga_GetDefaultAudioProcessingSettings(BDSP_AudioProcessing_eAudysseyVolume, (void *)&dspSettings, sizeof(dspSettings)); |
|---|
| 88 | |
|---|
| 89 | pSettings->enabled = (dspSettings.ui32AudysseyVolBypass == 1) ? false : true; |
|---|
| 90 | pSettings->channelMask = (uint8_t)dspSettings.i32ChannelMask; |
|---|
| 91 | pSettings->reInitialize = 0; |
|---|
| 92 | pSettings->volumeScalingEnabled = dspSettings.i32SwAudysseyVol; |
|---|
| 93 | pSettings->dynamicSurroundGainEnabled = dspSettings.i32SwDynSurrGain; |
|---|
| 94 | pSettings->hiLoCompress = dspSettings.i32SwHiLoCmpress; |
|---|
| 95 | pSettings->dynamicEqMode = (BAPE_AudysseyAdvDynamicEqMode)dspSettings.i32SwDynEQ; |
|---|
| 96 | pSettings->volume = 0; |
|---|
| 97 | BDBG_ASSERT(0 == dspSettings.i32dBVolSetting); |
|---|
| 98 | pSettings->gainCompression = dspSettings.i32GCF; |
|---|
| 99 | pSettings->headroomOffset = 0; |
|---|
| 100 | BDBG_ASSERT(0 == dspSettings.i32HeadroomOffset); |
|---|
| 101 | for ( i = 0; i < 8; i++ ) |
|---|
| 102 | { |
|---|
| 103 | pSettings->chCalbGain[i] = 0; |
|---|
| 104 | BDBG_ASSERT(0==dspSettings.i32chCalbGain[i]); |
|---|
| 105 | } |
|---|
| 106 | } |
|---|
| 107 | |
|---|
| 108 | /*************************************************************************** |
|---|
| 109 | Summary: |
|---|
| 110 | Open an SRS AudysseyAdv stage |
|---|
| 111 | ***************************************************************************/ |
|---|
| 112 | BERR_Code BAPE_AudysseyAdv_Create( |
|---|
| 113 | BAPE_Handle deviceHandle, |
|---|
| 114 | const BAPE_AudysseyAdvSettings *pSettings, |
|---|
| 115 | BAPE_AudysseyAdvHandle *pHandle |
|---|
| 116 | ) |
|---|
| 117 | { |
|---|
| 118 | BAPE_AudysseyAdvHandle handle; |
|---|
| 119 | |
|---|
| 120 | BDBG_OBJECT_ASSERT(deviceHandle, BAPE_Device); |
|---|
| 121 | BDBG_ASSERT(NULL != pSettings); |
|---|
| 122 | BDBG_ASSERT(NULL != pHandle); |
|---|
| 123 | |
|---|
| 124 | handle = BKNI_Malloc(sizeof(BAPE_AudysseyAdv)); |
|---|
| 125 | if ( NULL == handle ) |
|---|
| 126 | { |
|---|
| 127 | return BERR_TRACE(BERR_OUT_OF_SYSTEM_MEMORY); |
|---|
| 128 | } |
|---|
| 129 | BKNI_Memset(handle, 0, sizeof(BAPE_AudysseyAdv)); |
|---|
| 130 | BDBG_OBJECT_SET(handle, BAPE_AudysseyAdv); |
|---|
| 131 | handle->settings = *pSettings; |
|---|
| 132 | BAPE_P_InitPathNode(&handle->node, BAPE_PathNodeType_ePostProcessor, BAPE_PostProcessorType_eAudysseyAdv, 1, deviceHandle, handle); |
|---|
| 133 | handle->node.pName = "AVL"; |
|---|
| 134 | handle->node.paths[0].connector.numChannelPairs = 1; /* Only output stereo */ |
|---|
| 135 | handle->node.paths[0].connector.useBufferPool = true; |
|---|
| 136 | handle->node.paths[0].connector.dataSource = BAPE_DataSource_eDspBuffer; |
|---|
| 137 | |
|---|
| 138 | /* Generic Routines */ |
|---|
| 139 | handle->node.allocatePathToOutput = BAPE_DSP_P_AllocatePathToOutput; |
|---|
| 140 | handle->node.configPathToOutput = BAPE_DSP_P_ConfigPathToOutput; |
|---|
| 141 | handle->node.stopPathToOutput = BAPE_DSP_P_StopPathToOutput; |
|---|
| 142 | handle->node.startPathToOutput = BAPE_DSP_P_StartPathToOutput; |
|---|
| 143 | handle->node.stopPathToOutput = BAPE_DSP_P_StopPathToOutput; |
|---|
| 144 | |
|---|
| 145 | /* AudysseyAdv Specifics */ |
|---|
| 146 | handle->node.connectorSupported = BAPE_AudysseyAdv_P_ConnectorSupported; |
|---|
| 147 | handle->node.allocatePathFromInput = BAPE_AudysseyAdv_P_AllocatePathFromInput; |
|---|
| 148 | handle->node.configPathFromInput = BAPE_AudysseyAdv_P_ConfigPathFromInput; |
|---|
| 149 | handle->node.stopPathFromInput = BAPE_AudysseyAdv_P_StopPathFromInput; |
|---|
| 150 | handle->node.removeInput = BAPE_AudysseyAdv_P_RemoveInputCallback; |
|---|
| 151 | |
|---|
| 152 | *pHandle = handle; |
|---|
| 153 | return BERR_SUCCESS; |
|---|
| 154 | } |
|---|
| 155 | |
|---|
| 156 | void BAPE_AudysseyAdv_Destroy( |
|---|
| 157 | BAPE_AudysseyAdvHandle handle |
|---|
| 158 | ) |
|---|
| 159 | { |
|---|
| 160 | bool running; |
|---|
| 161 | BDBG_OBJECT_ASSERT(handle, BAPE_AudysseyAdv); |
|---|
| 162 | running = (handle->node.paths[0].connector.task != NULL)?true:false; |
|---|
| 163 | BDBG_ASSERT(false == running); |
|---|
| 164 | BDBG_ASSERT(NULL == handle->input); |
|---|
| 165 | BDBG_OBJECT_DESTROY(handle, BAPE_AudysseyAdv); |
|---|
| 166 | BKNI_Free(handle); |
|---|
| 167 | } |
|---|
| 168 | |
|---|
| 169 | void BAPE_AudysseyAdv_GetSettings( |
|---|
| 170 | BAPE_AudysseyAdvHandle handle, |
|---|
| 171 | BAPE_AudysseyAdvSettings *pSettings /* [out] Settings */ |
|---|
| 172 | ) |
|---|
| 173 | { |
|---|
| 174 | BDBG_OBJECT_ASSERT(handle, BAPE_AudysseyAdv); |
|---|
| 175 | BDBG_ASSERT(NULL != pSettings); |
|---|
| 176 | *pSettings = handle->settings; |
|---|
| 177 | } |
|---|
| 178 | |
|---|
| 179 | BERR_Code BAPE_AudysseyAdv_SetSettings( |
|---|
| 180 | BAPE_AudysseyAdvHandle handle, |
|---|
| 181 | const BAPE_AudysseyAdvSettings *pSettings |
|---|
| 182 | ) |
|---|
| 183 | { |
|---|
| 184 | BERR_Code errCode; |
|---|
| 185 | BDBG_OBJECT_ASSERT(handle, BAPE_AudysseyAdv); |
|---|
| 186 | BDBG_ASSERT(NULL != pSettings); |
|---|
| 187 | |
|---|
| 188 | if ( pSettings != &handle->settings ) |
|---|
| 189 | { |
|---|
| 190 | handle->settings = *pSettings; |
|---|
| 191 | } |
|---|
| 192 | |
|---|
| 193 | if ( handle->node.paths[0].connector.task != NULL ) |
|---|
| 194 | { |
|---|
| 195 | errCode = BAPE_AudysseyAdv_P_ApplyDspSettings(handle, |
|---|
| 196 | handle->node.paths[0].connector.task, |
|---|
| 197 | handle->node.paths[0].connector.branchId, |
|---|
| 198 | handle->node.paths[0].connector.stageId); |
|---|
| 199 | if ( errCode ) |
|---|
| 200 | { |
|---|
| 201 | return BERR_TRACE(errCode); |
|---|
| 202 | } |
|---|
| 203 | } |
|---|
| 204 | |
|---|
| 205 | return BERR_SUCCESS; |
|---|
| 206 | } |
|---|
| 207 | |
|---|
| 208 | |
|---|
| 209 | void BAPE_AudysseyAdv_GetConnector( |
|---|
| 210 | BAPE_AudysseyAdvHandle handle, |
|---|
| 211 | BAPE_Connector *pConnector |
|---|
| 212 | ) |
|---|
| 213 | { |
|---|
| 214 | BDBG_OBJECT_ASSERT(handle, BAPE_AudysseyAdv); |
|---|
| 215 | BDBG_ASSERT(NULL != pConnector); |
|---|
| 216 | *pConnector = &handle->node.paths[0].connector; |
|---|
| 217 | } |
|---|
| 218 | |
|---|
| 219 | |
|---|
| 220 | BERR_Code BAPE_AudysseyAdv_AddInput( |
|---|
| 221 | BAPE_AudysseyAdvHandle handle, |
|---|
| 222 | BAPE_Connector input |
|---|
| 223 | ) |
|---|
| 224 | { |
|---|
| 225 | BERR_Code errCode; |
|---|
| 226 | BDBG_OBJECT_ASSERT(handle, BAPE_AudysseyAdv); |
|---|
| 227 | BDBG_OBJECT_ASSERT(input, BAPE_PathConnector); |
|---|
| 228 | if ( NULL != handle->input ) |
|---|
| 229 | { |
|---|
| 230 | BDBG_ERR(("Can not have more than one input")); |
|---|
| 231 | return BERR_TRACE(BERR_NOT_SUPPORTED); |
|---|
| 232 | } |
|---|
| 233 | errCode = BAPE_PathNode_P_AddInput(&handle->node, input); |
|---|
| 234 | if ( errCode ) |
|---|
| 235 | { |
|---|
| 236 | return BERR_TRACE(errCode); |
|---|
| 237 | } |
|---|
| 238 | handle->input = input; |
|---|
| 239 | return BERR_SUCCESS; |
|---|
| 240 | } |
|---|
| 241 | |
|---|
| 242 | |
|---|
| 243 | BERR_Code BAPE_AudysseyAdv_RemoveInput( |
|---|
| 244 | BAPE_AudysseyAdvHandle handle, |
|---|
| 245 | BAPE_Connector input |
|---|
| 246 | ) |
|---|
| 247 | { |
|---|
| 248 | BERR_Code errCode; |
|---|
| 249 | BDBG_OBJECT_ASSERT(handle, BAPE_AudysseyAdv); |
|---|
| 250 | BDBG_OBJECT_ASSERT(input, BAPE_PathConnector); |
|---|
| 251 | if ( input != handle->input ) |
|---|
| 252 | { |
|---|
| 253 | BDBG_ERR(("Input %s %s (%#x) is not connected", input->pParent->pName, input->pName, input)); |
|---|
| 254 | return BERR_TRACE(BERR_INVALID_PARAMETER); |
|---|
| 255 | } |
|---|
| 256 | errCode = BAPE_PathNode_P_RemoveInput(&handle->node, input); |
|---|
| 257 | if ( errCode ) |
|---|
| 258 | { |
|---|
| 259 | return BERR_TRACE(errCode); |
|---|
| 260 | } |
|---|
| 261 | handle->input = NULL; |
|---|
| 262 | return BERR_SUCCESS; |
|---|
| 263 | } |
|---|
| 264 | |
|---|
| 265 | |
|---|
| 266 | BERR_Code BAPE_AudysseyAdv_RemoveAllInputs( |
|---|
| 267 | BAPE_AudysseyAdvHandle handle |
|---|
| 268 | ) |
|---|
| 269 | { |
|---|
| 270 | BDBG_OBJECT_ASSERT(handle, BAPE_AudysseyAdv); |
|---|
| 271 | if ( handle->input ) |
|---|
| 272 | { |
|---|
| 273 | return BAPE_AudysseyAdv_RemoveInput(handle, handle->input); |
|---|
| 274 | } |
|---|
| 275 | return BERR_SUCCESS; |
|---|
| 276 | } |
|---|
| 277 | |
|---|
| 278 | static BERR_Code BAPE_AudysseyAdv_P_ConnectorSupported(struct BAPE_PathNode *pNode, BAPE_PathConnector *pConnector) |
|---|
| 279 | { |
|---|
| 280 | BDBG_OBJECT_ASSERT(pNode, BAPE_PathNode); |
|---|
| 281 | BDBG_OBJECT_ASSERT(pConnector, BAPE_PathConnector); |
|---|
| 282 | if ( pConnector->dataSource == BAPE_DataSource_eDspBuffer && |
|---|
| 283 | pConnector->numChannelPairs == 1 && |
|---|
| 284 | !pConnector->compressed ) |
|---|
| 285 | { |
|---|
| 286 | return BERR_SUCCESS; |
|---|
| 287 | } |
|---|
| 288 | else |
|---|
| 289 | { |
|---|
| 290 | BDBG_ERR(("Only stereo DSP input is supported")); |
|---|
| 291 | return BERR_TRACE(BERR_INVALID_PARAMETER); |
|---|
| 292 | } |
|---|
| 293 | } |
|---|
| 294 | |
|---|
| 295 | static BERR_Code BAPE_AudysseyAdv_P_AllocatePathFromInput(struct BAPE_PathNode *pNode, struct BAPE_PathConnection *pConnection) |
|---|
| 296 | { |
|---|
| 297 | BERR_Code errCode; |
|---|
| 298 | BAPE_AudysseyAdvHandle handle; |
|---|
| 299 | BDBG_OBJECT_ASSERT(pNode, BAPE_PathNode); |
|---|
| 300 | BDBG_OBJECT_ASSERT(pConnection, BAPE_PathConnection); |
|---|
| 301 | BDBG_ASSERT(NULL != pConnection->pSource->pTaskCreateSettings); |
|---|
| 302 | handle = pNode->pHandle; |
|---|
| 303 | BDBG_OBJECT_ASSERT(handle, BAPE_AudysseyAdv); |
|---|
| 304 | /* Add stage to CIT and propagate task settings */ |
|---|
| 305 | errCode = BAPE_DSP_P_AddProcessingStage(pConnection->pSource->pTaskCreateSettings, pConnection->pSource->branchId, pConnection->pSource->stageId, |
|---|
| 306 | BAPE_DSP_P_GetDataTypeFromConnector(handle->input), |
|---|
| 307 | BDSP_AudioProcessing_eAudysseyVolume, |
|---|
| 308 | false, |
|---|
| 309 | &pNode->paths[0].connector.branchId, &pNode->paths[0].connector.stageId); |
|---|
| 310 | if ( errCode ) |
|---|
| 311 | { |
|---|
| 312 | return BERR_TRACE(errCode); |
|---|
| 313 | } |
|---|
| 314 | pNode->paths[0].connector.pTaskCreateSettings = pConnection->pSource->pTaskCreateSettings; |
|---|
| 315 | return BERR_SUCCESS; |
|---|
| 316 | } |
|---|
| 317 | |
|---|
| 318 | static BERR_Code BAPE_AudysseyAdv_P_ConfigPathFromInput(struct BAPE_PathNode *pNode, struct BAPE_PathConnection *pConnection) |
|---|
| 319 | { |
|---|
| 320 | BERR_Code errCode; |
|---|
| 321 | BAPE_AudysseyAdvHandle handle; |
|---|
| 322 | BDBG_OBJECT_ASSERT(pNode, BAPE_PathNode); |
|---|
| 323 | BDBG_OBJECT_ASSERT(pConnection, BAPE_PathConnection); |
|---|
| 324 | BDBG_ASSERT(NULL != pConnection->pSource->task); |
|---|
| 325 | |
|---|
| 326 | handle = pNode->pHandle; |
|---|
| 327 | BDBG_OBJECT_ASSERT(handle, BAPE_AudysseyAdv); |
|---|
| 328 | pNode->paths[0].connector.task = pConnection->pSource->task; |
|---|
| 329 | errCode = BAPE_AudysseyAdv_P_ApplyDspSettings(handle, |
|---|
| 330 | handle->node.paths[0].connector.task, |
|---|
| 331 | handle->node.paths[0].connector.branchId, |
|---|
| 332 | handle->node.paths[0].connector.stageId); |
|---|
| 333 | if ( errCode ) |
|---|
| 334 | { |
|---|
| 335 | return BERR_TRACE(errCode); |
|---|
| 336 | } |
|---|
| 337 | |
|---|
| 338 | return BERR_SUCCESS; |
|---|
| 339 | } |
|---|
| 340 | |
|---|
| 341 | static BERR_Code BAPE_AudysseyAdv_P_ApplyDspSettings(BAPE_AudysseyAdvHandle handle, BDSP_TaskHandle task, unsigned branchId, unsigned stageId) |
|---|
| 342 | { |
|---|
| 343 | BERR_Code errCode; |
|---|
| 344 | BDSP_Raaga_Audio_AudysseyVolUserConfig userConfig; |
|---|
| 345 | unsigned i; |
|---|
| 346 | |
|---|
| 347 | errCode = BDSP_Task_GetStageSettings(task, branchId, stageId, &userConfig, sizeof(userConfig)); |
|---|
| 348 | if ( errCode ) |
|---|
| 349 | { |
|---|
| 350 | return BERR_TRACE(errCode); |
|---|
| 351 | } |
|---|
| 352 | |
|---|
| 353 | BAPE_DSP_P_SET_VARIABLE(userConfig, ui32AudysseyVolBypass, handle->settings.enabled?0:1); |
|---|
| 354 | BAPE_DSP_P_SET_VARIABLE(userConfig, ui32NumChannels, 2*handle->input->numChannelPairs); |
|---|
| 355 | BAPE_DSP_P_SET_VARIABLE(userConfig, i32ChannelMask, handle->settings.channelMask); |
|---|
| 356 | BAPE_DSP_P_SET_VARIABLE(userConfig, i32AudysseyVolInit, handle->settings.reInitialize); |
|---|
| 357 | BAPE_DSP_P_SET_VARIABLE(userConfig, i32SwAudysseyVol, handle->settings.volumeScalingEnabled?1:0); |
|---|
| 358 | BAPE_DSP_P_SET_VARIABLE(userConfig, i32SwDynSurrGain, handle->settings.dynamicSurroundGainEnabled?1:0); |
|---|
| 359 | BAPE_DSP_P_SET_VARIABLE(userConfig, i32SwHiLoCmpress, handle->settings.hiLoCompress?1:0); |
|---|
| 360 | BAPE_DSP_P_SET_VARIABLE(userConfig, i32SwDynEQ, (int32_t)handle->settings.dynamicEqMode); |
|---|
| 361 | BAPE_DSP_P_SET_VARIABLE(userConfig, i32dBVolSetting, BAPE_P_FloatToQ1022(handle->settings.volume, 10)); |
|---|
| 362 | BAPE_DSP_P_SET_VARIABLE(userConfig, i32GCF, handle->settings.gainCompression); |
|---|
| 363 | BAPE_DSP_P_SET_VARIABLE(userConfig, i32dBVolSetting, BAPE_P_FloatToQ1022(handle->settings.headroomOffset, 100)); |
|---|
| 364 | BAPE_DSP_P_SET_VARIABLE(userConfig, i32dBVolSetting, BAPE_P_FloatToQ1022(handle->settings.headroomOffset, 100)); |
|---|
| 365 | for ( i = 0; i < 8; i++ ) |
|---|
| 366 | { |
|---|
| 367 | BAPE_DSP_P_SET_VARIABLE(userConfig, i32chCalbGain[i], BAPE_P_FloatToQ1022(handle->settings.chCalbGain[i], 100)); |
|---|
| 368 | } |
|---|
| 369 | |
|---|
| 370 | errCode = BDSP_Task_SetStageSettings(task, branchId, stageId, &userConfig, sizeof(userConfig)); |
|---|
| 371 | if ( errCode ) |
|---|
| 372 | { |
|---|
| 373 | return BERR_TRACE(errCode); |
|---|
| 374 | } |
|---|
| 375 | |
|---|
| 376 | return BERR_SUCCESS; |
|---|
| 377 | } |
|---|
| 378 | |
|---|
| 379 | static void BAPE_AudysseyAdv_P_StopPathFromInput(struct BAPE_PathNode *pNode, struct BAPE_PathConnection *pConnection) |
|---|
| 380 | { |
|---|
| 381 | /* Invalidate task handle */ |
|---|
| 382 | BDBG_OBJECT_ASSERT(pNode, BAPE_PathNode); |
|---|
| 383 | BSTD_UNUSED(pConnection); |
|---|
| 384 | pNode->paths[0].connector.task = NULL; |
|---|
| 385 | } |
|---|
| 386 | |
|---|
| 387 | static void BAPE_AudysseyAdv_P_RemoveInputCallback(struct BAPE_PathNode *pNode, BAPE_PathConnector *pConnector) |
|---|
| 388 | { |
|---|
| 389 | (void)BAPE_AudysseyAdv_RemoveInput(pNode->pHandle, pConnector); |
|---|
| 390 | } |
|---|
| 391 | |
|---|
| 392 | BERR_Code BAPE_AudysseyAdv_GetStatus( |
|---|
| 393 | BAPE_AudysseyAdvHandle handle, |
|---|
| 394 | BAPE_AudysseyAdvStatus *pStatus /* [out] Status */ |
|---|
| 395 | ) |
|---|
| 396 | { |
|---|
| 397 | BDSP_Raaga_Audio_AudysseyVolStatusInfo statusInfo; |
|---|
| 398 | unsigned i; |
|---|
| 399 | BERR_Code errCode; |
|---|
| 400 | |
|---|
| 401 | if ( NULL == handle->node.paths[0].connector.task ) |
|---|
| 402 | { |
|---|
| 403 | BDBG_ERR(("Not started, status not available")); |
|---|
| 404 | return BERR_TRACE(BERR_NOT_SUPPORTED); |
|---|
| 405 | } |
|---|
| 406 | |
|---|
| 407 | errCode = BDSP_Task_GetStageStatus(handle->node.paths[0].connector.task, |
|---|
| 408 | handle->node.paths[0].connector.branchId, |
|---|
| 409 | handle->node.paths[0].connector.stageId, |
|---|
| 410 | &statusInfo, sizeof(statusInfo)); |
|---|
| 411 | if ( errCode ) |
|---|
| 412 | { |
|---|
| 413 | return BERR_TRACE(errCode); |
|---|
| 414 | } |
|---|
| 415 | |
|---|
| 416 | pStatus->volumeApplied = statusInfo.i32Vol_Applied_dB; |
|---|
| 417 | pStatus->numChannels = statusInfo.ui32NumChannels; |
|---|
| 418 | pStatus->dynamicEqMode = statusInfo.i32SwDynEQ; |
|---|
| 419 | for ( i = 0; i < 8; i++ ) |
|---|
| 420 | { |
|---|
| 421 | pStatus->chCalcLevel[i] = statusInfo.i32chCalcLevel[i]; |
|---|
| 422 | } |
|---|
| 423 | |
|---|
| 424 | return BERR_SUCCESS; |
|---|
| 425 | } |
|---|
| 426 | |
|---|