diff options
author | John Grossman <johngro@google.com> | 2011-07-21 10:59:55 -0700 |
---|---|---|
committer | Simon Wilson <simonwilson@google.com> | 2011-07-27 14:59:56 -0700 |
commit | 3bb114a6459c78ea4e7d2f84568361430f26ff20 (patch) | |
tree | c70ebb8db726110287cf163dcbe55e982fab73dd /pcm.c | |
parent | ee99f213b29297b1016bc6210c16085c0b3068de (diff) |
pcm: add control for ASLA thresholds to pcm_open
Add the ability to explicitly set start, stop and silence thresholds during
tinyalsa's pcm_open. Setting any of these values to 0 in your pcm_config
structure will cause the system to use its old defaults.
Diffstat (limited to 'pcm.c')
-rw-r--r-- | pcm.c | 16 |
1 files changed, 13 insertions, 3 deletions
@@ -427,11 +427,21 @@ struct pcm *pcm_open(unsigned int card, unsigned int device, sparams.tstamp_mode = SNDRV_PCM_TSTAMP_ENABLE; sparams.period_step = 1; sparams.avail_min = 1; - sparams.start_threshold = config->period_count * config->period_size; - sparams.stop_threshold = config->period_count * config->period_size; + + if (!config->start_threshold) + sparams.start_threshold = config->period_count * config->period_size; + else + sparams.start_threshold = config->start_threshold; + + if (!config->stop_threshold) + sparams.stop_threshold = config->period_count * config->period_size; + else + sparams.stop_threshold = config->stop_threshold; + sparams.xfer_align = config->period_size / 2; /* needed for old kernels */ sparams.silence_size = 0; - sparams.silence_threshold = 0; + sparams.silence_threshold = config->silence_threshold; + if (ioctl(pcm->fd, SNDRV_PCM_IOCTL_SW_PARAMS, &sparams)) { oops(pcm, errno, "cannot set sw params"); |