nodesynth
Version:
Library for audio synthesis
82 lines (65 loc) • 1.91 kB
JavaScript
// Generated by CoffeeScript 1.10.0
(function() {
var Combiner, Common;
Combiner = require('./combiner');
Common = (function() {
function Common() {}
Common.prototype.combine = function(type, other) {
switch (type) {
case 'add':
case 'plus':
return Combiner.add(this, other);
case 'sub':
case 'subtract':
case 'minus':
return Combiner.subtract(this, other);
case 'mul':
case 'multiply':
case 'times':
return Combiner.multiply(this, other);
case 'div':
case 'divide':
return Combiner.divide(this, other);
case 'exp':
case 'exponent':
case 'pow':
case 'power':
return Combiner.exponent(this, other);
case 'mod':
case 'modulo':
case 'rem':
case 'remainder':
return Combiner.modulo(this, other);
case 'mix':
return Combiner.mix(this, other);
default:
return raise("Invalid combiner type " + type);
}
};
Common.prototype.add = function(other) {
return this.combine('add', other);
};
Common.prototype.subtract = function(other) {
return this.combine('sub', other);
};
Common.prototype.divide = function(other) {
return this.combine('div', other);
};
Common.prototype.multiply = function(other) {
return this.combine('mul', other);
};
Common.prototype.exponent = function(other) {
return this.combine('exp', other);
};
Common.prototype.modulo = function(other) {
return this.combine('mod', other);
};
Common.prototype.mix = function(other) {
return this.combine('mix', other);
};
return Common;
})();
module.exports = Common;
Combiner.prototype.__proto__ = Common.prototype;
}).call(this);
//# sourceMappingURL=common.js.map