mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-11-10 04:57:26 +01:00
audio: Bug fix: Fix Seek: wav file can have a tail
This commit is contained in:
parent
f78f4002fa
commit
ee3da352db
@ -57,6 +57,11 @@ func (s *Stream) Seek(offset int64, whence int) (int64, error) {
|
|||||||
return 0, fmt.Errorf("wav: invalid offset")
|
return 0, fmt.Errorf("wav: invalid offset")
|
||||||
}
|
}
|
||||||
s.remaining = s.dataSize - (n - s.headerSize)
|
s.remaining = s.dataSize - (n - s.headerSize)
|
||||||
|
// There could be a tail in wav file.
|
||||||
|
if s.remaining < 0 {
|
||||||
|
s.remaining = 0
|
||||||
|
return s.dataSize, nil
|
||||||
|
}
|
||||||
return n - s.headerSize, nil
|
return n - s.headerSize, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user