mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-25 03:08:54 +01:00
audio/wav: Bug fix: seek correctly when using io.SeekEnd
This commit is contained in:
parent
2439d407df
commit
244d8204c5
@ -74,8 +74,13 @@ func (s *stream) Read(p []byte) (int, error) {
|
|||||||
|
|
||||||
// Seek is implementation of io.Seeker's Seek.
|
// Seek is implementation of io.Seeker's Seek.
|
||||||
func (s *stream) Seek(offset int64, whence int) (int64, error) {
|
func (s *stream) Seek(offset int64, whence int) (int64, error) {
|
||||||
if whence == io.SeekStart {
|
switch whence {
|
||||||
offset += s.headerSize
|
case io.SeekStart:
|
||||||
|
offset = offset + s.headerSize
|
||||||
|
case io.SeekCurrent:
|
||||||
|
case io.SeekEnd:
|
||||||
|
offset = s.headerSize + s.dataSize + offset
|
||||||
|
whence = io.SeekStart
|
||||||
}
|
}
|
||||||
n, err := s.src.Seek(offset, whence)
|
n, err := s.src.Seek(offset, whence)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
Loading…
Reference in New Issue
Block a user