[Spirit FM] mikereidis:
I can reproduce the problem as described now, so at least that's a tiny bit of progress. I tried some simple poking of the ALSA "FM Radio Path" control, but that didn't help.

I can confirm that starting and stopping my app allows the audio to work again for at least 1 more call.

So in theory, I could add a hack to a hack that may be usable. I could keep the service running, and when the end of the "1 free" phone call is detected, it may be possible to briefly start and stop some parts of the FM service and that might enable audio on the next call.

What's strange about this problem is that the first phone call is OK. If it was a simple matter of my app leaving something in a bad state, you'd think that the audio problem would happen on the 1st call. Why is the first call OK ?

What else....? Perhaps the mediaserver. or some other service could be restarted.

These are the most promising potential quick fixes I can think of, because "Galaxy S ALSA" is a hack with known problems, including these phone call audio issues, even on CM and MIUI. I was hoping to remove it once MIUI supported the CM audio method. You may be aware of the somewhat random audio startup problems. Restarting fixes it but not before some very loud clicks that might have you wondering about the speaker damage issue. And for one reason or another there occasionally seem to be issues that persist across phone boots. Baffling...

I'm only keeping "Galaxy S ALSA" there now for ICS ROM testing. But I'd guess some people will still be using ICS ROMs in 2013 for which this will the only usable method. :(

So as before and always, the best solution is one the ROM audio library supports well. "Galaxy S ALSA" is not it, unless someone can figure out a good working solution that works with it. The API my app uses is relatively simple. Run the command shown below and see some of the output towards the end I reproduce:

adb shell /data/data/com.mikersmicros.fm/files/ssd 4 0

#or

adb shell /data/data/com.mikersmicros.fm_unlock/files/ssd 4 0

#Output:

...

elid numid: 9

elid name: FM Radio Path

cei iface: 2 Virtual Mixer

cei access: 0x3 rd,wr

cei owner: -1

cei type: 3 Enumerated

cei items: 4

cei names: 'FMR_OFF' 'FMR_SPK' 'FMR_HP' 'FMR_DUAL_MIX'

Values: 0

......

#So control number 9 lets you enable and disable the FM audio paths.

#Using this command, we can enable FM speaker (FMR_SPK):

adb shell /data/data/com.mikersmicros.fm_unlock/files/ssd 4 2 9 1

#This for headset (FMR_HP):

adb shell /data/data/com.mikersmicros.fm_unlock/files/ssd 4 2 9 2

#In theory this should disable FM audio (FMR_OFF), but it never works for me. This MIGHT be one reason for the problems.

adb shell /data/data/com.mikersmicros.fm_unlock/files/ssd 4 2 9 0

=============

But ALSA drivers under Android often have very bare minimum support, and other methods are usually used to control the audio hardware. The Galaxy S audio chip, the wm8994 has HUNDREDS of registers, and many more individual bits.

It's best for the Android audio library and drivers to handle complex routing issues. Apps should just use whatever facilities Android provides. The speaker damage issues and the need for a background process to play silence files are just two more reasons for this.

But sadly of course, Android FM audio solutions for different device and ROM combinations are not standardized, and always take effort when starting with AOSP code.