Tone.js/test/helper/Supports.js

44 lines
1.3 KiB
JavaScript
Raw Normal View History

define(["helper/ua-parser"], function (UserAgentParser) {
var parsed = new UserAgentParser().getBrowser();
var name = parsed.name;
var version = parseInt(parsed.major);
function is(browser, above){
above = above || 0;
return name === browser && version >= above;
}
function isnt(browser, below){
below = below || Infinity;
return !(name === browser && version <= below);
}
return {
//setValueCurveAtTime interpolates
INTERPOLATED_VALUE_CURVE : is("Chrome", 46),
//waveshaper has correct value at 0
WAVESHAPER_0_POSITION : isnt("Safari"),
//has stereo panner node
STEREO_PANNER_NODE : isnt("Safari"),
//can schedule a mixture of curves correctly
2017-02-20 03:51:10 +00:00
ACCURATE_SIGNAL_SCHEDULING : isnt("Safari"),
//can disconnect from a specific node
NODE_DISCONNECT : is("Chrome", 50),
//stereo panner is equal power panning
EQUAL_POWER_PANNER : isnt("Firefox"),
//doesn't seem to support the pluck synth
PLUCK_SYNTH : isnt("Safari"),
//has float time domain analyser
ANALYZE_FLOAT_TIME_DOMAIN : AnalyserNode && typeof AnalyserNode.prototype.getFloatTimeDomainData === "function",
//if the tests run in focus
ONLINE_TESTING : isnt("Firefox"),
//the close method resolves a promise
2017-12-28 23:44:14 +00:00
AUDIO_CONTEXT_CLOSE_RESOLVES : isnt("Firefox"),
//if it supports gUM testing
GET_USER_MEDIA : isnt("Safari")
};
});