summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorXANTRONIX Development2022-03-17 11:35:24 -0400
committerXANTRONIX Development2022-03-17 11:35:24 -0400
commitcc27bca6d8d70bf23b17c92aa1e2b28644b51844 (patch)
treeeaf4f1752013ef9ff7e7d48d287f6313e673e7c2
parent9708b5b0e2b5de0e60fb6b0ef7925bc9375b85cf (diff)
downloadxas-cc27bca6d8d70bf23b17c92aa1e2b28644b51844.tar.gz
xas-cc27bca6d8d70bf23b17c92aa1e2b28644b51844.tar.bz2
xas-cc27bca6d8d70bf23b17c92aa1e2b28644b51844.zip
Implement xas_audio_format_mono()
Implement xas_audio_format_mono() to return a new audio format descriptor for a given input, but in mono, as a convenience
-rw-r--r--include/xas/audio.h2
-rw-r--r--src/audio.c8
2 files changed, 10 insertions, 0 deletions
diff --git a/include/xas/audio.h b/include/xas/audio.h
index 343986d..76d38ce 100644
--- a/include/xas/audio.h
+++ b/include/xas/audio.h
@@ -53,6 +53,8 @@ struct _xas_audio_stream {
int xas_audio_format_eq(xas_audio_format a, xas_audio_format b);
+xas_audio_format xas_audio_format_mono(xas_audio_format format);
+
void xas_audio_zero(xas_audio_format format,
void *dest,
size_t index,
diff --git a/src/audio.c b/src/audio.c
index aedc4c0..95c727e 100644
--- a/src/audio.c
+++ b/src/audio.c
@@ -11,6 +11,14 @@ int xas_audio_format_eq(xas_audio_format a, xas_audio_format b) {
&& a.sample_rate == b.sample_rate;
}
+xas_audio_format xas_audio_format_mono(xas_audio_format format) {
+ return (xas_audio_format){
+ .channels = XAS_AUDIO_MONO,
+ .sample_size = format.sample_size,
+ .sample_rate = format.sample_rate
+ };
+}
+
void xas_audio_zero(xas_audio_format format,
void *dest,
size_t index,