mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2025-02-03 22:44:28 +01:00
audio: Reduce noise (#443)
This commit is contained in:
parent
3addbfce8a
commit
7cc6154de6
@ -418,11 +418,14 @@ func (p *Player) bufferToInt16(lengthInBytes int) []int16 {
|
|||||||
|
|
||||||
p.m.Lock()
|
p.m.Lock()
|
||||||
l := lengthInBytes
|
l := lengthInBytes
|
||||||
if len(p.buf) < lengthInBytes {
|
|
||||||
if !p.srcEOF {
|
// Buffer size needs to be much more than the actual required length
|
||||||
p.m.Unlock()
|
// so that noise due to empty buffer can be avoided.
|
||||||
return r
|
if len(p.buf) < lengthInBytes*4 && !p.srcEOF {
|
||||||
}
|
p.m.Unlock()
|
||||||
|
return r
|
||||||
|
}
|
||||||
|
if l > len(p.buf) {
|
||||||
l = len(p.buf)
|
l = len(p.buf)
|
||||||
}
|
}
|
||||||
for i := 0; i < l/2; i++ {
|
for i := 0; i < l/2; i++ {
|
||||||
|
Loading…
Reference in New Issue
Block a user