4
\$\begingroup\$

This question focuses on the API's available on phones.

I'd been planning to use OpenAL in my game for maximum portability. It runs great on Linux so I can quickly iterate while developing as well as leverage the desktop's superior debugging tools.

However I've recently heard that Android doesn't support OpenAL well. Instead they've gone with an OpenSL ES library.

What I'm looking for is a free Audio library that I can use with minimal custom code on iPhone, Android, and my Linux desktop. Does such a library exists?

Some extra details:
The game is written in C++ with custom minimal front ends, e.g. ObjC for iPhone, Java for Android, and SFML for desktops. I'm using OpenGL ES for portability as iPhone doesn't support the more advanced OpenGL APIs.

\$\endgroup\$
2
  • \$\begingroup\$ Would such library be in C++ then? \$\endgroup\$ Mar 3, 2011 at 16:55
  • \$\begingroup\$ I should be C++ compatible, e.g. C, C++, assembly, etc. Honestly I don't know of any other language that is compatible with desktops, Android, and iPhone. \$\endgroup\$
    – deft_code
    Mar 3, 2011 at 17:47

3 Answers 3

4
\$\begingroup\$

I find OpenAL pretty convoluted for small things. What are your feature requirements? Because mine are pretty simple:

  • load/close samples and music
  • play/pause/stop music
  • play samples
  • dynamically change per-channel volume for each item being played

If your requirements are that simple, too, I suggest you consider sticking with whatever’s more convenient on the platform, at the cost of a few #ifdef’s. I usually use SDL_mixer (despite its numerous shortcomings) on desktop systems, and the OS audio layer on mobile platforms.

You should have a look at ALmixer, which is basically SDL_mixer done right on top of OpenAL.

\$\endgroup\$
4
+25
\$\begingroup\$

You might want to check out fmod.

\$\endgroup\$
3
\$\begingroup\$

I have found it easier myself to put the playing of audio in the platform-specific code rather than trying to use a works-portably library to wrap it.

The discussion then comes what format to use. MP3 works well everywhere.

\$\endgroup\$
1
  • \$\begingroup\$ I was thinking of using this approach, e.g. use callbacks from my C++ to Swift on iOS and have Swift play the sounds, but I found there's always a lag before the sound plays and the latency is noticable. Did you ever have any such problems. Perhaps I need to spawn a thread and run sounds on that... \$\endgroup\$
    – user24493
    Sep 23, 2020 at 21:53

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .