-
Notifications
You must be signed in to change notification settings - Fork 32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Building libao using Android standalone toolchain #7
Comments
Can you please post the full log, i guess this error occours due to a missing dependency for the platform you want to compile this library for. If you want to do cross compilation you need the dependencies (i.e. "alsa for android") on your host system. I do not know if shared a library like that exists for android. If you do not need live output disable the plugin that is causing problems by passing "--disable-" to the configure script. |
Hi am trying to configure it for android I cannot pass the error. (fails sanity check)
The script
where
Thank you |
I Passed that error taking out from config the sanity check, but now on Android 9 I get ao_default_driver_id() returning -1. |
What driver plugins do you build? (most probably alsa?) You will need the driver plugin on your android device (which might not be trivial). You can try to statically link the alsa plugin as described here: #10 |
Hi, Thank you. I figure that out. Now returns the index for oss driver whichever is 4 or 5 after default static are in the driver table, and goes fine in the oss functions table, but open on /dev/snd/pcm* 0,# fails with access denied errno. I also tried the tinyalsa and is same issue from NDK. Looks like some Java Audio manager has to be called before, but I am in NDK pure C++. I am looking into that. |
Do you have a rooted phone? Did you try with su privileges? How did you link the plugins? |
I kind of got it to work on my android device using the example I attached to the other issue (#10). I built a completely statically linked binary using musl libc and alsa (wavplay.linux_aarch64_musl). The wav playback works only shortly after android itself performed a sound playback (i.e. beep after using the volume rocker). I guess some values need to be adjusted via amixer. |
I did some further digging. Seems like I miss the right alsa UCM configuration files for the sound hardware of my smartphone (may be the same issue for you). If I use an external USB soundcard via OTG everything works out of the box. |
Sounds interesting. I will try with the 2.0-sound card-usb. I'll have to solder a OTG, though I cannot find one in the cable box. Thank you. Ill play more definitely. |
Was experimenting to see if libao would build for Android using the standalone toolchain. I hit an issue with it not being able to find the soundcard.h include.
In configure.ac where the following appear:
AC_CHECK_HEADERS(sys/soundcard.h, have_oss=yes)
AC_CHECK_HEADERS(machine/soundcard.h, have_oss=yes)
I ended up adding this after it:
AC_CHECK_HEADERS(linux/soundcard.h, have_oss=yes)
I then patched ao_oss.c to use the HAVE_LINUX_SOUNDCARD_H define that the above check created:
diff -Naurp src/libao-1.2.0/src/plugins/oss/ao_oss.c tmp/libao-1.2.0/src/plugins/oss/ao_oss.c
--- src/libao-1.2.0/src/plugins/oss/ao_oss.c 2014-01-27 12:02:05 -0500
+++ tmp/libao-1.2.0/src/plugins/oss/ao_oss.c
@@ -34,11 +34,15 @@
#include <unistd.h>
#include <fcntl.h>
#include <math.h>
+#ifdef HAVE_LINUX_SOUNDCARD_H
+#include <linux/soundcard.h>
+#else
#if defined(OpenBSD) || defined(NetBSD)
#include <soundcard.h>
#else
#include <sys/soundcard.h>
#endif
+#endif
#include <sys/ioctl.h>
#include "ao/ao.h"
After those changes, I was able to get libao to build with some sound support. Thought I'd mention the patches I needed in case anyone else was interested or might need them in the future.
Thank you.
The text was updated successfully, but these errors were encountered: