Dawoodoz / DFPSR

Fast realtime softare rendering library for C++14 using SSE/AVX/NEON. 2D, 3D and isometric rendering with minimal system dependencies.
https://dawoodoz.com/dfpsr.html
78 stars 6 forks source link

Sound portability layer #34

Closed Dawoodoz closed 2 years ago

Dawoodoz commented 2 years ago

While game engines should be allowed to fully define how sounds are played and mixed in software, it would be good to at least have a sound portability layer that runs as a background thread and requests sound samples to be generated for speakers once in a while using a lambda callback.

The alternative would be to let anyone wanting sound include external sound engines just for the portability, in which features are changed when the sound engine is replaced. Sound output is simple, you just send samples to each speaker.

Due to the added work of selecting backend implementations and libraries for different platforms, adding this should have minimal impact on the ease of using the framework without sound. Maybe just an extra argument to the build scripts that can be assigned to NONE.

Dawoodoz commented 2 years ago

There is now a portable sound layer in the experimental branch. Just need to test it properly with different sound engines, optimize performance, make examples, create a build system that makes it convenient and document how to use it.

Dawoodoz commented 2 years ago

A standard representation for raw sound buffers would also be useful, so that different sound engines can share code for loading and saving different compressed formats.

Dawoodoz commented 2 years ago

The backend itself is done and currently used in the skeleton code for an SDK wizard application.