Skip to content

Commit c72252f

Browse files
committed
change sound systems to use better PM api
1 parent 9429eb3 commit c72252f

File tree

3 files changed

+3
-51
lines changed

3 files changed

+3
-51
lines changed

src/addons/addons/mediarecorder/userscript.js

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -323,24 +323,6 @@ export default async ({ addon, console, msg }) => {
323323
vm.runtime.audioEngine.inputNode.connect(mediaStreamDestination);
324324
const audioSource = ctx.createMediaStreamSource(mediaStreamDestination.stream);
325325
audioSource.connect(dest);
326-
// extended audio should be recorded
327-
if ("ext_jgExtendedAudio" in vm.runtime) {
328-
const extension = vm.runtime.ext_jgExtendedAudio;
329-
const helper = extension.helper;
330-
// audio context might not be created, make it for him
331-
if (!helper.audioContext) helper.audioContext = new AudioContext();
332-
// gain node for volume slidor might not be created, make it for him
333-
if (!helper.audioGlobalVolumeNode) {
334-
helper.audioGlobalVolumeNode = helper.audioContext.createGain();
335-
helper.audioGlobalVolumeNode.gain.value = vm.runtime.audioEngine.inputNode.gain.value;
336-
helper.audioGlobalVolumeNode.connect(helper.audioContext.destination);
337-
}
338-
// create media stream
339-
const mediaStreamDestination = helper.audioContext.createMediaStreamDestination();
340-
helper.audioGlobalVolumeNode.connect(mediaStreamDestination);
341-
const audioSource = ctx.createMediaStreamSource(mediaStreamDestination.stream);
342-
audioSource.connect(dest);
343-
}
344326
// literally any other extension
345327
for (const audioData of vm.runtime._extensionAudioObjects.values()) {
346328
if (audioData.audioContext && audioData.gainNode) {

src/addons/addons/vol-slider/module.js

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -11,21 +11,6 @@ const callbacks = [];
1111
export const setVolume = (newVolume) => {
1212
if (gainNode) {
1313
gainNode.value = newVolume;
14-
// extended audio
15-
if ("ext_jgExtendedAudio" in globalVm.runtime) {
16-
const extension = globalVm.runtime.ext_jgExtendedAudio;
17-
const helper = extension.helper;
18-
// audio context might not be created, make it for him
19-
if (!helper.audioContext) helper.audioContext = new AudioContext();
20-
// gain node for volume slidor might not be created, make it for him
21-
if (!helper.audioGlobalVolumeNode) {
22-
helper.audioGlobalVolumeNode = helper.audioContext.createGain();
23-
helper.audioGlobalVolumeNode.gain.value = gainNode.value;
24-
helper.audioGlobalVolumeNode.connect(helper.audioContext.destination);
25-
} else {
26-
helper.audioGlobalVolumeNode.gain.value = gainNode.value;
27-
}
28-
}
2914
// literally any other extension
3015
for (const audioData of globalVm.runtime._extensionAudioObjects.values()) {
3116
if (audioData.gainNode) {
@@ -73,21 +58,6 @@ const gotAudioEngine = (audioEngine) => {
7358
}
7459
gainNode = audioEngine.inputNode.gain;
7560
gainNode.value = volumeBeforeFinishSetup;
76-
// extended audio
77-
if ("ext_jgExtendedAudio" in globalVm.runtime) {
78-
const extension = globalVm.runtime.ext_jgExtendedAudio;
79-
const helper = extension.helper;
80-
// audio context might not be created, make it for him
81-
if (!helper.audioContext) helper.audioContext = new AudioContext();
82-
// gain node for volume slidor might not be created, make it for him
83-
if (!helper.audioGlobalVolumeNode) {
84-
helper.audioGlobalVolumeNode = helper.audioContext.createGain();
85-
helper.audioGlobalVolumeNode.gain.value = gainNode.value;
86-
helper.audioGlobalVolumeNode.connect(helper.audioContext.destination);
87-
return;
88-
}
89-
helper.audioGlobalVolumeNode.gain.value = gainNode.value;
90-
}
9161
// literally any other extension
9262
for (const audioData of globalVm.runtime._extensionAudioObjects.values()) {
9363
if (audioData.gainNode) {

src/components/variables-tab/variables-tab.jsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import Input from '../forms/input.jsx';
99
import Box from '../box/box.jsx';
1010
import styles from './variables-tab.css';
1111

12-
class ShareButton extends React.Component {
12+
class VariablesTab extends React.Component {
1313
constructor(props) {
1414
super(props);
1515
bindAll(this, [
@@ -104,7 +104,7 @@ class ShareButton extends React.Component {
104104
}
105105
}
106106

107-
ShareButton.propTypes = {
107+
VariablesTab.propTypes = {
108108
localVariables: PropTypes.any,
109109
globalVariables: PropTypes.any,
110110
showLargeValue: PropTypes.any,
@@ -121,4 +121,4 @@ ShareButton.propTypes = {
121121
onTypeVariableValue: PropTypes.func.isRequired,
122122
};
123123

124-
export default injectIntl(ShareButton);
124+
export default injectIntl(VariablesTab);

0 commit comments

Comments
 (0)