reaper-osc
Version:
Controls Cockos Reaper using OSC
131 lines (130 loc) • 4.62 kB
TypeScript
/**
* Contains classes for controlling Reaper's transport
* @module
*/
import { INotifyPropertyChanged } from './Notify';
import { ISendOscMessage, OscMessage } from './Messages';
/** The Reaper transport */
export declare class Transport implements INotifyPropertyChanged {
private _beat;
private _frames;
private _isFastForwarding;
private _isPlaying;
private _isRecording;
private _isRepeatEnabled;
private _isRewinding;
private _isStopped;
private _loopEnd;
private _loopStart;
private _time;
private readonly _handlers;
private readonly _sendOscMessage;
/**
* @param sendOscMessage A callback used to send OSC messages to Reaper
*/
constructor(sendOscMessage: ISendOscMessage);
/** 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 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 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;
/** 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;
/**
* Receive and handle an OSC message
* @param message The message to be handled
*/
receive(message: OscMessage): boolean;
/** 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;
}
/** 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;
}