| 1 | /*************************************************************************** |
|---|
| 2 | * (c)2004-2010 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_dolby_volume.c $ |
|---|
| 39 | * $brcm_Revision: Hydra_Software_Devel/5 $ |
|---|
| 40 | * $brcm_Date: 5/27/11 11:20a $ |
|---|
| 41 | * |
|---|
| 42 | * API Description: |
|---|
| 43 | * API name: DolbyVolume |
|---|
| 44 | * Specific APIs related to Dolby Volume Audio Processing |
|---|
| 45 | * |
|---|
| 46 | * Revision History: |
|---|
| 47 | * |
|---|
| 48 | * $brcm_Log: /magnum/portinginterface/ape/7422/bape_dolby_volume.c $ |
|---|
| 49 | * |
|---|
| 50 | * Hydra_Software_Devel/5 5/27/11 11:20a jgarrett |
|---|
| 51 | * SW7425-408: Revising format propagation logic |
|---|
| 52 | * |
|---|
| 53 | * Hydra_Software_Devel/4 5/25/11 5:14p jgarrett |
|---|
| 54 | * SW7425-408: Fixed CIT and userconfig errors |
|---|
| 55 | * |
|---|
| 56 | * Hydra_Software_Devel/3 5/14/11 11:56a jgarrett |
|---|
| 57 | * SW7425-407: Adding DV258 Support |
|---|
| 58 | * |
|---|
| 59 | * Hydra_Software_Devel/2 2/22/11 5:43p jgarrett |
|---|
| 60 | * SW7422-146: Implemented type renaming based on filter graph review |
|---|
| 61 | * comments |
|---|
| 62 | * |
|---|
| 63 | * Hydra_Software_Devel/1 1/12/11 4:24p jgarrett |
|---|
| 64 | * SW7422-146: Adding additional APIs |
|---|
| 65 | * |
|---|
| 66 | ***************************************************************************/ |
|---|
| 67 | |
|---|
| 68 | #include "bape.h" |
|---|
| 69 | #include "bape_priv.h" |
|---|
| 70 | #include "bdsp_raaga.h" |
|---|
| 71 | |
|---|
| 72 | BDBG_MODULE(bape_dolby_volume); |
|---|
| 73 | |
|---|
| 74 | BDBG_OBJECT_ID(BAPE_DolbyVolume); |
|---|
| 75 | |
|---|
| 76 | typedef struct BAPE_DolbyVolume |
|---|
| 77 | { |
|---|
| 78 | BDBG_OBJECT(BAPE_DolbyVolume) |
|---|
| 79 | BAPE_PathNode node; |
|---|
| 80 | BAPE_DolbyVolumeSettings settings; |
|---|
| 81 | BAPE_Connector input; |
|---|
| 82 | } BAPE_DolbyVolume; |
|---|
| 83 | |
|---|
| 84 | static BERR_Code BAPE_DolbyVolume_P_ConnectorSupported(struct BAPE_PathNode *pNode, BAPE_PathConnector *pConnector); |
|---|
| 85 | static BERR_Code BAPE_DolbyVolume_P_AllocatePathFromInput(struct BAPE_PathNode *pNode, struct BAPE_PathConnection *pConnection); |
|---|
| 86 | static BERR_Code BAPE_DolbyVolume_P_ConfigPathFromInput(struct BAPE_PathNode *pNode, struct BAPE_PathConnection *pConnection); |
|---|
| 87 | static BERR_Code BAPE_DolbyVolume_P_ApplyDspSettings(BAPE_DolbyVolumeHandle handle, BDSP_TaskHandle task, unsigned branchId, unsigned stageId); |
|---|
| 88 | static void BAPE_DolbyVolume_P_StopPathFromInput(struct BAPE_PathNode *pNode, struct BAPE_PathConnection *pConnection); |
|---|
| 89 | static void BAPE_DolbyVolume_P_RemoveInputCallback(struct BAPE_PathNode *pNode, BAPE_PathConnector *pConnector); |
|---|
| 90 | |
|---|
| 91 | void BAPE_DolbyVolume_GetDefaultSettings( |
|---|
| 92 | BAPE_DolbyVolumeSettings *pSettings /* [out] default settings */ |
|---|
| 93 | ) |
|---|
| 94 | { |
|---|
| 95 | BDSP_Raaga_Audio_DV258ConfigParams dspSettings; |
|---|
| 96 | |
|---|
| 97 | BDBG_ASSERT(NULL != pSettings); |
|---|
| 98 | BKNI_Memset(pSettings, 0, sizeof(*pSettings)); |
|---|
| 99 | BDSP_Raaga_GetDefaultAudioProcessingSettings(BDSP_AudioProcessing_eDv258, (void *)&dspSettings, sizeof(dspSettings)); |
|---|
| 100 | |
|---|
| 101 | BKNI_Memset(pSettings, 0, sizeof(*pSettings)); |
|---|
| 102 | pSettings->enabled = (dspSettings.i32DolbyVolumeEnable == 0) ? false : true; |
|---|
| 103 | pSettings->preGain = dspSettings.i32Pregain; |
|---|
| 104 | pSettings->inputReferenceLevel = dspSettings.i32InputReferenceLevel; |
|---|
| 105 | pSettings->outputReferenceLevel = dspSettings.i32OutputReferenceLevel; |
|---|
| 106 | pSettings->calibrationOffset = dspSettings.i32CalibrationOffset; |
|---|
| 107 | pSettings->reset = false; |
|---|
| 108 | pSettings->volumeModelerEnabled = (dspSettings.i32VlmMdlEnable == 0) ? false : true; |
|---|
| 109 | pSettings->digitalVolumeLevel = dspSettings.i32DigitalVolumeLevel; |
|---|
| 110 | pSettings->analogVolumeLevel = dspSettings.i32AnalogVolumeLevel; |
|---|
| 111 | pSettings->volumeLevelerEnabled = (dspSettings.i32LvlEnable == 0) ? false : true; |
|---|
| 112 | pSettings->midsideProcessingEnabled = (dspSettings.i32EnableMidsideProc == 0) ? false : true; |
|---|
| 113 | pSettings->halfModeEnabled = (dspSettings.i32HalfmodeFlag == 0) ? false : true; |
|---|
| 114 | pSettings->volumeLevelerAmount = dspSettings.i32LvlAmount; |
|---|
| 115 | pSettings->limiterEnabled = (dspSettings.i32LimiterEnable == 0) ? false : true; |
|---|
| 116 | } |
|---|
| 117 | |
|---|
| 118 | /*************************************************************************** |
|---|
| 119 | Summary: |
|---|
| 120 | Open an SRS DolbyVolume stage |
|---|
| 121 | ***************************************************************************/ |
|---|
| 122 | BERR_Code BAPE_DolbyVolume_Create( |
|---|
| 123 | BAPE_Handle deviceHandle, |
|---|
| 124 | const BAPE_DolbyVolumeSettings *pSettings, |
|---|
| 125 | BAPE_DolbyVolumeHandle *pHandle |
|---|
| 126 | ) |
|---|
| 127 | { |
|---|
| 128 | BAPE_DolbyVolumeHandle handle; |
|---|
| 129 | BAPE_DolbyVolumeSettings defaults; |
|---|
| 130 | |
|---|
| 131 | BDBG_OBJECT_ASSERT(deviceHandle, BAPE_Device); |
|---|
| 132 | BDBG_ASSERT(NULL != pHandle); |
|---|
| 133 | |
|---|
| 134 | if ( NULL == pSettings ) |
|---|
| 135 | { |
|---|
| 136 | pSettings = &defaults; |
|---|
| 137 | BAPE_DolbyVolume_GetDefaultSettings(&defaults); |
|---|
| 138 | } |
|---|
| 139 | |
|---|
| 140 | handle = BKNI_Malloc(sizeof(BAPE_DolbyVolume)); |
|---|
| 141 | if ( NULL == handle ) |
|---|
| 142 | { |
|---|
| 143 | return BERR_TRACE(BERR_OUT_OF_SYSTEM_MEMORY); |
|---|
| 144 | } |
|---|
| 145 | BKNI_Memset(handle, 0, sizeof(BAPE_DolbyVolume)); |
|---|
| 146 | BDBG_OBJECT_SET(handle, BAPE_DolbyVolume); |
|---|
| 147 | handle->settings = *pSettings; |
|---|
| 148 | BAPE_P_InitPathNode(&handle->node, BAPE_PathNodeType_ePostProcessor, BAPE_PostProcessorType_eDolbyVolume, 1, deviceHandle, handle); |
|---|
| 149 | handle->node.pName = "Dolby Volume"; |
|---|
| 150 | handle->node.paths[0].connector.numChannelPairs = 1; /* Only output stereo by default, this will follow the input format */ |
|---|
| 151 | handle->node.paths[0].connector.useBufferPool = true; |
|---|
| 152 | handle->node.paths[0].connector.dataSource = BAPE_DataSource_eDspBuffer; |
|---|
| 153 | |
|---|
| 154 | /* Generic Routines */ |
|---|
| 155 | handle->node.allocatePathToOutput = BAPE_DSP_P_AllocatePathToOutput; |
|---|
| 156 | handle->node.configPathToOutput = BAPE_DSP_P_ConfigPathToOutput; |
|---|
| 157 | handle->node.stopPathToOutput = BAPE_DSP_P_StopPathToOutput; |
|---|
| 158 | handle->node.startPathToOutput = BAPE_DSP_P_StartPathToOutput; |
|---|
| 159 | handle->node.stopPathToOutput = BAPE_DSP_P_StopPathToOutput; |
|---|
| 160 | |
|---|
| 161 | /* Pass through input format always for DV258 */ |
|---|
| 162 | handle->node.inputFormatChange = BAPE_DSP_P_InputFormatPassthrough; |
|---|
| 163 | |
|---|
| 164 | /* DolbyVolume Specifics */ |
|---|
| 165 | handle->node.connectorSupported = BAPE_DolbyVolume_P_ConnectorSupported; |
|---|
| 166 | handle->node.allocatePathFromInput = BAPE_DolbyVolume_P_AllocatePathFromInput; |
|---|
| 167 | handle->node.configPathFromInput = BAPE_DolbyVolume_P_ConfigPathFromInput; |
|---|
| 168 | handle->node.stopPathFromInput = BAPE_DolbyVolume_P_StopPathFromInput; |
|---|
| 169 | handle->node.removeInput = BAPE_DolbyVolume_P_RemoveInputCallback; |
|---|
| 170 | |
|---|
| 171 | *pHandle = handle; |
|---|
| 172 | return BERR_SUCCESS; |
|---|
| 173 | } |
|---|
| 174 | |
|---|
| 175 | void BAPE_DolbyVolume_Destroy( |
|---|
| 176 | BAPE_DolbyVolumeHandle handle |
|---|
| 177 | ) |
|---|
| 178 | { |
|---|
| 179 | bool running; |
|---|
| 180 | BDBG_OBJECT_ASSERT(handle, BAPE_DolbyVolume); |
|---|
| 181 | running = (handle->node.paths[0].connector.task != NULL)?true:false; |
|---|
| 182 | BDBG_ASSERT(false == running); |
|---|
| 183 | BDBG_ASSERT(NULL == handle->input); |
|---|
| 184 | BDBG_OBJECT_DESTROY(handle, BAPE_DolbyVolume); |
|---|
| 185 | BKNI_Free(handle); |
|---|
| 186 | } |
|---|
| 187 | |
|---|
| 188 | void BAPE_DolbyVolume_GetSettings( |
|---|
| 189 | BAPE_DolbyVolumeHandle handle, |
|---|
| 190 | BAPE_DolbyVolumeSettings *pSettings /* [out] Settings */ |
|---|
| 191 | ) |
|---|
| 192 | { |
|---|
| 193 | BDBG_OBJECT_ASSERT(handle, BAPE_DolbyVolume); |
|---|
| 194 | BDBG_ASSERT(NULL != pSettings); |
|---|
| 195 | *pSettings = handle->settings; |
|---|
| 196 | } |
|---|
| 197 | |
|---|
| 198 | BERR_Code BAPE_DolbyVolume_SetSettings( |
|---|
| 199 | BAPE_DolbyVolumeHandle handle, |
|---|
| 200 | const BAPE_DolbyVolumeSettings *pSettings |
|---|
| 201 | ) |
|---|
| 202 | { |
|---|
| 203 | BERR_Code errCode; |
|---|
| 204 | BDBG_OBJECT_ASSERT(handle, BAPE_DolbyVolume); |
|---|
| 205 | BDBG_ASSERT(NULL != pSettings); |
|---|
| 206 | |
|---|
| 207 | if ( pSettings != &handle->settings ) |
|---|
| 208 | { |
|---|
| 209 | handle->settings = *pSettings; |
|---|
| 210 | } |
|---|
| 211 | |
|---|
| 212 | if ( handle->node.paths[0].connector.task != NULL ) |
|---|
| 213 | { |
|---|
| 214 | errCode = BAPE_DolbyVolume_P_ApplyDspSettings(handle, |
|---|
| 215 | handle->node.paths[0].connector.task, |
|---|
| 216 | handle->node.paths[0].connector.branchId, |
|---|
| 217 | handle->node.paths[0].connector.stageId); |
|---|
| 218 | if ( errCode ) |
|---|
| 219 | { |
|---|
| 220 | return BERR_TRACE(errCode); |
|---|
| 221 | } |
|---|
| 222 | } |
|---|
| 223 | |
|---|
| 224 | return BERR_SUCCESS; |
|---|
| 225 | } |
|---|
| 226 | |
|---|
| 227 | |
|---|
| 228 | void BAPE_DolbyVolume_GetConnector( |
|---|
| 229 | BAPE_DolbyVolumeHandle handle, |
|---|
| 230 | BAPE_Connector *pConnector |
|---|
| 231 | ) |
|---|
| 232 | { |
|---|
| 233 | BDBG_OBJECT_ASSERT(handle, BAPE_DolbyVolume); |
|---|
| 234 | BDBG_ASSERT(NULL != pConnector); |
|---|
| 235 | *pConnector = &handle->node.paths[0].connector; |
|---|
| 236 | } |
|---|
| 237 | |
|---|
| 238 | |
|---|
| 239 | BERR_Code BAPE_DolbyVolume_AddInput( |
|---|
| 240 | BAPE_DolbyVolumeHandle handle, |
|---|
| 241 | BAPE_Connector input |
|---|
| 242 | ) |
|---|
| 243 | { |
|---|
| 244 | BERR_Code errCode; |
|---|
| 245 | BDBG_OBJECT_ASSERT(handle, BAPE_DolbyVolume); |
|---|
| 246 | BDBG_OBJECT_ASSERT(input, BAPE_PathConnector); |
|---|
| 247 | if ( NULL != handle->input ) |
|---|
| 248 | { |
|---|
| 249 | BDBG_ERR(("Can not have more than one input")); |
|---|
| 250 | return BERR_TRACE(BERR_NOT_SUPPORTED); |
|---|
| 251 | } |
|---|
| 252 | errCode = BAPE_PathNode_P_AddInput(&handle->node, input); |
|---|
| 253 | if ( errCode ) |
|---|
| 254 | { |
|---|
| 255 | return BERR_TRACE(errCode); |
|---|
| 256 | } |
|---|
| 257 | handle->input = input; |
|---|
| 258 | return BERR_SUCCESS; |
|---|
| 259 | } |
|---|
| 260 | |
|---|
| 261 | |
|---|
| 262 | BERR_Code BAPE_DolbyVolume_RemoveInput( |
|---|
| 263 | BAPE_DolbyVolumeHandle handle, |
|---|
| 264 | BAPE_Connector input |
|---|
| 265 | ) |
|---|
| 266 | { |
|---|
| 267 | BERR_Code errCode; |
|---|
| 268 | BDBG_OBJECT_ASSERT(handle, BAPE_DolbyVolume); |
|---|
| 269 | BDBG_OBJECT_ASSERT(input, BAPE_PathConnector); |
|---|
| 270 | if ( input != handle->input ) |
|---|
| 271 | { |
|---|
| 272 | BDBG_ERR(("Input %s %s (%#x) is not connected", input->pParent->pName, input->pName, input)); |
|---|
| 273 | return BERR_TRACE(BERR_INVALID_PARAMETER); |
|---|
| 274 | } |
|---|
| 275 | errCode = BAPE_PathNode_P_RemoveInput(&handle->node, input); |
|---|
| 276 | if ( errCode ) |
|---|
| 277 | { |
|---|
| 278 | return BERR_TRACE(errCode); |
|---|
| 279 | } |
|---|
| 280 | handle->input = NULL; |
|---|
| 281 | return BERR_SUCCESS; |
|---|
| 282 | } |
|---|
| 283 | |
|---|
| 284 | |
|---|
| 285 | BERR_Code BAPE_DolbyVolume_RemoveAllInputs( |
|---|
| 286 | BAPE_DolbyVolumeHandle handle |
|---|
| 287 | ) |
|---|
| 288 | { |
|---|
| 289 | BDBG_OBJECT_ASSERT(handle, BAPE_DolbyVolume); |
|---|
| 290 | if ( handle->input ) |
|---|
| 291 | { |
|---|
| 292 | return BAPE_DolbyVolume_RemoveInput(handle, handle->input); |
|---|
| 293 | } |
|---|
| 294 | return BERR_SUCCESS; |
|---|
| 295 | } |
|---|
| 296 | |
|---|
| 297 | static BERR_Code BAPE_DolbyVolume_P_ConnectorSupported(struct BAPE_PathNode *pNode, BAPE_PathConnector *pConnector) |
|---|
| 298 | { |
|---|
| 299 | BDBG_OBJECT_ASSERT(pNode, BAPE_PathNode); |
|---|
| 300 | BDBG_OBJECT_ASSERT(pConnector, BAPE_PathConnector); |
|---|
| 301 | if ( pConnector->dataSource == BAPE_DataSource_eDspBuffer && |
|---|
| 302 | !pConnector->compressed ) |
|---|
| 303 | { |
|---|
| 304 | return BERR_SUCCESS; |
|---|
| 305 | } |
|---|
| 306 | else |
|---|
| 307 | { |
|---|
| 308 | BDBG_ERR(("Only stereo DSP input is supported")); |
|---|
| 309 | return BERR_TRACE(BERR_INVALID_PARAMETER); |
|---|
| 310 | } |
|---|
| 311 | } |
|---|
| 312 | |
|---|
| 313 | static BERR_Code BAPE_DolbyVolume_P_AllocatePathFromInput(struct BAPE_PathNode *pNode, struct BAPE_PathConnection *pConnection) |
|---|
| 314 | { |
|---|
| 315 | BERR_Code errCode; |
|---|
| 316 | BAPE_DolbyVolumeHandle handle; |
|---|
| 317 | BDBG_OBJECT_ASSERT(pNode, BAPE_PathNode); |
|---|
| 318 | BDBG_OBJECT_ASSERT(pConnection, BAPE_PathConnection); |
|---|
| 319 | BDBG_ASSERT(NULL != pConnection->pSource->pTaskCreateSettings); |
|---|
| 320 | handle = pNode->pHandle; |
|---|
| 321 | BDBG_OBJECT_ASSERT(handle, BAPE_DolbyVolume); |
|---|
| 322 | /* Add stage to CIT and propagate task settings */ |
|---|
| 323 | errCode = BAPE_DSP_P_AddProcessingStage(pConnection->pSource->pTaskCreateSettings, pConnection->pSource->branchId, pConnection->pSource->stageId, |
|---|
| 324 | BAPE_DSP_P_GetDataTypeFromConnector(handle->input), |
|---|
| 325 | BDSP_AudioProcessing_eDv258, |
|---|
| 326 | false, |
|---|
| 327 | &pNode->paths[0].connector.branchId, &pNode->paths[0].connector.stageId); |
|---|
| 328 | if ( errCode ) |
|---|
| 329 | { |
|---|
| 330 | return BERR_TRACE(errCode); |
|---|
| 331 | } |
|---|
| 332 | pNode->paths[0].connector.pTaskCreateSettings = pConnection->pSource->pTaskCreateSettings; |
|---|
| 333 | return BERR_SUCCESS; |
|---|
| 334 | } |
|---|
| 335 | |
|---|
| 336 | static BERR_Code BAPE_DolbyVolume_P_ConfigPathFromInput(struct BAPE_PathNode *pNode, struct BAPE_PathConnection *pConnection) |
|---|
| 337 | { |
|---|
| 338 | BERR_Code errCode; |
|---|
| 339 | BAPE_DolbyVolumeHandle handle; |
|---|
| 340 | BDBG_OBJECT_ASSERT(pNode, BAPE_PathNode); |
|---|
| 341 | BDBG_OBJECT_ASSERT(pConnection, BAPE_PathConnection); |
|---|
| 342 | BDBG_ASSERT(NULL != pConnection->pSource->task); |
|---|
| 343 | |
|---|
| 344 | handle = pNode->pHandle; |
|---|
| 345 | BDBG_OBJECT_ASSERT(handle, BAPE_DolbyVolume); |
|---|
| 346 | pNode->paths[0].connector.task = pConnection->pSource->task; |
|---|
| 347 | errCode = BAPE_DolbyVolume_P_ApplyDspSettings(handle, |
|---|
| 348 | handle->node.paths[0].connector.task, |
|---|
| 349 | handle->node.paths[0].connector.branchId, |
|---|
| 350 | handle->node.paths[0].connector.stageId); |
|---|
| 351 | if ( errCode ) |
|---|
| 352 | { |
|---|
| 353 | return BERR_TRACE(errCode); |
|---|
| 354 | } |
|---|
| 355 | |
|---|
| 356 | return BERR_SUCCESS; |
|---|
| 357 | } |
|---|
| 358 | |
|---|
| 359 | static BERR_Code BAPE_DolbyVolume_P_ApplyDspSettings(BAPE_DolbyVolumeHandle handle, BDSP_TaskHandle task, unsigned branchId, unsigned stageId) |
|---|
| 360 | { |
|---|
| 361 | BERR_Code errCode; |
|---|
| 362 | BDSP_Raaga_Audio_DV258ConfigParams userConfig; |
|---|
| 363 | |
|---|
| 364 | errCode = BDSP_Task_GetStageSettings(task, branchId, stageId, &userConfig, sizeof(userConfig)); |
|---|
| 365 | if ( errCode ) |
|---|
| 366 | { |
|---|
| 367 | return BERR_TRACE(errCode); |
|---|
| 368 | } |
|---|
| 369 | |
|---|
| 370 | BAPE_DSP_P_SET_VARIABLE(userConfig, i32DolbyVolumeEnable, handle->settings.enabled?1:0); |
|---|
| 371 | BAPE_DSP_P_SET_VARIABLE(userConfig, i32Pregain, handle->settings.preGain); |
|---|
| 372 | BAPE_DSP_P_SET_VARIABLE(userConfig, i32InputReferenceLevel, handle->settings.inputReferenceLevel); |
|---|
| 373 | BAPE_DSP_P_SET_VARIABLE(userConfig, i32OutputReferenceLevel, handle->settings.outputReferenceLevel); |
|---|
| 374 | BAPE_DSP_P_SET_VARIABLE(userConfig, i32CalibrationOffset, handle->settings.calibrationOffset); |
|---|
| 375 | BAPE_DSP_P_SET_VARIABLE(userConfig, i32ResetNowFlag, handle->settings.reset?1:0); |
|---|
| 376 | BAPE_DSP_P_SET_VARIABLE(userConfig, i32VlmMdlEnable, handle->settings.volumeModelerEnabled?1:0); |
|---|
| 377 | BAPE_DSP_P_SET_VARIABLE(userConfig, i32DigitalVolumeLevel, handle->settings.digitalVolumeLevel); |
|---|
| 378 | BAPE_DSP_P_SET_VARIABLE(userConfig, i32AnalogVolumeLevel, handle->settings.analogVolumeLevel); |
|---|
| 379 | BAPE_DSP_P_SET_VARIABLE(userConfig, i32EnableMidsideProc, handle->settings.midsideProcessingEnabled?1:0); |
|---|
| 380 | BAPE_DSP_P_SET_VARIABLE(userConfig, i32HalfmodeFlag, handle->settings.halfModeEnabled?1:0); |
|---|
| 381 | BAPE_DSP_P_SET_VARIABLE(userConfig, i32LvlEnable, handle->settings.volumeLevelerEnabled?1:0); |
|---|
| 382 | BAPE_DSP_P_SET_VARIABLE(userConfig, i32LvlAmount, handle->settings.volumeLevelerAmount); |
|---|
| 383 | BAPE_DSP_P_SET_VARIABLE(userConfig, i32LimiterEnable, handle->settings.limiterEnabled?1:0); |
|---|
| 384 | |
|---|
| 385 | errCode = BDSP_Task_SetStageSettings(task, branchId, stageId, &userConfig, sizeof(userConfig)); |
|---|
| 386 | if ( errCode ) |
|---|
| 387 | { |
|---|
| 388 | return BERR_TRACE(errCode); |
|---|
| 389 | } |
|---|
| 390 | |
|---|
| 391 | return BERR_SUCCESS; |
|---|
| 392 | } |
|---|
| 393 | |
|---|
| 394 | static void BAPE_DolbyVolume_P_StopPathFromInput(struct BAPE_PathNode *pNode, struct BAPE_PathConnection *pConnection) |
|---|
| 395 | { |
|---|
| 396 | /* Invalidate task handle */ |
|---|
| 397 | BDBG_OBJECT_ASSERT(pNode, BAPE_PathNode); |
|---|
| 398 | BSTD_UNUSED(pConnection); |
|---|
| 399 | pNode->paths[0].connector.task = NULL; |
|---|
| 400 | } |
|---|
| 401 | |
|---|
| 402 | static void BAPE_DolbyVolume_P_RemoveInputCallback(struct BAPE_PathNode *pNode, BAPE_PathConnector *pConnector) |
|---|
| 403 | { |
|---|
| 404 | (void)BAPE_DolbyVolume_RemoveInput(pNode->pHandle, pConnector); |
|---|
| 405 | } |
|---|
| 406 | |
|---|