Update zifferjs

This commit is contained in:
2023-08-16 22:10:06 +03:00
parent d524a5290f
commit 89e82f7195
3 changed files with 32 additions and 30 deletions

View File

@ -30,7 +30,7 @@
"superdough": "^0.9.3", "superdough": "^0.9.3",
"tailwindcss": "^3.3.3", "tailwindcss": "^3.3.3",
"tone": "^14.8.49", "tone": "^14.8.49",
"zifferjs": "^0.0.5", "zifferjs": "^0.0.6",
"zzfx": "^1.2.0" "zzfx": "^1.2.0"
} }
} }

View File

@ -1,4 +1,4 @@
import { Pitch, Chord, Rest, Event, cachedEvent } from "zifferjs"; import { Pitch, Chord, Rest, Event, cachedPattern } from "zifferjs";
import { MidiConnection } from "./IO/MidiConnection"; import { MidiConnection } from "./IO/MidiConnection";
import { tryEvaluate } from "./Evaluator"; import { tryEvaluate } from "./Evaluator";
import { DrunkWalk } from "./Utils/Drunk"; import { DrunkWalk } from "./Utils/Drunk";
@ -248,8 +248,10 @@ export class UserAPI {
public zn(input: string, public zn(input: string,
options: {[key: string]: string|number} = {}): Event { options: {[key: string]: string|number} = {}): Event {
let event = cachedEvent(input, options); const pattern = cachedPattern(input, options);
if(pattern.hasStarted()) {
const event = pattern.peek();
// Check if event is modified // Check if event is modified
const node = event.modifiedEvent ? event.modifiedEvent : event; const node = event.modifiedEvent ? event.modifiedEvent : event;
@ -273,8 +275,8 @@ export class UserAPI {
// Remove old modified event // Remove old modified event
if(event.modifiedEvent) event.modifiedEvent = undefined; if(event.modifiedEvent) event.modifiedEvent = undefined;
}
return node.next(); return pattern.next();
} }
// ============================================================= // =============================================================

View File

@ -1148,10 +1148,10 @@ yaml@^2.1.1:
resolved "https://registry.npmjs.org/yaml/-/yaml-2.3.1.tgz" resolved "https://registry.npmjs.org/yaml/-/yaml-2.3.1.tgz"
integrity sha512-2eHWfjaoXgTBC2jNM1LRef62VQa0umtvRiDSk6HSzW7RvS5YtkabJrwYLLEKWBc8a5U2PTSCs+dJjUTJdlHsWQ== integrity sha512-2eHWfjaoXgTBC2jNM1LRef62VQa0umtvRiDSk6HSzW7RvS5YtkabJrwYLLEKWBc8a5U2PTSCs+dJjUTJdlHsWQ==
zifferjs@^0.0.5: zifferjs@^0.0.6:
version "0.0.5" version "0.0.6"
resolved "https://registry.yarnpkg.com/zifferjs/-/zifferjs-0.0.5.tgz#b641e6d960e1b24389feacc0d975262af63cb75e" resolved "https://registry.yarnpkg.com/zifferjs/-/zifferjs-0.0.6.tgz#7adfaa6a2ce6bdd496289dd0454f1767e6e5244e"
integrity sha512-8IfsiiWigHLh1h7SaBtXe0Cig8bbvCR6mI4P/0n3j/oedY8WQcu5gj+v1q+VcQW0D2zfTvGGKrWZdqCjXrKRfw== integrity sha512-fruobVQUaoko2d99euiGlvkJZH4mbuekJxUKiOt20vuLHzEybaLzWy9OuOryPodCatWCY5fcs40lB86ST5fWbg==
dependencies: dependencies:
lru-cache "^10.0.0" lru-cache "^10.0.0"