mirror of
https://github.com/issadarkthing/gomu.git
synced 2025-04-26 13:49:21 +08:00
add persistent volume
This commit is contained in:
parent
b7b3b7c7a9
commit
77c8c7615b
@ -188,11 +188,17 @@ func (p *Player) Play() {
|
||||
// volume up and volume down using -0.5 or +0.5
|
||||
func (p *Player) Volume(v float64) float64 {
|
||||
|
||||
// check if no songs playing currently
|
||||
if p._volume == nil {
|
||||
p.volume += v
|
||||
return p.volume
|
||||
}
|
||||
|
||||
defer func() {
|
||||
volume := int(p.volume*10) + 50
|
||||
viper.Set("volume", volume)
|
||||
}()
|
||||
|
||||
speaker.Lock()
|
||||
p._volume.Volume += v
|
||||
p.volume = p._volume.Volume
|
||||
|
Loading…
x
Reference in New Issue
Block a user