Created
October 29, 2018 12:18
-
-
Save weepy/8d5f3145c6b74f4db91205dcb2659cb4 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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