* Closes the audio data and releases all resources.
()
| 322 | * Closes the audio data and releases all resources. |
| 323 | */ |
| 324 | close(): void { |
| 325 | if (this.closed) { |
| 326 | return; |
| 327 | } |
| 328 | |
| 329 | finalizationRegistry.unregister(this); |
| 330 | openAudioDataCount--; |
| 331 | |
| 332 | if (this._data instanceof Frame) { |
| 333 | this._data.free(); |
| 334 | } |
| 335 | |
| 336 | // Spec: Close AudioData algorithm |
| 337 | this.closed = true; |
| 338 | this._data = null; |
| 339 | // @ts-expect-error Readonly |
| 340 | this.format = null; |
| 341 | // @ts-expect-error Readonly |
| 342 | this.sampleRate = 0; |
| 343 | // @ts-expect-error Readonly |
| 344 | this.numberOfFrames = 0; |
| 345 | // @ts-expect-error Readonly |
| 346 | this.numberOfChannels = 0; |
| 347 | } |
| 348 | } |
| 349 | |
| 350 | const getBytesPerSample = (format: AudioSampleFormat): number => { |
no outgoing calls
no test coverage detected