www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.announce - game-mixer v1.0.0

reply Guillaume Piolat <first.last gmail.com> writes:
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.
Aug 21 2021
parent JN <666total wp.pl> writes:
On Saturday, 21 August 2021 at 13:45:56 UTC, Guillaume Piolat 
wrote:
 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
Looks interesting. I don't mind C library bindings, but I prefer D libraries because they are easier to integrate and don't require chasing older dlls around.
Aug 22 2021