mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-11-10 04:57:26 +01:00
audio/internal/go2cpp: Add readerDriverPlayer.Reset
This commit is contained in:
parent
3abb7a3604
commit
c009070840
@ -99,6 +99,18 @@ func (p *Player) Play() {
|
||||
p.cond.Signal()
|
||||
}
|
||||
|
||||
func (p *Player) Reset() {
|
||||
p.cond.L.Lock()
|
||||
defer p.cond.L.Unlock()
|
||||
|
||||
if p.state == playerStateClosed {
|
||||
return
|
||||
}
|
||||
|
||||
p.v.Call("reset")
|
||||
p.cond.Signal()
|
||||
}
|
||||
|
||||
func (p *Player) Volume() float64 {
|
||||
return p.v.Get("volume").Float()
|
||||
}
|
||||
|
@ -30,6 +30,7 @@ type readerDriver interface {
|
||||
type readerDriverPlayer interface {
|
||||
Pause()
|
||||
Play()
|
||||
Reset()
|
||||
Volume() float64
|
||||
SetVolume(volume float64)
|
||||
io.Closer
|
||||
@ -121,6 +122,7 @@ func (p *readerPlayer) Current() time.Duration {
|
||||
p.m.Lock()
|
||||
defer p.m.Unlock()
|
||||
|
||||
// TODO: Add a new function to readerDriverPlayer and use it.
|
||||
return p.src.Current()
|
||||
}
|
||||
|
||||
@ -132,6 +134,7 @@ func (p *readerPlayer) Seek(offset time.Duration) error {
|
||||
p.m.Lock()
|
||||
defer p.m.Unlock()
|
||||
|
||||
p.player.Reset()
|
||||
return p.src.Seek(offset)
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user