adb shell cat /proc/asound/card0/pcm15p/sub0/hw_params access: RW_INTERLEAVED format: S16_LE subformat: STD channels: 2 rate: 48000 (48000/1) period_size: 240 buffer_size: 480
So I wrote a test app that plays lossless FLAC files directly through the ALSA driver.
The disgrace is:
1) It's targeted to recent msm8974 or apq8084 based devices and has no built-in support for other ones. If you've got an unsupported device, you have to modify the cards.xml file settings before anything, and this may be tricky (see below).
2) Root access is a must. A Permissive selinux setup may also be required (adb shell; setenforce Permissive).
3) No formats other than 16/24-bit FLAC or 16-bit APE are supported. There's a curious bug with 24-bit APE (won't be fixed);
-- All files not recognised for playback will be routed to Android;
-- If a particular sample rate (e.g., 176400) is not supported by hardware, it will be silently downsampled to its base rate (88200 or 44100 in this example);
-- If a particular format (i.e. a compressed stream, or 24-bit pcm or even 16-bit on some usb devices) is not supported, an error will be shown
4) In ALSA mode, volume controls work only when the app is in foreground (to be fixed);
5) Switching to/fro the Compr device may reboot your phone (kernel bug; workaround will be included later);
The settings file is called "/sdcard/.alsaplayer/cards.xml" and it's well commented. If you have a device missing there, all settings go in this file. A simple tip is checking the output of a mixer program like tinymixer and adding the diff when the device is playing and when it's not. These ALSA contrtols will be executed each time before the device is opened/closed/volume managed. The periods size/number to be added later.
This app also tries to play on "compressed" (a.k.a. "offload") Qualcomm devices, but you'll not be able to play FLAC files ulesss your kernel is patched; all newer msm8974/apq8084 devices support the hardware FLAC decoding, please ask your kernel developer to add the code like https://github.com/CyanogenMod/andro...fd87e90302c456 (I'm not providing a patch intentionally as (1) it's straightforward for an experienced developer (2) the codeaurora interface is really broken). For me, an offload FLAC playback sounds +worse+ than the direct pcm one (and I don't know the reasons why) -- I'm testing with the sennheiser IE-80 & audiotechnica ath 1000D headphones.
The program is opensource https://github.com/avs333/alsaplayer
The kudos go to skvalex who wrote almost all java part!