Skip to content

robbielyman/ziglo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ziglo

ziglo is a Zig interface to liblo, an implementation of the Open Sound Control protocol. ziglo provides Zig types for liblo primitives and convenience functions for adding and querying message contents leveraging Zig’s comptime.

To add this package to your project, pick a commit hash <hash> and run this:

$ zig fetch --save https://github.com/ryleelyman/ziglo/archive/<hash>.tar.gz

Then in your build.zig you can add this:

const ziglo = b.dependency("ziglo", .{
    .target = target,
    .optimize = optimize,
    .static = true, // builds a static liblo; defaults to false
});

// For whatever you're building; in this case let's assume it's called exe.
exe.root_module.addImport("ziglo", ziglo.module("ziglo"));

and in your source code:

// import
const ziglo = @import("ziglo");

// and use it something like this...
const server = ziglo.Server.new(null, null) orelse return error.Failed;
defer server.free();
// can hold onto the opaque pointer returned if you want to later remove this method.
_ = server.addMethod("/an/osc/path", null, wrap(anOscMethodHandler), null) orelse return error.Failed;

const target = ziglo.Address.new("localhost", "7777") orelse return error.Failed;
defer target.free();

const msg = ziglo.Message.new() orelse return error.Failed;
defer msg.free();
msg.add(.{ 4, 4.5, "a string", .nil, .infinity, null, true, false });

try server.send(target, "/another/osc/path", msg);

About

zig interface to liblo's OSC server implementation

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages