Skip to content
An implementation of Open Sound Control in D programming language.
Branch: master
Clone or download
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
examples Fix bug sending invalid message. Nov 7, 2017
source/osc
.gitignore First commit. Jul 8, 2016
.travis.yml Add CI config. Oct 7, 2016
LICENSE Rename LICENCE to LICENSE Oct 7, 2016
README.md Tweak description. Nov 25, 2016
dub.json Fix package name. Oct 7, 2016

README.md

osc-d

Dub version MIT License Build Status

##Description

An implementation of Open Sound Control in D programming language.

##Examples

###Server

static import osc;

void main() {
    auto server = new osc.Server(8000);
    while(true){
        import std.stdio;
        "popMessage".writeln;
        while(server.hasMessage){
            auto m = server.popMessage;
            foreach (int i, ref t; m.typeTags) {
                import std.conv;
                switch (t) {
                    case osc.TypeTag.Int:
                        m.args[i].to!int.writeln;
                        break;
                    case osc.TypeTag.Float:
                        m.args[i].to!float.writeln;
                        break;
                    case osc.TypeTag.String:
                        m.args[i].to!string.writeln;
                        break;
                    case osc.TypeTag.Blob:
                        m.args[i].to!(ubyte[]).writeln;
                        break;
                    default:
                        assert(0);
                }
            }
        }
        import std.datetime;
        import core.thread;
        Thread.sleep(1.dur!"seconds");
    }
}

###Client

static import osc;

void main() {
    auto client = new osc.Client(8000);
    auto message = osc.Message();
    
    message.addressPattern = "/foo";
    message.addValue(1000);
    message.addValue(-1);
    message.addValue("hello");
    message.addValue(1.234f);
    message.addValue(5.678f);
    
    client.push(message);
}
You can’t perform that action at this time.