mirror of
https://github.com/Tonejs/Tone.js
synced 2024-11-16 08:38:00 +00:00
adding onstop to noise
This commit is contained in:
parent
18facc5576
commit
07cdf6840e
1 changed files with 7 additions and 3 deletions
|
@ -109,9 +109,13 @@ export class Noise extends Source<NoiseOptions> {
|
||||||
*/
|
*/
|
||||||
protected _start(time?: Time): void {
|
protected _start(time?: Time): void {
|
||||||
const buffer = _noiseBuffers[this._type];
|
const buffer = _noiseBuffers[this._type];
|
||||||
this._source = new ToneBufferSource(buffer).connect(this.output);
|
this._source = new ToneBufferSource({
|
||||||
this._source.loop = true;
|
buffer,
|
||||||
this._source.playbackRate.value = this._playbackRate;
|
context: this.context,
|
||||||
|
loop: true,
|
||||||
|
onended: () => this.onstop(this),
|
||||||
|
playbackRate: this._playbackRate,
|
||||||
|
}).connect(this.output);
|
||||||
this._source.start(this.toSeconds(time), Math.random() * (buffer.duration - 0.001));
|
this._source.start(this.toSeconds(time), Math.random() * (buffer.duration - 0.001));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue