Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Select buffer size automatically by setting 0 #88

Merged
merged 2 commits into from
Apr 20, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 11 additions & 9 deletions src/webaudio/WebAudioNodes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,6 @@ export interface SourceClone {
*/
export class WebAudioNodes extends Filterable
{
/**
* The buffer size for script processor
* @name PIXI.sound.SoundNodes.BUFFER_SIZE
* @type {number}
* @default 256
*/
public static BUFFER_SIZE: number = 256;

/**
* Get the buffer source node
* @name PIXI.sound.SoundNodes#bufferSource
Expand Down Expand Up @@ -77,7 +69,7 @@ export class WebAudioNodes extends Filterable
const audioContext: AudioContext = context.audioContext;

const bufferSource: AudioBufferSourceNode = audioContext.createBufferSource();
const script: ScriptProcessorNode = audioContext.createScriptProcessor(WebAudioNodes.BUFFER_SIZE);
const script: ScriptProcessorNode = audioContext.createScriptProcessor(0);
const gain: GainNode = audioContext.createGain();
const analyser: AnalyserNode = audioContext.createAnalyser();

Expand Down Expand Up @@ -134,4 +126,14 @@ export class WebAudioNodes extends Filterable
gain.connect(this.destination);
return { source, gain };
}

/**
* Get buffer size of `ScriptProcessorNode`.
* @type {number}
* @readonly
*/
get bufferSize(): number
{
return this.script.bufferSize;
}
}