OfflineAudioContext Class
An audio context that renders its graph to AudioBuffer objects as fast as possible (https://webaudio.github.io/web-audio-api/#OfflineAudioContext), deterministically.
public sealed class OfflineAudioContext : BaseAudioContextRemarks
The rendering runs in tasks of the event loop of the window of the context: startRendering() returns before the rendering starts, and the promise is resolved by a task once the buffer is rendered. A context created by .NET code without window renders synchronously.
See also
- Inheritance
BaseAudioContextOfflineAudioContext
Constructors
| Name | Description |
|---|---|
| OfflineAudioContext(OfflineAudioContextOptions) | Creates an offline context. |
| OfflineAudioContext(uint, uint, float) | Creates an offline context that renders a buffer of a number of channels, a length and a sample rate. |
OfflineAudioContext overloads
OfflineAudioContext(OfflineAudioContextOptions)
OfflineAudioContext.csCreates an offline context.
public OfflineAudioContext(OfflineAudioContextOptions contextOptions)Parameters
contextOptionsOfflineAudioContextOptions
Exceptions
DomException- An option is not supported (a
NotSupportedError), or the document is not fully active (anInvalidStateError).
See also
OfflineAudioContext(uint, uint, float)
OfflineAudioContext.csCreates an offline context that renders a buffer of a number of channels, a length and a sample rate.
Parameters
Exceptions
DomException- An argument is not supported (a
NotSupportedError), or the document is not fully active (anInvalidStateError).
See also
Properties
| Name | Description |
|---|---|
| Length | Gets the length of the rendering in sample frames, or null for a rendering of undefined length. |
| OnComplete | Gets or sets the event handler of the complete event. |
Length
OfflineAudioContext.csGets the length of the rendering in sample frames, or null for a rendering of undefined length.
public uint? Length { get; }OnComplete
OfflineAudioContext.csGets or sets the event handler of the complete event.
Methods
| Name | Description |
|---|---|
| Close() | Closes the context: the rendering stops. |
| Resume() | Resumes the rendering suspended by OfflineAudioContext.Suspend. |
| StartRendering(uint?) | Starts the rendering of a buffer: the remaining frames of the context, or a chunk of frames (rounded up to a multiple of the render quantum size). |
| Suspend(double) | Schedules a suspension of the rendering at a time (rounded up to a render quantum boundary). |
Close()
OfflineAudioContext.csCloses the context: the rendering stops.
public Task Close()Resume()
OfflineAudioContext.csResumes the rendering suspended by OfflineAudioContext.Suspend.
public Task Resume()StartRendering(uint?)
OfflineAudioContext.csStarts the rendering of a buffer: the remaining frames of the context, or a chunk of frames (rounded up to a multiple of the render quantum size).
public Task<AudioBuffer> StartRendering(uint? chunkSize = null)Parameters
chunkSizeuint?- The number of frames to render, or null.
Returns
Task<AudioBuffer> A task completed with the rendered buffer.
See also
Suspend(double)
OfflineAudioContext.csSchedules a suspension of the rendering at a time (rounded up to a render quantum boundary).