mirror of
https://github.com/Tonejs/Tone.js
synced 2024-11-16 00:27:58 +00:00
removing unused tests
This commit is contained in:
parent
0ef0ad3a56
commit
e1b7fbd3f9
11 changed files with 29 additions and 123 deletions
|
@ -1,6 +1,6 @@
|
|||
define(["Tone/component/Envelope", "helper/Basic", "helper/Offline", "Test",
|
||||
"helper/Offline2", "helper/Supports", "helper/PassAudio", "helper/APITest"],
|
||||
function (Envelope, Basic, Offline, Test, Offline2, Supports, PassAudio, APITest) {
|
||||
"helper/Supports", "helper/PassAudio", "helper/APITest"],
|
||||
function (Envelope, Basic, Offline, Test, Supports, PassAudio, APITest) {
|
||||
describe("Envelope", function(){
|
||||
|
||||
Basic(Envelope);
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
define(["helper/OutputAudio", "Tone/instrument/Instrument", "helper/OutputAudioStereo",
|
||||
"Test", "helper/Offline", "helper/Meter"],
|
||||
function (OutputAudio, Instrument, OutputAudioStereo, Test, Offline, Meter) {
|
||||
"Test", "helper/Offline"],
|
||||
function (OutputAudio, Instrument, OutputAudioStereo, Test, Offline) {
|
||||
|
||||
return function(Constr, note, constrArg){
|
||||
|
||||
|
|
|
@ -1,8 +0,0 @@
|
|||
define(["helper/Offline", "helper/BufferTest"], function (Offline, BufferTest) {
|
||||
return function(callback, duration){
|
||||
duration = duration || 0.1;
|
||||
return Offline(callback, duration).then(function(buffer){
|
||||
return buffer.isSilent();
|
||||
});
|
||||
};
|
||||
});
|
|
@ -1,60 +1,17 @@
|
|||
define(["Tone/core/Tone"], function (Tone) {
|
||||
define(["helper/Offline"], function (Offline) {
|
||||
|
||||
//hold onto the current context
|
||||
var onlineContext = Tone.context;
|
||||
return function(callback, duration, channels){
|
||||
|
||||
/**
|
||||
* OFFLINE TESTING
|
||||
*/
|
||||
var Meter = function(duration){
|
||||
duration = duration || 1;
|
||||
var sampleRate = 44100;
|
||||
//dummy functions
|
||||
this._before = Tone.noOp;
|
||||
this._after = Tone.noOp;
|
||||
this._test = Tone.noOp;
|
||||
var rmsFrame = 256;
|
||||
//offline rendering context
|
||||
this.context = new OfflineAudioContext(1, sampleRate * duration, sampleRate);
|
||||
this.context.oncomplete = function(e){
|
||||
var buffer = e.renderedBuffer.getChannelData(0);
|
||||
for (var j = 0; j < buffer.length; j++){
|
||||
var sum = 0;
|
||||
if (j >= rmsFrame){
|
||||
for (var k = j - rmsFrame; k < j; k++){
|
||||
sum += buffer[k] * buffer[k];
|
||||
}
|
||||
try {
|
||||
this._test(Math.sqrt(sum / rmsFrame), j / sampleRate);
|
||||
} catch (e){
|
||||
Tone.setContext(onlineContext);
|
||||
throw new Error(e);
|
||||
}
|
||||
return Offline(callback, duration, channels).then(function(buffer){
|
||||
var blockTime = 512/buffer.sampleRate;
|
||||
var rms = buffer.getRMS(512);
|
||||
rms.forEach = function(callback){
|
||||
for (var i = 0; i < rms.length; i++){
|
||||
var level = rms[i];
|
||||
callback(level, blockTime * i);
|
||||
}
|
||||
}
|
||||
this._after();
|
||||
//reset the old context
|
||||
Tone.setContext(onlineContext);
|
||||
}.bind(this);
|
||||
};
|
||||
return rms;
|
||||
});
|
||||
};
|
||||
|
||||
Meter.prototype.run = function(){
|
||||
Tone.setContext(this.context);
|
||||
this._before(this.context.destination);
|
||||
this.context.startRendering();
|
||||
};
|
||||
|
||||
Meter.prototype.before = function(cb){
|
||||
this._before = cb;
|
||||
};
|
||||
|
||||
Meter.prototype.after = function(cb){
|
||||
this._after = cb;
|
||||
};
|
||||
|
||||
Meter.prototype.test = function(cb){
|
||||
this._test = cb;
|
||||
};
|
||||
|
||||
return Meter;
|
||||
});
|
|
@ -1,17 +0,0 @@
|
|||
define(["helper/Offline"], function (Offline) {
|
||||
|
||||
return function(callback, duration, channels){
|
||||
|
||||
return Offline(callback, duration, channels).then(function(buffer){
|
||||
var blockTime = 512/buffer.sampleRate;
|
||||
var rms = buffer.getRMS(512);
|
||||
rms.forEach = function(callback){
|
||||
for (var i = 0; i < rms.length; i++){
|
||||
var level = rms[i];
|
||||
callback(level, blockTime * i);
|
||||
}
|
||||
};
|
||||
return rms;
|
||||
});
|
||||
};
|
||||
});
|
|
@ -1,26 +0,0 @@
|
|||
define(["Tone/core/Tone", "helper/Offline"], function (Tone, Offline) {
|
||||
|
||||
/**
|
||||
* OFFLINE TESTING
|
||||
*/
|
||||
return function(callback, duration, channels){
|
||||
|
||||
var offline = new Offline(duration, channels);
|
||||
|
||||
/*offline.before(callback.bind(window, undefined, function testFn(cb){
|
||||
offline.test(cb);
|
||||
}, function tearDown(cb){
|
||||
offline.after(cb);
|
||||
}));*/
|
||||
|
||||
offline.before(function(output){
|
||||
callback(output, function testFn(cb){
|
||||
offline.test(cb);
|
||||
}, function(cb){
|
||||
offline.after(cb);
|
||||
});
|
||||
});
|
||||
|
||||
offline.run();
|
||||
};
|
||||
});
|
|
@ -1,6 +1,6 @@
|
|||
define(["Tone/instrument/PolySynth", "helper/Basic", "helper/InstrumentTests", "helper/OutputAudioStereo",
|
||||
"helper/Meter", "Tone/instrument/Instrument", "Test", "helper/OutputAudio", "Tone/instrument/MonoSynth", "helper/Offline"],
|
||||
function (PolySynth, Basic, InstrumentTests, OutputAudioStereo, Meter, Instrument, Test, OutputAudio, MonoSynth, Offline) {
|
||||
"Tone/instrument/Instrument", "Test", "helper/OutputAudio", "Tone/instrument/MonoSynth", "helper/Offline"],
|
||||
function (PolySynth, Basic, InstrumentTests, OutputAudioStereo, Instrument, Test, OutputAudio, MonoSynth, Offline) {
|
||||
|
||||
describe("PolySynth", function(){
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
define(["helper/Basic", "Tone/source/BufferSource", "helper/Offline", "Tone/core/Buffer", "helper/Meter", "helper/Meter2"],
|
||||
function (BasicTests, BufferSource, Offline, Buffer, Meter, Meter2) {
|
||||
define(["helper/Basic", "Tone/source/BufferSource", "helper/Offline", "Tone/core/Buffer", "helper/Meter"],
|
||||
function (BasicTests, BufferSource, Offline, Buffer, Meter) {
|
||||
|
||||
if (window.__karma__){
|
||||
Buffer.baseUrl = "/base/test/";
|
||||
|
@ -133,7 +133,7 @@ define(["helper/Basic", "Tone/source/BufferSource", "helper/Offline", "Tone/core
|
|||
});
|
||||
|
||||
it("can play for a specific duration", function(){
|
||||
return Meter2(function(){
|
||||
return Meter(function(){
|
||||
var player = new BufferSource(buffer);
|
||||
player.toMaster();
|
||||
player.start(0).stop(0.1);
|
||||
|
@ -155,7 +155,7 @@ define(["helper/Basic", "Tone/source/BufferSource", "helper/Offline", "Tone/core
|
|||
});
|
||||
|
||||
it("can play for a specific duration passed in the 'start' method", function(){
|
||||
return Meter2(function(){
|
||||
return Meter(function(){
|
||||
var player = new BufferSource(buffer);
|
||||
player.toMaster();
|
||||
player.start(0, 0, 0.1);
|
||||
|
@ -210,7 +210,7 @@ define(["helper/Basic", "Tone/source/BufferSource", "helper/Offline", "Tone/core
|
|||
});
|
||||
|
||||
it("can be scheduled to stop", function(){
|
||||
return Meter2(function(){
|
||||
return Meter(function(){
|
||||
var player = new BufferSource(buffer).toMaster();
|
||||
player.start(0).stop(0.1);
|
||||
}, 0.6).then(function(rms){
|
||||
|
@ -225,7 +225,7 @@ define(["helper/Basic", "Tone/source/BufferSource", "helper/Offline", "Tone/core
|
|||
});
|
||||
|
||||
it("can be scheduled to stop with a ramp", function(){
|
||||
return Meter2(function(){
|
||||
return Meter(function(){
|
||||
var player = new BufferSource(buffer).toMaster();
|
||||
player.start(0).stop(0.1, 0.1);
|
||||
}, 0.6).then(function(rms){
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
define(["helper/Basic", "Tone/source/MultiPlayer", "helper/Offline", "helper/SourceTests",
|
||||
"Tone/core/Buffer", "helper/OutputAudioStereo", "helper/Meter2"],
|
||||
"Tone/core/Buffer", "helper/OutputAudioStereo", "helper/Meter"],
|
||||
function (BasicTests, MultiPlayer, Offline, SourceTests, Buffer, OutputAudioStereo, Meter) {
|
||||
|
||||
if (window.__karma__){
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
define(["helper/Basic", "Tone/source/Player", "helper/Offline",
|
||||
"helper/SourceTests", "Tone/core/Buffer", "helper/Meter2", "helper/Offline2", "Test"],
|
||||
function (BasicTests, Player, Offline, SourceTests, Buffer, Meter, Offline2, Test) {
|
||||
"helper/SourceTests", "Tone/core/Buffer", "helper/Meter", "Test"],
|
||||
function (BasicTests, Player, Offline, SourceTests, Buffer, Meter, Test) {
|
||||
|
||||
if (window.__karma__){
|
||||
Buffer.baseUrl = "/base/test/";
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
define(["helper/Basic", "Tone/source/UserMedia", "Test", "Tone/source/Source", "helper/Offline2"],
|
||||
function (BasicTests, UserMedia, Test, Source, Offline) {
|
||||
define(["helper/Basic", "Tone/source/UserMedia", "Test", "Tone/source/Source"],
|
||||
function (BasicTests, UserMedia, Test, Source) {
|
||||
|
||||
describe("UserMedia", function(){
|
||||
|
||||
|
|
Loading…
Reference in a new issue