Skip to content

Commit

Permalink
Fix a clamping inaccuracy in the speaker writer
Browse files Browse the repository at this point in the history
  • Loading branch information
ajzaff committed Jun 12, 2020
1 parent b573886 commit ffb96bb
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion speaker/speaker.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ func update() {
if val > +1 {
val = +1
}
valInt16 := int16(val * (1<<15 - 1))
valInt16 := int16((val+1)/2*(1<<16-1) + (-1 << 15))
low := byte(valInt16)
high := byte(valInt16 >> 8)
buf[i*4+c*2+0] = low
Expand Down

0 comments on commit ffb96bb

Please sign in to comment.