mirror of
https://github.com/scratchfoundation/scratch-audio.git
synced 2025-06-17 15:34:54 -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.
|
||||
*/
|
||||
class AudioEngine {
|
||||
constructor (audioContext = new AudioContext()) {
|
||||
constructor (audioContext = new AudioContext(), optInputNode = null) {
|
||||
/**
|
||||
* AudioContext to play and manipulate sounds with a graph of source
|
||||
* and effect nodes.
|
||||
|
@ -55,7 +55,7 @@ class AudioEngine {
|
|||
* will change the volume for all sounds.
|
||||
* @type {GainNode}
|
||||
*/
|
||||
this.inputNode = this.audioContext.createGain();
|
||||
this.inputNode = optInputNode || this.audioContext.createGain();
|
||||
this.inputNode.connect(this.audioContext.destination);
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue