UNPKG

flocking

Version:

Creative audio synthesis for the Web

78 lines (66 loc) 2.12 kB
/* * Flocking Band * https://github.com/continuing-creativity/flocking * * Copyright 2013-2015, Colin Clark * Dual licensed under the MIT and GPL Version 2 licenses. */ /*global require, flock*/ /*jshint white: false, newcap: true, regexp: true, browser: true, forin: false, nomen: true, bitwise: false, maxerr: 100, indent: 4, plusplus: false, curly: true, eqeqeq: true, freeze: true, latedef: true, noarg: true, nonew: true, quotmark: double, undef: true, unused: true, strict: true, asi: false, boss: false, evil: false, expr: false, funcscope: false*/ var fluid = fluid || require("infusion"), flock = fluid.registerNamespace("flock"); (function () { "use strict"; /** * flock.band provides an IoC-friendly interface for a collection of named synths. */ // TODO: Unit tests. // TODO: It seems likely that this component should be a flock.node, too. fluid.defaults("flock.band", { gradeNames: ["fluid.component"], synthGrade: "flock.noteTarget", invokers: { play: { func: "{that}.events.onPlay.fire" }, pause: { func: "{that}.events.onPause.fire" }, set: { func: "{that}.events.onSet.fire" }, getSynths: { funcName: "fluid.queryIoCSelector", args: ["{that}", "{that}.options.synthGrade"] } }, events: { onPlay: null, onPause: null, onSet: null }, distributeOptions: [ { source: "{that}.options.synthListeners", removeSource: true, target: "{that flock.synth}.options.listeners" } ], synthListeners: { "{band}.events.onPlay": { func: "{that}.play" }, "{band}.events.onPause": { func: "{that}.pause" }, "{band}.events.onSet": { func: "{that}.set" } } }); }());