status_t SpeechEnhancementController::SetWBSpeechParametersToAllModem(const AUDIO_CUSTOM_WB_PARAM_STRUCT *pSphParamWB)
{
    SpeechDriverFactory *pSpeechDriverFactory = SpeechDriverFactory::GetInstance();
    SpeechDriverInterface *pSpeechDriver = NULL;

    for (int modem_index = MODEM_1; modem_index < NUM_MODEM; modem_index++) {
        pSpeechDriver = pSpeechDriverFactory->GetSpeechDriverByIndex((modem_index_t)modem_index);
        if (pSpeechDriver != NULL) { // Might be single talk and some speech driver is NULL
            pSpeechDriver->SetWBSpeechParameters(pSphParamWB);
        }
    }

    return NO_ERROR;
}
void SpeechEnhancementController::SetBtHeadsetNrecOnToAllModem(const bool bt_headset_nrec_on)
{
    SpeechDriverFactory *pSpeechDriverFactory = SpeechDriverFactory::GetInstance();
    SpeechDriverInterface *pSpeechDriver = NULL;

    property_set(PROPERTY_KEY_BT_HEADSET_NREC_ON, (bt_headset_nrec_on == false) ? "0" : "1");
    mBtHeadsetNrecOn = bt_headset_nrec_on;

    for (int modem_index = MODEM_1; modem_index < NUM_MODEM; modem_index++)
    {
        pSpeechDriver = pSpeechDriverFactory->GetSpeechDriverByIndex((modem_index_t)modem_index);
        if (pSpeechDriver != NULL) // Might be single talk and some speech driver is NULL
        {
            pSpeechDriver->SetBtHeadsetNrecOn(mBtHeadsetNrecOn);
        }
    }
}
status_t SpeechEnhancementController::SetSpeechEnhancementMaskToAllModem(const sph_enh_mask_struct_t &mask)
{
    char property_value[PROPERTY_VALUE_MAX];
    sprintf(property_value, "0x%x 0x%x", mask.main_func, mask.dynamic_func);
    property_set(PROPERTY_KEY_SPH_ENH_MASKS, property_value);

    mSpeechEnhancementMask = mask;

    SpeechDriverFactory *pSpeechDriverFactory = SpeechDriverFactory::GetInstance();
    SpeechDriverInterface *pSpeechDriver = NULL;

    for (int modem_index = MODEM_1; modem_index < NUM_MODEM; modem_index++) {
        pSpeechDriver = pSpeechDriverFactory->GetSpeechDriverByIndex((modem_index_t)modem_index);
        if (pSpeechDriver != NULL) { // Might be single talk and some speech driver is NULL
            pSpeechDriver->SetSpeechEnhancementMask(mSpeechEnhancementMask);
        }
    }

    return NO_ERROR;
}
status_t SpeechEnhancementController::SetNBSpeechParametersToAllModem(const AUDIO_CUSTOM_PARAM_STRUCT *pSphParamNB)
{
    SpeechDriverFactory *pSpeechDriverFactory = SpeechDriverFactory::GetInstance();
    SpeechDriverInterface *pSpeechDriver = NULL;
    AUDIO_CUSTOM_PARAM_STRUCT mSphParamNB;

    if (mSMNROn == true)
    {
        //forcely set single mic setting
        ALOGD("%s(), mSMNROn = %d, set single mic setting", __FUNCTION__, mSMNROn);
        memcpy(&mSphParamNB, pSphParamNB, sizeof(AUDIO_CUSTOM_PARAM_STRUCT));
        for (int speech_mode_index = 0; speech_mode_index < 8; speech_mode_index++)
        {
            (mSphParamNB.speech_mode_para[speech_mode_index][13]) = 0;
            (mSphParamNB.speech_mode_para[speech_mode_index][14]) = 0;

        }
    }


    for (int modem_index = MODEM_1; modem_index < NUM_MODEM; modem_index++)
    {
        pSpeechDriver = pSpeechDriverFactory->GetSpeechDriverByIndex((modem_index_t)modem_index);
        if (pSpeechDriver != NULL) // Might be single talk and some speech driver is NULL
        {
            if (mSMNROn != true)
            {
                pSpeechDriver->SetNBSpeechParameters(pSphParamNB);
            }
            else
            {
                pSpeechDriver->SetNBSpeechParameters(&mSphParamNB);
            }
        }
    }

    return NO_ERROR;
}