Skip to content

Commit

Permalink
Fix volume hack (#63)
Browse files Browse the repository at this point in the history
  • Loading branch information
cdauth committed Aug 22, 2024
1 parent bdcf4d8 commit 56e9e54
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/state/pattern.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export const allVolumeHackValidator = numberRecordValidator(z.number());
*/
export type InstrumentVolumeHack = z.infer<typeof instrumentVolumeHackValidator>;
const strictInstrumentVolumeHackValidator = z.record(instrumentValidator, allVolumeHackValidator);
export const instrumentVolumeHackValidator = transformValidator(allVolumeHackValidator.or(strictInstrumentVolumeHackValidator), (val) => {
export const instrumentVolumeHackValidator = transformValidator(strictInstrumentVolumeHackValidator.or(allVolumeHackValidator), (val) => {
if (Object.keys(val).every((key) => key.match(/^[0-9]+$/))) {
// Legacy volume hack: one volume per stroke (not differentiated by instruments)
return Object.fromEntries(config.instrumentKeys.map((instr) => [instr, clone(val)]));
Expand Down

0 comments on commit 56e9e54

Please sign in to comment.