added decibels volume control to sources

This commit is contained in:
Yotam Mann 2015-02-04 10:11:10 -05:00
parent b0b572f113
commit 2dbacd3310

View file

@ -28,6 +28,12 @@ define(["Tone/core/Tone", "Tone/core/Transport", "Tone/core/Master"], function(T
*/
this.onended = options.onended;
/**
* the volume of the output in decibels
* @type {Tone.Signal}
*/
this.volume = new Tone.Signal(this.output.gain, Tone.Signal.Units.Decibels);
/**
* keeps track of the timeout for chaning the state
* and calling the onended
@ -48,6 +54,7 @@ define(["Tone/core/Tone", "Tone/core/Transport", "Tone/core/Master"], function(T
*/
Tone.Source.defaults = {
"onended" : function(){},
"volume" : 0,
};
/**
@ -123,18 +130,6 @@ define(["Tone/core/Tone", "Tone/core/Transport", "Tone/core/Master"], function(T
Tone.Transport.unsyncSource(this);
};
/**
* gets the setVolume method from {@link Tone.Master}
* @method
*/
Tone.Source.prototype.setVolume = Tone.Master.setVolume;
/**
* gets the getVolume method from {@link Tone.Master}
* @method
*/
Tone.Source.prototype.getVolume = Tone.Master.getVolume;
/**
* clean up
* @return {Tone.Source} `this`
@ -156,14 +151,6 @@ define(["Tone/core/Tone", "Tone/core/Transport", "Tone/core/Master"], function(T
this.onended();
};
/**
* the volume of the source
* @memberOf Tone.Source#
* @type {number}
* @name volume
*/
Tone._defineGetterSetter(Tone.Source, "volume");
/**
* @enum {string}
*/