aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Alc/alsa.c10
-rw-r--r--openalrc.sample6
2 files changed, 15 insertions, 1 deletions
diff --git a/Alc/alsa.c b/Alc/alsa.c
index f661d76b..875d1347 100644
--- a/Alc/alsa.c
+++ b/Alc/alsa.c
@@ -281,6 +281,8 @@ static ALCboolean alsa_open_playback(ALCdevice *device, const ALCchar *deviceNam
unsigned int periods;
alsa_data *data;
char driver[64];
+ const char *str;
+ int allowmmap;
char *err;
int i;
@@ -360,12 +362,18 @@ open_alsa:
periods = 4;
bufferSizeInFrames = device->UpdateFreq / periods;
+ str = GetConfigValue("alsa", "mmap", "true");
+ allowmmap = (strcasecmp(str, "true") == 0 ||
+ strcasecmp(str, "yes") == 0 ||
+ strcasecmp(str, "on") == 0 ||
+ atoi(str) != 0);
+
psnd_pcm_hw_params_malloc(&p);
#define ok(func, str) (i=(func),((i<0)?(err=(str)),0:1))
/* start with the largest configuration space possible */
if(!(ok(psnd_pcm_hw_params_any(data->pcmHandle, p), "any") &&
/* set interleaved access */
- (ok(psnd_pcm_hw_params_set_access(data->pcmHandle, p, SND_PCM_ACCESS_MMAP_INTERLEAVED), "set access") ||
+ ((allowmmap && ok(psnd_pcm_hw_params_set_access(data->pcmHandle, p, SND_PCM_ACCESS_MMAP_INTERLEAVED), "set access")) ||
ok(psnd_pcm_hw_params_set_access(data->pcmHandle, p, SND_PCM_ACCESS_RW_INTERLEAVED), "set access")) &&
/* set format (implicitly sets sample bits) */
ok(psnd_pcm_hw_params_set_format(data->pcmHandle, p, data->format), "set format") &&
diff --git a/openalrc.sample b/openalrc.sample
index 37325d14..0e33e648 100644
--- a/openalrc.sample
+++ b/openalrc.sample
@@ -55,6 +55,12 @@ periods = 4 # Sets the number of update buffers. Default is 4
capture = default # Sets the device name for the default capture device.
# Default is default
+mmap = true # Sets whether to try using mmap mode (helps reduce latencies and
+ # CPU consumption). If mmap isn't available, it will automatically
+ # fall back to non-mmap mode. True, yes, on, and non-0 values will
+ # attempt to use mmap. 0 and anything else will force mmap off.
+ # Default is true.
+
[oss] # OSS backend stuff
device = /dev/dsp # Sets the device name for OSS output. Default is /dev/dsp