12c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent/*
22c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent * Copyright (C) 2004-2010 NXP Software
32c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent * Copyright (C) 2010 The Android Open Source Project
42c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent *
52c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent * Licensed under the Apache License, Version 2.0 (the "License");
62c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent * you may not use this file except in compliance with the License.
72c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent * You may obtain a copy of the License at
82c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent *
92c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent *      http://www.apache.org/licenses/LICENSE-2.0
102c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent *
112c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent * Unless required by applicable law or agreed to in writing, software
122c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent * distributed under the License is distributed on an "AS IS" BASIS,
132c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
142c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent * See the License for the specific language governing permissions and
152c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent * limitations under the License.
162c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent */
172c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent
182c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent/****************************************************************************************/
192c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent/*                                                                                      */
202c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent/*  Includes                                                                            */
212c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent/*                                                                                      */
222c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent/****************************************************************************************/
232c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent
242c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent#include "LVEQNB.h"
252c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent#include "LVEQNB_Private.h"
262c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent#include "VectorArithmetic.h"
272c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent#include "BIQUAD.h"
282c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent
292c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent
302c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent/****************************************************************************************/
312c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent/*                                                                                      */
322c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent/*  Defines                                                                             */
332c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent/*                                                                                      */
342c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent/****************************************************************************************/
352c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent
362c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent#define     LOW_FREQ            298             /* 32768/110 for low test frequency */
372c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent#define     HIGH_FREQ           386             /* 32768/85 for high test frequency */
382c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent
392c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent/****************************************************************************************/
402c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent/*                                                                                      */
412c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent/* FUNCTION:                 LVEQNB_GetParameters                                       */
422c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent/*                                                                                      */
432c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent/* DESCRIPTION:                                                                         */
442c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent/*  Request the N-Band equaliser parameters. The current parameter set is returned via  */
452c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent/*  the parameter pointer.                                                              */
462c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent/*                                                                                      */
472c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent/* PARAMETERS:                                                                          */
482c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent/*  hInstance                Instance handle                                            */
492c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent/*  pParams                  Pointer to an empty parameter structure                    */
502c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent/*                                                                                      */
512c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent/* RETURNS:                                                                             */
522c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent/*  LVEQNB_SUCCESS          Succeeds                                                    */
532c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent/*  LVEQNB_NULLADDRESS      Instance or pParams  is NULL pointer                        */
542c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent/*                                                                                      */
552c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent/* NOTES:                                                                               */
562c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent/*  1.  This function may be interrupted by the LVEQNB_Process function                 */
572c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent/*                                                                                      */
582c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent/****************************************************************************************/
592c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent
602c8e5cab3faa6d360e222b7a6c40a80083d021acEric LaurentLVEQNB_ReturnStatus_en LVEQNB_GetParameters(LVEQNB_Handle_t     hInstance,
612c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent                                            LVEQNB_Params_t     *pParams)
622c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent{
632c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent
642c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent    LVEQNB_Instance_t    *pInstance =(LVEQNB_Instance_t  *)hInstance;
652c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent
662c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent   /*
672c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent     * Check for error conditions
682c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent     */
692c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent    if((hInstance == LVM_NULL) || (pParams == LVM_NULL))
702c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent    {
712c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent        return LVEQNB_NULLADDRESS;
722c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent    }
732c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent
742c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent    *pParams = pInstance->Params;
752c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent
762c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent    return(LVEQNB_SUCCESS);
772c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent}
782c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent
792c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent
802c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent/************************************************************************************/
812c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent/*                                                                                  */
822c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent/* FUNCTION:                 LVEQNB_GetCapabilities                                 */
832c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent/*                                                                                  */
842c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent/* DESCRIPTION:                                                                     */
852c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent/*  Get the N-Band equaliser capabilities. The current capabilities are returned    */
862c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent/*  via the pointer.                                                                */
872c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent/*                                                                                  */
882c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent/* PARAMETERS:                                                                      */
892c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent/*  hInstance                Instance handle                                        */
902c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent/*  pCapabilities            Pointer to an empty capability structure               */
912c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent/*                                                                                  */
922c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent/* RETURNS:                                                                         */
932c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent/*  LVEQNB_Success           Succeeds                                               */
942c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent/*  LVEQNB_NULLADDRESS       hInstance or pCapabilities is NULL                     */
952c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent/*                                                                                  */
962c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent/* NOTES:                                                                           */
972c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent/*  1.  This function may be interrupted by the LVEQNB_Process function             */
982c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent/*                                                                                  */
992c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent/************************************************************************************/
1002c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent
1012c8e5cab3faa6d360e222b7a6c40a80083d021acEric LaurentLVEQNB_ReturnStatus_en LVEQNB_GetCapabilities(LVEQNB_Handle_t           hInstance,
1022c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent                                              LVEQNB_Capabilities_t     *pCapabilities)
1032c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent{
1042c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent
1052c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent    LVEQNB_Instance_t    *pInstance =(LVEQNB_Instance_t  *)hInstance;
1062c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent
1072c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent    if((hInstance == LVM_NULL) || (pCapabilities == LVM_NULL))
1082c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent    {
1092c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent        return LVEQNB_NULLADDRESS;
1102c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent    }
1112c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent
1122c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent    *pCapabilities = pInstance->Capabilities;
1132c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent
1142c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent    return(LVEQNB_SUCCESS);
1152c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent}
1162c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent
1172c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent
1182c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent/************************************************************************************/
1192c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent/*                                                                                  */
1202c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent/* FUNCTION:            LVEQNB_SetFilters                                           */
1212c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent/*                                                                                  */
1222c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent/* DESCRIPTION:                                                                     */
1232c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent/*  Sets the filter type based on the definition.                                   */
1242c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent/*                                                                                  */
1252c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent/* PARAMETERS:                                                                      */
1262c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent/*  pInstance           Pointer to the instance                                     */
1272c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent/*  pParams             Initialisation parameters                                   */
1282c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent/*                                                                                  */
1292c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent/* RETURNS:                                                                         */
1302c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent/*  void                Nothing                                                     */
1312c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent/*                                                                                  */
1322c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent/* NOTES:                                                                           */
1332c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent/*  1. To select the biquad type the follow rules are applied:                      */
1342c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent/*          Double precision    if (fc <= fs/110)                                   */
1352c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent/*          Double precision    if (fs/110 < fc < fs/85) & (Q>3)                    */
1362c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent/*          Single precision    otherwise                                           */
1372c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent/*                                                                                  */
1382c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent/************************************************************************************/
1392c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent
1402c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurentvoid    LVEQNB_SetFilters(LVEQNB_Instance_t     *pInstance,
1412c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent                          LVEQNB_Params_t       *pParams)
1422c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent{
1432c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent
1442c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent    extern const LVM_UINT16   LVEQNB_SampleRateTab[];           /* Sample rate table */
1452c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent    LVM_UINT16          i;                                      /* Filter band index */
1462c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent    LVM_UINT32          fs = (LVM_UINT32)LVEQNB_SampleRateTab[(LVM_UINT16)pParams->SampleRate];  /* Sample rate */
1472c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent    LVM_UINT32          fc;                                     /* Filter centre frequency */
1482c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent    LVM_INT16           QFactor;                                /* Filter Q factor */
1492c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent
1502c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent
1512c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent    pInstance->NBands = pParams->NBands;
1522c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent
1532c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent    for (i=0; i<pParams->NBands; i++)
1542c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent    {
1552c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent        /*
1562c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent         * Get the filter settings
1572c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent         */
1582c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent        fc = (LVM_UINT32)pParams->pBandDefinition[i].Frequency;     /* Get the band centre frequency */
1592c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent        QFactor = (LVM_INT16)pParams->pBandDefinition[i].QFactor;   /* Get the band Q factor */
1602c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent
1612c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent
1622c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent        /*
1632c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent         * For each filter set the type of biquad required
1642c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent         */
1652c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent        pInstance->pBiquadType[i] = LVEQNB_SinglePrecision;         /* Default to single precision */
1662c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent        if ((fc << 15) <= (LOW_FREQ * fs))
1672c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent        {
1682c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent            /*
1692c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent             * fc <= fs/110
1702c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent             */
1712c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent            pInstance->pBiquadType[i] = LVEQNB_DoublePrecision;
1722c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent        }
1732c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent        else if (((fc << 15) <= (HIGH_FREQ * fs)) && (QFactor > 300))
1742c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent        {
1752c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent            /*
1762c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent             * (fs/110 < fc < fs/85) & (Q>3)
1772c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent             */
1782c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent            pInstance->pBiquadType[i] = LVEQNB_DoublePrecision;
1792c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent        }
1802c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent
1812c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent
1822c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent        /*
1832c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent         * Check for out of range frequencies
1842c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent         */
1852c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent        if (fc > (fs >> 1))
1862c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent        {
1872c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent            pInstance->pBiquadType[i] = LVEQNB_OutOfRange;
1882c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent        }
1892c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent
1902c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent
1912c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent        /*
1922c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent         * Copy the filter definition to persistant memory
1932c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent         */
1942c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent        pInstance->pBandDefinitions[i] = pParams->pBandDefinition[i];
1952c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent
1962c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent    }
1972c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent}
1982c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent
1992c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent
2002c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent/************************************************************************************/
2012c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent/*                                                                                  */
2022c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent/* FUNCTION:            LVEQNB_SetCoefficients                                      */
2032c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent/*                                                                                  */
2042c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent/* DESCRIPTION:                                                                     */
2052c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent/*  Sets the filter coefficients. This uses the type to select single or double     */
2062c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent/*  precision coefficients.                                                         */
2072c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent/*                                                                                  */
2082c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent/* PARAMETERS:                                                                      */
2092c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent/*  pInstance           Pointer to the instance                                     */
2102c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent/*  pParams             Initialisation parameters                                   */
2112c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent/*                                                                                  */
2122c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent/************************************************************************************/
2132c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent
2142c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurentvoid    LVEQNB_SetCoefficients(LVEQNB_Instance_t     *pInstance)
2152c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent{
2162c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent
2172c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent    LVM_UINT16              i;                          /* Filter band index */
2182c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent    LVEQNB_BiquadType_en    BiquadType;                 /* Filter biquad type */
2192c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent
2202c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent
2212c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent    /*
2222c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent     * Set the coefficients for each band by the init function
2232c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent     */
2242c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent    for (i=0; i<pInstance->Params.NBands; i++)
2252c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent    {
2262c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent
2272c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent        /*
2282c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent         * Check band type for correct initialisation method and recalculate the coefficients
2292c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent         */
2302c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent        BiquadType = pInstance->pBiquadType[i];
2312c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent        switch  (BiquadType)
2322c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent        {
2332c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent            case    LVEQNB_DoublePrecision:
2342c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent            {
2352c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent                PK_C32_Coefs_t      Coefficients;
2362c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent
2372c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent                /*
2382c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent                 * Calculate the double precision coefficients
2392c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent                 */
2402c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent                LVEQNB_DoublePrecCoefs((LVM_UINT16)pInstance->Params.SampleRate,
2412c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent                                       &pInstance->pBandDefinitions[i],
2422c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent                                       &Coefficients);
2432c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent
2442c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent                /*
2452c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent                 * Set the coefficients
2462c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent                 */
2472c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent                PK_2I_D32F32CllGss_TRC_WRA_01_Init(&pInstance->pEQNB_FilterState[i],
2482c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent                                                   &pInstance->pEQNB_Taps[i],
2492c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent                                                   &Coefficients);
2502c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent                break;
2512c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent            }
2522c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent
2532c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent            case    LVEQNB_SinglePrecision:
2542c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent            {
2552c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent                PK_C16_Coefs_t      Coefficients;
2562c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent
2572c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent                /*
2582c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent                 * Calculate the single precision coefficients
2592c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent                 */
2602c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent                LVEQNB_SinglePrecCoefs((LVM_UINT16)pInstance->Params.SampleRate,
2612c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent                                       &pInstance->pBandDefinitions[i],
2622c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent                                       &Coefficients);
2632c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent
2642c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent                /*
2652c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent                 * Set the coefficients
2662c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent                 */
2672c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent                PK_2I_D32F32CssGss_TRC_WRA_01_Init(&pInstance->pEQNB_FilterState[i],
2682c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent                                                   &pInstance->pEQNB_Taps[i],
2692c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent                                                   &Coefficients);
2702c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent                break;
2712c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent            }
2722c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent            default:
2732c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent                break;
2742c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent        }
2752c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent    }
2762c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent
2772c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent}
2782c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent
2792c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent
2802c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent/************************************************************************************/
2812c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent/*                                                                                  */
2822c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent/* FUNCTION:            LVEQNB_ClearFilterHistory                                   */
2832c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent/*                                                                                  */
2842c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent/* DESCRIPTION:                                                                     */
2852c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent/*  Clears the filter data history                                                  */
2862c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent/*                                                                                  */
2872c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent/* PARAMETERS:                                                                      */
2882c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent/*  pInstance           Pointer to the instance                                     */
2892c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent/*                                                                                  */
2902c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent/************************************************************************************/
2912c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent
2922c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurentvoid    LVEQNB_ClearFilterHistory(LVEQNB_Instance_t     *pInstance)
2932c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent{
2942c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent    LVM_INT16       *pTapAddress;
2952c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent    LVM_INT16       NumTaps;
2962c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent
2972c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent
2982c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent    pTapAddress = (LVM_INT16 *)pInstance->pEQNB_Taps;
2992c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent    NumTaps     = (LVM_INT16)((pInstance->Capabilities.MaxBands * sizeof(Biquad_2I_Order2_Taps_t))/sizeof(LVM_INT16));
3002c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent
3012c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent    if (NumTaps != 0)
3022c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent    {
3032c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent        LoadConst_16(0,                                 /* Clear the history, value 0 */
3042c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent                     pTapAddress,                       /* Destination */
3052c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent                     NumTaps);                          /* Number of words */
3062c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent    }
3072c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent}
3082c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent
3092c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent
3102c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent/****************************************************************************************/
3112c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent/*                                                                                      */
3122c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent/* FUNCTION:                LVEQNB_Control                                              */
3132c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent/*                                                                                      */
3142c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent/* DESCRIPTION:                                                                         */
3152c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent/*  Sets or changes the LifeVibes module parameters.                                    */
3162c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent/*                                                                                      */
3172c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent/* PARAMETERS:                                                                          */
3182c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent/*  hInstance               Instance handle                                             */
3192c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent/*  pParams                 Pointer to a parameter structure                            */
3202c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent/*                                                                                      */
3212c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent/* RETURNS:                                                                             */
3222c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent/*  LVEQNB_Success          Always succeeds                                             */
3232c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent/*  LVEQNB_NULLADDRESS      Instance or pParams  is NULL pointer                        */
3242c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent/*  LVEQNB_NULLADDRESS      NULL address for the equaliser filter definitions and the   */
3252c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent/*                          number of bands is non-zero                                 */
3262c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent/*                                                                                      */
3272c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent/* NOTES:                                                                               */
3282c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent/*  1.  This function may be interrupted by the LVEQNB_Process function                 */
3292c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent/*                                                                                      */
3302c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent/****************************************************************************************/
3312c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent
3322c8e5cab3faa6d360e222b7a6c40a80083d021acEric LaurentLVEQNB_ReturnStatus_en LVEQNB_Control(LVEQNB_Handle_t        hInstance,
3332c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent                                      LVEQNB_Params_t        *pParams)
3342c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent{
3352c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent
3362c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent    LVEQNB_Instance_t    *pInstance = (LVEQNB_Instance_t  *)hInstance;
3372c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent    LVM_INT16            bChange    = LVM_FALSE;
3382c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent    LVM_INT16            i = 0;
3392c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent    LVEQNB_Mode_en       OperatingModeSave ;
3402c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent
3412c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent    /*
3422c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent     * Check for error conditions
3432c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent     */
3442c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent    if((hInstance == LVM_NULL) || (pParams == LVM_NULL))
3452c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent    {
3462c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent        return LVEQNB_NULLADDRESS;
3472c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent    }
3482c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent
3492c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent    if((pParams->NBands !=0) && (pParams->pBandDefinition==LVM_NULL))
3502c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent    {
3512c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent        return LVEQNB_NULLADDRESS;
3522c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent    }
3532c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent
3542c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent    OperatingModeSave = pInstance->Params.OperatingMode;
3552c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent
3562c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent    /* Set the alpha factor of the mixer */
3572c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent    if (pParams->SampleRate != pInstance->Params.SampleRate)
3582c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent    {
3592c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent        LVC_Mixer_VarSlope_SetTimeConstant(&pInstance->BypassMixer.MixerStream[0],LVEQNB_BYPASS_MIXER_TC,(LVM_Fs_en)pParams->SampleRate,2);
3602c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent        LVC_Mixer_VarSlope_SetTimeConstant(&pInstance->BypassMixer.MixerStream[1],LVEQNB_BYPASS_MIXER_TC,(LVM_Fs_en)pParams->SampleRate,2);
3612c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent    }
3622c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent
3632c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent
3642c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent    if( (pInstance->Params.NBands            !=  pParams->NBands          ) ||
3652c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent        (pInstance->Params.OperatingMode     !=  pParams->OperatingMode   ) ||
3662c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent        (pInstance->Params.pBandDefinition   !=  pParams->pBandDefinition ) ||
3672c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent        (pInstance->Params.SampleRate        !=  pParams->SampleRate      ) ||
3682c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent        (pInstance->Params.SourceFormat      !=  pParams->SourceFormat    ))
3692c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent    {
3702c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent
3712c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent        bChange = LVM_TRUE;
3722c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent    }
3732c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent    else
3742c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent    {
3752c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent        for(i = 0; i < pParams->NBands; i++)
3762c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent        {
3772c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent
3782c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent            if((pInstance->pBandDefinitions[i].Frequency  != pParams->pBandDefinition[i].Frequency )||
3792c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent                (pInstance->pBandDefinitions[i].Gain       != pParams->pBandDefinition[i].Gain      )||
3802c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent                (pInstance->pBandDefinitions[i].QFactor    != pParams->pBandDefinition[i].QFactor   ))
3812c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent            {
3822c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent
3832c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent                bChange = LVM_TRUE;
3842c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent            }
3852c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent        }
3862c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent    }
3872c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent
3882c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent
3892c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent    if(bChange){
3902c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent
3912c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent        /*
3922c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent         * If the sample rate has changed clear the history
3932c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent         */
3942c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent        if (pInstance->Params.SampleRate != pParams->SampleRate)
3952c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent        {
3962c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent            LVEQNB_ClearFilterHistory(pInstance);           /* Clear the history */
3972c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent        }
3982c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent
3992c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent        /*
4002c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent         * Update the instance parameters
4012c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent         */
4022c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent        pInstance->Params = *pParams;
4032c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent
4042c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent
4052c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent        /*
4062c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent         * Reset the filters except if the algo is switched off
4072c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent         */
4082c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent        if(pParams->OperatingMode != LVEQNB_BYPASS){
4092c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent            /*
4102c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent             * Reset the filters as all parameters could have changed
4112c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent             */
4122c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent            LVEQNB_SetFilters(pInstance,                        /* Instance pointer */
4132c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent                              pParams);                         /* New parameters */
4142c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent
4152c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent            /*
4162c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent             * Update the filters
4172c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent             */
4182c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent            LVEQNB_SetCoefficients(pInstance);                  /* Instance pointer */
4192c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent        }
4202c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent
4212c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent        if(pParams->OperatingMode != OperatingModeSave)
4222c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent        {
4232c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent            if(pParams->OperatingMode == LVEQNB_ON)
4242c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent            {
4252c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent                LVC_Mixer_SetTarget(&pInstance->BypassMixer.MixerStream[0],LVM_MAXINT_16);
4262c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent                LVC_Mixer_SetTarget(&pInstance->BypassMixer.MixerStream[1],0);
4272c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent
4282c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent                pInstance->BypassMixer.MixerStream[0].CallbackSet        = 1;
4292c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent                pInstance->BypassMixer.MixerStream[1].CallbackSet        = 1;
4302c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent            }
4312c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent            else
4322c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent            {
4332c8e5cab3faa6d360e222b7a6c40a80083d021acEric Laurent                /* Stay on the ON operating mode until the transition is done */
434