timeline-state-resolver
Version:
Have timeline, control stuff
49 lines • 2.27 kB
TypeScript
import { OSCMessageCommandContent, Mappings, Timeline, TSRTimelineContent, MultiOSCOptions, DeviceStatus, ActionExecutionResult } from 'timeline-state-resolver-types';
import { Device } from '../../service/device';
import * as osc from 'osc';
import { CommandWithContext } from '../..';
export interface MultiOscInitTestOptions {
oscSenders?: Record<string, (msg: osc.OscMessage, address?: string | undefined, port?: number | undefined) => void>;
}
interface MultiOSCDeviceState {
[connectionId: string]: {
[address: string]: OSCDeviceStateContent | undefined;
} | undefined;
}
interface OSCDeviceStateContent extends OSCMessageCommandContent {
connectionId: string;
fromTlObject: string;
}
export interface MultiOscCommandWithContext extends CommandWithContext {
command: OSCDeviceStateContent;
}
/**
* This is a generic wrapper for any osc-enabled device.
*/
export declare class MultiOSCMessageDevice extends Device<MultiOSCOptions, MultiOSCDeviceState, MultiOscCommandWithContext> {
readonly actions: Record<string, (id: string, payload?: Record<string, any>) => Promise<ActionExecutionResult>>;
private _connections;
private _commandQueue;
private _commandQueueTimer;
private _timeBetweenCommands;
init(initOptions: MultiOSCOptions, testOptions?: MultiOscInitTestOptions): Promise<boolean>;
terminate(): Promise<void>;
get connected(): boolean;
getStatus(): Omit<DeviceStatus, 'active'>;
/**
* Transform the timeline state into a device state, which is in this case also
* a timeline state.
* @param state
*/
convertTimelineStateToDeviceState(state: Timeline.TimelineState<TSRTimelineContent>, mappings: Mappings): MultiOSCDeviceState;
/**
* Compares the new timeline-state with the old one, and generates commands to account for the difference
* @param oldOscSendState The assumed current state
* @param newOscSendState The desired state of the device
*/
diffStates(oldOscSendState: MultiOSCDeviceState | undefined, newOscSendState: MultiOSCDeviceState): Array<MultiOscCommandWithContext>;
sendCommand(command: MultiOscCommandWithContext): Promise<any>;
private _processQueue;
}
export {};
//# sourceMappingURL=index.d.ts.map