mirror of
https://github.com/Tonejs/Tone.js
synced 2024-12-26 19:43:12 +00:00
instrument tests
fixed dispose methods bc of tests.
This commit is contained in:
parent
040536a3b7
commit
cc95ee6caf
7 changed files with 68 additions and 8 deletions
|
@ -171,11 +171,13 @@ define(["Tone/core/Tone", "Tone/signal/Signal"], function(Tone){
|
|||
}
|
||||
this.frequency.dispose();
|
||||
this.Q.dispose();
|
||||
this.detune.dispose();
|
||||
this.gain.dispose();
|
||||
this._filters = null;
|
||||
this.frequency = null;
|
||||
this.Q = null;
|
||||
this.gain = null;
|
||||
this.detune = null;
|
||||
};
|
||||
|
||||
return Tone.Filter;
|
||||
|
|
|
@ -220,7 +220,7 @@ function(Tone){
|
|||
/**
|
||||
* clean up
|
||||
*/
|
||||
Tone.DuoSynth.dispose = function(){
|
||||
Tone.DuoSynth.prototype.dispose = function(){
|
||||
Tone.Monophonic.prototype.dispose.call(this);
|
||||
this.voice0.dispose();
|
||||
this.voice1.dispose();
|
||||
|
|
|
@ -177,7 +177,7 @@ function(Tone){
|
|||
/**
|
||||
* clean up
|
||||
*/
|
||||
Tone.FMSynth.dispose = function(){
|
||||
Tone.FMSynth.prototype.dispose = function(){
|
||||
Tone.Monophonic.prototype.dispose.call(this);
|
||||
this.carrier.dispose();
|
||||
this.modulator.dispose();
|
||||
|
|
|
@ -155,14 +155,15 @@ function(Tone){
|
|||
this.envelope.dispose();
|
||||
this.filterEnvelope.dispose();
|
||||
this.filter.dispose();
|
||||
this.detune.dispose();
|
||||
this._unison.dispose();
|
||||
this._amplitude.disconnect();
|
||||
this.oscillator = null;
|
||||
this.filterEnvelope = null;
|
||||
this.envelope = null;
|
||||
this.filter = null;
|
||||
this.detune = null;
|
||||
this._unison = null;
|
||||
this._amplitude = null;
|
||||
this.frequency = null;
|
||||
this.detune = null;
|
||||
};
|
||||
|
||||
return Tone.MonoSynth;
|
||||
|
|
|
@ -122,12 +122,13 @@ function(Tone){
|
|||
/**
|
||||
* clean up
|
||||
*/
|
||||
Tone.MultiSampler.dispose = function(){
|
||||
Tone.MultiSampler.prototype.dispose = function(){
|
||||
Tone.prototype.dispose.call(this);
|
||||
for (var samp in this.samples){
|
||||
this.samples[samp].dispose();
|
||||
this.samples[samp] = null;
|
||||
}
|
||||
this.samples = null;
|
||||
};
|
||||
|
||||
return Tone.MultiSampler;
|
||||
|
|
|
@ -30,8 +30,8 @@ function wasDisposed(obj, expect){
|
|||
}
|
||||
|
||||
var allTests = ["tests/Core", "tests/Timing", "tests/Signal", "tests/SignalComparison",
|
||||
"tests/SignalMath", "tests/Transport", "tests/Sources", "tests/Components", "tests/Effect"];
|
||||
// var allTests = ["tests/Core", "tests/SignalComparison"];
|
||||
"tests/SignalMath", "tests/Transport", "tests/Sources", "tests/Components", "tests/Effect", "tests/Instruments"];
|
||||
// var allTests = ["tests/Core", "tests/Instruments"];
|
||||
|
||||
require(allTests, function(){
|
||||
mocha.run();
|
||||
|
|
56
test/tests/Instruments.js
Normal file
56
test/tests/Instruments.js
Normal file
|
@ -0,0 +1,56 @@
|
|||
/* global it, describe, wasDisposed */
|
||||
|
||||
define(["tests/Core", "chai", "Tone/instrument/DuoSynth", "Tone/instrument/MonoSynth", "Tone/instrument/FMSynth",
|
||||
"Tone/instrument/PolySynth", "Tone/instrument/Sampler", "Tone/instrument/MultiSampler"],
|
||||
function(Tone, chai, DuoSynth, MonoSynth, FMSynth, PolySynth, Sampler, MultiSampler){
|
||||
|
||||
var expect = chai.expect;
|
||||
|
||||
describe("Tone.MonoSynth", function(){
|
||||
it("can be created and disposed", function(){
|
||||
var ms = new MonoSynth();
|
||||
ms.dispose();
|
||||
wasDisposed(ms, expect);
|
||||
});
|
||||
});
|
||||
|
||||
describe("Tone.DuoSynth", function(){
|
||||
it("can be created and disposed", function(){
|
||||
var ds = new DuoSynth();
|
||||
ds.dispose();
|
||||
wasDisposed(ds, expect);
|
||||
});
|
||||
});
|
||||
|
||||
describe("Tone.FMSynth", function(){
|
||||
it("can be created and disposed", function(){
|
||||
var fms = new FMSynth();
|
||||
fms.dispose();
|
||||
wasDisposed(fms, expect);
|
||||
});
|
||||
});
|
||||
|
||||
describe("Tone.PolySynth", function(){
|
||||
it("can be created and disposed", function(){
|
||||
var ps = new PolySynth();
|
||||
ps.dispose();
|
||||
wasDisposed(ps, expect);
|
||||
});
|
||||
});
|
||||
|
||||
describe("Tone.Sampler", function(){
|
||||
it("can be created and disposed", function(){
|
||||
var samp = new Sampler();
|
||||
samp.dispose();
|
||||
wasDisposed(samp, expect);
|
||||
});
|
||||
});
|
||||
|
||||
describe("Tone.MultiSampler", function(){
|
||||
it("can be created and disposed", function(){
|
||||
var samp = new MultiSampler();
|
||||
samp.dispose();
|
||||
wasDisposed(samp, expect);
|
||||
});
|
||||
});
|
||||
});
|
Loading…
Reference in a new issue