Monday, August 15, 2011

Can you Hear me? Good!

Lets have a little talk about or what I like to call the audio driver from Hell.

Some background to start.  First off, our audio system is already a pretty big hack.  When the msm7x30 phones first started appearing, sound became the first major hurdle.  It ended up that HTC did some new and crazy stuff to the libaudio drivers that came with the phone, stuff tied directly to the framework, that made having audio on an AOSP based ROM pretty much impossible.
*Enter the G2* So came the realization that we needed an aosp based libaudio.  Turns out that CAF (Code Aurora Forums) Had the source posted for the msm7x30 audio driver. BUT it still did not work.  HTC added a DSP to the audio system for better sound reproduction based on what your current audio source was.  This DSP (aic3254) broke everything.  This is where the G2 aka Vision came in.  It was an HTC AOSP based phone, maybe, just maybe its libaudio would hold the key.  And well it did.  What occurred is that HTC is horrible about leaving code in its drivers/framework etc, tied to other devices/carriers.  The G2 Libaudio had the AOSP compatibilty but in HTC's popular fashion it also contained the code for proper profile switching for the aic3254.

So right now for the msm7x30 phones running CM7, we are actually using the libaudio from the g2(vision).
On the newer phones like mecha and vivo, we still get audio but we have found some quirks.  Apparently HTC has been adding more functionality to the aic3254 in the audio lib, and because of that, it is making the support on newer phones more difficult. (i.e. the Camcorder recording audio bug).  This is also where a few other little things have been creeping up with headphone support, skype, etc.
*Enter Kali-*
Now here is where some magic comes in from the CM team.  Kali- who supports the ACE and VIVO has been hacking away at the HTC libaudio, and putting the missing functions into the source code from CAF.  Its really come along way, but still has several little bugs as expected from reverse engineering the sound lib.

So, the question of the night is, "How does this effect the mecha users?"
Well up until 1.5.x I was using the prebuilt libaudio from vision.  I had been playing around with the source built one from Kali, and decided that it was working well enough to put out as the audio driver for mecha, or atleast give it more testing than just me.
As you can tell, 1.5.x fixed a few things, and broke some things.  I worked with Kali- to fix some of the issues, but there was some more glaring problems that just couldnt justify keeping the implementation. (Dont try voice dialing on BT trust me.)
So because of that, I swapped back to the prebuilt libaudio from vision for 1.6.x.  If you noticed some stuff got fixed, and other things got broken again.  For right now, this is the frankenstein we have to live with.  Do understand that we are trying to get the msm7x30 audio working as best as possible, but in the mean time there are somethings we have to live with.


  1. Still can't get over how smooth it is....I have a bug where while in the car over bt I don't have audio in a call but that's it. I thank you for all you have done! Keep up the outstanding work!

  2. Thanks for all you do bro. I don't know why I bought the thunder butt. I don't care for htc phones (or should I say batteries/battery management)& I don't like sense. But I did want a shiny new phone coming from the d1. You have made the thunderbolt worth owning for me.

  3. Yeah I'm on 1.5.2 but all I see is no by car phone audio. Music playback is fine. Calls would be nice but I'm not sure ill complain.

  4. I just tried voice dialing from Bluetooth before reading this, and that little warning made me chuckle, was wondering why the phone was almost completely unresponsive.
    As it isn't said enough, thank you for all your hard work and dedication, both here, and to our country. As a former service member (USMC), I know what it's like to make sacrifices. How you juggle that, your family, and developing is beyond me.

  5. Thanks for grinding away at these annoying issues. My only issue is no mic when I'm using headphones on a call. It's annoying but I can deal with it knowing smart dudes like you are still trying to hack this thing together. Thanks!