Shirakumo / cl-mixed

A simple audio mixing and processing library based on libmixed.
https://shirakumo.github.io/cl-mixed/
zlib License
22 stars 7 forks source link

Pass buffer size in buffering attributes to pulse:simple-new call #22

Closed Gleefre closed 1 year ago

Gleefre commented 1 year ago

As discussed on #shirakumo pa_simple_write call (during mixed:mix) periodically blocks for ~50ms if initialized with default buffering attributes which results in a delay between harmony:play call and the actual start of the playback.

Per documentation:

  1. tlength (playback) and fragsize (recording) should be set to the maximum latency that the application can deal with. It seems that it corresponds to the buffer size.
  2. prebuf and minreq are recommended to be set to the default value ((uint32_t) -1 = #xffffffff) which leaves the initialization of the parameter to the pulse audio server.
  3. maxlength could be set to a lower value to set an upper bound for latency, but that comes at cost of getting more underruns if it is set lower than what the server can reliably handle. It seems to me that the default value is good enough.
Shinmera commented 1 year ago

Great, thanks!