diff options
author | Chris Robinson <[email protected]> | 2010-11-23 07:24:27 -0800 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2010-11-23 07:24:27 -0800 |
commit | 13ba253aec2abaccc7c075d2bb5d196b0aae629f (patch) | |
tree | b13dadefc2e8734efcfbb3d546329f16ffd515b7 /Alc/alsa.c | |
parent | c58469e2341b39662ab825ee35d70a9d17b78f74 (diff) |
Calculate ALSA buffer length with the other values
Diffstat (limited to 'Alc/alsa.c')
-rw-r--r-- | Alc/alsa.c | 8 |
1 files changed, 6 insertions, 2 deletions
@@ -562,6 +562,7 @@ static ALCboolean alsa_reset_playback(ALCdevice *device) allowmmap = GetConfigValueBool("alsa", "mmap", 1); periods = device->NumUpdates; periodLen = (ALuint64)device->UpdateSize * 1000000 / device->Frequency; + bufferLen = periodLen * periods; rate = device->Frequency; err = NULL; @@ -572,7 +573,11 @@ static ALCboolean alsa_reset_playback(ALCdevice *device) /* set interleaved access */ if(i >= 0 && (!allowmmap || (i=psnd_pcm_hw_params_set_access(data->pcmHandle, p, SND_PCM_ACCESS_MMAP_INTERLEAVED)) < 0)) { - if(periods > 2) periods--; + if(periods > 2) + { + periods--; + bufferLen = periodLen * periods; + } if((i=psnd_pcm_hw_params_set_access(data->pcmHandle, p, SND_PCM_ACCESS_RW_INTERLEAVED)) < 0) err = "set access"; } @@ -648,7 +653,6 @@ static ALCboolean alsa_reset_playback(ALCdevice *device) if(i >= 0 && (i=psnd_pcm_hw_params_set_rate_near(data->pcmHandle, p, &rate, NULL)) < 0) err = "set rate near"; /* set buffer time (implicitly constrains period/buffer parameters) */ - bufferLen = periodLen * periods; if(i >= 0 && (i=psnd_pcm_hw_params_set_buffer_time_near(data->pcmHandle, p, &bufferLen, NULL)) < 0) err = "set buffer time near"; /* set period time in frame units (implicitly sets buffer size/bytes/time and period size/bytes) */ |