set original context even after test failure

This commit is contained in:
Yotam Mann 2015-10-09 10:57:37 -04:00
parent d3cb326a36
commit 1601c1f4ac
2 changed files with 13 additions and 2 deletions

View file

@ -24,7 +24,12 @@ define(["Tone/core/Tone"], function (Tone) {
for (var k = j - rmsFrame; k < j; k++){
sum += buffer[k] * buffer[k];
}
this._test(Math.sqrt(sum / rmsFrame), j / sampleRate);
try {
this._test(Math.sqrt(sum / rmsFrame), j / sampleRate);
} catch (e){
Tone.setContext(onlineContext);
throw new Error(e);
}
}
}
this._after();

View file

@ -29,7 +29,13 @@ define(["Tone/core/Tone"], function (Tone) {
if (channels === 1) {
ret = ret[0];
}
this._test(ret, i / sampleRate);
try {
this._test(ret, i / sampleRate);
} catch (e){
//reset the old context
Tone.setContext(onlineContext);
throw new Error(e);
}
}
this._after();
//reset the old context