mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2025-01-27 03:02:49 +01:00
audio/internal/go2cpp: Protect the functions by the lock correctly
This commit is contained in:
parent
f4b770eff6
commit
f4efdd6355
@ -179,6 +179,9 @@ func (p *Player) Reset() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (p *Player) Volume() float64 {
|
func (p *Player) Volume() float64 {
|
||||||
|
p.cond.L.Lock()
|
||||||
|
defer p.cond.L.Unlock()
|
||||||
|
|
||||||
if !p.v.Truthy() {
|
if !p.v.Truthy() {
|
||||||
return p.volume
|
return p.volume
|
||||||
}
|
}
|
||||||
@ -186,6 +189,9 @@ func (p *Player) Volume() float64 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (p *Player) SetVolume(volume float64) {
|
func (p *Player) SetVolume(volume float64) {
|
||||||
|
p.cond.L.Lock()
|
||||||
|
defer p.cond.L.Unlock()
|
||||||
|
|
||||||
if !p.v.Truthy() {
|
if !p.v.Truthy() {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -201,6 +207,9 @@ func (p *Player) UnplayedBufferSize() int64 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (p *Player) Err() error {
|
func (p *Player) Err() error {
|
||||||
|
p.cond.L.Lock()
|
||||||
|
defer p.cond.L.Unlock()
|
||||||
|
|
||||||
return p.err
|
return p.err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user