Tone.js/test/instrument/MembraneSynth.js

55 lines
1.5 KiB
JavaScript
Raw Normal View History

define(["Tone/instrument/MembraneSynth", "helper/Basic", "helper/InstrumentTests"], function (MembraneSynth, Basic, InstrumentTest) {
2015-08-31 15:37:10 +00:00
describe("MembraneSynth", function(){
2015-08-31 15:37:10 +00:00
Basic(MembraneSynth);
InstrumentTest(MembraneSynth, "C2");
2015-08-31 15:37:10 +00:00
context("API", function(){
2017-12-30 16:26:29 +00:00
it("can get and set oscillator attributes", function(){
var drumSynth = new MembraneSynth();
2015-08-31 15:37:10 +00:00
drumSynth.oscillator.type = "triangle";
expect(drumSynth.oscillator.type).to.equal("triangle");
drumSynth.dispose();
});
2017-12-30 16:26:29 +00:00
it("can get and set envelope attributes", function(){
var drumSynth = new MembraneSynth();
2015-08-31 15:37:10 +00:00
drumSynth.envelope.attack = 0.24;
expect(drumSynth.envelope.attack).to.equal(0.24);
drumSynth.dispose();
});
2017-12-30 16:26:29 +00:00
it("can get and set the octaves and pitch decay", function(){
var drumSynth = new MembraneSynth();
2015-08-31 15:37:10 +00:00
drumSynth.octaves = 12;
drumSynth.pitchDecay = 0.2;
expect(drumSynth.pitchDecay).to.equal(0.2);
expect(drumSynth.octaves).to.equal(12);
drumSynth.dispose();
});
2017-12-30 16:26:29 +00:00
it("can be constructed with an options object", function(){
var drumSynth = new MembraneSynth({
2015-08-31 15:37:10 +00:00
"envelope" : {
"sustain" : 0.3
}
});
expect(drumSynth.envelope.sustain).to.equal(0.3);
drumSynth.dispose();
});
2017-12-30 16:26:29 +00:00
it("can get/set attributes", function(){
var drumSynth = new MembraneSynth();
2015-08-31 15:37:10 +00:00
drumSynth.set({
"envelope.decay" : 0.24
});
expect(drumSynth.get().envelope.decay).to.equal(0.24);
drumSynth.dispose();
});
});
});
2017-12-30 16:26:29 +00:00
});