Fix sporadic validation, fix preferences bug

This commit is contained in:
Kevin Thomas
2022-08-31 11:16:23 -07:00
parent 60a01908c2
commit 4d22dab887
4 changed files with 69 additions and 64 deletions

View File

@@ -155,11 +155,13 @@ export default {
this.stop()
},
methods: {
play () {
async play () {
if (!this.players.loaded) {
return
}
await Tone.start()
this.playDisabled = true
Tone.Transport.cancel()
@@ -226,9 +228,11 @@ export default {
const maxInt = parseInt(s.sporadicMax, 10)
const minInt = parseInt(s.sporadicMin, 10)
const rand = Math.floor(Math.random() * (maxInt - minInt + 1) + minInt)
s.initialSporadicPlayInterval = setInterval(() => this.playSporadicSample(s.id), rand * 1000)
if (minInt <= maxInt) {
const rand = Math.floor(Math.random() * (maxInt - minInt + 1) + minInt)
s.initialSporadicPlayInterval = setInterval(() => this.playSporadicSample(s.id), rand * 1000)
}
} else {
this.players.player(s.id).loop = true
this.players.player(s.id).unsync().sync().start(0)
@@ -902,15 +906,6 @@ export default {
this.selectedProfile = this.profileItems.find(p => p.text === this.activeProfile.name)
this.updateProfile()
this.confirmSwitchProfileDialog = false
},
validateSporadicRange (sample) {
const min = parseInt(sample.sporadicMin, 10)
const max = parseInt(sample.sporadicMax, 10)
if (isNaN(min) || isNaN(max) || max <= min || min <= 0 || max <= 0) {
return 'Invalid'
} else {
return true
}
}
}
}