C# Wrapper for LibSunvox + Nuget Package

Post Reply
Heliarco
Posts: 1
Joined: Wed Feb 15, 2017 8:27 pm

C# Wrapper for LibSunvox + Nuget Package

Post by Heliarco » Wed Feb 15, 2017 8:40 pm

Hi guys, I wanted to use Sunvox in a C# Game, so i decided to wrap the entire libsunvox with native invocations and turn it into a .Net nuget package:
https://www.nuget.org/packages/Sunvox.Net

The wrapper itself is autogenerated by a tool i wrote, and so i hope to be able to keep up with updates extremely quickly.
Not every part of the wrapper is covered by unit tests yet, but what i have used works flawlessly (mainly loading, playing rewinding etc.).

Usage is straight forward, e.g:

Code: Select all

 PM> Install-Package Sunvox.Net 

Code: Select all

using Sunvox.Net;
namespace SunvoxPackageTest
{
    class Program
    {
        static void Main(string[] args)
        {
            var i =  Vox.Init("", 44100, 2, 0);
            Vox.OpenSlot(0);
            Vox.Load(0, "test.sunvox");
            Vox.Play(0);
            System.Threading.Thread.Sleep(2000);
            Vox.Stop(0);
            Vox.CloseSlot(0);
            Vox.Deinit();
        }
    }
}
Have fun :)

(P.s. i hope im not breaking any licensing issues by publishing this, as far as i could tell it seemed a.okay :D)

Post Reply