mirror of
https://github.com/Tonejs/Tone.js
synced 2024-11-16 00:27:58 +00:00
testing cancelAndHold during exponential ramp
This commit is contained in:
parent
8759443f9e
commit
1e5606a003
2 changed files with 25 additions and 4 deletions
|
@ -1,5 +1,5 @@
|
|||
define(["helper/Basic", "Test", "Tone/core/Param", "Tone/type/Type", "Tone/signal/Signal", "Tone/core/Transport"],
|
||||
function (Basic, Test, Param, Tone, Signal, Transport) {
|
||||
function(Basic, Test, Param, Tone, Signal, Transport) {
|
||||
|
||||
describe("Param", function(){
|
||||
|
||||
|
@ -252,7 +252,7 @@ define(["helper/Basic", "Test", "Tone/core/Param", "Tone/type/Type", "Tone/signa
|
|||
param.dispose();
|
||||
});
|
||||
|
||||
it("can cancelAndHold an automation", function(){
|
||||
it("can cancelAndHold a linear automation", function(){
|
||||
var gain = Tone.context.createGain();
|
||||
var param = new Param(gain.gain);
|
||||
param.linearRampToValueAtTime(0.5, "+0.5");
|
||||
|
@ -260,6 +260,14 @@ define(["helper/Basic", "Test", "Tone/core/Param", "Tone/type/Type", "Tone/signa
|
|||
param.dispose();
|
||||
});
|
||||
|
||||
it("can cancelAndHold an exponential automation", function(){
|
||||
var gain = Tone.context.createGain();
|
||||
var param = new Param(gain.gain);
|
||||
param.exponentialRampToValueAtTime(0.5, "+0.5");
|
||||
param.cancelAndHoldAtTime(0);
|
||||
param.dispose();
|
||||
});
|
||||
|
||||
it("can set a linear ramp from the current time", function(){
|
||||
var gain = Tone.context.createGain();
|
||||
var param = new Param(gain.gain);
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
define(["helper/Offline", "helper/Basic", "Test", "Tone/signal/Signal",
|
||||
"Tone/type/Type", "Tone/core/Transport", "helper/ConstantOutput"],
|
||||
function (Offline, Basic, Test, Signal, Tone, Transport, ConstantOutput) {
|
||||
function(Offline, Basic, Test, Signal, Tone, Transport, ConstantOutput) {
|
||||
|
||||
describe("Signal", function(){
|
||||
|
||||
|
@ -119,7 +119,7 @@ function (Offline, Basic, Test, Signal, Tone, Transport, ConstantOutput) {
|
|||
}, 1);
|
||||
});
|
||||
|
||||
it("can cancel and hold an automation curve", function(){
|
||||
it("can cancel and hold a linear automation curve", function(){
|
||||
return Offline(function(){
|
||||
var sig = new Signal(0).toMaster();
|
||||
sig.linearRampTo(2, 1);
|
||||
|
@ -132,6 +132,19 @@ function (Offline, Basic, Test, Signal, Tone, Transport, ConstantOutput) {
|
|||
});
|
||||
});
|
||||
|
||||
it("can cancel and hold an exponential automation curve", function(){
|
||||
return Offline(function(){
|
||||
var sig = new Signal(1).toMaster();
|
||||
sig.exponentialRampTo(2, 1);
|
||||
sig.cancelAndHoldAtTime(0.5);
|
||||
}, 1).then(function(buffer){
|
||||
expect(buffer.getValueAtTime(0)).to.be.closeTo(1, 0.1);
|
||||
expect(buffer.getValueAtTime(0.25)).to.be.closeTo(1.2, 0.1);
|
||||
expect(buffer.getValueAtTime(0.5)).to.be.closeTo(1.4, 0.1);
|
||||
expect(buffer.getValueAtTime(0.75)).to.be.closeTo(1.4, 0.1);
|
||||
});
|
||||
});
|
||||
|
||||
it("can set a linear ramp from the current time", function(){
|
||||
return Offline(function(){
|
||||
var sig = new Signal(0).toMaster();
|
||||
|
|
Loading…
Reference in a new issue