Skip to content

Instantly share code, notes, and snippets.

@weepy
Created October 29, 2018 12:18
Show Gist options
  • Save weepy/8eecf23941e90a4636b8b79f00147878 to your computer and use it in GitHub Desktop.
Save weepy/8eecf23941e90a4636b8b79f00147878 to your computer and use it in GitHub Desktop.
function Poly({world, factory, polyphony}) {
var output = world.create('UPoly');
output.channels = {};
for (var i = 0; i < polyphony; i++) {
var unit = factory(world);
output.channels[i] = unit;
output.addUnit(unit);
}
this.set = function (o) {
for (var _i in o) {
output[_i] = o[_i];
}
output.run('setAll', o);
};
return output;
}
var poly = new Poly({
world: world,
polyphony: 3,
factory: function factory(world) {
return world.create('UZiggy', {
filename1: '/add_waves/color1.L.ogg',
filename2: '/add_waves/square_add1.L.ogg',
filename3: '/add_waves/sine_add4.L.ogg'
});
}
});
poly.start({
key: 4
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment