mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2025-01-12 20:18:59 +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
|
var runloop bool
|
||||||
if !p.v.Truthy() {
|
if !p.v.Truthy() {
|
||||||
p.v = p.context.v.Call("createPlayer", p.onWritten)
|
p.v = p.context.v.Call("createPlayer", p.onWritten)
|
||||||
p.v.Set("volume", p.volume)
|
|
||||||
runloop = true
|
runloop = true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
p.v.Set("volume", p.volume)
|
||||||
p.v.Call("play")
|
p.v.Call("play")
|
||||||
|
|
||||||
// Prepare the first data as soon as possible, or the audio can get stuck.
|
// 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()
|
p.cond.L.Lock()
|
||||||
defer p.cond.L.Unlock()
|
defer p.cond.L.Unlock()
|
||||||
|
|
||||||
|
p.volume = volume
|
||||||
if !p.v.Truthy() {
|
if !p.v.Truthy() {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
p.v.Set("volume", volume)
|
p.v.Set("volume", volume)
|
||||||
p.volume = volume
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *Player) UnplayedBufferSize() int64 {
|
func (p *Player) UnplayedBufferSize() int64 {
|
||||||
|
Loading…
Reference in New Issue
Block a user