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.

ALSA in Gingerbread

Hello,

I am trying to bring audio up on a custom 3530 platform. I've tried to edit the asound.conf but I can't see to figure it out. So I've written a shell script to route the sound via alsa_amixer.

#!/system/bin/
alsa_amixer cset numid=56 on
alsa_amixer cset numid=57 on
alsa_amixer cset numid=58 on
alsa_amixer cset numid=52 on
alsa_amixer cset numid=53 on
alsa_amixer cset numid=54 on
alsa_amixer cset numid=13 3,0
alsa_amixer cset numid=3 30,30
alsa_amixer cset numid=5 1,0

When i run this script the unit has sound, but I would like to integrate this logic into the asound.conf. Here was my attempt modifying the asound.conf.

# Android ALSA configuration file for TI OMAP3430 reference platform using the TWL4030 ASoC audio.

##
## Mixer Devices
##

ctl.AndroidOut {
    type hw
    card 0
}

ctl.AndroidIn {
    type hw
    card 0
}


##
## Playback Devices
##

pcm.AndroidOut_Speaker {
    type hooks
    slave.pcm {
        type hw
        card 0
        device 0
    }
    hooks.0 {
        type ctl_elems
        hook_args [
        {name 'PredriveL Mixer AudioL1' value on}
        {name 'PredriveL Mixer AudioL2' value on}
        {name 'PredriveL Mixer AudioR2' value on}
        {name 'PredriveR Mixer AudioL2' value on}
        {name 'PredriveR Mixer AudioR1' value on}
        {name 'PredriveR Mixer AudioR2' value on}
        {name 'PreDriv Playback Volume' value 3}   
        ]
    }   
}

pcm.AndroidOut_Speaker_normal {
    type hooks
    slave.pcm {
        type hw
        card 0
        device 0
    }
    hooks.0 {
        type ctl_elems
        hook_args [
        {name 'PredriveL Mixer AudioL1' value on}
        {name 'PredriveL Mixer AudioL2' value on}
        {name 'PredriveL Mixer AudioR2' value on}
        {name 'PredriveR Mixer AudioL2' value on}
        {name 'PredriveR Mixer AudioR1' value on}
        {name 'PredriveR Mixer AudioR2' value on}
        {name 'PreDriv Playback Volume' value 3}   
        ]
    }
}

pcm.AndroidOut_Headset {
    type hw
}

pcm.AndroidOut_Earpiece {
    type hw
}

# No bluetooth available.  Send output to the bit bucket.
pcm.AndroidOut_Bluetooth {
    type null
}

pcm.AndroidOut_Bluetooth-A2DP {
    type null
}


##
## Recording device
##

pcm.AndroidIn {
    type hw
}

This asound.conf seems to do nothing. Is there something I'm missing, or could someone point me to some documentation? Thanks!

 

 

  • Hi Tyler,

    The file asound.conf does not affect the settings.
    The file hardware/ti/omap3/modules/alsa/alsa_module.cpp has to be changed to reflect the amixer changes.
    You may have to edit the existing function setDefaultControls to add your amixer settings.
    Please let us know in case of any issues.

    Regards,
    Arun

    Kindly click the verify answer button on this post if it answer your question.

  • Arun,

    Thanks for the quick response. I checked out alsa_module.cpp and found this:

    /* Currently Controls are configured/supported for the following Output
     * and Input devices:
     *
     * OutPut devices:
     * AudioSystem::DEVICE_OUT_SPEAKER
     *
     * Input devices:
     * AudioSystem::DEVICE_IN_BUILTIN_MIC
     *
     * FIXME: Controls to be set for following audio-device profiles on per hardware basis:
     *       DEVICE_OUT_EARPIECE, DEVICE_IN/OUT_WIRED_HEADSET/HEADPHONE, DEVICE_IN/OUT_BLUETOOTH_*(+ A2DP profiles)
     **/

    void setDefaultControls(uint32_t devices, int mode)
    {
    LOGV("%s", __FUNCTION__);
        ALSAControl control("hw:00");

        /* check whether the devices is input or not */
        /* for output devices */
        if (devices & 0x0000FFFF){
            if (devices & AudioSystem::DEVICE_OUT_SPEAKER) {
                control.set("HeadsetR Mixer AudioR1", 1); // on
                control.set("HeadsetL Mixer AudioL1", 1); // on
                control.set("Headset Playback Volume", 1); //Headset Volume
            } else {
                control.set("HeadsetR Mixer AudioR1", (unsigned int)0); // off
                control.set("HeadsetL Mixer AudioL1", (unsigned int)0); // off
            }
        }

        /* for input devices */
        if (devices >> 16) {
            if (devices & AudioSystem::DEVICE_IN_BUILTIN_MIC) {
            control.set("Analog Left AUXL Capture Switch", 1); //on
            control.set("Analog Right AUXR Capture Switch", 1); //on
            control.set("Analog Capture Volume", (unsigned int)0); //Capture volume '0' to capture less noice
            } else {
            control.set("Analog Left AUXL Capture Switch", (unsigned int)0); //off
            control.set("Analog Right AUXR Capture Switch", (unsigned int)0); //off
            }
        }
    }

     

    This looks to be exactly what I was looking for. I will try my settings in the morning, and report back. Thanks again.

    Tyler

  • HI tyler ,

                I am also getting the same problem , my play shows navigation but no sound will be produced .

    If in case you have solved this issue by changing this particular code. Please let me know what all you have modified and on what basis?

    THANKS AND REGARDS
    ROHIT Y SHANBHAG
    BANGALORE

  • I'm  booting android gingerbread on Da Vinci 8148 , the android boots succesfully , but  the audio is very low , its not audible , how can i configure it.