Created
April 19, 2016 20:20
-
-
Save hoch/aad9ad657686d1f492faa8d5dfa2c814 to your computer and use it in GitHub Desktop.
DynamicsCompressorNode.reduction polyfill
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
!function() { | |
var _isCompressorReductionAudioParam = | |
typeof (new OfflineAudioContext(1, 1, 44100)).createDynamicsCompressor().reduction | |
=== 'object'; | |
AudioContext.prototype._createDynamicsCompressor = | |
AudioContext.prototype.createDynamicsCompressor; | |
OfflineAudioContext.prototype._createDynamicsCompressor = | |
OfflineAudioContext.prototype.createDynamicsCompressor; | |
AudioContext.prototype.createDynamicsCompressor = | |
OfflineAudioContext.prototype.createDynamicsCompressor = function () { | |
var compressor = this._createDynamicsCompressor(); | |
if (_isCompressorReductionAudioParam) { | |
compressor._reduction = compressor.reduction; | |
Object.defineProperty(compressor, 'reduction', { | |
get: function () { | |
return compressor._reduction.value; | |
} | |
}); | |
} | |
return compressor; | |
}; | |
}(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment