UNPKG

reaper-osc

Version:
164 lines (163 loc) 5.92 kB
/** * Contains classes for controlling Reaper's transport * @module */ import { INotifyPropertyChanged } from './Notify'; import { ReaperOscEvent } from './Client/Events'; import { ReaperOscCommand } from './Client/Commands'; import { LastMarker } from './Marker'; import { LastRegion } from './Region'; declare type SendCommand = (command: ReaperOscCommand) => void; /** The Reaper transport */ export declare class Transport implements INotifyPropertyChanged { private _beat; private _frames; private _isFastForwarding; private _isPaused; private _isPlaying; private _isRecording; private _isRepeatEnabled; private _isRewinding; private _isStopped; private _isRewindByMarker; private _isSetLoop; private _loopEnd; private _loopStart; private _time; private readonly _lastMarker; private readonly _lastRegion; private readonly _send; /** * @param send A callback used to send typed commands to Reaper */ constructor(send: SendCommand); /** Indicates the current transport beat in format mm.bb.xx */ get beat(): string; /** Indicates the current transport from in format h:m:s:f */ get frames(): string; /** Indicates whether playback is paused */ get isPaused(): boolean; /** Indicates whether playback is active */ get isPlaying(): boolean; /** Indicates whether playback is stopped */ get isStopped(): boolean; /** Indicates whether recording is active */ get isRecording(): boolean; /** Indicates whether rewind is active */ get isRewinding(): boolean; /** Indicates whether fast-foward is active */ get isFastForwarding(): boolean; /** Indicates whether repeat is enabled */ get isRepeatEnabled(): boolean; /** Indicates whether rewind-to-previous-marker is enabled */ get isRewindByMarker(): boolean; /** Indicates whether the set-loop-points mode is enabled */ get isSetLoop(): boolean; /** The most recently passed marker */ get lastMarker(): LastMarker; /** The most recently entered region */ get lastRegion(): LastRegion; /** Indicates the end time of the loop (in seconds) */ get loopEnd(): number; /** Indicates the start time of the loop (in seconds) */ get loopStart(): number; /** Indicates the current transport time in seconds */ get time(): number; /** * Handle a typed incoming event * @param event The event to handle */ handleEvent(event: ReaperOscEvent): void; /** Jumps to the specified beat (absolute) * @param beat The beat to jump to */ jumpToBeat(beat: Beat): void; /** Jumps to the specified frame (absolute) * @param frame Frame to jump to (in format h:m:s:f). Values in an invalid format will be ignored by Reaper */ jumpToFrame(frame: string): void; /** Jumps to the specified time in seconds (absolute) * @param time The time to jump to (in seconds). If this value is negative, Reaper will jump to 0 */ jumpToTime(time: number): void; /** * Jumps to a relative time in seconds. * Note that the absolute value to jump to is calculated by the library based on the currently known time, * as Reaper does not appear to support jumping to a relative time via OSC * @param time The relative time jump (in seconds) */ jumpToTimeRelative(time: number): void; onPropertyChanged(property: string, callback: () => void): () => void; /** Toggle pause */ pause(): void; /** Toggle play */ play(): void; /** Toggle recording */ record(): void; /** * Sets the loop end time * @param time End time for the loop (in seconds) */ setLoopEnd(time: number): void; /** * Sets the loop start time * @param time Start time for the loop (in seconds) */ setLoopStart(time: number): void; /** Start fast fowarding. Will continue until stopped */ startFastForwarding(): void; /** Start rewinding. Will continue until stopped */ startRewinding(): void; /** Stop playback or recording */ stop(): void; /** Stop fast forwarding */ stopFastForwarding(): void; /** Stop rewinding */ stopRewinding(): void; /** Toggle repeat on or off */ toggleRepeat(): void; /** Toggle rewind-to-previous-marker on or off */ toggleRewindByMarker(): void; /** Toggle the set-loop-points mode on or off */ toggleSetLoop(): void; /** * Jump to the marker with the given user-assigned number (as shown in Reaper's UI). * @param markerNumber The user-assigned marker number to jump to */ gotoMarker(markerNumber: number): void; /** * Jump to the region with the given user-assigned number (as shown in Reaper's UI). * @param regionNumber The user-assigned region number to jump to */ gotoRegion(regionNumber: number): void; } /** Represents a beat value in Reaper */ export declare class Beat { private readonly _beat; private readonly _fraction; private readonly _measure; /** * @param measure The measure of the beat * @param beat The beat in the measure * @param fraction The beat fraction (must be >= 0 and < 100) */ constructor(measure: number, beat: number, fraction: number); /** Indicates the beat portion of the beat (mm) */ get beat(): number; /** Indicates the fraction portion of the beat (bb) */ get fraction(): number; /** Indicates the measure of the beat (xx) */ get measure(): number; /** * Parses a string into a Beat * @param value String value in the format mm.bb.xx * @returns The parsed beat * @throws Throws an error when the format is invalid */ static parse(value: string): Beat; /** * Converts the beat into its string representation in the format mm.bb.xx */ toString(): string; } export {};