minor optimisations

This commit is contained in:
2023-11-19 21:36:46 +01:00
parent 1fd9d514f9
commit 268533a5c6
3 changed files with 7 additions and 10 deletions

View File

@ -100,9 +100,6 @@ export const installEditor = (app: Editor) => {
editorSetup, editorSetup,
toposTheme, toposTheme,
app.chosenLanguage.of(javascript()), app.chosenLanguage.of(javascript()),
EditorView.updateListener.of((v: ViewUpdate) => {
v;
}),
]; ];
app.dynamicPlugins = new Compartment(); app.dynamicPlugins = new Compartment();
app.state = EditorState.create({ app.state = EditorState.create({

View File

@ -135,10 +135,8 @@ export const registerOnKeyDown = (app: Editor) => {
if (event.keyCode === keycode) { if (event.keyCode === keycode) {
event.preventDefault(); event.preventDefault();
if (event.ctrlKey) { if (event.ctrlKey) {
event.preventDefault();
app.api.script(keycode - 111); app.api.script(keycode - 111);
} else { } else {
event.preventDefault();
app.changeModeFromInterface("local"); app.changeModeFromInterface("local");
app.changeToLocalBuffer(index); app.changeToLocalBuffer(index);
hideDocumentation(); hideDocumentation();

View File

@ -12,9 +12,9 @@ export class TransportNode extends AudioWorkletNode {
/** @type {(this: MessagePort, ev: MessageEvent<any>) => any} */ /** @type {(this: MessagePort, ev: MessageEvent<any>) => any} */
handleMessage = (message) => { handleMessage = (message) => {
if(message.data) { if (message.data) {
if (message.data.type === "bang") { if (message.data.type === "bang") {
if(this.app.clock.running) { if (this.app.clock.running) {
if (this.app.settings.send_clock) { if (this.app.settings.send_clock) {
this.app.api.MidiConnection.sendMidiClock(); this.app.api.MidiConnection.sendMidiClock();
} }
@ -22,8 +22,10 @@ export class TransportNode extends AudioWorkletNode {
this.app.clock.tick this.app.clock.tick
); );
this.app.clock.time_position = futureTimeStamp; this.app.clock.time_position = futureTimeStamp;
this.timeviewer.innerHTML = `${zeroPad(futureTimeStamp.bar, 2)}:${futureTimeStamp.beat + 1 if (futureTimeStamp.pulse % this.app.clock.ppqn == 0) {
}:${zeroPad(futureTimeStamp.pulse, 2)} / ${this.app.clock.bpm}`; this.timeviewer.innerHTML = `${zeroPad(futureTimeStamp.bar, 2)}:${futureTimeStamp.beat + 1
} / ${this.app.clock.bpm}`;
}
if (this.app.exampleIsPlaying) { if (this.app.exampleIsPlaying) {
tryEvaluate(this.app, this.app.example_buffer); tryEvaluate(this.app, this.app.example_buffer);
} else { } else {
@ -60,6 +62,6 @@ export class TransportNode extends AudioWorkletNode {
} }
stop() { stop() {
this.port.postMessage({type: "stop" }); this.port.postMessage({ type: "stop" });
} }
} }