mirror of
https://github.com/issadarkthing/gomu.git
synced 2025-04-28 13:48:53 +08:00
small refactor
This commit is contained in:
parent
fa1bcb1f70
commit
0e85518099
@ -137,7 +137,7 @@ func (p *Player) Run() {
|
|||||||
p.done = done
|
p.done = done
|
||||||
|
|
||||||
sstreamer := beep.Seq(streamer, beep.Callback(func() {
|
sstreamer := beep.Seq(streamer, beep.Callback(func() {
|
||||||
// prevents from sending done channel is the song is skipped
|
// prevents from sending done channel if the song is skipped
|
||||||
if !p.isSkipped {
|
if !p.isSkipped {
|
||||||
done <- true
|
done <- true
|
||||||
} else {
|
} else {
|
||||||
@ -145,6 +145,7 @@ func (p *Player) Run() {
|
|||||||
}
|
}
|
||||||
}))
|
}))
|
||||||
|
|
||||||
|
|
||||||
ctrl := &beep.Ctrl{Streamer: sstreamer, Paused: false}
|
ctrl := &beep.Ctrl{Streamer: sstreamer, Paused: false}
|
||||||
|
|
||||||
resampler := beep.ResampleRatio(4, 1, ctrl)
|
resampler := beep.ResampleRatio(4, 1, ctrl)
|
||||||
@ -203,10 +204,10 @@ next:
|
|||||||
select {
|
select {
|
||||||
case <-done:
|
case <-done:
|
||||||
close(done)
|
close(done)
|
||||||
p.position = 0
|
p.position = 0
|
||||||
p.current = ""
|
p.current = ""
|
||||||
p.IsRunning = false
|
p.IsRunning = false
|
||||||
p.format = nil
|
p.format = nil
|
||||||
|
|
||||||
if len(p.queue) != 0 {
|
if len(p.queue) != 0 {
|
||||||
go p.Run()
|
go p.Run()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user