Merge branch 'dev' of https://github.com/Tonejs/Tone.js into dev

This commit is contained in:
tambien 2019-04-12 10:39:48 -04:00
commit a32ad7f0d0
4 changed files with 44 additions and 3 deletions

View file

@ -3,7 +3,8 @@ import "../component/Analyser";
import "../core/AudioNode";
/**
* @class Get the current waveform data of the connected audio source.
* @class Get the current frequency data of the connected audio source
* using a fast Fourier transform.
* @extends {Tone.AudioNode}
* @param {Number=} size The size of the FFT. Value must be a power of
* two in the range 32 to 32768.

View file

@ -19,8 +19,9 @@ import "../core/AudioNode";
* //pan the input signal hard right.
* var panner = new Tone.Panner(1);
*/
Tone.Panner = function(initialPan){
Tone.Panner = function(){
var options = Tone.defaults(arguments, ["pan"], Tone.Panner);
Tone.AudioNode.call(this);
/**
* the panner node
@ -37,12 +38,22 @@ Tone.Panner = function(initialPan){
this.pan = this._panner.pan;
//initial value
this.pan.value = Tone.defaultArg(initialPan, 0);
this.pan.value = options.pan;
this._readOnly("pan");
};
Tone.extend(Tone.Panner, Tone.AudioNode);
/**
* Defaults
* @type {Object}
* @const
* @static
*/
Tone.Panner.defaults = {
"pan" : 0
};
/**
* Clean up.
* @returns {Tone.Panner} this

21
examples/simpleHtml.html Normal file
View file

@ -0,0 +1,21 @@
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8" />
<title>App</title>
<meta name="viewport" content="width=device-width, initial-scale=1" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/tone/13.8.3/Tone.js"></script>
<script>
function playNote() {
var synth = new Tone.Synth().toMaster();
synth.triggerAttackRelease("C4", "8n");
}
</script>
</head>
<body>
<h1>Simple HTML5 Tone.js Demo</h1>
<button onclick="playNote()">Click me to play note!</button>
</body>
</html>

View file

@ -29,6 +29,14 @@ describe("Panner", function(){
panner.dispose();
});
it("can be constructed with an options object", function(){
var panner = new Panner({
"pan" : 0.5
});
expect(panner.pan.value).to.be.closeTo(0.5, 0.001);
panner.dispose();
});
it("passes the incoming signal through", function(){
return PassAudio(function(input){
var panner = new Panner().toMaster();