removing unused tests

This commit is contained in:
Yotam Mann 2017-02-20 16:45:32 -05:00
parent 0ef0ad3a56
commit e1b7fbd3f9
11 changed files with 29 additions and 123 deletions

View file

@ -1,6 +1,6 @@
define(["Tone/component/Envelope", "helper/Basic", "helper/Offline", "Test", define(["Tone/component/Envelope", "helper/Basic", "helper/Offline", "Test",
"helper/Offline2", "helper/Supports", "helper/PassAudio", "helper/APITest"], "helper/Supports", "helper/PassAudio", "helper/APITest"],
function (Envelope, Basic, Offline, Test, Offline2, Supports, PassAudio, APITest) { function (Envelope, Basic, Offline, Test, Supports, PassAudio, APITest) {
describe("Envelope", function(){ describe("Envelope", function(){
Basic(Envelope); Basic(Envelope);

View file

@ -1,6 +1,6 @@
define(["helper/OutputAudio", "Tone/instrument/Instrument", "helper/OutputAudioStereo", define(["helper/OutputAudio", "Tone/instrument/Instrument", "helper/OutputAudioStereo",
"Test", "helper/Offline", "helper/Meter"], "Test", "helper/Offline"],
function (OutputAudio, Instrument, OutputAudioStereo, Test, Offline, Meter) { function (OutputAudio, Instrument, OutputAudioStereo, Test, Offline) {
return function(Constr, note, constrArg){ return function(Constr, note, constrArg){

View file

@ -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();
});
};
});

View file

@ -1,60 +1,17 @@
define(["Tone/core/Tone"], function (Tone) { define(["helper/Offline"], function (Offline) {
//hold onto the current context return function(callback, duration, channels){
var onlineContext = Tone.context;
/** return Offline(callback, duration, channels).then(function(buffer){
* OFFLINE TESTING var blockTime = 512/buffer.sampleRate;
*/ var rms = buffer.getRMS(512);
var Meter = function(duration){ rms.forEach = function(callback){
duration = duration || 1; for (var i = 0; i < rms.length; i++){
var sampleRate = 44100; var level = rms[i];
//dummy functions callback(level, blockTime * i);
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);
}
} }
} };
this._after(); return rms;
//reset the old context });
Tone.setContext(onlineContext);
}.bind(this);
}; };
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;
}); });

View file

@ -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;
});
};
});

View file

@ -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();
};
});

View file

@ -1,6 +1,6 @@
define(["Tone/instrument/PolySynth", "helper/Basic", "helper/InstrumentTests", "helper/OutputAudioStereo", define(["Tone/instrument/PolySynth", "helper/Basic", "helper/InstrumentTests", "helper/OutputAudioStereo",
"helper/Meter", "Tone/instrument/Instrument", "Test", "helper/OutputAudio", "Tone/instrument/MonoSynth", "helper/Offline"], "Tone/instrument/Instrument", "Test", "helper/OutputAudio", "Tone/instrument/MonoSynth", "helper/Offline"],
function (PolySynth, Basic, InstrumentTests, OutputAudioStereo, Meter, Instrument, Test, OutputAudio, MonoSynth, Offline) { function (PolySynth, Basic, InstrumentTests, OutputAudioStereo, Instrument, Test, OutputAudio, MonoSynth, Offline) {
describe("PolySynth", function(){ describe("PolySynth", function(){

View file

@ -1,5 +1,5 @@
define(["helper/Basic", "Tone/source/BufferSource", "helper/Offline", "Tone/core/Buffer", "helper/Meter", "helper/Meter2"], define(["helper/Basic", "Tone/source/BufferSource", "helper/Offline", "Tone/core/Buffer", "helper/Meter"],
function (BasicTests, BufferSource, Offline, Buffer, Meter, Meter2) { function (BasicTests, BufferSource, Offline, Buffer, Meter) {
if (window.__karma__){ if (window.__karma__){
Buffer.baseUrl = "/base/test/"; 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(){ it("can play for a specific duration", function(){
return Meter2(function(){ return Meter(function(){
var player = new BufferSource(buffer); var player = new BufferSource(buffer);
player.toMaster(); player.toMaster();
player.start(0).stop(0.1); 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(){ it("can play for a specific duration passed in the 'start' method", function(){
return Meter2(function(){ return Meter(function(){
var player = new BufferSource(buffer); var player = new BufferSource(buffer);
player.toMaster(); player.toMaster();
player.start(0, 0, 0.1); 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(){ it("can be scheduled to stop", function(){
return Meter2(function(){ return Meter(function(){
var player = new BufferSource(buffer).toMaster(); var player = new BufferSource(buffer).toMaster();
player.start(0).stop(0.1); player.start(0).stop(0.1);
}, 0.6).then(function(rms){ }, 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(){ it("can be scheduled to stop with a ramp", function(){
return Meter2(function(){ return Meter(function(){
var player = new BufferSource(buffer).toMaster(); var player = new BufferSource(buffer).toMaster();
player.start(0).stop(0.1, 0.1); player.start(0).stop(0.1, 0.1);
}, 0.6).then(function(rms){ }, 0.6).then(function(rms){

View file

@ -1,5 +1,5 @@
define(["helper/Basic", "Tone/source/MultiPlayer", "helper/Offline", "helper/SourceTests", 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) { function (BasicTests, MultiPlayer, Offline, SourceTests, Buffer, OutputAudioStereo, Meter) {
if (window.__karma__){ if (window.__karma__){

View file

@ -1,6 +1,6 @@
define(["helper/Basic", "Tone/source/Player", "helper/Offline", define(["helper/Basic", "Tone/source/Player", "helper/Offline",
"helper/SourceTests", "Tone/core/Buffer", "helper/Meter2", "helper/Offline2", "Test"], "helper/SourceTests", "Tone/core/Buffer", "helper/Meter", "Test"],
function (BasicTests, Player, Offline, SourceTests, Buffer, Meter, Offline2, Test) { function (BasicTests, Player, Offline, SourceTests, Buffer, Meter, Test) {
if (window.__karma__){ if (window.__karma__){
Buffer.baseUrl = "/base/test/"; Buffer.baseUrl = "/base/test/";

View file

@ -1,5 +1,5 @@
define(["helper/Basic", "Tone/source/UserMedia", "Test", "Tone/source/Source", "helper/Offline2"], define(["helper/Basic", "Tone/source/UserMedia", "Test", "Tone/source/Source"],
function (BasicTests, UserMedia, Test, Source, Offline) { function (BasicTests, UserMedia, Test, Source) {
describe("UserMedia", function(){ describe("UserMedia", function(){