Last active
December 20, 2015 09:19
-
-
Save gre/6107277 to your computer and use it in GitHub Desktop.
Extract of ZOUND live main.js code
This file contains 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
network.on({ | |
"user-track-take": function (data, user) { | |
pattern.tracks.at(data.track).set("offmode", user, { network: true }); | |
}, | |
"user-track-release": function (data, user) { | |
pattern.tracks.at(data.track).set("offmode", null, { network: true }); | |
}, | |
"user-connect": function (data) { | |
users.add(new zound.models.User({ id: data.user }), { network: true }); | |
}, | |
"user-disconnect": function (data) { | |
users.remove(data.user); | |
pattern.tracks.chain() | |
.filter(function (track) { | |
return track.get("offmode")===data.user; | |
}) | |
.each(function (track) { | |
track.set("offmode", null); | |
}); | |
}, | |
"user-select-slot": function (data, user) { | |
users.get(user).set("slot", data, { network: true }); | |
}, | |
"set-slot": function(data, user){ | |
pattern.getSlot(data.track, data.slot).set(data.data, { network: true }); | |
}, | |
"module-position": function (data) { | |
song.modules.get(data.module).set(data.position, { network: true }); | |
}, | |
"module-output-add": function (data) { | |
song.modules.get(data.module).outputs.add( | |
song.modules.get(data.output), { network: true } | |
); | |
}, | |
"module-output-remove": function (data) { | |
song.modules.get(data.module).outputs.remove(data.output, { network: true }); | |
}, | |
"add-module": function(data) { | |
song.modules.add(new modules[data.moduleName](data), { network: true }); | |
}, | |
"remove-module": function(data) { | |
song.removeModule(data.module, { network: true }); | |
}, | |
"property-change": function(data, user) { | |
song.modules.get(data.module) | |
.properties.at(data.property) | |
.set("value", data.value, { network: true }); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment