UNPKG

reaper-osc

Version:
112 lines (111 loc) 4.47 kB
/** * Contains classes for controlling Reaper via OSC * @module */ import { OscMessage } from './Messages'; import { Track } from './Tracks'; import { Transport } from './Transport'; import { ViewPort } from './ViewPort'; import { DeviceState } from './Device'; import { SelectedTrack } from './SelectedTrack'; import { Marker } from './Marker'; import { Region } from './Region'; import { ReaperOscClient } from './Client/Client'; import { ReaperConfiguration } from './Config'; import { INotifyPropertyChanged } from './Notify'; export { ReaperConfiguration, ConsoleLogger, LogLevel, Logger } from './Config'; /** * Allows control of an instance of Reaper via OSC. * * @example * ```typescript * // Create an instance of Reaper using default settings * const reaper = new Reaper(); * // Start OSC * reaper.startOsc(); * // Give the port a chance to open, then tell Reaper to start playback * setTimeout(() => {reaper.transport.play();}, 100); *``` */ export declare class Reaper implements INotifyPropertyChanged { private _isAutoRecordArmEnabled; private _isAnySoloed; private _isMetronomeEnabled; private readonly _afterMessageReceived; private readonly _client; private readonly _masterTrack; private readonly _device; private readonly _markers; private readonly _regions; private readonly _selectedTrack; private readonly _tracks; private readonly _transport; private readonly _viewport; constructor(config?: ReaperConfiguration); constructor(client: ReaperOscClient, config?: ReaperConfiguration); /** The underlying stateless OSC client */ get client(): ReaperOscClient; /** Controls the OSC device's navigation state (track/bank/FX selection) */ get device(): DeviceState; /** Indicates whether auto-record-arm is enabled */ get isAutoRecordArmEnabled(): boolean; /** Indicates whether any track is soloed */ get isAnySoloed(): boolean; /** Indicates whether the metronome is enabled */ get isMetronomeEnabled(): boolean; /** Indicates whether OSC is ready to send and receive messages */ get isReady(): boolean; /** The master track */ get master(): Track; /** The current bank of markers */ get markers(): ReadonlyArray<Marker>; /** The current bank of regions */ get regions(): ReadonlyArray<Region>; onPropertyChanged(property: string, callback: () => void): () => void; /** * Triggers the action `Control surface: Refresh all surfaces` (Command ID: 41743) */ refreshControlSurfaces(): void; /** * Send a message to Reaper via OSC. Messages may not be sent while {@link Reaper.isReady} is false. * @param message The OSC message to be sent */ sendOscMessage(message: OscMessage): void; /** Open the OSC port and start listening for messages */ start(): Promise<void>; /** Stop listening for OSC messages */ stop(): Promise<void>; /** Toggle auto-record-arm on or off */ toggleAutoRecordArm(): void; /** Toggle the metronome on or off */ toggleMetronome(): void; /** Reset all solos */ soloReset(): void; /** * The OSC device's currently focused track. * State is populated by the sync burst Reaper sends when the focused track changes. * @see {@link DeviceState.selectTrack} */ get selectedTrack(): SelectedTrack; /** The current bank of tracks */ get tracks(): ReadonlyArray<Track>; /** Transport controls */ get transport(): Transport; /** Arrange-view scroll and zoom controls */ get viewport(): ViewPort; /** * Trigger a Reaper action * @param commandId The Command ID of the action to be triggered. * @param value The value to send for the action. Note that some actions expect the CC value (0-127) while others expect a decimal value between 0 and 1. * @example * ```typescript * // Trigger action 'Track: Toggle mute for master track' * reaper.triggerAction(14); * // Trigger SWS Extension action 'SWS/S&M: Live Config #1 - Apply config (MIDI/OSC only)' with a CC value of 3, selects config #3 * reaper.triggerAction('_S&M_LIVECFG_APPLY1', 3); * // Trigger action 'Track: Set volume for track 01 (MIDI CC/OSC only)' with a value of 0.75, sets volume of track 1 to +0.0dB * reaper.triggerAction(20, 0.7156) * ``` */ triggerAction(commandId: number | string, value?: number | null): void; }