Creates a new worker synthesizer core: the synthesizer that runs in the worker. Most parameters here are provided with the first message that is posted to the worker by the WorkerSynthesizer.
The data from the first message sent from WorkerSynthesizer. Listen for the first event and use its data to initialize this class.
The first port from the first message sent from WorkerSynthesizer.
The function to post a message back to the main thread. Usually postMessage.
The postMessage() method of the Worker interface sends a message to the worker. The first parameter is the data to send to the worker. The data may be any JavaScript object that can be handled by the structured clone algorithm.
Optionaloptions: StructuredSerializeOptionsOptionalcompressionFunction: WorkerSampleEncodingFunction
Optional function for compressing SF3 banks.
ReadonlysequencersThe array of sequencers to use with the synthesizer. This property allows for direct access to the sequencers and their MIDI data.
ReadonlysynthesizerThe synthesizer instance. This property allows for direct access to the audio engine.
ProtectedfinishFinishes processing an audio block: syncs the sequencers and voice counts, then sends the queued messages. Call after rendering the block.
Handles a message received from the main thread.
The message received.
ProtectedpostRejects the main thread promise waiting for the given response type.
The response type that will not arrive.
The reason of the failure.
ProtectedrunRuns an offline operation with the audio loop stopped. The loop is always restarted, and a failure rejects the main thread promise waiting for the response.
The response type the main thread is waiting for.
The operation, which posts the response itself on success.
ProtectedstartStarts processing an audio block: queues the messages and advances the sequencers. Call before rendering the block.
The core audio engine for the worker synthesizer.
This part of the synthesizer runs in the Web Worker and contains the actual audio engine.