reaper-osc
Version:
Controls Cockos Reaper using OSC
122 lines (121 loc) • 3.98 kB
TypeScript
/**
* Contains classes for controlling FX in Reaper
* @module
*/
import { INotifyPropertyChanged } from './Notify';
import { ReaperOscEvent } from './Client/Events';
import { ReaperOscCommand } from './Client/Commands';
declare type SendCommand = (command: ReaperOscCommand) => void;
/**
* A Reaper FX.
*
* @example
* ```typescript
* // Open an FX UI window
* fx.openUi();
* // Bypass the FX
* fx.bypass();
* ```
*/
export declare abstract class Fx implements INotifyPropertyChanged {
protected _isBypassed: boolean;
protected _isUiOpen: boolean;
protected _name: string;
protected _preset: string;
protected readonly _send: SendCommand;
constructor(name: string, send: SendCommand);
/** Bypass the FX */
abstract bypass(): void;
/** Close the UI of the FX */
abstract closeUi(): void;
/** Indicates whether the FX is bypassed */
get isBypassed(): boolean;
/** Indicates whether the FX's UI is open */
get isUiOpen(): boolean;
/** The name of the FX */
get name(): string;
/** Load the next FX preset */
abstract nextPreset(): void;
onPropertyChanged(property: string, callback: () => void): () => void;
/** Open the UI of the FX */
abstract openUi(): void;
/**
* The name of the current preset.
*
* **Update behaviour varies by subclass:**
* - `DeviceSelectedFx` — updated in real time whenever the preset changes, because Reaper
* sends `/fx/preset` in response to every preset navigation command.
* - `SelectedTrackFxSlot` and `TrackFx` — only updated during a sync burst
* (`refreshControlSurfaces()`), because Reaper only sends `/fx/{n}/preset` and
* `/track/{n}/fx/{m}/preset` as part of the full state refresh, not in response to
* individual preset commands.
*
* If you need live preset feedback, use `DeviceSelectedFx` (via `selectedTrack.selectedFx`
* after calling `device.selectFx(n)` to point it at the desired slot).
*/
get preset(): string;
/** Load the previous FX preset */
abstract previousPreset(): void;
/** Unbypass the FX */
abstract unbypass(): void;
/** Handle a typed incoming event */
abstract handleEvent(event: ReaperOscEvent): void;
}
/**
* An FX on a {@link Track}
*/
export declare class TrackFx extends Fx {
readonly trackNumber: number;
readonly fxNumber: number;
/**
* @param trackNumber The number of the track the FX is on
* @param fxNumber The FX number in the current bank
* @param send A callback used to send typed commands to Reaper
*/
constructor(trackNumber: number, fxNumber: number, send: SendCommand);
get oscAddress(): string;
handleEvent(event: ReaperOscEvent): void;
private _matchesTrackFx;
bypass(): void;
unbypass(): void;
openUi(): void;
closeUi(): void;
nextPreset(): void;
previousPreset(): void;
}
/**
* An FX slot on the OSC device's currently selected track (addressed via `/fx/N/`).
*/
export declare class SelectedTrackFxSlot extends Fx {
readonly fxNumber: number;
/**
* @param fxNumber The FX slot number in the device FX bank
* @param send A callback used to send typed commands to Reaper
*/
constructor(fxNumber: number, send: SendCommand);
handleEvent(event: ReaperOscEvent): void;
private _matchesFx;
bypass(): void;
unbypass(): void;
openUi(): void;
closeUi(): void;
nextPreset(): void;
previousPreset(): void;
}
/**
* The OSC device's currently focused FX (addressed via `/fx/` with no slot number).
*/
export declare class DeviceSelectedFx extends Fx {
/**
* @param send A callback used to send typed commands to Reaper
*/
constructor(send: SendCommand);
handleEvent(event: ReaperOscEvent): void;
bypass(): void;
unbypass(): void;
openUi(): void;
closeUi(): void;
nextPreset(): void;
previousPreset(): void;
}
export {};