soundcraft-ui-connection
Version:
Library for controlling the Soundcraft Ui series audio mixers
109 lines (108 loc) • 4.89 kB
TypeScript
import { Observable } from 'rxjs';
import { MixerConnection } from '../mixer-connection';
import { MixerStore } from '../state/mixer-store';
import { Easings } from '../utils/transitions/easings';
import { FadeableChannel, PannableChannel, PostProcessableChannel } from './interfaces';
/**
* Base class for all sources routed to a matrix bus.
* A matrix source can be an AUX bus or subgroup (`MtxBusChannel`) or the
* master mix (`MtxMasterChannel`). Matrix buses are only available on the Ui24R.
*
* The level, MUTE and PAN observables are derived purely from the `fullChannelId`,
* because the matrix state always lives at `<fullChannelId>.value/.mute/.pan`.
* The concrete subclass only has to provide the `fullChannelId` and override `name$`,
* which is the one source that can't be derived from the id (the master source has no
* channel index and therefore no name path).
*/
export declare abstract class MtxChannel implements FadeableChannel, PannableChannel, PostProcessableChannel {
protected conn: MixerConnection;
protected store: MixerStore;
protected fullChannelId: string;
/** Name of the matrix source (provided by the concrete subclass) */
abstract readonly name$: Observable<string>;
/** Linear level of the matrix source (between `0` and `1`) */
readonly faderLevel$: Observable<number>;
/** dB level of the matrix source (between `-Infinity` and `10`) */
readonly faderLevelDB$: Observable<number>;
/** MUTE state of the matrix source */
readonly mute$: Observable<boolean>;
/** PAN value of the matrix source (between `0` and `1`) */
readonly pan$: Observable<number>;
/** PRE/POST PROC state of the matrix source (`false` for PRE PROC, `true` for POST PROC) */
readonly postProc$: Observable<boolean>;
/** all linked channels (mirror on the stereo-linked matrix output and stereo-link neighbour) */
protected linkedChannelIds: string[];
/** channels that mirror the PAN value (the stereo-linked matrix output, but not a neighbour source) */
protected panLinkChannelIds: string[];
private transitionSources$;
constructor(conn: MixerConnection, store: MixerStore, fullChannelId: string);
/**
* Perform fader transition to linear value
* @param targetValue Target value as linear value (between 0 and 1)
* @param fadeTime Fade time in ms
* @param easing Easing characteristic, as an entry of the `Easings` enum. Defaults to `Linear`
* @param fps Frames per second, defaults to 25
*/
fadeTo(targetValue: number, fadeTime: number, easing?: Easings, fps?: number): Promise<void>;
/**
* Perform fader transition to dB value
* @param targetValueDB Target value as dB value (between -Infinity and 10)
* @param fadeTime Fade time in ms
* @param easing Easing characteristic, as an entry of the `Easings` enum. Defaults to `Linear`
* @param fps Frames per second, defaults to 25
*/
fadeToDB(targetValueDB: number, fadeTime: number, easing?: Easings, fps?: number): Promise<void>;
/**
* Set linear level of the matrix source
* @param value value between `0` and `1`
*/
setFaderLevel(value: number): void;
private setFaderLevelRaw;
/**
* Set dB level of the matrix source
* @param value value between `-Infinity` and `10`
*/
setFaderLevelDB(dbValue: number): void;
/**
* Change the fader value relatively by adding a given linear value
* @param offset value to add to the current linear fader value
*/
changeFaderLevel(offset: number): void;
/**
* Change the fader value relatively by adding a given value
* @param offsetDB value (dB) to add to the current value
*/
changeFaderLevelDB(offsetDB: number): void;
/**
* Set MUTE state for the matrix source
* @param value MUTE state
*/
setMute(value: boolean): void;
/** Enable MUTE for the matrix source */
mute(): void;
/** Disable MUTE for the matrix source */
unmute(): void;
/** Toggle MUTE state for the matrix source */
toggleMute(): void;
/**
* Set PAN value of the matrix source.
* This only works for stereo-linked matrix buses, not for mono matrix.
* @param value value between `0` and `1`
*/
setPan(value: number): void;
/**
* Relatively change PAN value of the matrix source.
* This only works for stereo-linked matrix buses, not for mono matrix.
* @param offset offset to change (final values are between `0` and `1`)
*/
changePan(offset: number): void;
/**
* Set PRE/POST PROC state for the matrix source
* @param value POST PROC (`true`) or PRE PROC (`false`)
*/
setPostProc(value: boolean): void;
/** Set matrix source to POST PROC */
postProc(): void;
/** Set matrix source to PRE PROC */
preProc(): void;
}