mirror of
https://github.com/Tonejs/Tone.js
synced 2025-01-08 18:08:46 +00:00
41 lines
1.1 KiB
JavaScript
41 lines
1.1 KiB
JavaScript
|
define(["helper/Basic", "Tone/source/AMOscillator", "helper/Offline", "helper/SourceTests", "helper/OscillatorTests", "Test"],
|
||
|
function (BasicTests, AMOscillator, Offline, SourceTests, OscillatorTests, Test) {
|
||
|
|
||
|
describe("AMOscillator", function(){
|
||
|
|
||
|
//run the common tests
|
||
|
BasicTests(AMOscillator);
|
||
|
SourceTests(AMOscillator);
|
||
|
OscillatorTests(AMOscillator);
|
||
|
|
||
|
context("Amplitude Modulation", function(){
|
||
|
|
||
|
it("can pass in parameters in the constructor", function(){
|
||
|
var fmOsc = new AMOscillator({
|
||
|
"harmonicity" : 3,
|
||
|
"modulationType" : "square3"
|
||
|
});
|
||
|
expect(fmOsc.harmonicity.value).to.be.closeTo(3, 0.001);
|
||
|
expect(fmOsc.modulationType).to.equal("square3");
|
||
|
fmOsc.dispose();
|
||
|
});
|
||
|
|
||
|
it("can set the harmonicity", function(){
|
||
|
var fmOsc = new AMOscillator();
|
||
|
fmOsc.harmonicity.value = 0.2;
|
||
|
expect(fmOsc.harmonicity.value).to.be.closeTo(0.2, 0.001);
|
||
|
fmOsc.dispose();
|
||
|
});
|
||
|
|
||
|
it("can set the modulationType", function(){
|
||
|
var fmOsc = new AMOscillator();
|
||
|
fmOsc.modulationType = "triangle5";
|
||
|
expect(fmOsc.modulationType).to.equal("triangle5");
|
||
|
fmOsc.dispose();
|
||
|
});
|
||
|
|
||
|
|
||
|
});
|
||
|
});
|
||
|
|
||
|
});
|