mirror of
https://github.com/gnif/LookingGlass.git
synced 2024-11-25 14:57:20 +00:00
[client] audio: reduce resampler latency
The best quality resampler has an intrinsic latency of about 3ms, and the processing itself takes another 1-2ms per 10ms block. The faster setting has an intrinsic latency of about 0.4ms, with about 0.04ms processing time. This makes for an overall saving of about 4ms, with negligible loss in quality.
This commit is contained in:
parent
7efc274e81
commit
c2523be4b4
@ -328,8 +328,7 @@ void audio_playbackStart(int channels, int sampleRate, PSAudioFormat format,
|
|||||||
playbackStop();
|
playbackStop();
|
||||||
|
|
||||||
int srcError;
|
int srcError;
|
||||||
audio.playback.spiceData.src =
|
audio.playback.spiceData.src = src_new(SRC_SINC_FASTEST, channels, &srcError);
|
||||||
src_new(SRC_SINC_BEST_QUALITY, channels, &srcError);
|
|
||||||
if (!audio.playback.spiceData.src)
|
if (!audio.playback.spiceData.src)
|
||||||
{
|
{
|
||||||
DEBUG_ERROR("Failed to create resampler: %s", src_strerror(srcError));
|
DEBUG_ERROR("Failed to create resampler: %s", src_strerror(srcError));
|
||||||
@ -614,7 +613,7 @@ void audio_playbackData(uint8_t * data, size_t size)
|
|||||||
// the resampler startup latency
|
// the resampler startup latency
|
||||||
if (audio.playback.state == STREAM_STATE_KEEP_ALIVE)
|
if (audio.playback.state == STREAM_STATE_KEEP_ALIVE)
|
||||||
{
|
{
|
||||||
int resamplerLatencyFrames = 144;
|
int resamplerLatencyFrames = 20;
|
||||||
targetPosition += resamplerLatencyFrames;
|
targetPosition += resamplerLatencyFrames;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user