mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-25 03:08:54 +01:00
audio/internal/go2cpp: Bug fix: Set the volume whenever the player state is
This commit is contained in:
parent
3a0f7e619e
commit
83dc3966e7
@ -121,10 +121,10 @@ func (p *Player) Play() {
|
||||
var runloop bool
|
||||
if !p.v.Truthy() {
|
||||
p.v = p.context.v.Call("createPlayer", p.onWritten)
|
||||
p.v.Set("volume", p.volume)
|
||||
runloop = true
|
||||
}
|
||||
|
||||
p.v.Set("volume", p.volume)
|
||||
p.v.Call("play")
|
||||
|
||||
// Prepare the first data as soon as possible, or the audio can get stuck.
|
||||
@ -192,11 +192,11 @@ func (p *Player) SetVolume(volume float64) {
|
||||
p.cond.L.Lock()
|
||||
defer p.cond.L.Unlock()
|
||||
|
||||
p.volume = volume
|
||||
if !p.v.Truthy() {
|
||||
return
|
||||
}
|
||||
p.v.Set("volume", volume)
|
||||
p.volume = volume
|
||||
}
|
||||
|
||||
func (p *Player) UnplayedBufferSize() int64 {
|
||||
|
Loading…
Reference in New Issue
Block a user