mirror of
https://github.com/issadarkthing/gomu.git
synced 2025-04-26 13:49:21 +08:00
possible fix for random stop playing
This commit is contained in:
parent
23fa8c036f
commit
5bcfa1df7a
@ -386,7 +386,7 @@ func (c Command) defineCommands() {
|
||||
if err != nil {
|
||||
logError(err)
|
||||
}
|
||||
gomu.playingBar._progress = position - 1
|
||||
gomu.playingBar._progress = position
|
||||
}
|
||||
}
|
||||
})
|
||||
@ -399,7 +399,7 @@ func (c Command) defineCommands() {
|
||||
if err != nil {
|
||||
logError(err)
|
||||
}
|
||||
gomu.playingBar._progress = position - 1
|
||||
gomu.playingBar._progress = position
|
||||
} else {
|
||||
err := gomu.player.seek(0)
|
||||
if err != nil {
|
||||
@ -418,7 +418,7 @@ func (c Command) defineCommands() {
|
||||
if err != nil {
|
||||
logError(err)
|
||||
}
|
||||
gomu.playingBar._progress = position - 1
|
||||
gomu.playingBar._progress = position
|
||||
}
|
||||
}
|
||||
})
|
||||
@ -431,7 +431,7 @@ func (c Command) defineCommands() {
|
||||
if err != nil {
|
||||
logError(err)
|
||||
}
|
||||
gomu.playingBar._progress = position - 1
|
||||
gomu.playingBar._progress = position
|
||||
} else {
|
||||
err := gomu.player.seek(0)
|
||||
if err != nil {
|
||||
|
13
player.go
13
player.go
@ -151,6 +151,7 @@ next:
|
||||
p.position = 0
|
||||
p.isRunning = false
|
||||
p.format = nil
|
||||
// p.hasInit = false
|
||||
gomu.playingBar.stop()
|
||||
|
||||
nextSong, err := gomu.queue.dequeue()
|
||||
@ -178,15 +179,21 @@ next:
|
||||
}
|
||||
|
||||
p.i++
|
||||
if p.i >= gomu.playingBar.full {
|
||||
done <- struct{}{}
|
||||
continue
|
||||
// break next
|
||||
}
|
||||
|
||||
gomu.playingBar.progress <- 1
|
||||
|
||||
speaker.Lock()
|
||||
p.position = p.getPosition()
|
||||
speaker.Unlock()
|
||||
|
||||
if p.i > gomu.playingBar.full {
|
||||
/* if p.i > gomu.playingBar.full {
|
||||
break next
|
||||
}
|
||||
} */
|
||||
|
||||
}
|
||||
|
||||
@ -305,7 +312,7 @@ func (p *Player) seek(pos int) error {
|
||||
speaker.Lock()
|
||||
defer speaker.Unlock()
|
||||
err := p.streamSeekCloser.Seek(pos * int(p.format.SampleRate))
|
||||
p.i = pos - 1
|
||||
p.i = pos
|
||||
return err
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user