Motivated by the aptX codecs for CM14.1 bluetooth stack found by dh.harald (https://forum.xda-developers.com/oneplus-3/themes/mod-aptx-codec-t3521228) I present:
APTX (HD) support for CyanogenMod 13 based ROMs - V1.2
I ported the aptx codec offloading support from the latest Qualcomm bluetooth stack over to the bluetooth stack from CM 13. After a full week of porting and bugfixing I managed to get it to work on my Galaxy S5 running CM13!
Please go ahead and test this on other devices (or other Marshmallow based ROMs, if the bluetooth stack's API is equal to the API from CM13, it should work).
If it does not work for you, dirty flash your ROM again, the modification should be overwritten.
Requirements
ARMv7 device (sorry, no ARM64 or x86 support!)
CM13.0 ROM (for 14.X see dh.harald's thread)
aptX capable headset/speaker
Download
aptXforCM13_v1.2.zip (AFH)
aptXforCM13_v1.2.zip (Github)
Installation
1. Install zip from recovery
2. Add the following to the /system/build.prop file
Code:
persist.bt.a2dp_offload_cap=sbc-aptx-aptxhd
Search your log for the line I bt_btif_media: btif_a2dp_encoder_init Selected Codec aptX to see if it works.
Confirmed devices
Samsung Galaxy S5 (klte) on CM 13.0 (SD801)
OnePlus 3 on CM 13.0 (SD820)
OnePlus 3 on BJRR (SD820)
Galaxy S6 Edge+ on CM13 (Exynos 7420)
LG G2 D802 on CM13 (SD800)
Version history
V1.2 - This release incorporates two security fixes for bionic and bt library (CVE-2017-0422, CVE-2017-0602)
V1.1 - Improved A2DP buffer sizes, fixing audio glitches and reduces CPU usage
V1.0 - Initial release
Build from source code
If you want to integrate this mod to your own build/ROM, use the following repositories:
https://github.com/mh0rst/android_bionic for bionic (In repo mainfest.xml: <project path="bionic" name="mh0rst/android_bionic" groups="pdk" />)
https://github.com/mh0rst/android_system_bt (In repo mainfest.xml: <project path="system/bt" name="mh0rst/android_system_bt" groups="pdk" revision="cm-13.0-with-aptx" />)
Impossible to download, ads everywhere, but no file...
ElDonTheo said:
Impossible to download, ads everywhere, but no file...
Click to expand...
Click to collapse
Sorry for that, I didn't realize these sites had so many ads. Will upload to github and AFH this evening, make a suggestion if you want the file somewhere else.
Works fine here on a OnePlus3 with CM 13.0 nightly 20161107 (latest available version). I tested with a VTIN bluetooth 4.0 in-ear headphones.
Thanks a lot for this!!!
Works also fine on Sultan's CM13 for OP3.
Thank you very much for porting this to Marshmallow!
I need for xiaomi mi5.
lockdlock said:
I need for xiaomi mi5.
Click to expand...
Click to collapse
I don't know what bluetooth stack is used by the mi5, at least for their official ROM. Because they are using the Snapdragon 820 processor it might be the standard fluoride stack, which may work. Just try to flash this mod, if it doesn't work, re-flash your original ROM.
I know the mi5 has unofficial cm13/14.1 support, you could try to flash one of those and then try my mod (for cm13) or dh.haralds mod (for cm14.1)
Download is great now, thanks
But I couldn't make it work, it breaks the Bluetooth, which cannot be enabled :/
Galaxy Tab Pro 8.4 - RR unoffical
Same thing as mentioned above, it breaks the Bluetooth functionality.
Flashed it with and without dalvic / cache cleaning on htc one mini 2 with cm13
Does it need specific modifications to get it run?
Off topic: I read something on the forum - Snapdragon LLVM Compiler is just for the system not for compiling apps, right?
ElDonTheo said:
Download is great now, thanks
But I couldn't make it work, it breaks the Bluetooth, which cannot be enabled :/
Galaxy Tab Pro 8.4 - RR unoffical
Click to expand...
Click to collapse
Are you usung RR 5.8.0 or 5.7.4? Can you post a complete logcat of trying to enable bluetooth?
MrAnswer said:
Same thing as mentioned above, it breaks the Bluetooth functionality.
Flashed it with and without dalvic / cache cleaning on htc one mini 2 with cm13
Does it need specific modifications to get it run?
Off topic: I read something on the forum - Snapdragon LLVM Compiler is just for the system not for compiling apps, right?
Click to expand...
Click to collapse
I looked at the logcat you provided and the source of the ROM, but the creator didn't release the manifest used to build the ROM, therefore I can't check for differences between the bluetooth stacks. I don't want to raise hopes, it is very hard for me to solve bugs in combination with devices I don't own and without meaningful logcat or (obvious differences in) the source code.
The only specific modification my mod needs is a small modification to libc (symbols needed by aptx library, which was originally compiled for Nougat), and this is already included in my mod. It is likely that your ROMs modify libc or has a different bluetooth stack than CM13.
The snapdragon compiler AFAIK was introduced with the nougat repositories, and can be used for both system and app compiling (at least the native parts of the apps). I don't use it ATM, because I still compile for Marshmallow based CM13.
Dear @brhorst
I have a SM-G928F and @Rainbow_Dash CM13 ported rom ,
before using your codec :
music streaming Bluetooth work but lot of noise
Call with bluetooth work but lot of noise
after used your aptx codec :
music streaming Bluetooth work weel !!!!
Call with bluetooth work but lot of noise
my question is , can I manage to use the libs for "call throught bluetooth"?
Br
Elkhardioui said:
Dear @brhorst
I have a SM-G928F and @Rainbow_Dash CM13 ported rom ,
before using your codec :
music streaming Bluetooth work but lot of noise
Call with bluetooth work but lot of noise
after used your aptx codec :
music streaming Bluetooth work weel !!!!
Call with bluetooth work but lot of noise
my question is , can I manage to use the libs for "call throught bluetooth"?
Br
Click to expand...
Click to collapse
Hi,
unfortunately, the playback of audio and call handling is separated in the bluetooth standard (Audio => A2DP, Calling => HFP) and stack and cannot be mixed or exchanged in an easy way.
This makes perfect sense, because the requirements for both use cases are totally different: Audio should have best quality, latency is not an issue, whereas during a call, low latency is very important, which is gained as a trade off from audio quality.
I didn't touch the HFP part of the stack, maybe backporting it from nougat or newest Qualcomm repositories can help. As I can't reproduce the problem (don't have a S6 Edge), this has to be done by a developer with such a device.
I'm sorry I can't help you otherwise than having a great music listening experience via bluetooth.
brhorst said:
Hi,
unfortunately, the playback of audio and call handling is separated in the bluetooth standard (Audio => A2DP, Calling => HFP) and stack and cannot be mixed or exchanged in an easy way.
This makes perfect sense, because the requirements for both use cases are totally different: Audio should have best quality, latency is not an issue, whereas during a call, low latency is very important, which is gained as a trade off from audio quality.
I didn't touch the HFP part of the stack, maybe backporting it from nougat or newest Qualcomm repositories can help. As I can't reproduce the problem (don't have a S6 Edge), this has to be done by a developer with such a device.
I'm sorry I can't help you otherwise than having a great music listening experience via bluetooth.
Click to expand...
Click to collapse
Dear sir,
Thank for your answer, I understand the situation, anyway good job and thank you for your amazing job
Would there be ARM64 support for this aptx codec CM13 ?
L649288 said:
Would there be ARM64 support for this aptx codec CM13 ?
Click to expand...
Click to collapse
It's working fine on OnePlus 3 which is ARM64
lekronop said:
It's working fine on OnePlus 3 which is ARM64
Click to expand...
Click to collapse
I installed it on Xiaomi Redmi 3 Pro, cm13 64bit, bluetooth stopped working at all. Restored system from backup.
Confirmed working on LG G2 D802 CM13, thank you!
01-30 12:11:57.563 I/bt_btif_media(3161): btif_a2dp_encoder_init Selected Codec aptX
L649288 said:
Would there be ARM64 support for this aptx codec CM13 ?
Click to expand...
Click to collapse
L649288 said:
I installed it on Xiaomi Redmi 3 Pro, cm13 64bit, bluetooth stopped working at all. Restored system from backup.
Click to expand...
Click to collapse
Arm64 would be possible if we could find arm64 versions of the libaptXScheduler.so and libaptX-1.0.0-rel-AndroidXXXX.so files. You may find them in firmware images of ARM64 devices supporting Nougat and aptX.
Then it would only be a matter of compiling the bluetooth stack against arm64.
Given the backwards compatibility of ARMv8, it might work if the bluetooth stack is compiled for ARM64. I can make a test build for ARM64 when I have some spare time (probably around March), or you could try to use my repositories to fire up your own build.
Firstly, thanks for working to backport this.
I also tested this on kenzo with a LineageOS 13 build from 2017-02-13 with Feb security patches. Unable to turn on BT. Can provide debug logs if needed.
h4waii said:
Firstly, thanks for working to backport this.
I also tested this on kenzo with a LineageOS 13 build from 2017-02-13 with Feb security patches. Unable to turn on BT. Can provide debug logs if needed.
Click to expand...
Click to collapse
Yes, please provide a logcat when you try to turn on BT. I can look into it when I get some spare time (don't have any atm).
Hello guys,
Ok, I simply modify my mixer_path.xml in order to have more powerful headphone sound, but I didn't made any save, and obviously, my headphone is now no more working, bt and speaker works fine.
I'm under Pixel experience, this rom exactly :
Xiaomi Redmi Note 6 Pro (tulip)
Version: Pie
File name: PixelExperience_tulip-9.0-20190715-1050-OFFICIAL.zip
Can't post direct link because my account is new !
I can't reinstall my ROM due to some app like Google Auth, you know ...
So can someone give me a solution to install this zip on my computer, on an android simulator for example, or can someone give me his original file !!! (I prefer the first solution )
I'm open to any suggestion, thx in advance, much respect to read this, and even more if you answer me, thx guys !
Install at your own Risk !
Only works on Redmi Note 5 Pro (whyred) with MIUI software
Previous version didn't work.(call issue).
I fixed it.
If app working propetly on your phone tell me (or just press "thanks!"), if no tell me about problems.
This version don't need Magisk Module. (Magisk Module doesn't work on my phone)
Good Luck!
Tested on Miui 11 by xiaomi.eu (9.10.10) Android 9.0 With Dolby Digital And VIPER4Android FX (Works in all applications)
Necessary things:
Rooted Redmi Note 5 Pro (whyred)
File manager (for example: Root Browser)
1.Backup yours mixer_patchs.xml (system/vendor/etc)
2.Delete and paste new mixer_patchs.xml (Make sure you have permission 644 (rw- r-- r--)
3.Reboot
4.Done
Thanks to dante64
link: https:// drive.google.com/file/d/1nW8RqJOvd9-slTXV6yyIbBG0CTysjQWn/view?fbclid=IwAR2CgvaU7uC4OdCLnG4vZmALFuJTFHcstNb07fB9CaZaJ5KxmOeFlGvQ_Co (delete space)
I want to try this, but why the sketchy broken link and the xml in a .rar file?
I want to be able to download the xml directly and test it using my phone. Can't you upload to something like sourceforge or androidfilehost?
Warrimonk said:
I want to try this, but why the sketchy broken link and the xml in a .rar file?
I want to be able to download the xml directly and test it using my phone. Can't you upload to something like sourceforge or androidfilehost?
Click to expand...
Click to collapse
Don't be ridiculous
It was working good and one help please send link of Dolby and Viper4 android
with small steps for MIUI 11
I use this guide
https://forum.xda-developers.com/re...lby-digital-plus-viper4-miui-pie-rom-t3958081
Call issue
Hi, thank you. I have a call issue, I can't listen anything when I call someone. I have to activate the speakerphone
fabrizioguerra said:
Hi, thank you. I have a call issue, I can't listen anything when I call someone. I have to activate the speakerphone
Click to expand...
Click to collapse
i have same just active speaker and then deactive it now you can hear from calling speaker
audismart007 said:
It was working good and one help please send link of Dolby and Viper4 android
with small steps for MIUI 11
Click to expand...
Click to collapse
go to magisk mannager and search viper4android and install it
its easy way
this is one of the most common mods and of course the most made on all devices expecially xiaomi ones, but i'm afraid to see that no one made this mod for the Mi 9 Lite.
Herewith attached you can find the mixer files from system/vendor/etc folder which should be modified and replaced with permissions rw-r-- or making a working magisk module
however i didn't personally study yet the how to make and modify the files in the main thread and actually have very little time
can anyone make the mod starting from this files i also asked in private to some cool guys and if they make the mod we can post it here
please note that this mod will be for xiaomi.eu weekly files (based on CN CC) firmwares) for miui 11 and Android 10 Q (taken from 9.11.21 rom but should work on all future releases as well.
I also leave here my google drive link with the needed files
https://drive.google.com/file/d/1S4Wt2gBGNsxCb9pKclxfFEsUjCEiXSTJ/view?usp=sharing
Dual speaker on Mi 9 Lite can be only achieved with mixer_paths_mtp.xml seems like some lines are missing on our device.. Modified Tavii, Tashaa and other mixers do nothing because phone using only mixer_paths_mtp.xml
Espmic86 said:
this is one of the most common mods and of course the most made on all devices expecially xiaomi ones, but i'm afraid to see that no one made this mod for the Mi 9 Lite.
Herewith attached you can find the mixer files from system/vendor/etc folder which should be modified and replaced with permissions rw-r-- or making a working magisk module
however i didn't personally study yet the how to make and modify the files in the main thread and actually have very little time
can anyone make the mod starting from this files i also asked in private to some cool guys and if they make the mod we can post it here
please note that this mod will be for xiaomi.eu weekly files (based on CN CC) firmwares) for miui 11 and Android 10 Q (taken from 9.11.21 rom but should work on all future releases as well.
I also leave here my google drive link with the needed files
https://drive.google.com/file/d/1S4Wt2gBGNsxCb9pKclxfFEsUjCEiXSTJ/view?usp=sharing
Click to expand...
Click to collapse
Hope we can get it soon :c
Hyped for having this
when i restart device, the mixer files values goes to default....
why ?
Maybe someone knows how to activate the speakers to work in stereo mode, make a modification Dual Speakers as on many other phones?
The original mixer_paths.xml file from the G100 firmware is attached.
Cannot I believe, requires ACDB edits
I'm sorry, but I didn't understand the question.
ilia3367 said:
Maybe someone knows how to activate the speakers to work in stereo mode, make a modification Dual Speakers as on many other phones?
The original mixer_paths.xml file from the G100 firmware is attached.
Click to expand...
Click to collapse
did you success?
我也希望有人弄这个!