Skip to content

Commit

Permalink
Fix issues found by type-checking
Browse files Browse the repository at this point in the history
  • Loading branch information
frostburn committed Nov 30, 2023
1 parent df38be3 commit fe0e64a
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 12 deletions.
3 changes: 3 additions & 0 deletions src/components/ScaleBuilder.vue
Original file line number Diff line number Diff line change
Expand Up @@ -504,6 +504,7 @@ function confirmPreset() {
:newline="props.newline"
:scaleName="scaleName"
:baseMidiNote="baseMidiNote"
:midiOctaveOffset="midiOctaveOffset"
:scale="scale"
/>

Expand All @@ -514,6 +515,7 @@ function confirmPreset() {
:newline="props.newline"
:scaleName="scaleName"
:baseMidiNote="baseMidiNote"
:midiOctaveOffset="midiOctaveOffset"
:scale="scale"
/>

Expand All @@ -524,6 +526,7 @@ function confirmPreset() {
:newline="props.newline"
:scaleName="scaleName"
:baseMidiNote="baseMidiNote"
:midiOctaveOffset="midiOctaveOffset"
:scale="scale"
/>

Expand Down
7 changes: 5 additions & 2 deletions src/components/modals/export/KorgExport.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,13 @@ import { sanitizeFilename } from '@/utils'
import { computed, ref } from 'vue'
import Modal from '@/components/ModalDialog.vue'
import type { Scale } from 'scale-workshop-core'
import type { ExporterParams } from '@/exporters/base'
const props = defineProps<{
newline: string
scaleName: string
baseMidiNote: number
midiOctaveOffset: number
scale: Scale
}>()
Expand Down Expand Up @@ -39,11 +41,12 @@ const fileTypePreview = computed(() => {
})
async function doExport() {
const params = {
const params: ExporterParams = {
newline: props.newline,
scale: props.scale,
filename: sanitizeFilename(props.scaleName),
baseMidiNote: props.baseMidiNote
baseMidiNote: props.baseMidiNote,
midiOctaveOffset: props.midiOctaveOffset
}
const exporter = new KorgExporter(params, modelName.value, useOctaveFormat.value)
Expand Down
5 changes: 4 additions & 1 deletion src/components/modals/export/MtsSysexExport.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,13 @@ import { ref, watch } from 'vue'
import Modal from '@/components/ModalDialog.vue'
import type { Scale } from 'scale-workshop-core'
import { clamp } from 'xen-dev-utils'
import type { ExporterParams } from '@/exporters/base'
const props = defineProps<{
newline: string
scaleName: string
baseMidiNote: number
midiOctaveOffset: number
scale: Scale
}>()
Expand Down Expand Up @@ -48,11 +50,12 @@ function presetIndexInputCallback(indexInput: string): void {
}
function doExport() {
const params = {
const params: ExporterParams = {
newline: props.newline,
scale: props.scale,
filename: sanitizeFilename(props.scaleName),
baseMidiNote: props.baseMidiNote,
midiOctaveOffset: props.midiOctaveOffset,
name: name.value,
presetIndex: parseInt(presetIndex.value)
}
Expand Down
7 changes: 5 additions & 2 deletions src/components/modals/export/ReaperExport.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,13 @@ import { sanitizeFilename } from '@/utils'
import { ref } from 'vue'
import Modal from '@/components/ModalDialog.vue'
import type { Scale } from 'scale-workshop-core'
import type { ExporterParams } from '@/exporters/base'
const props = defineProps<{
newline: string
scaleName: string
baseMidiNote: number
midiOctaveOffset: number
scale: Scale
}>()
Expand All @@ -30,14 +32,15 @@ const integratePeriod = ref(false)
const displayPeriod = ref(true)
function doExport() {
const params = {
const params: ExporterParams = {
newline: props.newline,
scale: props.scale,
filename: sanitizeFilename(props.scaleName),
baseMidiNote: props.baseMidiNote,
midiOctaveOffset: props.midiOctaveOffset,
format: format.value,
basePeriod: basePeriod.value,
baseDegrree: baseDegree.value,
baseDegree: baseDegree.value,
centsRoot: centsRoot.value,
integratePeriod: integratePeriod.value,
displayPeriod: displayPeriod.value
Expand Down
15 changes: 8 additions & 7 deletions src/components/modals/modification/StretchScale.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { ref } from 'vue'
import Modal from '@/components/ModalDialog.vue'
import ScaleLineInput from '@/components/ScaleLineInput.vue'
import { ExtendedMonzo, Interval, type Scale } from 'scale-workshop-core'
import { DEFAULT_NUMBER_OF_COMPONENTS } from '@/constants'
import { DEFAULT_NUMBER_OF_COMPONENTS, FIFTH } from '@/constants'
const props = defineProps<{
scale: Scale
centsFractionDigits: number
Expand All @@ -12,17 +12,16 @@ const props = defineProps<{
const emit = defineEmits(['update:scale', 'cancel'])
const amount = ref(1.005)
// Dummy variable to get the types right
const pureFifth = new Interval(
ExtendedMonzo.fromFraction('3/2', DEFAULT_NUMBER_OF_COMPONENTS),
'ratio'
const equallyTemperedFifth = new Interval(
ExtendedMonzo.fromEqualTemperament('7/12', '2/1', DEFAULT_NUMBER_OF_COMPONENTS),
'equal temperament'
)
const referenceString = ref('')
const reference = ref(pureFifth)
const reference = ref(FIFTH)
const targetString = ref('')
const target = ref(pureFifth)
const target = ref(FIFTH)
function calculateAmount() {
const calculated = target.value.totalCents() / reference.value.totalCents()
Expand Down Expand Up @@ -69,6 +68,7 @@ function modify() {
<ScaleLineInput
id="reference"
placeholder="7\12"
:defaultValue="equallyTemperedFifth"
@update:value="reference = $event"
v-model="referenceString"
/>
Expand All @@ -78,6 +78,7 @@ function modify() {
<ScaleLineInput
id="reference"
placeholder="3/2"
:defaultValue="FIFTH"
@update:value="target = $event"
v-model="targetString"
/>
Expand Down

0 comments on commit fe0e64a

Please sign in to comment.