* Creates a copy of this audio data.
()
| 297 | * Creates a copy of this audio data. |
| 298 | */ |
| 299 | clone(): AudioData { |
| 300 | this.ensureNotClosed(); |
| 301 | |
| 302 | if (this._data instanceof Frame) { |
| 303 | const clone = this._data.clone(); |
| 304 | if (!clone) { |
| 305 | throw new Error('Failed to clone AVFrame.'); |
| 306 | } |
| 307 | |
| 308 | return new AudioDataPolyfill(clone); |
| 309 | } else { |
| 310 | return new AudioData({ |
| 311 | format: this.format!, |
| 312 | sampleRate: this.sampleRate, |
| 313 | numberOfFrames: this.numberOfFrames, |
| 314 | numberOfChannels: this.numberOfChannels, |
| 315 | timestamp: this.timestamp, |
| 316 | data: this._data!, |
| 317 | }); |
| 318 | } |
| 319 | } |
| 320 | |
| 321 | /** |
| 322 | * Closes the audio data and releases all resources. |
nothing calls this directly
no test coverage detected