Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics

C/C++ lightweight audio lib

A topic by Darenn Keller created Aug 01, 2018 Views: 116 Replies: 6
Viewing posts 1 to 4

Hey !
We're using our own engine based on openGL. For now using some part of the STL the engine creates a 700ko executable. I tried to find a C/C++ lightweight audio lib, but I failed (too big or I can't make it work). Any advice ?


700kb? That seems small enough to run game code beside it.
 You could also write your own audio buffer system which is (relatively) easy in C++ if you just do something for single voice tones. Like something where you just go "AudioGenLib::GenSine(hertz, volume, duration);".
This could help you in writing that.

Thank's for the help !


Im using SDL too, and for the audio Im using SDL basic audio callback system. Its very raw but if you need code to load a WAV file and play it I can send it to you.

Btw, if instead of linking against the dynamic DLL you link against the static LIB you will reduce the EXE size. I also use this EXE compressor:

and I managed to create my SDL/OpenGL app that weights less than 300KBs

Very interesting, thanks !

Submitted (1 edit)

Thanks for the tips ! After a lot of research, after having compiled a bunch of libraries, the best solution I found is to directly use the windows API (Direct sound) that is installed on all windows in system 32 (dsound.dll). Kinda old and obscure, but it works... I tried OpenAL and other audio libraries based on OpenAL but they are too large, DLL only (no stripping possible) and I don't want to use any exe compressor. So the win32 api was for me the only solution (#include <dsound.h>)

Submitted (1 edit)

Sounds interesting... Any chance it could be done in C#? I'm not completely familiar with the differences between C# and C++ other than abstraction and level differences, as well as much compatibility between the languages.