diff options
-rw-r--r-- | include/tinyalsa/pcm.h | 11 | ||||
-rw-r--r-- | src/pcm.c | 3 |
2 files changed, 10 insertions, 4 deletions
diff --git a/include/tinyalsa/pcm.h b/include/tinyalsa/pcm.h index 5191882..f32e11d 100644 --- a/include/tinyalsa/pcm.h +++ b/include/tinyalsa/pcm.h @@ -202,13 +202,15 @@ struct pcm_config { unsigned int period_count; /** The sample format of a PCM */ enum pcm_format format; - /* Values to use for the ALSA start, stop and silence thresholds. Setting - * any one of these values to 0 will cause the default tinyalsa values to be - * used instead. Tinyalsa defaults are as follows. + /* Values to use for the ALSA start, stop and silence thresholds, and + * silence size. Setting any one of these values to 0 will cause the + * default tinyalsa values to be used instead. + * Tinyalsa defaults are as follows. * * start_threshold : period_count * period_size * stop_threshold : period_count * period_size * silence_threshold : 0 + * silence_size : 0 */ /** The minimum number of frames required to start the PCM */ unsigned int start_threshold; @@ -216,6 +218,9 @@ struct pcm_config { unsigned int stop_threshold; /** The minimum number of frames to silence the PCM */ unsigned int silence_threshold; + /** The number of frames to overwrite the playback buffer when the playback underrun is greater + * than the silence threshold */ + unsigned int silence_size; }; /** Enumeration of a PCM's hardware parameters. @@ -438,6 +438,7 @@ int pcm_set_config(struct pcm *pcm, const struct pcm_config *config) pcm->config.start_threshold = config->period_count * config->period_size; pcm->config.stop_threshold = config->period_count * config->period_size; pcm->config.silence_threshold = 0; + pcm->config.silence_size = 0; } else pcm->config = *config; @@ -519,7 +520,7 @@ int pcm_set_config(struct pcm *pcm, const struct pcm_config *config) sparams.stop_threshold = config->stop_threshold; sparams.xfer_align = config->period_size / 2; /* needed for old kernels */ - sparams.silence_size = 0; + sparams.silence_size = config->silence_size; sparams.silence_threshold = config->silence_threshold; pcm->boundary = sparams.boundary = pcm->buffer_size; |