Soundorv0.13.0

soundor:host

The plugin's identity, the host it runs in, and the host's transport.

What the plugin knows of where it runs: its own identity, the host's audio settings and name, and the transport (playing, tempo, position).

import { plugin, snapshot, subscribe } from 'soundor:host';

plugin.name; // from soundor.config
snapshot().sampleRate;
const stop = subscribe(({ transport }) => drawPlayhead(transport?.ppqPosition));

Exports

ExportWhat it is
plugin{ id, name }, from soundor.config.ts, typed as their literal values.
snapshot()The host's state now: a HostSnapshot.
subscribe(listener)Calls listener with each new snapshot when the host's state changes: every frame while playing. Returns a function that unsubscribes.

HostSnapshot

FieldTypeWhat it is
sampleRatenumberThe audio's sample rate, in Hz.
blockSizenumberThe audio's block size, in samples.
hostNamestringThe host's name, when the plugin can tell ("Reaper").
transportTransport | nullThe host's transport; null until the host reports one.

Transport

FieldTypeWhat it is
playingbooleanWhether the host plays.
recordingbooleanWhether it records.
loopingbooleanWhether it loops.
bpmnumberThe tempo, in beats per minute.
timeSignatureobject{ numerator, denominator }: 4/4 is { 4, 4 }.
ppqPositionnumberThe musical position, in quarter notes.
barStartPpqnumberWhere the current bar starts, in quarter notes.
timeInSecondsnumberThe position in seconds.
timeInSamplesnumberThe position in samples.

The plugin observes the transport; it never controls it. In the JUCE runtime the transport is captured on the audio thread without locking; in the web runtime it is the host page's own (web runtime).

On this page