mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2025-01-13 04:22:05 +01:00
Change sleeping time
This commit is contained in:
parent
ab5a598d27
commit
47f31f75a0
@ -81,7 +81,6 @@ func Play(channel int, l []int16, r []int16) bool {
|
|||||||
ch.l = append(ch.l, l...)
|
ch.l = append(ch.l, l...)
|
||||||
ch.r = append(ch.r, r...)
|
ch.r = append(ch.r, r...)
|
||||||
result = true
|
result = true
|
||||||
return
|
|
||||||
})
|
})
|
||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
|
@ -20,11 +20,12 @@ import (
|
|||||||
"bytes"
|
"bytes"
|
||||||
"encoding/binary"
|
"encoding/binary"
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/timshannon/go-openal/openal"
|
|
||||||
"log"
|
"log"
|
||||||
"runtime"
|
"runtime"
|
||||||
"sync"
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"github.com/timshannon/go-openal/openal"
|
||||||
)
|
)
|
||||||
|
|
||||||
var channelsMutex = sync.Mutex{}
|
var channelsMutex = sync.Mutex{}
|
||||||
@ -94,7 +95,7 @@ func initialize() {
|
|||||||
|
|
||||||
for {
|
for {
|
||||||
oneProcessed := false
|
oneProcessed := false
|
||||||
for channel, source := range sources {
|
for ch, source := range sources {
|
||||||
processed := source.BuffersProcessed()
|
processed := source.BuffersProcessed()
|
||||||
if processed == 0 {
|
if processed == 0 {
|
||||||
continue
|
continue
|
||||||
@ -104,7 +105,7 @@ func initialize() {
|
|||||||
buffers := make([]openal.Buffer, processed)
|
buffers := make([]openal.Buffer, processed)
|
||||||
source.UnqueueBuffers(buffers)
|
source.UnqueueBuffers(buffers)
|
||||||
for _, buffer := range buffers {
|
for _, buffer := range buffers {
|
||||||
l, r := loadChannelBuffer(channel, bufferSize)
|
l, r := loadChannelBuffer(ch, bufferSize)
|
||||||
b := toBytesWithPadding(l, r, bufferSize)
|
b := toBytesWithPadding(l, r, bufferSize)
|
||||||
buffer.SetData(openal.FormatStereo16, b, SampleRate)
|
buffer.SetData(openal.FormatStereo16, b, SampleRate)
|
||||||
source.QueueBuffer(buffer)
|
source.QueueBuffer(buffer)
|
||||||
@ -115,7 +116,7 @@ func initialize() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if !oneProcessed {
|
if !oneProcessed {
|
||||||
time.Sleep(1)
|
time.Sleep(1 * time.Millisecond)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
Loading…
Reference in New Issue
Block a user