summaryrefslogtreecommitdiff
path: root/wolf3d/js/webkitAudioContextMonkeyPatch.js
diff options
context:
space:
mode:
authors1n <[email protected]>2019-09-11 18:46:21 -0700
committers1n <[email protected]>2019-09-11 18:46:21 -0700
commit7e704ee1fdab32255a013961d5935554655baaec (patch)
treea0eb5213c4060bd6d4cae382c65feeae55a79dc5 /wolf3d/js/webkitAudioContextMonkeyPatch.js
parentlink proper css (diff)
downloads1n.pw-admin-7e704ee1fdab32255a013961d5935554655baaec.tar.xz
s1n.pw-admin-7e704ee1fdab32255a013961d5935554655baaec.zip
remove wolf3d, add credits to dino
Diffstat (limited to 'wolf3d/js/webkitAudioContextMonkeyPatch.js')
-rw-r--r--wolf3d/js/webkitAudioContextMonkeyPatch.js175
1 files changed, 0 insertions, 175 deletions
diff --git a/wolf3d/js/webkitAudioContextMonkeyPatch.js b/wolf3d/js/webkitAudioContextMonkeyPatch.js
deleted file mode 100644
index 6ce16bd..0000000
--- a/wolf3d/js/webkitAudioContextMonkeyPatch.js
+++ /dev/null
@@ -1,175 +0,0 @@
-/* Copyright 2013 Chris Wilson
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-*/
-
-/*
-
-This monkeypatch library is intended to be included in projects that use
-webkitAudioContext (instead of AudioContext), and that may use the now-
-deprecated bits of the Web Audio API (e.g. using BufferSourceNode.noteOn()
-instead of BufferSourceNode.start().
-
-This library should be harmless to include if the browser does not have
-the unprefixed "AudioContext" implemented. If unprefixed AudioContext is
-supported, but the deprecated method names are already implemented, this
-library will have created a few shim functions on create* methods, but
-will not damage or override anything else.
-
-Ideally, the use of this library will go to zero - it is only intended as
-a way to quickly get script written to the old Web Audio methods to work
-in browsers that only support the new, approved methods.
-
-The patches this library handles:
-
-AudioBufferSourceNode.noteOn() is aliased to start()
-AudioBufferSourceNode.noteGrainOn() is aliased to start()
-AudioBufferSourceNode.noteOff() is aliased to stop()
-AudioContext.createGainNode() is aliased to createGain()
-AudioContext.createDelayNode() is aliased to createDelay()
-AudioContext.createJavaScriptNode() is aliased to createScriptProcessor()
-OscillatorNode.noteOn() is aliased to start()
-OscillatorNode.noteOff() is aliased to stop()
-AudioParam.setTargetValueAtTime() is aliased to setTargetAtTime()
-OscillatorNode's old enum values are aliased to the Web IDL enum values.
-BiquadFilterNode's old enum values are aliased to the Web IDL enum values.
-PannerNode's old enum values are aliased to the Web IDL enum values.
-AudioContext.createWaveTable() is aliased to createPeriodicWave().
-OscillatorNode.setWaveTable() is aliased to setPeriodicWave().
-
-*/
-(function (global, exports, perf) {
- 'use strict';
-
- function fixSetTarget(param) {
- if (!param) // if NYI, just return
- return;
- if (!param.setTargetValueAtTime)
- param.setTargetValueAtTime = param.setTargetAtTime;
- }
-
- if (window.hasOwnProperty('AudioContext') /*&& !window.hasOwnProperty('webkitAudioContext') */) {
- window.webkitAudioContext = AudioContext;
-
- AudioContext.prototype.internal_createGain = AudioContext.prototype.createGain;
- AudioContext.prototype.createGain = function() {
- var node = this.internal_createGain();
- fixSetTarget(node.gain);
- return node;
- };
-
- AudioContext.prototype.internal_createDelay = AudioContext.prototype.createDelay;
- AudioContext.prototype.createDelay = function() {
- var node = this.internal_createDelay();
- fixSetTarget(node.delayTime);
- return node;
- };
-
- AudioContext.prototype.internal_createBufferSource = AudioContext.prototype.createBufferSource;
- AudioContext.prototype.createBufferSource = function() {
- var node = this.internal_createBufferSource();
- if (!node.noteOn)
- node.noteOn = node.start;
- if (!node.noteGrainOn)
- node.noteGrainOn = node.start;
- if (!node.noteOff)
- node.noteOff = node.stop;
- fixSetTarget(node.playbackRate);
- return node;
- };
-
- AudioContext.prototype.internal_createDynamicsCompressor = AudioContext.prototype.createDynamicsCompressor;
- AudioContext.prototype.createDynamicsCompressor = function() {
- var node = this.internal_createDynamicsCompressor();
- fixSetTarget(node.threshold);
- fixSetTarget(node.knee);
- fixSetTarget(node.ratio);
- fixSetTarget(node.reduction);
- fixSetTarget(node.attack);
- fixSetTarget(node.release);
- return node;
- };
-
- AudioContext.prototype.internal_createBiquadFilter = AudioContext.prototype.createBiquadFilter;
- AudioContext.prototype.createBiquadFilter = function() {
- var node = this.internal_createBiquadFilter();
- fixSetTarget(node.frequency);
- fixSetTarget(node.detune);
- fixSetTarget(node.Q);
- fixSetTarget(node.gain);
- var enumValues = ['LOWPASS', 'HIGHPASS', 'BANDPASS', 'LOWSHELF', 'HIGHSHELF', 'PEAKING', 'NOTCH', 'ALLPASS'];
- for (var i = 0; i < enumValues.length; ++i) {
- var enumValue = enumValues[i];
- var newEnumValue = enumValue.toLowerCase();
- if (!node.hasOwnProperty(enumValue)) {
- node[enumValue] = newEnumValue;
- }
- }
- return node;
- };
-
- if (AudioContext.prototype.hasOwnProperty( 'createOscillator' )) {
- AudioContext.prototype.internal_createOscillator = AudioContext.prototype.createOscillator;
- AudioContext.prototype.createOscillator = function() {
- var node = this.internal_createOscillator();
- if (!node.noteOn)
- node.noteOn = node.start;
- if (!node.noteOff)
- node.noteOff = node.stop;
- fixSetTarget(node.frequency);
- fixSetTarget(node.detune);
- var enumValues = ['SINE', 'SQUARE', 'SAWTOOTH', 'TRIANGLE', 'CUSTOM'];
- for (var i = 0; i < enumValues.length; ++i) {
- var enumValue = enumValues[i];
- var newEnumValue = enumValue.toLowerCase();
- if (!node.hasOwnProperty(enumValue)) {
- node[enumValue] = newEnumValue;
- }
- }
- if (!node.hasOwnProperty('setWaveTable')) {
- node.setWaveTable = node.setPeriodicTable;
- }
- return node;
- };
- }
-
- AudioContext.prototype.internal_createPanner = AudioContext.prototype.createPanner;
- AudioContext.prototype.createPanner = function() {
- var node = this.internal_createPanner();
- var enumValues = {
- 'EQUALPOWER': 'equalpower',
- 'HRTF': 'HRTF',
- 'LINEAR_DISTANCE': 'linear',
- 'INVERSE_DISTANCE': 'inverse',
- 'EXPONENTIAL_DISTANCE': 'exponential',
- };
- for (var enumValue in enumValues) {
- var newEnumValue = enumValues[enumValue];
- if (!node.hasOwnProperty(enumValue)) {
- node[enumValue] = newEnumValue;
- }
- }
- return node;
- };
-
- if (!AudioContext.prototype.hasOwnProperty('createGainNode'))
- AudioContext.prototype.createGainNode = AudioContext.prototype.createGain;
- if (!AudioContext.prototype.hasOwnProperty('createDelayNode'))
- AudioContext.prototype.createDelayNode = AudioContext.prototype.createDelay;
- if (!AudioContext.prototype.hasOwnProperty('createJavaScriptNode'))
- AudioContext.prototype.createJavaScriptNode = AudioContext.prototype.createScriptProcessor;
- if (!AudioContext.prototype.hasOwnProperty('createWaveTable'))
- AudioContext.prototype.createWaveTable = AudioContext.prototype.createPeriodicWave;
- }
-}(window));
-