UNPKG

@polygonjs/polygonjs

Version:

node-based WebGL 3D engine https://polygonjs.com

48 lines (47 loc) 1.07 kB
"use strict"; export class AudioBuilder { setAudioNode(inputNode) { this._audioNode = inputNode; } audioNode() { return this._audioNode; } setSource(source) { this._source = source; if (!this._audioNode) { this.setAudioNode(source); } } source() { return this._source; } setInstrument(instrument) { this._instrument = instrument; if (!this._audioNode) { this.setAudioNode(instrument); } } instrument() { return this._instrument; } setOscillatorParams(params) { this._oscillatorParams = params; } oscillatorParams() { return this._oscillatorParams; } setEnvelopeParams(params) { this._envelopeParams = params; } envelopeParams() { return this._envelopeParams; } clone() { const newAudioBuilder = new AudioBuilder(); newAudioBuilder.setAudioNode(this._audioNode); newAudioBuilder.setSource(this._source); newAudioBuilder.setInstrument(this._instrument); newAudioBuilder.setEnvelopeParams(this._envelopeParams); return newAudioBuilder; } }