From 9891d61206faa8b4fb1bd146b74da010264a4b69 Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Sat, 7 Nov 2015 23:05:45 -0800 Subject: Add options to disable Pulse's and ALSA's resamplers --- Alc/backends/alsa.c | 7 +++++-- Alc/backends/pulseaudio.c | 3 ++- 2 files changed, 7 insertions(+), 3 deletions(-) (limited to 'Alc/backends') diff --git a/Alc/backends/alsa.c b/Alc/backends/alsa.c index 97723cae..9a443c09 100644 --- a/Alc/backends/alsa.c +++ b/Alc/backends/alsa.c @@ -770,8 +770,11 @@ static ALCboolean ALCplaybackAlsa_reset(ALCplaybackAlsa *self) } CHECK(snd_pcm_hw_params_set_channels(self->pcmHandle, hp, ChannelsFromDevFmt(device->FmtChans))); /* set rate (implicitly constrains period/buffer parameters) */ - if(snd_pcm_hw_params_set_rate_resample(self->pcmHandle, hp, 0) < 0) - ERR("Failed to disable ALSA resampler\n"); + if(GetConfigValueBool(al_string_get_cstr(device->DeviceName), "alsa", "allow-resampler", 0)) + { + if(snd_pcm_hw_params_set_rate_resample(self->pcmHandle, hp, 0) < 0) + ERR("Failed to disable ALSA resampler\n"); + } CHECK(snd_pcm_hw_params_set_rate_near(self->pcmHandle, hp, &rate, NULL)); /* set buffer time (implicitly constrains period/buffer parameters) */ if((err=snd_pcm_hw_params_set_buffer_time_near(self->pcmHandle, hp, &bufferLen, NULL)) < 0) diff --git a/Alc/backends/pulseaudio.c b/Alc/backends/pulseaudio.c index ffbf04b2..9ad04a71 100644 --- a/Alc/backends/pulseaudio.c +++ b/Alc/backends/pulseaudio.c @@ -950,7 +950,8 @@ static ALCboolean ALCpulsePlayback_reset(ALCpulsePlayback *self) ALCpulsePlayback_sinkInfoCallback, self); wait_for_operation(o, self->loop); - if(!(device->Flags&DEVICE_FREQUENCY_REQUEST)) + if(GetConfigValueBool(al_string_get_cstr(device->DeviceName), "pulse", "fix-rate", 0) || + !(device->Flags&DEVICE_FREQUENCY_REQUEST)) flags |= PA_STREAM_FIX_RATE; flags |= PA_STREAM_INTERPOLATE_TIMING | PA_STREAM_AUTO_TIMING_UPDATE; flags |= PA_STREAM_ADJUST_LATENCY; -- cgit v1.2.3