UNPKG

soundcraft-ui-connection

Version:

Library for controlling the Soundcraft Ui series audio mixers

56 lines (55 loc) 2.68 kB
import { MixerStore } from './state/mixer-store'; import { ChannelType, FxType, VolumeBusType } from './types'; /** Clamp numeric value to min and max */ export declare function clamp(value: number, min: number, max: number): number; /** Round a number to three decimal places */ export declare function roundToThreeDecimals(value: number): number; /** * Transform player time in seconds to human-readable format M:SS * @param value player time in seconds */ export declare function playerTimeToString(value: number): string; /** * Get the number of the channel that is stereo-linked to the given channel. * Returns `undefined` when the channel is not linked (stereo index `-1`), * so callers can skip adding a linked channel in that case. * @param channel Channel number * @param stereoIndex Stereo index of the channel (`0` = first, `1` = second, `-1` = not linked) */ export declare function getLinkedChannelNumber(channel: number, stereoIndex: number): number | undefined; /** Helper function to convert FX type into readable name (Reverb, Chorus, ...) */ export declare function fxTypeToString(type: FxType): keyof typeof FxType; /** * Sanitize a channel name before sending it to the mixer: * removes the reserved `^` separator, limits the length to 20 characters * and converts the name to uppercase. * @param name raw channel name */ export declare function sanitizeChannelName(name: string): string; /** * Construct the default human-readable name for a channel, * based on the default labels from the web interface * @param type channel type * @param channel channel number */ export declare function getDefaultChannelName(type: ChannelType, channel: number): string; /** * Construct the default human-readable name for a matrix bus output (Ui24R only). * A matrix lives in the same `a` slot as the AUX it replaced, but uses a different * default label. * @param channel matrix bus number */ export declare function getDefaultMatrixName(channel: number): string; /** * Construct the default human-readable name for a volume bus (solo or headphones), * based on the default labels from the web interface * @param type volume bus type * @param busId volume bus number */ export declare function getDefaultVolumeBusName(type: VolumeBusType, busId: number): string; /** * Returns a Promise that fires when the mixer state hasn't changed for 25 ms OR when 250 ms timeout are over. * This makes sure that all initial params can be received by the mixer after connection init. * In case the state never stands still for 50 ms, the 250 ms timeout will emit finally. */ export declare function waitForInitParams(store: MixerStore): Promise<void>;