1
0
Fork 0
mirror of https://github.com/FrankerFaceZ/FrankerFaceZ.git synced 2025-07-03 17:48:30 +00:00
* Changed: Update another method used in the audio compressor to use a newer API when available.
This commit is contained in:
SirStendec 2022-04-25 14:19:34 -04:00
parent 3ea07abb0e
commit 3291b95e55
2 changed files with 23 additions and 6 deletions

View file

@ -1,7 +1,7 @@
{ {
"name": "frankerfacez", "name": "frankerfacez",
"author": "Dan Salvato LLC", "author": "Dan Salvato LLC",
"version": "4.33.1", "version": "4.33.2",
"description": "FrankerFaceZ is a Twitch enhancement suite.", "description": "FrankerFaceZ is a Twitch enhancement suite.",
"private": true, "private": true,
"license": "Apache-2.0", "license": "Apache-2.0",

View file

@ -1419,12 +1419,21 @@ export default class PlayerBase extends Module {
return; return;
if ( want_gain && ! gain ) { if ( want_gain && ! gain ) {
gain = video._ffz_gain = ctx.createGain();
let value = video._ffz_gain_value; let value = video._ffz_gain_value;
if ( value == null ) if ( value == null )
value = this.settings.get('player.gain.default'); value = this.settings.get('player.gain.default');
try {
gain = video._ffz_gain = new GainNode(ctx, {
gain: value
});
} catch(err) {
this.log.info('Unable to use new GainNode. Falling back to old method.');
gain = video._ffz_gain = ctx.createGain();
gain.gain.value = value; gain.gain.value = value;
}
comp.connect(gain); comp.connect(gain);
if ( compressed ) { if ( compressed ) {
@ -1537,14 +1546,22 @@ export default class PlayerBase extends Module {
} }
video._ffz_context = ctx; video._ffz_context = ctx;
const src = video._ffz_source = ctx.createMediaElementSource(video); let src;
try {
src = video._ffz_source = new MediaElementAudioSourceNode(ctx, {
mediaElement: video
});
} catch(err) {
this.log.info('Unable to use new MediaElementAudioSourceNode. Falling back to old method.');
src = video._ffz_source = ctx.createMediaElementSource(video);
}
src.connect(ctx.destination); src.connect(ctx.destination);
try { try {
comp = video._ffz_compressor = new DynamicsCompressorNode(ctx); comp = video._ffz_compressor = new DynamicsCompressorNode(ctx);
} catch (err) { } catch (err) {
this.log.info('Unable to uew new DynamicsCompressorNode. Falling back to old method.'); this.log.info('Unable to use new DynamicsCompressorNode. Falling back to old method.');
comp = video._ffz_compressor = ctx.createDynamicsCompressor(); comp = video._ffz_compressor = ctx.createDynamicsCompressor();
} }
@ -1560,7 +1577,7 @@ export default class PlayerBase extends Module {
}); });
} catch(err) { } catch(err) {
this.log.info('Unable to uew new GainNode. Falling back to old method.'); this.log.info('Unable to use new GainNode. Falling back to old method.');
gain = video._ffz_gain = ctx.createGain(); gain = video._ffz_gain = ctx.createGain();
gain.gain.value = value; gain.gain.value = value;
} }