mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-25 11:18:54 +01:00
examples/sinewave: Bug fix: Sinewave volume was too small
This commit is contained in:
parent
10cb0bba5f
commit
7dafbb2e4e
@ -68,7 +68,7 @@ func (s *stream) Read(buf []byte) (int, error) {
|
||||
const length = int64(sampleRate / frequency)
|
||||
p := s.position / 4
|
||||
for i := 0; i < len(buf)/4; i++ {
|
||||
const max = (1<<15 - 1) / 2
|
||||
const max = 32767
|
||||
b := int16(math.Sin(2*math.Pi*float64(p)/float64(length)) * max)
|
||||
buf[4*i] = byte(b)
|
||||
buf[4*i+1] = byte(b >> 8)
|
||||
|
Loading…
Reference in New Issue
Block a user