This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

AER: with Multi-Mic Selection, how to manually select an active mic.

AER version: 16.0.0.1

Platfrom: c5517

I have a system with two microphones and have followed the template of the example/simulation to create two instances of the AER, initialize/open the mss module and modify the aer processing as shown in the example.

In the course of my debugging/tuning, I would like to force the mss to pick one mic channel over the other at initialization time. Again based on the examples/documentation I am doing the following, where gActiveMic is set to 1.

tint aaer_mmic_init(void)
{
    mssControl_t      mss_ctl_cfg;
    tint stat;
   
   
if (gActiveMic>=AER_HF_NUM_MIC)
   
{
        stat
=mss_ERR_INVALIDPAR;
       
return stat;
   
}
   
   
/* Set the passed hands-free mic instance as the active instance for AER */
    stat
= aerActivate (gAppAerInst[gActiveMic], NULL);
 
   
/* Set the hands-free mic as the selected source for MSS */
    mss_ctl_cfg
.valid_bitfield = mss_CTL_SELECT_SRC;
    mss_ctl_cfg
.source.group   = mss_SRC_MIC_FIXED;
    mss_ctl_cfg
.source.index   = gActiveMic;
    stat
= mssControl (gAppMssInst, &mss_ctl_cfg);
        
   
if (1==doFreeze)
   
{
       
// DEBUG: freeze selection, should keep mic at the one selected above.
        mss_ctl_cfg.valid_bitfield = mss_CTL_MODES;
        mss_ctl_cfg
.modes.mask = mss_CTL_MODES_FREEZE;
        mss_ctl_cfg
.modes.value = mss_CTL_MODES_FREEZE;

   
}
   
return stat;
} /* aaer_mmic_init */

The end result of the above code is that the first time through my main audio thread the call to mms control function, which evaluates the current mic and compares it to the active mic reports that the current mic is 0 and immediately switches to mic 0.

// Checks for change in active mic and activates the aer for the newly selected mic.
// returns the active mic.

tint aaer_mmic_control(tint* p_the_current_active_mic)
{
tint stat;
/* Get selected mic information from MSS */
mssDebugStat(gAppMssInst, &mss_dbg);
/* Check if a different mic has just been selected */
if(mss_dbg.cur_src.index != *p_the_current_active_mic)
{
/* Activate the AER instance for the newly selected mic */
stat
= aerActivate(gAppAerInst[mss_dbg.cur_src.index],gAppAerInst[*p_the_current_active_mic]);
*p_the_current_active_mic =mss_dbg.cur_src.index;
}

return stat;
} /* aaer_mmic_control */

In looking at mms debug information in aaer_mmic_init( ), before and after the call to the mms_control( ) function it shows

mms_dbg.cur_src.group = 0;

mss_dbg.cur_src.index = 0;

mms_dbg.new_src.group = 29504

mms_dbg.new_src.index = -7534

It shows these same values on the first call to aaer_mmic_control( ) function

What is the proper way to manually select a microphone with the mss? 

Why after this call to mmsControl

   /* Set the hands-free mic as the selected source for MSS */
    mss_ctl_cfg
.valid_bitfield = mss_CTL_SELECT_SRC;
    mss_ctl_cfg
.source.group   = mss_SRC_MIC_FIXED;
    mss_ctl_cfg
.source.index   = 1;
    stat
= mssControl (gAppMssInst, &mss_ctl_cfg);

does the mss_dbg info show that the current mic is 0?

-Shawn

  • CORRECTION TO THE CODE FRAGMENTS PRESENTED: (Some code got lost when I was trying to prune the code for better readability.  Here is the code in its entirety.  Sorry the formatting/indenting is so bad.

    tint aaer_mmic_init(void)
    {
    mssControl_t mss_ctl_cfg;
    tint stat;
    // mssDebugStat_t mss_dbg;


    if (gActiveMic>=AER_HF_NUM_MIC)
    {
    stat
    =mss_ERR_INVALIDPAR;
    return stat;
    }

    /* Set the passed hands-free mic instance as the active instance for AER */
    stat
    = aerActivate (gAppAerInst[gActiveMic], NULL);
    if (stat != aer_NOERR)
    {
    #ifdef DEBUG_LOG_PRINT
    LOG_printf(&trace,
    "ERROR: aerActivate() = %d", stat);
    #endif
    return stat;
    }
    /* Get selected mic information from MSS */
    mssDebugStat(gAppMssInst, &mss_dbg);

    /* Set the hands-free mic as the selected source for MSS */
    mss_ctl_cfg
    .valid_bitfield = mss_CTL_SELECT_SRC;
    mss_ctl_cfg
    .source.group = mss_SRC_MIC_FIXED;
    mss_ctl_cfg
    .source.index = gActiveMic;
    stat
    = mssControl (gAppMssInst, &mss_ctl_cfg);

    /* Get selected mic information from MSS */
    mssDebugStat(gAppMssInst, &mss_dbg);

    if (stat != aer_NOERR)
    {
    #ifdef DEBUG_LOG_PRINT
    LOG_printf(&trace,
    "ERROR: mssControl() = %d", stat);
    #endif
    return stat;
    }

    if (1==doFreeze)
    {
    // DEBUG: freeze selection, should keep mic at the one selected above.
    mss_ctl_cfg.valid_bitfield = mss_CTL_MODES;
    mss_ctl_cfg
    .modes.mask = mss_CTL_MODES_FREEZE;
    mss_ctl_cfg
    .modes.value = mss_CTL_MODES_FREEZE;

    stat
    = mssControl (gAppMssInst, &mss_ctl_cfg);
    if (stat != aer_NOERR)
    {
    #ifdef DEBUG_LOG_PRINT
    LOG_printf(&trace,
    "ERROR: mssControl() = %d", stat);
    #endif
    return stat;
    }
    }


    /* Get selected mic information from MSS */
    mssDebugStat(gAppMssInst, &mss_dbg);

    return stat;
    } /* aaer_mmic_init */

  • Hi Shawn,

    Version 16.0.0.1 had a bug in mssControl() which caused the problem you encountered. I attached a new version of AER library which has the fix. Please unzip the attached file and replace

    <installation root>\packages\ti\mas\aer\c55L\aer_a.c55L and aer_c.c55L with the unzipped files.

    In addition, after the call to mssControl to select a microphone, the mss_dbg will still show current mic is 0 until the switch over is finished. The time for switching is configurable through parameter switch_duration

    Regards,

    Jianzhong

  • I don't see the attachment, or maybe my system is blocking it?  Is there a link I can go to to get the newest aer release?

    Also,

    If I select a specfic mic and then I freeze the control mode, will the switch over still take place after switch_duration? Or do I have to wait for the switch over to occur before freezing the control mode.

    thanks

    -S

  • Shawn,

    Yes, the switch over will still take place. The “freeze” control only stops the automatic selection by MSS.

    Regards,

    Jianzhong