UNPKG

reaper-osc

Version:
150 lines (149 loc) 5.75 kB
/** Contains classes for controlling tracks in Reaper * @module */ import { TrackFx } from './Fx'; import { TrackSend } from './Send'; import { TrackReceive } from './Receive'; import { INotifyPropertyChanged } from './Notify'; import { ReaperOscEvent, RecordMonitoringMode } from './Client/Events'; import { ReaperOscCommand } from './Client/Commands'; export { RecordMonitoringMode } from './Client/Events'; declare type SendCommand = (command: ReaperOscCommand) => void; /** A Reaper track */ export declare class Track implements INotifyPropertyChanged { readonly trackNumber: number; private _isMuted; private _isRecordArmed; private _isSelected; private _isSoloed; private _name; private _pan; private _pan2; private _panMode; private _recordMonitoring; private _volumeDb; private _volumeFaderPosition; private _vu; private _vuLeft; private _vuRight; private readonly _fx; private readonly _sends; private readonly _receives; private readonly _send; /** * @param trackNumber The track's number in the current bank * @param numberOfFx The number of FX per FX bank * @param numberOfSends The number of sends per track * @param numberOfReceives The number of receives per track * @param send A callback used to send typed commands to Reaper */ constructor(trackNumber: number, numberOfFx: number, numberOfSends: number, numberOfReceives: number, send: SendCommand); /** * Deselect the track in the Reaper project. * Note: this affects Reaper's project-level track selection (visible in the UI). * To change which track the OSC device is focused on, use {@link DeviceState.selectTrack} instead. */ deselect(): void; /** The track's current FX bank */ get fx(): TrackFx[]; /** The track's sends */ get sends(): ReadonlyArray<TrackSend>; /** The track's receives */ get receives(): ReadonlyArray<TrackReceive>; /** * Handle a typed incoming event * @param event The event to handle */ handleEvent(event: ReaperOscEvent): void; /** Indicates whether the track is muted */ get isMuted(): boolean; /** Indicates whether the track is armed for recording */ get isRecordArmed(): boolean; /** * Indicates whether the track is selected in the Reaper project. * Note: this reflects Reaper's project-level selection, not the OSC device's focused track. * @see {@link DeviceState.selectTrack} and {@link Reaper.selectedTrack} */ get isSelected(): boolean; /** Indicates whether the track is soloed */ get isSoloed(): boolean; /** Mute the track */ mute(): void; /** The track name */ get name(): string; onPropertyChanged(property: string, callback: () => void): () => void; /** A floating-point value between -1 and 1 that indicates the pan position, with -1 being 100% left and 1 being 100% right */ get pan(): number; /** A floating-point value between -1 and 1 that indicates the pan 2 position, with -1 being 100% left and 1 being 100% right */ get pan2(): number; /** The current pan mode */ get panMode(): string; /** Arm the track for recording */ recordArm(): void; /** Indicates the record monitoring mode */ get recordMonitoring(): RecordMonitoringMode; /** Disarm track recording */ recordDisarm(): void; /** * Renames the track * @param name The new name of the track * @example * ```typescript * // Change the track name to 'Guitar' * track.rename('Guitar'); * ``` */ rename(name: string): void; /** * Select the track in the Reaper project. * Note: this affects Reaper's project-level track selection (visible in the UI). * To change which track the OSC device is focused on, use {@link DeviceState.selectTrack} instead. */ select(): void; /** * Set the record monitoring mode * @param {RecordMonitorMode} value * */ setMonitoringMode(value: RecordMonitoringMode): void; /** * Sets the pan * @param value A floating-point value between -1 and 1, where -1 is 100% left and 1 is 100% right */ setPan(value: number): void; /** * Sets the pan 2 * @param value A floating-point value between -1 and 1, where -1 is 100% left and 1 is 100% right */ setPan2(value: number): void; /** * Sets the volume to a specific dB value. * @param value Value (in dB) to set the volume to. Valid range is -100 to 12. */ setVolumeDb(value: number): void; /** Sets the volume by moving the fader to a specific position * @param position A value for the fader position between 0 and 1, where 0 is all the way down and 1 is all the way up */ setVolumeFaderPosition(position: number): void; /** Solo the track */ solo(): void; /** Toggle mute on/off */ toggleMute(): void; /** Toggle record arm on/off */ toggleRecordArm(): void; /** Toggle solo on/off */ toggleSolo(): void; /** Unmute the track */ unmute(): void; /** Unsolo the track */ unsolo(): void; /** The track volume in dB */ get volumeDb(): number; /** A floating-point value between 0 and 1 that indicates the fader position, with 0 being all the way down and 1 being all the way up */ get volumeFaderPosition(): number; /** A floating-point value between 0 and 1 that indicates the VU level */ get vu(): number; /** A floating-point value between 0 and 1 that indicates the Left VU level */ get vuLeft(): number; /** A floating-point value between 0 and 1 that indicates the Right VU level */ get vuRight(): number; }