1

I made a game in C++ with OpenGL ES rendering and using OpenAL for sound. To make it work on iPhone I could not use ALUT so I use only "al.h" and "alc.h".

I now try to build my game with the last Android SDK, that supports native applications and added sound support with OpenSL ES. (I believed OpenSL ES was to OpenAL what OpenGL ES is to OpenGL.)

I would like to know if by chance there is an equivalent to the "alc.h" file for OpenSL ES :

#if defined (MYAPP_IOS)
#include <OpenAL/al.h>
#include <OpenAL/alc.h>
#elif defined (MYAPP_ANDROID)
#include <EGL/egl.h>
    // alc.h equivalent for OpenSL ES here ?
#else
#include <AL/al.h>
#include <AL/alc.h>
#endif

If not, does anybody know a way to handle context and device in OpenSL ES in a similar way than OpenAL (or maybe a way to handle that in both without needing "alc.h" ?). The two errors Android ndk-build returns are of that type :

error: ISO C++ forbids declaration of 'ALCcontext' with no type

Billy ONeal
  • 104,103
  • 58
  • 317
  • 552
teupoui
  • 293
  • 3
  • 15

1 Answers1

3

I found this on the site that seemed to have what you're looking for: Android OpenAL?

Looks like someone was able to compile OpenAL for Android. Hopefully this can get you started!

Community
  • 1
  • 1
SpencerElliott
  • 885
  • 5
  • 16
  • I had looked at it but I wonder if OpenAL's LGPL licence does not forbid to use it : I would have to dynamically link OpenAL, which is impossible on iPhone but I do not know if it is possible (and easy) on Android. Has anybody got a clue about that ? (See http://pielot.org/2010/12/14/openal-on-android/#comment-362 for more details. – teupoui Jan 07 '11 at 15:18
  • Native libraries are compiled into a Linux .so shared libraries that Android loads into memory when you load them initially in Java. So, technically you should be able to replace that .so with a newer shared library by replacing it in the APK or releasing a new version of the application. I believe this sticks within the LGPL licensing since you're technically linking to a shared library. Someone correct me if I'm wrong about the licensing :\ – SpencerElliott Jan 08 '11 at 03:23