Tone.js/test/instrument/AMSynth.js
2015-08-31 11:37:10 -04:00

54 lines
No EOL
1.4 KiB
JavaScript

define(["Tone/instrument/AMSynth", "helper/Basic", "helper/InstrumentTests"], function (AMSynth, Basic, InstrumentTest) {
describe("AMSynth", function(){
Basic(AMSynth);
InstrumentTest(AMSynth, "C4");
context("API", function(){
it ("can get and set carrier attributes", function(){
var amSynth = new AMSynth();
amSynth.carrier.oscillator.type = "triangle";
expect(amSynth.carrier.oscillator.type).to.equal("triangle");
amSynth.dispose();
});
it ("can get and set modulator attributes", function(){
var amSynth = new AMSynth();
amSynth.modulator.envelope.attack = 0.24;
expect(amSynth.modulator.envelope.attack).to.equal(0.24);
amSynth.dispose();
});
it ("can get and set harmonicity", function(){
var amSynth = new AMSynth();
amSynth.harmonicity.value = 2;
expect(amSynth.harmonicity.value).to.equal(2);
amSynth.dispose();
});
it ("can be constructed with an options object", function(){
var amSynth = new AMSynth({
"carrier" : {
"filter" : {
"rolloff" : -24
}
}
});
expect(amSynth.carrier.filter.rolloff).to.equal(-24);
amSynth.dispose();
});
it ("can get/set attributes", function(){
var amSynth = new AMSynth();
amSynth.set({
"harmonicity" : 1.5
});
expect(amSynth.get().harmonicity).to.equal(1.5);
amSynth.dispose();
});
});
});
});