From 0e8c423e5102e778083e55945df5db5b8267b3a3 Mon Sep 17 00:00:00 2001 From: Hajime Hoshi Date: Fri, 25 Mar 2022 20:27:13 +0900 Subject: [PATCH] Revert "audio: add (*Player).UnplayedBufferSize (#2021)" This reverts commit 7744013b0517e492d48cbfd352525acc32234701. Reason: This is no longer needed and SetBufferSize is enough. Updates #2020 Updates #2026 --- audio/audio.go | 5 ----- audio/player.go | 12 ------------ 2 files changed, 17 deletions(-) diff --git a/audio/audio.go b/audio/audio.go index 9a39db189..aaa52f385 100644 --- a/audio/audio.go +++ b/audio/audio.go @@ -399,11 +399,6 @@ func (p *Player) SetVolume(volume float64) { p.p.SetVolume(volume) } -// UnplayedBufferSize returns the amount of unplayed data in the player's buffer in the time duration. -func (p *Player) UnplayedBufferSize() time.Duration { - return p.p.UnplayedBufferSize() -} - // SetBufferSize adjusts the buffer size of the player. // If 0 is specified, the default buffer size is used. // A small buffer size is useful if you want to play a real-time PCM for example. diff --git a/audio/player.go b/audio/player.go index f196bc1f8..bc462f703 100644 --- a/audio/player.go +++ b/audio/player.go @@ -286,18 +286,6 @@ func (p *playerImpl) Err() error { return p.player.Err() } -func (p *playerImpl) UnplayedBufferSize() time.Duration { - p.m.Lock() - defer p.m.Unlock() - - if p.player == nil { - return 0 - } - - samples := p.player.UnplayedBufferSize() / bytesPerSample - return time.Duration(samples) * time.Second / time.Duration(p.factory.sampleRate) -} - func (p *playerImpl) SetBufferSize(bufferSize int) { p.m.Lock() defer p.m.Unlock()