Skip to content

Commit

Permalink
Update sonic-weave dependency
Browse files Browse the repository at this point in the history
SonicWeave changelog:
- Admit inf in the universal monzo basis
- Interprete rgb and hsl colors literally
- Reserve nan and inf as keywords
- Normalize zero and NaN
- Fix intrinsic calls
  • Loading branch information
frostburn committed May 14, 2024
1 parent 7d412d9 commit 2ef6f7f
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 29 deletions.
10 changes: 5 additions & 5 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "scale-workshop",
"version": "3.0.0-beta.25",
"version": "3.0.0-beta.26",
"scripts": {
"dev": "vite",
"build": "run-p type-check \"build-only {@}\" --",
Expand All @@ -21,7 +21,7 @@
"moment-of-symmetry": "^0.5.2",
"pinia": "^2.1.7",
"qs": "^6.12.0",
"sonic-weave": "github:xenharmonic-devs/sonic-weave#v0.0.36",
"sonic-weave": "github:xenharmonic-devs/sonic-weave#v0.0.37",
"sw-synth": "^0.1.0",
"temperaments": "^0.5.3",
"values.js": "^2.1.1",
Expand Down
8 changes: 4 additions & 4 deletions src/components/modals/modification/EnumerateScale.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const scale = useScaleStore()
function overtonal() {
scale.sourceText += ';elevate();simplify;map(repr)'
const { visitor, defaults } = scale.getUserScopeVisitor()
const overtones = visitor.currentScale.map(i => i.label)
const overtones = visitor.currentScale.map((i) => i.label)
visitor.currentScale.length = 0
scale.sourceText = visitor.expand(defaults)
if (scale.sourceText) {
Expand All @@ -23,7 +23,7 @@ function overtonal() {
function undertonal() {
scale.sourceText += ';reflect();elevate();simplify;map(repr)'
const { visitor, defaults } = scale.getUserScopeVisitor()
const undertones = visitor.currentScale.map(i => i.label)
const undertones = visitor.currentScale.map((i) => i.label)
visitor.currentScale.length = 0
scale.sourceText = visitor.expand(defaults)
if (scale.sourceText) {
Expand All @@ -37,7 +37,7 @@ function undertonal() {
function retroversion() {
scale.sourceText += ';retrovert();elevate();simplify;map(repr)'
const { visitor, defaults } = scale.getUserScopeVisitor()
const tones = visitor.currentScale.map(i => i.label)
const tones = visitor.currentScale.map((i) => i.label)
visitor.currentScale.length = 0
scale.sourceText = visitor.expand(defaults)
if (scale.sourceText) {
Expand All @@ -51,7 +51,7 @@ function retroversion() {
function revposition() {
scale.sourceText += ';revpose();elevate();simplify;map(repr)'
const { visitor, defaults } = scale.getUserScopeVisitor()
const tones = visitor.currentScale.map(i => i.label)
const tones = visitor.currentScale.map((i) => i.label)
visitor.currentScale.length = 0
scale.sourceText = visitor.expand(defaults)
if (scale.sourceText) {
Expand Down
2 changes: 1 addition & 1 deletion src/exporters/__tests__/test-data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export function getTestData(appTitle: string) {
whole: 100n,
fractional: '',
exponent: null,
real: false,
real: false
}),
relativeC5,
new Interval(
Expand Down
10 changes: 5 additions & 5 deletions src/stores/scale.ts
Original file line number Diff line number Diff line change
Expand Up @@ -336,13 +336,13 @@ export const useScaleStore = defineStore('scale', () => {
// Methods
function getUserScopeVisitor() {
const globalVisitor = getGlobalScaleWorkshopVisitor()
const visitor = new StatementVisitor(globalVisitor);
visitor.isUserRoot = true;
const visitor = new StatementVisitor(globalVisitor)
visitor.isUserRoot = true
const defaults = visitor.rootContext!.clone()
defaults.gas = gas.value

const ast = parseAST(sourceText.value)
visitor.executeProgram(ast);
visitor.executeProgram(ast)
return {
defaults,
visitor
Expand All @@ -356,9 +356,9 @@ export const useScaleStore = defineStore('scale', () => {
latticeIntervals.value = []
const globalVisitor = getGlobalScaleWorkshopVisitor()
const visitor = new StatementVisitor(globalVisitor)
visitor.isUserRoot = true;
visitor.isUserRoot = true
const ast = parseAST(sourceText.value)
visitor.executeProgram(ast);
visitor.executeProgram(ast)
let userDeclaredPitch = false
for (const statement of ast.body) {
if (statement.type === 'PitchDeclaration') {
Expand Down
10 changes: 6 additions & 4 deletions src/stores/tempering.ts
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ export const useRank2Store = defineStore('rank2', () => {
const generatorPerPeriod = computed(() => {
const p = period.value.totalCents()
if (!p) {
return 0;
return 0
}
return generator.value.totalCents() / p
})
Expand All @@ -174,7 +174,9 @@ export const useRank2Store = defineStore('rank2', () => {
}
return value || 1
})
const opposite = computed(() => isBright(generatorPerPeriod.value, safeSize.value / safeNumPeriods.value) ? 'dark' : 'bright')
const opposite = computed(() =>
isBright(generatorPerPeriod.value, safeSize.value / safeNumPeriods.value) ? 'dark' : 'bright'
)

const [mosPatterns, mosPatternsError] = computedAndError(() => {
if (method.value === 'generator') {
Expand Down Expand Up @@ -223,7 +225,7 @@ export const useRank2Store = defineStore('rank2', () => {
const circlePeriodCents = computed(() => {
const p = period.value.totalCents()
if (!p || isNaN(p)) {
return 0.0001;
return 0.0001
}
const stretch = parseFloat(periodStretch.value)
if (isNaN(stretch)) {
Expand All @@ -235,7 +237,7 @@ export const useRank2Store = defineStore('rank2', () => {
const circleGeneratorCents = computed(() => {
const g = generator.value.totalCents()
if (isNaN(g)) {
return 0;
return 0
}
const fine = parseFloat(generatorFineCents.value)
if (isNaN(fine)) {
Expand Down
10 changes: 2 additions & 8 deletions src/utils.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
import { computed, watch, type ComputedRef, type Ref } from 'vue'
import { gcd, mmod } from 'xen-dev-utils'
import {
evaluateExpression,
getSourceVisitor,
Interval,
parseAST,
repr
} from 'sonic-weave'
import { evaluateExpression, getSourceVisitor, Interval, parseAST, repr } from 'sonic-weave'

/**
* Calculate the smallest power of two greater or equal to the input value.
Expand Down Expand Up @@ -62,7 +56,7 @@ export function expandCode(source: string) {
const visitor = getSourceVisitor()
const defaults = visitor.rootContext!.clone()
const ast = parseAST(source)
visitor.executeProgram(ast);
visitor.executeProgram(ast)
return visitor.expand(defaults)
}

Expand Down

0 comments on commit 2ef6f7f

Please sign in to comment.