()
| 61 | constructor(url?: ToneAudioBuffer | AudioBuffer | string, onload?: () => void); |
| 62 | constructor(options?: Partial<ToneBufferSourceOptions>); |
| 63 | constructor() { |
| 64 | |
| 65 | super(optionsFromArguments(ToneBufferSource.getDefaults(), arguments, ["url", "onload"])); |
| 66 | const options = optionsFromArguments(ToneBufferSource.getDefaults(), arguments, ["url", "onload"]); |
| 67 | |
| 68 | connect(this._source, this._gainNode); |
| 69 | this._source.onended = () => this._stopSource(); |
| 70 | |
| 71 | /** |
| 72 | * The playbackRate of the buffer |
| 73 | */ |
| 74 | this.playbackRate = new Param({ |
| 75 | context: this.context, |
| 76 | param: this._source.playbackRate, |
| 77 | units: "positive", |
| 78 | value: options.playbackRate, |
| 79 | }); |
| 80 | |
| 81 | // set some values initially |
| 82 | this.loop = options.loop; |
| 83 | this.loopStart = options.loopStart; |
| 84 | this.loopEnd = options.loopEnd; |
| 85 | this._buffer = new ToneAudioBuffer(options.url, options.onload, options.onerror); |
| 86 | |
| 87 | this._internalChannels.push(this._source); |
| 88 | } |
| 89 | |
| 90 | static getDefaults(): ToneBufferSourceOptions { |
| 91 | return Object.assign(OneShotSource.getDefaults(), { |
nothing calls this directly
no test coverage detected