| 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_tru_volume.h $ |
|---|
| 39 | * $brcm_Revision: Hydra_Software_Devel/4 $ |
|---|
| 40 | * $brcm_Date: 7/15/11 5:51p $ |
|---|
| 41 | * |
|---|
| 42 | * API Description: |
|---|
| 43 | * API name: TruVolume |
|---|
| 44 | * Specific APIs related to SRS TruVolume (formerly Volume IQ) Audio Processing |
|---|
| 45 | * |
|---|
| 46 | * Revision History: |
|---|
| 47 | * |
|---|
| 48 | * $brcm_Log: /magnum/portinginterface/ape/7422/bape_tru_volume.h $ |
|---|
| 49 | * |
|---|
| 50 | * Hydra_Software_Devel/4 7/15/11 5:51p jgarrett |
|---|
| 51 | * SWDTV-6761: Adding StudioSound API |
|---|
| 52 | * |
|---|
| 53 | * Hydra_Software_Devel/3 4/16/11 12:32p jgarrett |
|---|
| 54 | * SW7425-371: Removing tabs |
|---|
| 55 | * |
|---|
| 56 | * Hydra_Software_Devel/2 2/22/11 5:44p jgarrett |
|---|
| 57 | * SW7422-146: Implemented type renaming based on filter graph review |
|---|
| 58 | * comments |
|---|
| 59 | * |
|---|
| 60 | * Hydra_Software_Devel/1 1/12/11 4:24p jgarrett |
|---|
| 61 | * SW7422-146: Adding additional APIs |
|---|
| 62 | * |
|---|
| 63 | ***************************************************************************/ |
|---|
| 64 | |
|---|
| 65 | #ifndef BAPE_TRU_VOLUME_H__ |
|---|
| 66 | #define BAPE_TRU_VOLUME_H__ |
|---|
| 67 | |
|---|
| 68 | #include "bape.h" |
|---|
| 69 | |
|---|
| 70 | /*************************************************************************** |
|---|
| 71 | Summary: |
|---|
| 72 | TruVolume Handle |
|---|
| 73 | ***************************************************************************/ |
|---|
| 74 | typedef struct BAPE_TruVolume *BAPE_TruVolumeHandle; |
|---|
| 75 | |
|---|
| 76 | /*************************************************************************** |
|---|
| 77 | Summary: |
|---|
| 78 | TruVolume Block Size |
|---|
| 79 | ***************************************************************************/ |
|---|
| 80 | typedef enum BAPE_TruVolumeBlockSize |
|---|
| 81 | { |
|---|
| 82 | BAPE_TruVolumeBlockSize_e256, |
|---|
| 83 | BAPE_TruVolumeBlockSize_e512, |
|---|
| 84 | BAPE_TruVolumeBlockSize_e768, |
|---|
| 85 | BAPE_TruVolumeBlockSize_e1024, |
|---|
| 86 | BAPE_TruVolumeBlockSize_eMax |
|---|
| 87 | } BAPE_TruVolumeBlockSize; |
|---|
| 88 | |
|---|
| 89 | /*************************************************************************** |
|---|
| 90 | Summary: |
|---|
| 91 | TruVolume Mode |
|---|
| 92 | ***************************************************************************/ |
|---|
| 93 | typedef enum BAPE_TruVolumeMode |
|---|
| 94 | { |
|---|
| 95 | BAPE_TruVolumeMode_eLight, |
|---|
| 96 | BAPE_TruVolumeMode_eNormal, |
|---|
| 97 | BAPE_TruVolumeMode_eHeavy, |
|---|
| 98 | BAPE_TruVolumeMode_eMax |
|---|
| 99 | } BAPE_TruVolumeMode; |
|---|
| 100 | |
|---|
| 101 | /*************************************************************************** |
|---|
| 102 | Summary: |
|---|
| 103 | TruVolume Speaker Resolution |
|---|
| 104 | ***************************************************************************/ |
|---|
| 105 | typedef enum BAPE_TruVolumeSpeakerResolution |
|---|
| 106 | { |
|---|
| 107 | BAPE_TruVolumeSpeakerResolution_e20Hz, |
|---|
| 108 | BAPE_TruVolumeSpeakerResolution_e40Hz, |
|---|
| 109 | BAPE_TruVolumeSpeakerResolution_e110Hz, |
|---|
| 110 | BAPE_TruVolumeSpeakerResolution_e200Hz, |
|---|
| 111 | BAPE_TruVolumeSpeakerResolution_e315Hz, |
|---|
| 112 | BAPE_TruVolumeSpeakerResolution_e410Hz, |
|---|
| 113 | BAPE_TruVolumeSpeakerResolution_eMax |
|---|
| 114 | } BAPE_TruVolumeSpeakerResolution; |
|---|
| 115 | |
|---|
| 116 | /*************************************************************************** |
|---|
| 117 | Summary: |
|---|
| 118 | SRS Filter Coefficient Generation Modes. |
|---|
| 119 | Also required by StudioSound. |
|---|
| 120 | ***************************************************************************/ |
|---|
| 121 | typedef enum BAPE_SrsFilterCoefficientMode |
|---|
| 122 | { |
|---|
| 123 | BAPE_SrsFilterCoefficientMode_eUser, /* Use user specified coefficients */ |
|---|
| 124 | BAPE_SrsFilterCoefficientMode_eSpecification, /* Use Filter Specification to generate filter coeffcients */ |
|---|
| 125 | BAPE_SrsFilterCoefficientMode_eMax |
|---|
| 126 | } BAPE_SrsFilterCoefficientMode; |
|---|
| 127 | |
|---|
| 128 | /*************************************************************************** |
|---|
| 129 | Summary: |
|---|
| 130 | SRS High Pass Filter Order. |
|---|
| 131 | Also required by StudioSound. |
|---|
| 132 | ***************************************************************************/ |
|---|
| 133 | typedef enum BAPE_SrsFilterOrder |
|---|
| 134 | { |
|---|
| 135 | BAPE_SrsFilterOrder_e0 = 0, |
|---|
| 136 | BAPE_SrsFilterOrder_e2 = 2, |
|---|
| 137 | BAPE_SrsFilterOrder_e4 = 4, |
|---|
| 138 | BAPE_SrsFilterOrder_e6 = 6, |
|---|
| 139 | BAPE_SrsFilterOrder_eMax |
|---|
| 140 | } BAPE_SrsFilterOrder; |
|---|
| 141 | |
|---|
| 142 | /*************************************************************************** |
|---|
| 143 | Summary: |
|---|
| 144 | SRS High Pass Filter Coefficients. |
|---|
| 145 | Also required by StudioSound. |
|---|
| 146 | ***************************************************************************/ |
|---|
| 147 | typedef struct BAPE_SrsHighPassFilterCoefficientSet |
|---|
| 148 | { |
|---|
| 149 | unsigned scale; /* Specified q-format of the coefficients. (1+scale).(31-scale) format |
|---|
| 150 | Default: 1. scale=1 implies a q-format of 2.30 */ |
|---|
| 151 | int coefficientB0; |
|---|
| 152 | int coefficientB1; |
|---|
| 153 | int coefficientB2; |
|---|
| 154 | int coefficientA1; |
|---|
| 155 | int coefficientA2; |
|---|
| 156 | } BAPE_SrsHighPassFilterCoefficientSet; |
|---|
| 157 | |
|---|
| 158 | /*************************************************************************** |
|---|
| 159 | Summary: |
|---|
| 160 | SRS High Pass Filter parameter for coefficients specified by user. |
|---|
| 161 | Also required by StudioSound. |
|---|
| 162 | ***************************************************************************/ |
|---|
| 163 | typedef struct BAPE_SrsHighPassFilterCoefficients |
|---|
| 164 | { |
|---|
| 165 | BAPE_SrsFilterOrder filterOrder; /* HighPass Filter order. Default BAPE_SrsFilterOrder_eOrder4 */ |
|---|
| 166 | BAPE_SrsHighPassFilterCoefficientSet coefficients[3]; /* Number of active biquads filter decided by filterOrder, N = filterOrder/2 */ |
|---|
| 167 | } BAPE_SrsHighPassFilterCoefficients; |
|---|
| 168 | |
|---|
| 169 | /*************************************************************************** |
|---|
| 170 | Summary: |
|---|
| 171 | SRS High Pass Filter parameter for coefficients generated by specification. |
|---|
| 172 | Also required by StudioSound. |
|---|
| 173 | ***************************************************************************/ |
|---|
| 174 | typedef struct BAPE_SrsHighPassFilterCoefficientSpecification |
|---|
| 175 | { |
|---|
| 176 | unsigned cutoffFrequency; /* Range: 20 to 1000 hz, Default: 180 Hz */ |
|---|
| 177 | BAPE_SrsFilterOrder filterOrder; /* HighPass Filter order. Default BAPE_SrsFilterOrder_e4 */ |
|---|
| 178 | } BAPE_SrsHighPassFilterCoefficientSpecification; |
|---|
| 179 | |
|---|
| 180 | /*************************************************************************** |
|---|
| 181 | Summary: |
|---|
| 182 | SRS High Pass Filter Settings. |
|---|
| 183 | Also required by StudioSound. |
|---|
| 184 | ***************************************************************************/ |
|---|
| 185 | typedef struct BAPE_SrsHighPassFilterSettings |
|---|
| 186 | { |
|---|
| 187 | bool enabled; /* If true, High Pass Filter processing is enabled. Default: true */ |
|---|
| 188 | BAPE_SrsFilterCoefficientMode coefficientMode; /* Coefficient generation mode. Default: BAPE_SrsFilterCoefficientMode_eUserSpecified */ |
|---|
| 189 | |
|---|
| 190 | struct |
|---|
| 191 | { |
|---|
| 192 | BAPE_SrsHighPassFilterCoefficients user[3]; /* Array size 3, representing supported sampling rates 32, 44.1 and 48kHz, |
|---|
| 193 | will be used if coefficientMode is BAPE_SrsFilterCoefficientMode_eUser */ |
|---|
| 194 | BAPE_SrsHighPassFilterCoefficientSpecification specification; /* Filter specification for generating filter coeffcients, |
|---|
| 195 | will be used if coefMode is BAPE_SrsFilterCoefficientMode_eSpecification */ |
|---|
| 196 | } coefficientSettings; |
|---|
| 197 | } BAPE_SrsHighPassFilterSettings; |
|---|
| 198 | |
|---|
| 199 | /*************************************************************************** |
|---|
| 200 | Summary: |
|---|
| 201 | TruVolume Settings |
|---|
| 202 | ***************************************************************************/ |
|---|
| 203 | typedef struct BAPE_TruVolumeSettings |
|---|
| 204 | { |
|---|
| 205 | bool enabled; /* If true, processing is enabled. Otherwise this stage is bypassed */ |
|---|
| 206 | |
|---|
| 207 | BAPE_TruVolumeBlockSize blockSize; /* Block Size for processing */ |
|---|
| 208 | |
|---|
| 209 | bool enableNormalGain; /* If true, normal processing will be performed. If false, only bypassGain is applied. */ |
|---|
| 210 | |
|---|
| 211 | unsigned inputGain; /* Input gain ranges from 0 to 3200. Default: 100 */ |
|---|
| 212 | unsigned outputGain; /* Output gain ranges from 0 to 3200. Default: 50 */ |
|---|
| 213 | unsigned bypassGain; /* Bypass gain (In %). Ranges from 0 to 100 */ |
|---|
| 214 | |
|---|
| 215 | uint32_t referenceLevel; /* Reference level. Ranges from 0x00000109 to 0x007fffff */ |
|---|
| 216 | |
|---|
| 217 | BAPE_TruVolumeMode mode; /* Processing Mode. */ |
|---|
| 218 | |
|---|
| 219 | BAPE_TruVolumeSpeakerResolution speakerResolution; |
|---|
| 220 | |
|---|
| 221 | unsigned maxGain; /* Max gain control (In %). Ranges from 0 to 100 */ |
|---|
| 222 | |
|---|
| 223 | bool enableDcNotchFilter; /* If true, the DC notch filter will be enabled */ |
|---|
| 224 | |
|---|
| 225 | bool enableNoiseManager; |
|---|
| 226 | int noiseManagerThreshold; /* Noise manager threshold. Ranges from 0 to 200 (Default=20). */ |
|---|
| 227 | |
|---|
| 228 | bool enableNormalizer; /* If true, the normalizer is enabled. */ |
|---|
| 229 | |
|---|
| 230 | unsigned calibrate; /* Ranges from 0..25600. Default=100. */ |
|---|
| 231 | |
|---|
| 232 | BAPE_SrsHighPassFilterSettings highPassFilter; /* High Pass Filter Settings applied prior to TruVolume */ |
|---|
| 233 | } BAPE_TruVolumeSettings; |
|---|
| 234 | |
|---|
| 235 | /*************************************************************************** |
|---|
| 236 | Summary: |
|---|
| 237 | Get default settings for an SRS TruVolume stage |
|---|
| 238 | ***************************************************************************/ |
|---|
| 239 | void BAPE_TruVolume_GetDefaultSettings( |
|---|
| 240 | BAPE_TruVolumeSettings *pSettings /* [out] default settings */ |
|---|
| 241 | ); |
|---|
| 242 | |
|---|
| 243 | /*************************************************************************** |
|---|
| 244 | Summary: |
|---|
| 245 | Open an SRS TruVolume stage |
|---|
| 246 | ***************************************************************************/ |
|---|
| 247 | BERR_Code BAPE_TruVolume_Create( |
|---|
| 248 | BAPE_Handle deviceHandle, |
|---|
| 249 | const BAPE_TruVolumeSettings *pSettings, |
|---|
| 250 | BAPE_TruVolumeHandle *pHandle |
|---|
| 251 | ); |
|---|
| 252 | |
|---|
| 253 | /*************************************************************************** |
|---|
| 254 | Summary: |
|---|
| 255 | Close an SRS TruVolume stage |
|---|
| 256 | |
|---|
| 257 | Description: |
|---|
| 258 | Input to the stage must be removed prior to closing. |
|---|
| 259 | ***************************************************************************/ |
|---|
| 260 | void BAPE_TruVolume_Destroy( |
|---|
| 261 | BAPE_TruVolumeHandle handle |
|---|
| 262 | ); |
|---|
| 263 | |
|---|
| 264 | /*************************************************************************** |
|---|
| 265 | Summary: |
|---|
| 266 | Get Settings for an SRS TruVolume stage |
|---|
| 267 | ***************************************************************************/ |
|---|
| 268 | void BAPE_TruVolume_GetSettings( |
|---|
| 269 | BAPE_TruVolumeHandle handle, |
|---|
| 270 | BAPE_TruVolumeSettings *pSettings /* [out] Settings */ |
|---|
| 271 | ); |
|---|
| 272 | |
|---|
| 273 | /*************************************************************************** |
|---|
| 274 | Summary: |
|---|
| 275 | Set Settings for an SRS TruVolume stage |
|---|
| 276 | ***************************************************************************/ |
|---|
| 277 | BERR_Code BAPE_TruVolume_SetSettings( |
|---|
| 278 | BAPE_TruVolumeHandle handle, |
|---|
| 279 | const BAPE_TruVolumeSettings *pSettings |
|---|
| 280 | ); |
|---|
| 281 | |
|---|
| 282 | /*************************************************************************** |
|---|
| 283 | Summary: |
|---|
| 284 | Get the audio connector for an SRS TruVolume stage |
|---|
| 285 | ***************************************************************************/ |
|---|
| 286 | void BAPE_TruVolume_GetConnector( |
|---|
| 287 | BAPE_TruVolumeHandle handle, |
|---|
| 288 | BAPE_Connector *pConnector |
|---|
| 289 | ); |
|---|
| 290 | |
|---|
| 291 | /*************************************************************************** |
|---|
| 292 | Summary: |
|---|
| 293 | Add an input to this processing stage |
|---|
| 294 | ***************************************************************************/ |
|---|
| 295 | BERR_Code BAPE_TruVolume_AddInput( |
|---|
| 296 | BAPE_TruVolumeHandle handle, |
|---|
| 297 | BAPE_Connector input |
|---|
| 298 | ); |
|---|
| 299 | |
|---|
| 300 | /*************************************************************************** |
|---|
| 301 | Summary: |
|---|
| 302 | Remove an input from this processing stage |
|---|
| 303 | ***************************************************************************/ |
|---|
| 304 | BERR_Code BAPE_TruVolume_RemoveInput( |
|---|
| 305 | BAPE_TruVolumeHandle handle, |
|---|
| 306 | BAPE_Connector input |
|---|
| 307 | ); |
|---|
| 308 | |
|---|
| 309 | /*************************************************************************** |
|---|
| 310 | Summary: |
|---|
| 311 | Remove all inputs from this processing stage |
|---|
| 312 | ***************************************************************************/ |
|---|
| 313 | BERR_Code BAPE_TruVolume_RemoveAllInputs( |
|---|
| 314 | BAPE_TruVolumeHandle handle |
|---|
| 315 | ); |
|---|
| 316 | |
|---|
| 317 | #endif /* #ifndef BAPE_TRU_VOLUME_H__ */ |
|---|
| 318 | |
|---|