audio: Rename UnwrittenBufferSize -> UnplayedBufferSize

This commit is contained in:
Hajime Hoshi 2021-03-01 01:27:42 +09:00
parent 6d442c0a17
commit 9e73b0d287
2 changed files with 4 additions and 4 deletions

View File

@ -175,8 +175,8 @@ func (p *Player) SetVolume(volume float64) {
p.volume = volume p.volume = volume
} }
func (p *Player) UnwrittenBufferSize() int64 { func (p *Player) UnplayedBufferSize() int64 {
return int64(p.v.Get("unwrittenBufferSize").Int()) return int64(p.v.Get("unplayedBufferSize").Int())
} }
func (p *Player) Close() error { func (p *Player) Close() error {

View File

@ -33,7 +33,7 @@ type readerDriverPlayer interface {
Reset() Reset()
Volume() float64 Volume() float64
SetVolume(volume float64) SetVolume(volume float64)
UnwrittenBufferSize() int64 UnplayedBufferSize() int64
io.Closer io.Closer
} }
@ -142,7 +142,7 @@ func (p *readerPlayer) Current() time.Duration {
defer p.m.Unlock() defer p.m.Unlock()
p.ensurePlayer() p.ensurePlayer()
sample := (p.src.Current() - p.player.UnwrittenBufferSize()) / bytesPerSample sample := (p.src.Current() - p.player.UnplayedBufferSize()) / bytesPerSample
return time.Duration(sample) * time.Second / time.Duration(p.factory.sampleRate) return time.Duration(sample) * time.Second / time.Duration(p.factory.sampleRate)
} }