2014-04-05 22:05:42 +00:00
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
//
|
|
|
|
// MASTER OUTPUT
|
|
|
|
//
|
|
|
|
// a single master output
|
|
|
|
// adds a toMaster method on AudioNodes and components
|
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
|
2014-04-06 20:51:30 +00:00
|
|
|
define(["Tone/core/Tone"], function(Tone){
|
2014-04-05 22:05:42 +00:00
|
|
|
|
|
|
|
var Master = function(){
|
|
|
|
//extend audio unit
|
|
|
|
Tone.call(this);
|
|
|
|
|
|
|
|
//put a hard limiter on the output so we don't blow any eardrums
|
|
|
|
this.limiter = this.context.createDynamicsCompressor();
|
|
|
|
this.limiter.threshold.value = 0;
|
|
|
|
this.limiter.ratio.value = 20;
|
|
|
|
this.chain(this.input, this.limiter, this.output, this.context.destination);
|
|
|
|
}
|
|
|
|
|
|
|
|
Tone.extend(Master);
|
|
|
|
|
|
|
|
///////////////////////////////////////////////////////////////////////////
|
|
|
|
// Add toMaster methods
|
|
|
|
///////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
//@param {AudioNode|Tone=} unit
|
|
|
|
Tone.prototype.toMaster = function(){
|
|
|
|
this.connect(Tone.Master);
|
|
|
|
}
|
|
|
|
|
|
|
|
AudioNode.prototype.toMaster = function(){
|
|
|
|
this.connect(Tone.Master);
|
|
|
|
}
|
|
|
|
|
2014-04-11 23:17:01 +00:00
|
|
|
//a single master output
|
|
|
|
Tone.Master = new Master();
|
|
|
|
|
2014-04-05 22:05:42 +00:00
|
|
|
return Tone.Master;
|
|
|
|
})
|