Reporting what I found so far. Hopefully someone can give a hint... First of all, preparing some tools:
$ cd $AOSP $ adb push ./out/target/product/emev/symbols/system/bin/tinymix /system/bin/tinymix $ adb push ./out/target/product/emev/symbols/system/bin/tinyplay /system/bin/tinyplay $ adb push ./out/target/product/emev/symbols/system/bin/tinycap /system/bin/tinycap $ adb push ./device/renesas/emev/audio/sample1.wav /storage/sdcard0/Music/sample1.wav $ adb shell chmod 755 /system/bin/tinymix $ adb shell chmod 755 /system/bin/tinyplay $ adb shell chmod 755 /system/bin/tinycap Then, let's see what HAL reports: $ adb logcat | grep audio I/AudioFlinger( 75): Using module 1 has the primary audio interface V/audio_hw_primary( 75): path_apply: ctl 0 Playback Switch j=9 value=1 V/audio_hw_primary( 75): path_apply: ctl 1 CODEC Power Switch j=10 value=1 V/audio_hw_primary( 75): path_apply: ctl 2 Sampling Rate Switch j=8 value=10 V/audio_hw_primary( 75): Path: speaker, length: 3 V/audio_hw_primary( 75): 0: Playback Switch -> 1 V/audio_hw_primary( 75): 1: CODEC Power Switch -> 1 V/audio_hw_primary( 75): 2: Sampling Rate Switch -> 10 V/audio_hw_primary( 75): mixert ctl 0 - new: 2, old: 2 V/audio_hw_primary( 75): mixert ctl 1 - new: 2, old: 2 V/audio_hw_primary( 75): mixert ctl 2 - new: 2, old: 2 V/audio_hw_primary( 75): mixert ctl 3 - new: 2, old: 2 V/audio_hw_primary( 75): mixert ctl 4 - new: 2, old: 2 V/audio_hw_primary( 75): mixert ctl 5 - new: 2, old: 2 V/audio_hw_primary( 75): mixert ctl 6 - new: 2, old: 2 V/audio_hw_primary( 75): mixert ctl 7 - new: 0, old: 0 V/audio_hw_primary( 75): mixert ctl 8 - new: 10, old: 10 V/audio_hw_primary( 75): mixert ctl 9 - new: 1, old: 1 V/audio_hw_primary( 75): mixert ctl 10 - new: 1, old: 1 V/audio_hw_primary( 75): select_devices: adev->devices=2 -> hp=n speaker=y main-mic=n I/AudioPolicyService( 75): Loaded audio policy from LEGACY Audio Policy HAL (audio_policy) W/WiredAccessoryObserver( 253): This kernel does not have usb audio support W/WiredAccessoryObserver( 253): This kernel does not have HDMI audio support And what the mixer device reports: $ adb shell tinymix Number of controls: 11 ctl type num name value 0 INT 2 DAC Volume 2 2 1 INT 2 Headphone Volume 2 2 2 INT 2 Speaker Volume 2 2 3 INT 2 MIC1 Volume 2 2 4 INT 2 MIC2 Volume 2 2 5 INT 2 AUXIN Volume 2 2 6 INT 2 AUXOUT Volume 2 2 7 ENUM 1 Capture Switch OFF 8 ENUM 1 Sampling Rate Switch 44.1kHz 9 ENUM 1 Playback Switch OFF 10 BOOL 1 CODEC Power Switch On First discrepancy here. The "Playback Switch" is OFF if we look at it with tinymix, while it should be set to value of 1 (which is "Speaker_normal") standing to HAL. I tried changing some other setting in mixer_paths.xml but they're not reflected in tinymix. What could have go wrong here? Let's see how to hack it, to make the device play some sound and show that the PCM, Mixer and tinyalsa layers are actually working fine. $ adb shell # tinymix 9 1 # tinymix Number of controls: 11 ctl type num name value 0 INT 2 DAC Volume 2 2 1 INT 2 Headphone Volume 2 2 2 INT 2 Speaker Volume 2 2 3 INT 2 MIC1 Volume 2 2 4 INT 2 MIC2 Volume 2 2 5 INT 2 AUXIN Volume 2 2 6 INT 2 AUXOUT Volume 2 2 7 ENUM 1 Capture Switch OFF 8 ENUM 1 Sampling Rate Switch 44.1kHz 9 ENUM 1 Playback Switch Speaker_normal 10 BOOL 1 CODEC Power Switch On # tinyplay /storage/sdcard0/Music/sample1.wav Playing sample: 2 ch, 44100 hz, 16 bit [ ... music playing fine on speakers ... ] I can control volume or output selection, through tinymix. I noticed that for other sample wav files I found on the internet (I have not many with me), tinyplay fails for either "is not a PCM riff/wave file" or "can't set PCM device ... cannot set hw params". First error is clearly a file format error. Second one is because the PCM device can't handle the sample rate for example, I guess. I'd like to understand what PCM output is produced by the Android MediaPlayer. Does it depend on the origin file being decoded (e.g. an .mp3)? If it's not producing exactly what the PCM expects, I may get an error from the player. On Thursday, 8 November 2012 14:42:21 UTC+1, ffxx68 wrote: > > Hi > > I'm trying to port a ICS implementation of ALSA audio to JB, or a tablet > device, under this project: > > Mainly, I have the following to integrate (which I have the patch for ICS): > > external/alsa-lib > hardware/alsa_sound > > plus some other smaller fix around, but I want to understand first of all > what to do with these two first. > > For example, I have the some files with the same names in both > hardware/alsa_sound and hardware/libhardware_legacy/ > audio (from AOSP), but their content is very different in the two > locations. > > If I keep the ones from hardware/alsa_sound, build fails. > If I copy them from hardware/libhardware_legacy/audio to > hardware/alsa_sound, I can build but I get a crash during boot. > > Which one should I keep and compile? > Once compiled, which libraries should I use from alsa_sound or > libhardware_legacy/audio? > > Basically, I don't know the approach to follow, with the ALSA integration. > I couldn't find any guide, or tutorial, so any help in that sense is > welcome too. > > Thanks in advance > Fabio > -- -- unsubscribe: [email protected] website: http://groups.google.com/group/android-porting --- You received this message because you are subscribed to the Google Groups "android-porting" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/groups/opt_out.
