AudioBufferSourceNode.buffer how to work it.

Dear All.

 

If there is setting a buffer of AudioBufferSourceNode, how it should work?

I think that AudioBufferSourceNode.buffer should be able to set buffer
anytime whatever the node is playing or not.

I believe if all cases are able to JS developer, it is fantastic.

 

< case1 >
sourcenode.buffer = null;
sourcenode.start(0); // mute
...
sourcenode.buffer = meaningfulbuffer; // sound 

< case2 >
sourcenode.buffer = meaningfulbuffer;
sourcenode.start(0); // sound
...
sourcenode.buffer = null; // mute
...
sourcenode.buffer = meaningfulbuffer; // sound

< case 3 >
sourcenode.start(0);
sourcenode.buffer = meaningfulbuffer; // sound

< case 4 >
sourcenode.buffer = meaningfulbuffer;
sourcenode.start(0); // sound

< case 5 >
sourcenode.buffer = meaningfulbuffer1;
sourcenode.start(0); // sound buffer1

.

sourcenode.buffer = meaningfulbuffer2;

sourcenode.start(0); // sound buffer2

 

 

In spec, nullable buffer is existed which has mono channel silence can help
making source muted to AudioBufferSourceNode without stop().

If setting buffer or calling start() is allowed more than once,
AudioBufferSourceNode can be reused.

 

Is there any confirmed change about calling start() multiple times?

 

 

However, it also has some issue.

"The spec doesn't say, but the buffer attribute of an AudioBufferSourceNode
should probably be only settable once.

If you've started the source node and change the buffer while the previous
buffer is playing, you have no control over when the new source starts."

https://github.com/WebAudio/web-audio-api/issues/288

 

Please feel free to give your opinion and correct way for Web Audio API.

 

Br,

Khno

 

Received on Tuesday, 11 March 2014 09:04:04 UTC