mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2025-01-13 20:42:07 +01:00
audio/internal/readerdriver: Adjust buffer size for low-spec machines (Linux)
Updates #1549
This commit is contained in:
parent
85b436b5bb
commit
7b320f2aeb
@ -56,6 +56,8 @@ type context struct {
|
|||||||
|
|
||||||
var theContext *context
|
var theContext *context
|
||||||
|
|
||||||
|
const bufferSize = 4096
|
||||||
|
|
||||||
func NewContext(sampleRate, channelNum, bitDepthInBytes int) (Context, chan struct{}, error) {
|
func NewContext(sampleRate, channelNum, bitDepthInBytes int) (Context, chan struct{}, error) {
|
||||||
ready := make(chan struct{})
|
ready := make(chan struct{})
|
||||||
close(ready)
|
close(ready)
|
||||||
@ -132,7 +134,7 @@ func NewContext(sampleRate, channelNum, bitDepthInBytes int) (Context, chan stru
|
|||||||
const defaultValue = 0xffffffff
|
const defaultValue = 0xffffffff
|
||||||
bufferAttr := C.pa_buffer_attr{
|
bufferAttr := C.pa_buffer_attr{
|
||||||
maxlength: defaultValue,
|
maxlength: defaultValue,
|
||||||
tlength: 2048,
|
tlength: bufferSize,
|
||||||
prebuf: defaultValue,
|
prebuf: defaultValue,
|
||||||
minreq: defaultValue,
|
minreq: defaultValue,
|
||||||
}
|
}
|
||||||
@ -247,7 +249,7 @@ func ebiten_readerdriver_streamWriteCallback(stream *C.pa_stream, requestedBytes
|
|||||||
|
|
||||||
var buf unsafe.Pointer
|
var buf unsafe.Pointer
|
||||||
var buf32 []float32
|
var buf32 []float32
|
||||||
var bytesToFill C.size_t = 256
|
var bytesToFill C.size_t = bufferSize
|
||||||
var players []*playerImpl
|
var players []*playerImpl
|
||||||
for n := int(requestedBytes); n > 0; n -= int(bytesToFill) {
|
for n := int(requestedBytes); n > 0; n -= int(bytesToFill) {
|
||||||
c.cond.L.Lock()
|
c.cond.L.Lock()
|
||||||
|
Loading…
Reference in New Issue
Block a user