Skip to content

Commit

Permalink
Attach default interval options to parsed scale lines
Browse files Browse the repository at this point in the history
ref #378
  • Loading branch information
frostburn committed May 2, 2023
1 parent c75afb2 commit 7c7c95d
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,12 @@ import {
} from "./keyboard-mapping";
import { VirtualSynth } from "./virtual-synth";
import { Synth } from "@/synth";
import { Interval, parseLine, Scale } from "scale-workshop-core";
import {
Interval,
parseLine,
Scale,
type IntervalOptions,
} from "scale-workshop-core";
// === Root props and audio ===
const rootProps = defineProps<{
Expand Down Expand Up @@ -166,14 +171,18 @@ function updateFromScaleLines(lines: string[]) {
}
scaleLines.value = lines;
const intervals: Interval[] = [];
const options: IntervalOptions = {
centsFractionDigits: centsFractionDigits.value,
decimalFractionDigits: decimalFractionDigits.value,
};
lines.forEach((line) => {
try {
const interval = parseLine(line, DEFAULT_NUMBER_OF_COMPONENTS);
const interval = parseLine(line, DEFAULT_NUMBER_OF_COMPONENTS, options);
intervals.push(interval);
} catch {}
});
if (!intervals.length) {
intervals.push(parseLine("1/1", DEFAULT_NUMBER_OF_COMPONENTS));
intervals.push(parseLine("1/1", DEFAULT_NUMBER_OF_COMPONENTS, options));
}
const surrogate = Scale.fromIntervalArray(intervals);
Expand Down

0 comments on commit 7c7c95d

Please sign in to comment.