Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions docs/spessa-synth-sequencer/event-types.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ The lists list properties of the object.
Called when a MIDI message is sent and externalMIDIPlayback is true.

- message: number[] - the binary MIDI message
- time: number - the synthesizer's current time when this event was sent.
Use this for scheduling MIDI messages to your external MIDI device.

### timeChange

Expand Down
5 changes: 4 additions & 1 deletion src/sequencer/sequencer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -421,7 +421,10 @@ export class SpessaSynthSequencer {
);
return;
}
this.callEvent("midiMessage", { message });
this.callEvent("midiMessage", {
message,
time: this.synth.currentSynthTime
});
}

protected sendMIDIAllOff() {
Expand Down
6 changes: 6 additions & 0 deletions src/sequencer/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@ export interface SequencerEventData {
* The binary MIDI message.
*/
message: Iterable<number>;

/**
* The synthesizer's current time when this event was sent.
* Use this for scheduling MIDI messages to your external MIDI device.
*/
time: number;
};
/**
* Called when the time is changed.
Expand Down