Android OpenAL?
Asked Answered
M

4

33

Has anyone built OpenAL for the Android, or found the shared library for it on the system? This seems like an obvious need for a game of any kind, yet there's no resources out there for it. It seems the Android java sound library can't do pitch changes from what I can tell, so there seems a need for OpenAL. I know OpenAL Soft can be built on top of ALSA, but I'm not sure if anyones done that, and I'm sure it would take me a month.

If there's a good guide somewhere on sound manipulation on the Android without OpenAL, that's fine too. It's just that OpenAL is sort of a standard for game makers and it would be nice to port my thousands of lines over to this system, which I sort of thought was the point of the NDK before I dugg into it and saw that there's almost no shared library access on the system.

Thanks.. I hope I can actually port without becoming a java expert myself. Really disliking the NDK so far!

Miscue answered 6/4, 2010 at 18:25 Comment(0)
T
36

A few options are available now for NDK audio:

  1. It's not OpenAL, but OpenSL ES 1.0.1 is an official part of the NDK as of API level 9 (2.3). More information here.

  2. OpenAL Soft has an OpenSL ES backend in its git master (not released as of version 1.13). It is however at this time broken on Android, as it is written for OpenSL ES 1.1, not 1.0.1. See this commit for a fix.

  3. As mentioned in a previous answer, a JNI backend for OpenAL Soft is linked to and described here as the only option for OpenAL on pre-2.3 Android platforms. However, this is an outdated fork of OpenAL Soft - I've updated the backend to the latest version on a github repo here along with the OpenSL ES 1.0.1 fix. Also included is an untested optional patch that claims to provide better performance and less latency.

Tidy answered 21/9, 2011 at 20:20 Comment(1)
+1 from me after the edit. Posting (good) answers on old questions is positively encouraged here, that's why there are badges awarded for it.Ricercare
P
8

Just before Google announced that 3D audio is going to be included into Android 2.3, I managed to compile OpenAL for Android, and package it as shared object.

See http://pielot.org/2010/12/14/openal-on-android/

Might still be helpful if you'd like to target devices < 2.3.

Cheers.

Pupil answered 16/12, 2010 at 19:42 Comment(1)
To extend Martin's answer: He also gives some high level examples of use here.Josey
O
5

OpenSL is planned for a future Android build; OpenAL isn't available, and the low-level hardware is off-limits to anything you can do in the NDK, so you can't safely build it yourself.

There's no support for low-latency audio even planned; there's a bug to that effect here:

http://code.google.com/p/android/issues/detail?id=3434

Star it if it's relevant to you; maybe Google will listen if it gets enough stars.

EDIT: There IS low latency audio in Android 4.0+, and OpenSL is available now. See this page and linked pages: http://source.android.com/devices/audio/latency.html Also see the NDK guide on OpenSL.

O answered 29/10, 2010 at 23:34 Comment(0)
A
-3

You can use the NDK to build OpenAL and package it with your APK. That way you can access it from your native code.

Acclimatize answered 6/4, 2010 at 18:42 Comment(4)
You can't access the low-level sound APIs (ALSA etc.) in any supported way from the NDK, so no, you can't do this.O
so the only api that can be used is that one java: android.media ?Rascal
No, you can also use soundpool and audiotrack (which is low level), in java, as well as now opensl es in native code.Chequered
Woops, sorry about that, I thought you meant mediaplayer, soundpool and audiotrack are part of android.media. Although you can use opensl es still, assuming your willing to target 2.2+. Also, from what I understand, audiotrack does give you fairly low level access to your audio, if your willing to use the JNI to make calls to it from java, from your native code.Chequered

© 2022 - 2024 — McMap. All rights reserved.