From 9c9a44299900695a91aa50a2751f903144bd3a0f Mon Sep 17 00:00:00 2001 From: dvdli Date: Wed, 28 Oct 2020 16:05:19 +0800 Subject: AOSP CL "Add pcm_params string conversion and format checking" https://android.googlesource.com/platform/external/tinyalsa/+/70530a69767a9a383c5bf546e6e803aac08a5a1e%5E!/ title: Add pcm_params string conversion and format checking commit 70530a69767a9a383c5bf546e6e803aac08a5a1e author Andy Hung --- include/tinyalsa/pcm.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'include') diff --git a/include/tinyalsa/pcm.h b/include/tinyalsa/pcm.h index 1184d81..5191882 100644 --- a/include/tinyalsa/pcm.h +++ b/include/tinyalsa/pcm.h @@ -264,6 +264,21 @@ unsigned int pcm_params_get_min(const struct pcm_params *pcm_params, enum pcm_pa unsigned int pcm_params_get_max(const struct pcm_params *pcm_params, enum pcm_param param); +/* Converts the pcm parameters to a human readable string. + * The string parameter is a caller allocated buffer of size bytes, + * which is then filled up to size - 1 and null terminated, + * if size is greater than zero. + * The return value is the number of bytes copied to string + * (not including null termination) if less than size; otherwise, + * the number of bytes required for the buffer. + */ +int pcm_params_to_string(struct pcm_params *params, char *string, unsigned int size); + +/* Returns 1 if the pcm_format is present (format bit set) in + * the pcm_params structure; 0 otherwise, or upon unrecognized format. + */ +int pcm_params_format_test(struct pcm_params *params, enum pcm_format format); + struct pcm; struct pcm *pcm_open(unsigned int card, -- cgit v1.2.3 From 1e75a165df625396afd68bbc68a59c517727c3e6 Mon Sep 17 00:00:00 2001 From: dvdli Date: Wed, 28 Oct 2020 17:37:19 +0800 Subject: AOSP CL "pcm: add support to set silence_size" https://android.googlesource.com/platform/external/tinyalsa/+/e25fe0b50ea717a9f347dcb927d396e8772e6362 commit e25fe0b50ea717a9f347dcb927d396e8772e6362 author Maneet Singh pcm: add support to set silence_size Tinyalsa always set silence_size to zero. Add support to set this pcm software parameter as required. Bug: 20226809 Bug: 20300203 Change-Id: I25de43623dc04bf5a3ad4c6573bc2b8dad1eec5e --- include/tinyalsa/pcm.h | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'include') 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. -- cgit v1.2.3 From faaa6972a2846b43366887bc0779c6c1be20a16f Mon Sep 17 00:00:00 2001 From: dvdli Date: Wed, 28 Oct 2020 22:18:40 +0800 Subject: AOSP CL "Export pcm_mmap_avail" https://android.googlesource.com/platform/external/tinyalsa/+/9074cfc4127cb841f0633b35895141f90da3f0d6 commit 9074cfc4127cb841f0633b35895141f90da3f0d6 author Dylan Reid Export pcm_mmap_avail This is useful for timer based wakeups and for checking how much data has been captured by a hotwording device. Change-Id: I409201a5c9ce73abc807a9dd767beb3a32810f06 Signed-off-by: Dylan Reid --- include/tinyalsa/pcm.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'include') diff --git a/include/tinyalsa/pcm.h b/include/tinyalsa/pcm.h index f32e11d..a49746c 100644 --- a/include/tinyalsa/pcm.h +++ b/include/tinyalsa/pcm.h @@ -341,6 +341,8 @@ int pcm_mmap_begin(struct pcm *pcm, void **areas, unsigned int *offset, unsigned int pcm_mmap_commit(struct pcm *pcm, unsigned int offset, unsigned int frames); +int pcm_mmap_avail(struct pcm *pcm); + int pcm_link(struct pcm *pcm1, struct pcm *pcm2); int pcm_unlink(struct pcm *pcm); -- cgit v1.2.3 From 72216211c7a5f29510a2f50dbdc70b35af44fb3a Mon Sep 17 00:00:00 2001 From: dvdli Date: Wed, 28 Oct 2020 22:22:27 +0800 Subject: AOSP CL "Add pcm_get_poll_fd" https://android.googlesource.com/platform/external/tinyalsa/+/b42510d55bafc96805a44bd6ac40faac28ebd219 commit b42510d55bafc96805a44bd6ac40faac28ebd219 author Dylan Reid Add pcm_get_poll_fd Similar to ALSA snd_pcm_get_poll_fd, this will allow a user to wait for a sound device to have data in a poll(2) call. The hotword thread will use this to wait for a message on its socket or for audio data to become ready. Change-Id: I61375a73d7a842b00362fc707c12f99aa18e0bdf Signed-off-by: Dylan Reid --- include/tinyalsa/pcm.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'include') diff --git a/include/tinyalsa/pcm.h b/include/tinyalsa/pcm.h index a49746c..99ca786 100644 --- a/include/tinyalsa/pcm.h +++ b/include/tinyalsa/pcm.h @@ -343,6 +343,8 @@ int pcm_mmap_commit(struct pcm *pcm, unsigned int offset, unsigned int frames); int pcm_mmap_avail(struct pcm *pcm); +int pcm_get_poll_fd(struct pcm *pcm); + int pcm_link(struct pcm *pcm1, struct pcm *pcm2); int pcm_unlink(struct pcm *pcm); -- cgit v1.2.3 From e43e85c1885d935e36c53fc04c4f1660c2b3fd3a Mon Sep 17 00:00:00 2001 From: dvdli Date: Wed, 28 Oct 2020 22:56:53 +0800 Subject: AOSP CL "pcm: add API for MMAP NO IRQ mode" https://android.googlesource.com/platform/external/tinyalsa/+/5b15b4cbd9e779a4ecd87e0f757fb0f8f6b9bcb8 commit 5b15b4cbd9e779a4ecd87e0f757fb0f8f6b9bcb8 author Eric Laurent pcm: add API for MMAP NO IRQ mode Bug: 33398120 Test: build Change-Id: Iecb47f76337d98ceb01044ca488a04e1f350c6bc --- include/tinyalsa/pcm.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'include') diff --git a/include/tinyalsa/pcm.h b/include/tinyalsa/pcm.h index 99ca786..cdc31a5 100644 --- a/include/tinyalsa/pcm.h +++ b/include/tinyalsa/pcm.h @@ -343,6 +343,8 @@ int pcm_mmap_commit(struct pcm *pcm, unsigned int offset, unsigned int frames); int pcm_mmap_avail(struct pcm *pcm); +int pcm_mmap_get_hw_ptr(struct pcm* pcm, unsigned int *hw_ptr, struct timespec *tstamp); + int pcm_get_poll_fd(struct pcm *pcm); int pcm_link(struct pcm *pcm1, struct pcm *pcm2); -- cgit v1.2.3 From c0c5e7534011a9a3d64b74e0f20a3417fbbbc290 Mon Sep 17 00:00:00 2001 From: dvdli Date: Thu, 29 Oct 2020 15:32:35 +0800 Subject: AOSP CL "tinyalsa: fix typos in tinyplay and asoundlib.h" commit f451f433520fc154de6e371747f21d2f746da83b author Glenn Kasten tinyalsa: fix typos in tinyplay and asoundlib.h Test: run tinyplay and look for typos in the output Change-Id: Ieedcc1b7610700aa3d5ff913d5c01105db2c1601 --- include/tinyalsa/mixer.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include') diff --git a/include/tinyalsa/mixer.h b/include/tinyalsa/mixer.h index 2acdd54..77d5d01 100644 --- a/include/tinyalsa/mixer.h +++ b/include/tinyalsa/mixer.h @@ -133,7 +133,7 @@ int mixer_ctl_set_array(struct mixer_ctl *ctl, const void *array, size_t count); int mixer_ctl_set_enum_by_string(struct mixer_ctl *ctl, const char *string); -/* Determe range of integer mixer controls */ +/* Determine range of integer mixer controls */ int mixer_ctl_get_range_min(const struct mixer_ctl *ctl); int mixer_ctl_get_range_max(const struct mixer_ctl *ctl); -- cgit v1.2.3