mirror of
https://github.com/scratchfoundation/scratch-audio.git
synced 2025-06-27 04:10:32 -04:00
Add optional custom input node param
This commit is contained in:
parent
89c345950e
commit
b551d26565
1 changed files with 2 additions and 2 deletions
|
@ -41,7 +41,7 @@ const decodeAudioData = function (audioContext, buffer) {
|
||||||
* sprites.
|
* sprites.
|
||||||
*/
|
*/
|
||||||
class AudioEngine {
|
class AudioEngine {
|
||||||
constructor (audioContext = new AudioContext()) {
|
constructor (audioContext = new AudioContext(), optInputNode = null) {
|
||||||
/**
|
/**
|
||||||
* AudioContext to play and manipulate sounds with a graph of source
|
* AudioContext to play and manipulate sounds with a graph of source
|
||||||
* and effect nodes.
|
* and effect nodes.
|
||||||
|
@ -55,7 +55,7 @@ class AudioEngine {
|
||||||
* will change the volume for all sounds.
|
* will change the volume for all sounds.
|
||||||
* @type {GainNode}
|
* @type {GainNode}
|
||||||
*/
|
*/
|
||||||
this.inputNode = this.audioContext.createGain();
|
this.inputNode = optInputNode || this.audioContext.createGain();
|
||||||
this.inputNode.connect(this.audioContext.destination);
|
this.inputNode.connect(this.audioContext.destination);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue