Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cross platform sound API for games? [closed]

Tags:

c++

c

api

audio

Is there an API only for sound?

APIs such as Allegro or SDL provide too much for my needs. I simply need a library that can do something like:

InitSound();
Sound *door = LoadSound("door.wav");
PlaySound(door,volume);

It would also be great if it could support compressed formats such as Vorbis or MP3.

like image 615
jmasterx Avatar asked Sep 03 '10 14:09

jmasterx


4 Answers

I'm a big fan of the SFML library. It does provide additional graphics and network features, but what is relevant to this question, is that it also has neat audio package.

Audio features are:

  • Uses hardware acceleration whenever possible
  • Can load and save standard sound formats: Ogg, WAV, FLAC, AIFF, Au, RAW, paf, 8SVX, NIST, VOC, IRCAM, W64, MAT4, MAT5 PVF, HTK, SDS, AVR, SD2, Core Audio Format, WVE, MPC2K, RF64
  • Can load all audio resources directly from files in memory
  • 3D sound spacialization
  • Easy interface for capturing audio
  • Manages memory efficiently, so that you don't have to worry about resources lifetime or storage
  • Supports streaming for big files; you can even write your custom streaming class for any source (network, ...)
  • Supports multi-channels formats (mono, stereo, 4.0, 5.1, 6.1, 7.1)

Website: http://www.sfml-dev.org/

like image 137
rochal Avatar answered Nov 20 '22 18:11

rochal


Use PortAudio. It is a portable cross-platform audio API.

like image 35
Baget Avatar answered Nov 20 '22 17:11

Baget


If you are use to using OpenGL then you might like to try OpenAL?

The API is very similar to OpenGL so you should feel at home.

like image 35
graham.reeds Avatar answered Nov 20 '22 19:11

graham.reeds


I really like SFML, it's written in C++ and follows most of the rules of good API design (RAII and so forth).

If you prefer a more "C-like" library, SDL needs to be mentioned.

like image 4
Dragontamer5788 Avatar answered Nov 20 '22 19:11

Dragontamer5788