| 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: nexus_audio_mixer.h $ |
|---|
| 39 | * $brcm_Revision: 1 $ |
|---|
| 40 | * $brcm_Date: 10/10/11 10:18a $ |
|---|
| 41 | * |
|---|
| 42 | * API Description: |
|---|
| 43 | * API name: AudioMixer |
|---|
| 44 | * APIs for an audio mixer. Allows one or more inputs to be |
|---|
| 45 | * connected, and provides input volume control for mixing. |
|---|
| 46 | * |
|---|
| 47 | * Revision History: |
|---|
| 48 | * |
|---|
| 49 | * $brcm_Log: /nexus/modules/audio/7422/include/nexus_audio_mixer.h $ |
|---|
| 50 | * |
|---|
| 51 | * 1 10/10/11 10:18a jgarrett |
|---|
| 52 | * SW7425-1119: Merge to main branch |
|---|
| 53 | * |
|---|
| 54 | * SW7425-1119/1 8/26/11 12:19p jgarrett |
|---|
| 55 | * SW7425-1119: Adding mixer start/stop routines |
|---|
| 56 | * |
|---|
| 57 | ***************************************************************************/ |
|---|
| 58 | #ifndef NEXUS_AUDIO_MIXER_H__ |
|---|
| 59 | #define NEXUS_AUDIO_MIXER_H__ |
|---|
| 60 | |
|---|
| 61 | #include "nexus_types.h" |
|---|
| 62 | #include "nexus_audio_types.h" |
|---|
| 63 | |
|---|
| 64 | #ifdef __cplusplus |
|---|
| 65 | extern "C" { |
|---|
| 66 | #endif |
|---|
| 67 | |
|---|
| 68 | /*=************************************ |
|---|
| 69 | Interface: AudioMixer |
|---|
| 70 | |
|---|
| 71 | Header file: nexus_audio_mixer.h |
|---|
| 72 | |
|---|
| 73 | Module: Audio |
|---|
| 74 | |
|---|
| 75 | Description: Mixer two or more PCM NEXUS_AudioInputs into a single NEXUS_AudioOutput. |
|---|
| 76 | |
|---|
| 77 | **************************************/ |
|---|
| 78 | |
|---|
| 79 | /** |
|---|
| 80 | Summary: |
|---|
| 81 | Handle for an Audio Mixer |
|---|
| 82 | **/ |
|---|
| 83 | typedef struct NEXUS_AudioMixer *NEXUS_AudioMixerHandle; |
|---|
| 84 | |
|---|
| 85 | /*************************************************************************** |
|---|
| 86 | Summary: |
|---|
| 87 | Audio Mixer Settings |
|---|
| 88 | ***************************************************************************/ |
|---|
| 89 | typedef struct NEXUS_AudioMixerSettings |
|---|
| 90 | { |
|---|
| 91 | bool mixUsingDsp; /* If true, mix contents in the DSP as opposed to the mixer hardware. |
|---|
| 92 | This requires the masterInput field to be set below prior to starting |
|---|
| 93 | any input. This field should be set prior to NEXUS_AudioMixer_Open |
|---|
| 94 | and not changed on the fly. */ |
|---|
| 95 | NEXUS_AudioInput master; /* If mixUsingDsp is true, this field will determine what input is deemed |
|---|
| 96 | to be the master for mixing purposes. The master must be started prior |
|---|
| 97 | to starting any secondary channels, and it will determine the output timing. |
|---|
| 98 | It must also be directly connected to this mixer, with no post-processing |
|---|
| 99 | prior to mixing. */ |
|---|
| 100 | } NEXUS_AudioMixerSettings; |
|---|
| 101 | |
|---|
| 102 | /*************************************************************************** |
|---|
| 103 | Summary: |
|---|
| 104 | Get default settings for an audio mixer |
|---|
| 105 | ***************************************************************************/ |
|---|
| 106 | void NEXUS_AudioMixer_GetDefaultSettings( |
|---|
| 107 | NEXUS_AudioMixerSettings *pSettings /* [out] Default Settings */ |
|---|
| 108 | ); |
|---|
| 109 | |
|---|
| 110 | /*************************************************************************** |
|---|
| 111 | Summary: |
|---|
| 112 | Open an audio mixer |
|---|
| 113 | ***************************************************************************/ |
|---|
| 114 | NEXUS_AudioMixerHandle NEXUS_AudioMixer_Open( /* attr{destructor=NEXUS_AudioMixer_Close} */ |
|---|
| 115 | const NEXUS_AudioMixerSettings *pSettings /* attr{null_allowed=y} */ |
|---|
| 116 | ); |
|---|
| 117 | |
|---|
| 118 | /*************************************************************************** |
|---|
| 119 | Summary: |
|---|
| 120 | Close an audio mixer |
|---|
| 121 | ***************************************************************************/ |
|---|
| 122 | void NEXUS_AudioMixer_Close( |
|---|
| 123 | NEXUS_AudioMixerHandle handle |
|---|
| 124 | ); |
|---|
| 125 | |
|---|
| 126 | /*************************************************************************** |
|---|
| 127 | Summary: |
|---|
| 128 | Get current settings for an audio mixer |
|---|
| 129 | ***************************************************************************/ |
|---|
| 130 | void NEXUS_AudioMixer_GetSettings( |
|---|
| 131 | NEXUS_AudioMixerHandle handle, |
|---|
| 132 | NEXUS_AudioMixerSettings *pSettings /* [out] Mixer Settings */ |
|---|
| 133 | ); |
|---|
| 134 | |
|---|
| 135 | /*************************************************************************** |
|---|
| 136 | Summary: |
|---|
| 137 | Start a mixer |
|---|
| 138 | |
|---|
| 139 | Description: |
|---|
| 140 | This call is optional. By default, mixers will automatically start when |
|---|
| 141 | The first input starts, but if you want to explicitly enable the mixer |
|---|
| 142 | earlier call this function prior to starting any inputs. Currently, this |
|---|
| 143 | is only supported if mixUsingDsp is set to true. |
|---|
| 144 | ***************************************************************************/ |
|---|
| 145 | NEXUS_Error NEXUS_AudioMixer_Start( |
|---|
| 146 | NEXUS_AudioMixerHandle handle |
|---|
| 147 | ); |
|---|
| 148 | |
|---|
| 149 | /*************************************************************************** |
|---|
| 150 | Summary: |
|---|
| 151 | Stop a mixer |
|---|
| 152 | |
|---|
| 153 | Description: |
|---|
| 154 | This call is required only if you call NEXUS_AudioMixer_Start(). By default, |
|---|
| 155 | mixers will automatically stop when the last input stops, but if you |
|---|
| 156 | have explicitly started the mixer via NEXUS_AudioMixer_Start() you must call |
|---|
| 157 | this routine to stop it after all inputs have stopped. |
|---|
| 158 | ***************************************************************************/ |
|---|
| 159 | void NEXUS_AudioMixer_Stop( |
|---|
| 160 | NEXUS_AudioMixerHandle handle |
|---|
| 161 | ); |
|---|
| 162 | |
|---|
| 163 | /*************************************************************************** |
|---|
| 164 | Summary: |
|---|
| 165 | Set settings of an audio mixer |
|---|
| 166 | ***************************************************************************/ |
|---|
| 167 | NEXUS_Error NEXUS_AudioMixer_SetSettings( |
|---|
| 168 | NEXUS_AudioMixerHandle handle, |
|---|
| 169 | const NEXUS_AudioMixerSettings *pSettings /* Mixer Settings */ |
|---|
| 170 | ); |
|---|
| 171 | |
|---|
| 172 | /*************************************************************************** |
|---|
| 173 | Summary: |
|---|
| 174 | Add an audio input to a mixer |
|---|
| 175 | ***************************************************************************/ |
|---|
| 176 | NEXUS_Error NEXUS_AudioMixer_AddInput( |
|---|
| 177 | NEXUS_AudioMixerHandle handle, |
|---|
| 178 | NEXUS_AudioInput input |
|---|
| 179 | ); |
|---|
| 180 | |
|---|
| 181 | /*************************************************************************** |
|---|
| 182 | Summary: |
|---|
| 183 | Remove an audio input from a mixer |
|---|
| 184 | ***************************************************************************/ |
|---|
| 185 | NEXUS_Error NEXUS_AudioMixer_RemoveInput( |
|---|
| 186 | NEXUS_AudioMixerHandle handle, |
|---|
| 187 | NEXUS_AudioInput input |
|---|
| 188 | ); |
|---|
| 189 | |
|---|
| 190 | /*************************************************************************** |
|---|
| 191 | Summary: |
|---|
| 192 | Remove all audio inputs from a mixer |
|---|
| 193 | ***************************************************************************/ |
|---|
| 194 | NEXUS_Error NEXUS_AudioMixer_RemoveAllInputs( |
|---|
| 195 | NEXUS_AudioMixerHandle handle |
|---|
| 196 | ); |
|---|
| 197 | |
|---|
| 198 | /*************************************************************************** |
|---|
| 199 | Summary: |
|---|
| 200 | Get the audio input connector for connection to outputs or post-processing |
|---|
| 201 | ***************************************************************************/ |
|---|
| 202 | NEXUS_AudioInput NEXUS_AudioMixer_GetConnector( |
|---|
| 203 | NEXUS_AudioMixerHandle mixer |
|---|
| 204 | ); |
|---|
| 205 | |
|---|
| 206 | #ifdef __cplusplus |
|---|
| 207 | } |
|---|
| 208 | #endif |
|---|
| 209 | |
|---|
| 210 | #endif /* #ifndef NEXUS_AUDIO_MIXER_H__ */ |
|---|
| 211 | |
|---|