game-mixer v1.0.0
Guillaume Piolat
first.last at gmail.com
Sat Aug 21 13:45:56 UTC 2021
One year after the translation of libsoundsio to D by Dennis:
https://forum.dlang.org/post/xckyiizkjwdwvuvtmmvr@forum.dlang.org
I'm happy to introduce the `game-mixer` package in v1.0.0:
https://code.dlang.org/packages/game-mixer
A simple-to-use library for emitting sounds in your game.
**Current Features:**
- play MP3 / WAV / XM / MOD
- integrated resampling and threaded decoding
- looping, fade-in/fade-out
- progressive buffering of played audio for playing in any number
of channels
- master effects
- based upon libsoundio-d:
https://code.dlang.org/packages/libsoundio-d
- nothrow @nogc (but not -betterC)
**Examples**
import std.stdio;
import gamemixer;
void main()
{
IMixer mixer = mixerCreate();
IAudioSource music =
mixer.createSourceFromFile("my-music.mp3");
mixer.play(music);
writeln("Press ENTER to stop playback...");
readln();
mixerDestroy(mixer);
}
There are three examples in the repo:
- music-playback (explain fades)
- binaural-beat (explain master effects)
- drum-machine (explain delayed play and playground)
**Why not SDL2_mixer?**
- It can be just a tiny bit more difficult to embed if you are
making a desktop application.
- You might have a fetish for pure D libraries.
- The API is smaller, and hopefully less ambiguous.
However, as you will notice, it is less tested and support
Windows and Linux only for now. Also less audio formats.
**Future goals**
If this library actually find some usage, it might be interesting
to add:
- master limiter
- "epoch" presets that mimicks the sounds of older eras.
- loopback output, to have the output of game-mixer in an audio
plug-in
Feedback welcome, see you on the DUBverse.
More information about the Digitalmars-d-announce
mailing list