When using the 'blipper' (sinc) resampler, the frontend expects 548.625 samples per frame. On average the correct number are sent, but this is done in 'chunks' - the audio batch callback is used to send 512 samples, and then it is called again with the remainder. The audio batch callback should only be called once per frame for optimal performance.
When using the Convoluted Cosine resampler, the frontend expects 1097.25 samples per frame. On average the correct number are sent, but again this is done in 'chunks' - samples are written whenever a total of 1024 have accumulated, which means that on some frames 1024 are sent and on others 2*1024 (highly uneven pacing)
As a result, the core is 'abusing' the frontend audio buffer, leading to poor performance at low audio latencies and bad AV synchronisation.
This PR fixes the issue. Samples are now output with even pacing, and usage of the audio batch callback is minimised to once per frame.
In addition, the PR adds a new Audio Resampler core option which allows the audio resampler to be changed at runtime. Previously this was a complier option, which meant several platforms were limited to using only the (poor quality but fast) Convoluted Cosine algorithm.
At present, the core has bad audio sample pacing:
When using the 'blipper' (sinc) resampler, the frontend expects 548.625 samples per frame. On average the correct number are sent, but this is done in 'chunks' - the audio batch callback is used to send 512 samples, and then it is called again with the remainder. The audio batch callback should only be called once per frame for optimal performance.
When using the Convoluted Cosine resampler, the frontend expects 1097.25 samples per frame. On average the correct number are sent, but again this is done in 'chunks' - samples are written whenever a total of 1024 have accumulated, which means that on some frames 1024 are sent and on others 2*1024 (highly uneven pacing)
As a result, the core is 'abusing' the frontend audio buffer, leading to poor performance at low audio latencies and bad AV synchronisation.
This PR fixes the issue. Samples are now output with even pacing, and usage of the audio batch callback is minimised to once per frame.
In addition, the PR adds a new
Audio Resampler
core option which allows the audio resampler to be changed at runtime. Previously this was a complier option, which meant several platforms were limited to using only the (poor quality but fast) Convoluted Cosine algorithm.