mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-11-10 04:57:26 +01:00
audio: Bug fix: Reduce delay for desktops
This commit is contained in:
parent
7692cf6a1b
commit
205c6f1462
@ -62,7 +62,7 @@ func initialize() {
|
||||
emptyBytes := make([]byte, 4*bufferSize)
|
||||
|
||||
for _, source := range sources {
|
||||
const bufferNum = 16
|
||||
const bufferNum = 4
|
||||
buffers := openal.NewBuffers(bufferNum)
|
||||
for _, buffer := range buffers {
|
||||
buffer.SetData(openal.FormatStereo16, emptyBytes, SampleRate)
|
||||
@ -81,6 +81,7 @@ func initialize() {
|
||||
if processed == 0 {
|
||||
continue
|
||||
}
|
||||
|
||||
oneProcessed = true
|
||||
buffers := make([]openal.Buffer, processed)
|
||||
source.UnqueueBuffers(buffers)
|
||||
@ -90,6 +91,10 @@ func initialize() {
|
||||
buffer.SetData(openal.FormatStereo16, b, SampleRate)
|
||||
source.QueueBuffer(buffer)
|
||||
}
|
||||
if source.State() == openal.Stopped {
|
||||
source.Rewind()
|
||||
source.Play()
|
||||
}
|
||||
}
|
||||
if !oneProcessed {
|
||||
time.Sleep(1)
|
||||
|
Loading…
Reference in New Issue
Block a user