mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-11-10 04:57:26 +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 {
|
||||
p.cond.L.Lock()
|
||||
defer p.cond.L.Unlock()
|
||||
|
||||
if !p.v.Truthy() {
|
||||
return p.volume
|
||||
}
|
||||
@ -186,6 +189,9 @@ func (p *Player) Volume() float64 {
|
||||
}
|
||||
|
||||
func (p *Player) SetVolume(volume float64) {
|
||||
p.cond.L.Lock()
|
||||
defer p.cond.L.Unlock()
|
||||
|
||||
if !p.v.Truthy() {
|
||||
return
|
||||
}
|
||||
@ -201,6 +207,9 @@ func (p *Player) UnplayedBufferSize() int64 {
|
||||
}
|
||||
|
||||
func (p *Player) Err() error {
|
||||
p.cond.L.Lock()
|
||||
defer p.cond.L.Unlock()
|
||||
|
||||
return p.err
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user