-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathevent-types.d.ts
More file actions
50 lines (50 loc) · 1.55 KB
/
event-types.d.ts
File metadata and controls
50 lines (50 loc) · 1.55 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
import { type TUniqueIdentifier } from "./uuid.ts";
export type TEvent = INoteEvent | IStopAllNotesEvent | ITransportEvent | ICancelNoteEvent;
interface IBaseEvent {
type: TEventType;
}
export declare const EventType: {
readonly Note: "Note";
readonly TransportPlayback: "TransportPlayback";
readonly TransportStop: "TransportStop";
readonly StopAllNotes: "StopAllNotes";
readonly CancelNote: "CancelNote";
};
export type TEventType = (typeof EventType)[keyof typeof EventType];
export declare const NoteEventStage: {
readonly Start: 0;
readonly End: 1;
readonly InstantaneousStartEnd: 2;
readonly Update: 3;
};
export type TNoteEventStage = (typeof NoteEventStage)[keyof typeof NoteEventStage];
export interface INoteEvent extends IBaseEvent {
type: "Note";
noteId: TUniqueIdentifier;
stage: TNoteEventStage;
audioContextTime: number;
transportTime?: number;
index?: number;
frequency?: number;
velocity?: number;
}
export interface IStopAllNotesEvent extends IBaseEvent {
type: "StopAllNotes";
audioContextTime?: number;
}
export interface ICancelNoteEvent extends IBaseEvent {
type: "CancelNote";
audioContextTime?: number;
noteId: TUniqueIdentifier;
}
export interface ITransportPlaybackEvent extends IBaseEvent {
type: "TransportPlayback";
nextBeatTime: number;
nextContextTime: number;
tempo: number;
}
export interface ITransportStopEvent extends IBaseEvent {
type: "TransportStop";
}
export type ITransportEvent = ITransportPlaybackEvent | ITransportStopEvent;
export {};