Skip to content

Extremely tiny C# audio library (using a small wrapper of raylib's raudio.c)

Notifications You must be signed in to change notification settings

ModTheGungeon/RayAudio

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

RayAudio

RayAudio is a C# binding of the raudio.c standalone library from the raylib project.

RayAudio was created for Semi, where it is employed in order to allow for mods to play custom sounds and music. You might find it useful in projects in which you don't need thousands of complicated sound effects and proprietary plugins.

Building

RayAudio is a normal .NET 3.5 project. However, it depends on a native helper library residing in /raudio-helper. A Makefile is provided that is confirmed to work on Linux, but for other platforms you might need to change up the command a little bit. Considering how small raudio.c is, this shouldn't take longer than a couple of minutes.

Usage

Before playing any audio, you have to initialize the audio device:

RayAudio.AudioDevice.Initialize();

After this, you can load a Sound or a MusicStream:

var sound = RayAudio.Sound.Load("/...");
var music = RayAudio.Music.Load("/...");

To play a sound, just use:

sound.Play();

As for streaming files (MusicStream), after playing them (music.Play()) you will have to refill the buffers as often as you can (ideally every frame) using:

music.Update();

Remember to dispose of Sound and MusicStream resources, and to call AudioDevice.Close() when the program exits.

About

Extremely tiny C# audio library (using a small wrapper of raylib's raudio.c)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published