mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-25 11:18:54 +01:00
audio/internal/readerdriver: Bug fix: Need to align the buffer size
This commit is contained in:
parent
e650e71d8c
commit
24dc20e80e
@ -124,7 +124,11 @@ func (c *contextImpl) Close() error {
|
|||||||
|
|
||||||
// oneBufferSize returns the size of one buffer in the player implementation.
|
// oneBufferSize returns the size of one buffer in the player implementation.
|
||||||
func (c *contextImpl) oneBufferSize() int {
|
func (c *contextImpl) oneBufferSize() int {
|
||||||
return c.sampleRate * c.channelNum * c.bitDepthInBytes / 4
|
bytesPerSample := c.channelNum * c.bitDepthInBytes
|
||||||
|
s := c.sampleRate * bytesPerSample / 4
|
||||||
|
|
||||||
|
// Align s in multiples of bytes per sample, or a buffer could have extra bytes.
|
||||||
|
return s / bytesPerSample * bytesPerSample
|
||||||
}
|
}
|
||||||
|
|
||||||
// maxBufferSize returns the maximum size of the buffer for the audio source.
|
// maxBufferSize returns the maximum size of the buffer for the audio source.
|
||||||
|
Loading…
Reference in New Issue
Block a user