Compare commits

...

2 Commits

Author SHA1 Message Date
Kay Thomas
c4642df353 Merge pull request #33 from kaythomas0/v0.6.2
v0.6.2
2022-09-04 20:41:54 -07:00
Kevin Thomas
aca7fbd1e0 Fix sporadic playback with timer 2022-09-04 19:46:31 -07:00
3 changed files with 28 additions and 28 deletions

2
package-lock.json generated
View File

@@ -1,6 +1,6 @@
{ {
"name": "noisedash", "name": "noisedash",
"version": "0.6.0", "version": "0.6.2",
"lockfileVersion": 1, "lockfileVersion": 1,
"requires": true, "requires": true,
"dependencies": { "dependencies": {

View File

@@ -1,6 +1,6 @@
{ {
"name": "noisedash", "name": "noisedash",
"version": "0.6.0", "version": "0.6.2",
"private": true, "private": true,
"author": "Kay Thomas <kaythomas@pm.me> (https://kaythomas.dev)", "author": "Kay Thomas <kaythomas@pm.me> (https://kaythomas.dev)",
"scripts": { "scripts": {

View File

@@ -188,6 +188,18 @@ export default {
this.lfo.connect(this.filter.frequency).start() this.lfo.connect(this.filter.frequency).start()
} }
if (this.isTimerEnabled) {
this.duration = parseInt((this.hours * 3600)) + parseInt((this.minutes * 60)) + parseInt(this.seconds)
this.timeRemaining = this.duration
this.transportInterval = setInterval(() => this.stop(), this.duration * 1000 + 100)
this.timeRemainingInterval = setInterval(() => this.startTimer(), 1000)
Tone.Transport.loopEnd = this.duration
this.noise.sync().start(0).stop(this.duration)
} else {
this.noise.sync().start(0)
}
this.loadedSamples.forEach(s => { this.loadedSamples.forEach(s => {
this.players.player(s.id).loop = true this.players.player(s.id).loop = true
this.players.player(s.id).fadeIn = s.fadeIn this.players.player(s.id).fadeIn = s.fadeIn
@@ -206,39 +218,27 @@ export default {
} else { } else {
this.players.player(s.id).toDestination() this.players.player(s.id).toDestination()
} }
})
if (this.isTimerEnabled) { if (s.playbackMode === 'sporadic') {
this.duration = parseInt((this.hours * 3600)) + parseInt((this.minutes * 60)) + parseInt(this.seconds) this.players.player(s.id).loop = false
this.noise.sync().start(0).stop(this.duration)
Tone.Transport.loopEnd = this.duration
this.timeRemaining = this.duration
this.transportInterval = setInterval(() => this.stop(), this.duration * 1000 + 100)
this.timeRemainingInterval = setInterval(() => this.startTimer(), 1000)
this.loadedSamples.forEach(s => { const maxInt = parseInt(s.sporadicMax, 10)
this.players.player(s.id).unsync().sync().start(0).stop(this.duration) const minInt = parseInt(s.sporadicMin, 10)
})
} else {
this.noise.sync().start(0)
this.loadedSamples.forEach(s => { if (minInt <= maxInt) {
if (s.playbackMode === 'sporadic') { const rand = Math.floor(Math.random() * (maxInt - minInt + 1) + minInt)
this.players.player(s.id).loop = false s.initialSporadicPlayInterval = setInterval(() => this.playSporadicSample(s.id), rand * 1000)
}
} else {
this.players.player(s.id).loop = true
const maxInt = parseInt(s.sporadicMax, 10) if (this.isTimerEnabled) {
const minInt = parseInt(s.sporadicMin, 10) this.players.player(s.id).unsync().sync().start(0).stop(this.duration)
if (minInt <= maxInt) {
const rand = Math.floor(Math.random() * (maxInt - minInt + 1) + minInt)
s.initialSporadicPlayInterval = setInterval(() => this.playSporadicSample(s.id), rand * 1000)
}
} else { } else {
this.players.player(s.id).loop = true
this.players.player(s.id).unsync().sync().start(0) this.players.player(s.id).unsync().sync().start(0)
} }
}) }
} })
Tone.Transport.start('+0.1') Tone.Transport.start('+0.1')
}, },