commit: 89e45852644d37a23ff83ceb208f438a66a2835f
parent 0e2d4ca59a0ad34a51f8dcfdf702a63d1164a023
Author: Michael Forney <mforney@mforney.org>
Date: Mon, 31 Oct 2022 03:50:47 -0700
sndio: tinyalsa patch improvements
Diffstat:
3 files changed, 247 insertions(+), 80 deletions(-)
diff --git a/pkg/sndio/patch/0003-alsa-Port-to-tinyalsa.patch b/pkg/sndio/patch/0003-alsa-Port-to-tinyalsa.patch
@@ -1,17 +1,31 @@
-From 1dc4c8e89aa9d24a7844e86f2d97b321b70fd74a Mon Sep 17 00:00:00 2001
+From 39ec20119841c84500e589fee15c10e9fe6c0c97 Mon Sep 17 00:00:00 2001
From: Michael Forney <mforney@mforney.org>
Date: Tue, 31 Aug 2021 14:30:07 -0700
Subject: [PATCH] alsa: Port to tinyalsa
---
- libsndio/sio_alsa.c | 741 ++++++++++++++++----------------------------
- 1 file changed, 259 insertions(+), 482 deletions(-)
+ libsndio/debug.c | 2 +-
+ libsndio/sio_alsa.c | 747 +++++++++++++++-----------------------------
+ 2 files changed, 247 insertions(+), 502 deletions(-)
+diff --git a/libsndio/debug.c b/libsndio/debug.c
+index 304975a..40fdc92 100644
+--- a/libsndio/debug.c
++++ b/libsndio/debug.c
+@@ -35,7 +35,7 @@ _sndio_debug_init(void)
+
+ if (_sndio_debug < 0) {
+ dbg = issetugid() ? NULL : getenv("SNDIO_DEBUG");
+- if (!dbg || sscanf(dbg, "%u", &_sndio_debug) != 1)
++ if (!dbg || sscanf(dbg, "%d", &_sndio_debug) != 1)
+ _sndio_debug = 0;
+ }
+ }
diff --git a/libsndio/sio_alsa.c b/libsndio/sio_alsa.c
-index 6107617..fb85434 100644
+index 6107617..e460bf6 100644
--- a/libsndio/sio_alsa.c
+++ b/libsndio/sio_alsa.c
-@@ -29,31 +29,29 @@
+@@ -29,31 +29,28 @@
#include <string.h>
#include <unistd.h>
#include <values.h>
@@ -25,7 +39,7 @@ index 6107617..fb85434 100644
-#define DEVNAME_PREFIX "hw:"
-
#ifdef DEBUG
- static snd_output_t *output = NULL;
+-static snd_output_t *output = NULL;
-#define DALSA(str, err) fprintf(stderr, "%s: %s\n", str, snd_strerror(err))
+#define DALSA(str, pcm) fprintf(stderr, "%s: %s\n", str, pcm_get_error(pcm))
#else
@@ -50,7 +64,7 @@ index 6107617..fb85434 100644
int running;
int events;
int ipartial, opartial;
-@@ -102,90 +100,56 @@ static unsigned int cap_rates[] = {
+@@ -102,90 +99,56 @@ static unsigned int cap_rates[] = {
8000, 11025, 12000, 16000, 22050, 24000,
32000, 44100, 48000, 64000, 88200, 96000
};
@@ -154,7 +168,7 @@ index 6107617..fb85434 100644
default:
DPRINTF("sio_alsa_fmttopar: 0x%x: unsupported format\n", fmt);
hdl->sio.eof = 1;
-@@ -199,77 +163,41 @@ sio_alsa_fmttopar(struct sio_alsa_hdl *hdl, snd_pcm_format_t fmt,
+@@ -199,78 +162,19 @@ sio_alsa_fmttopar(struct sio_alsa_hdl *hdl, snd_pcm_format_t fmt,
* convert sio_par encoding to ALSA format
*/
static void
@@ -162,13 +176,12 @@ index 6107617..fb85434 100644
+sio_alsa_enctofmt(struct sio_alsa_hdl *hdl, enum pcm_format *rfmt,
unsigned int bits, unsigned int sig, unsigned int le)
{
- if (bits == 8) {
+- if (bits == 8) {
- if (sig == ~0U || !sig)
- *rfmt = SND_PCM_FORMAT_U8;
- else
- *rfmt = SND_PCM_FORMAT_S8;
-+ *rfmt = PCM_FORMAT_S8;
- } else if (bits == 16) {
+- } else if (bits == 16) {
- if (sig == ~0U || sig) {
- if (le == ~0U) {
- *rfmt = SIO_LE_NATIVE ?
@@ -188,15 +201,7 @@ index 6107617..fb85434 100644
- else
- *rfmt = SND_PCM_FORMAT_U16_BE;
- }
-+ if (le == ~0U) {
-+ *rfmt = SIO_LE_NATIVE ?
-+ PCM_FORMAT_S16_LE :
-+ PCM_FORMAT_S16_BE;
-+ } else if (le)
-+ *rfmt = PCM_FORMAT_S16_LE;
-+ else
-+ *rfmt = PCM_FORMAT_S16_BE;
- } else if (bits == 24) {
+- } else if (bits == 24) {
- if (sig == ~0U || sig) {
- if (le == ~0U) {
- *rfmt = SIO_LE_NATIVE ?
@@ -216,15 +221,7 @@ index 6107617..fb85434 100644
- else
- *rfmt = SND_PCM_FORMAT_U24_BE;
- }
-+ if (le == ~0U) {
-+ *rfmt = SIO_LE_NATIVE ?
-+ PCM_FORMAT_S24_LE :
-+ PCM_FORMAT_S24_BE;
-+ } else if (le)
-+ *rfmt = PCM_FORMAT_S24_LE;
-+ else
-+ *rfmt = PCM_FORMAT_S24_BE;
- } else if (bits == 32) {
+- } else if (bits == 32) {
- if (sig == ~0U || sig) {
- if (le == ~0U) {
- *rfmt = SIO_LE_NATIVE ?
@@ -244,22 +241,24 @@ index 6107617..fb85434 100644
- else
- *rfmt = SND_PCM_FORMAT_U32_BE;
- }
-+ if (le == ~0U) {
-+ *rfmt = SIO_LE_NATIVE ?
-+ PCM_FORMAT_S32_LE :
-+ PCM_FORMAT_S32_BE;
-+ } else if (le)
-+ *rfmt = PCM_FORMAT_S32_LE;
-+ else
-+ *rfmt = PCM_FORMAT_S32_BE;
- } else {
- *rfmt = SIO_LE_NATIVE ?
+- } else {
+- *rfmt = SIO_LE_NATIVE ?
- SND_PCM_FORMAT_S16_LE : SND_PCM_FORMAT_S16_BE;
-+ PCM_FORMAT_S16_LE : PCM_FORMAT_S16_BE;
- }
+- }
++ if (le == ~0U)
++ le = SIO_LE_NATIVE;
++ if (bits == 8)
++ *rfmt = PCM_FORMAT_S8;
++ else if (bits == 24)
++ *rfmt = le ? PCM_FORMAT_S24_LE : PCM_FORMAT_S24_BE;
++ else if (bits == 32)
++ *rfmt = le ? PCM_FORMAT_S32_LE : PCM_FORMAT_S32_BE;
++ else
++ *rfmt = le ? PCM_FORMAT_S16_LE : PCM_FORMAT_S16_BE;
}
-@@ -279,8 +207,7 @@ _sio_alsa_open(const char *str, unsigned mode, int nbio)
+ struct sio_hdl *
+@@ -279,8 +183,7 @@ _sio_alsa_open(const char *str, unsigned mode, int nbio)
const char *p;
struct sio_alsa_hdl *hdl;
struct sio_par par;
@@ -269,7 +268,7 @@ index 6107617..fb85434 100644
p = _sndio_parsetype(str, "rsnd");
if (p == NULL) {
-@@ -300,42 +227,45 @@ _sio_alsa_open(const char *str, unsigned mode, int nbio)
+@@ -300,42 +203,45 @@ _sio_alsa_open(const char *str, unsigned mode, int nbio)
return NULL;
_sio_create(&hdl->sio, &sio_alsa_ops, mode, nbio);
@@ -343,7 +342,7 @@ index 6107617..fb85434 100644
/*
* Default parameters may not be compatible with libsndio (eg. mulaw
* encodings, different playback and recording parameters, etc...), so
-@@ -356,12 +286,16 @@ _sio_alsa_open(const char *str, unsigned mode, int nbio)
+@@ -356,12 +262,16 @@ _sio_alsa_open(const char *str, unsigned mode, int nbio)
return (struct sio_hdl *)hdl;
bad_free_ipcm:
if (mode & SIO_REC)
@@ -364,7 +363,7 @@ index 6107617..fb85434 100644
bad_free_hdl:
free(hdl);
return NULL;
-@@ -372,11 +306,14 @@ sio_alsa_close(struct sio_hdl *sh)
+@@ -372,11 +282,14 @@ sio_alsa_close(struct sio_hdl *sh)
{
struct sio_alsa_hdl *hdl = (struct sio_alsa_hdl *)sh;
@@ -384,7 +383,7 @@ index 6107617..fb85434 100644
free(hdl);
}
-@@ -394,14 +331,12 @@ sio_alsa_start(struct sio_hdl *sh)
+@@ -394,14 +307,12 @@ sio_alsa_start(struct sio_hdl *sh)
hdl->oused = 0;
hdl->idelta = 0;
hdl->odelta = 0;
@@ -401,7 +400,7 @@ index 6107617..fb85434 100644
hdl->sio.eof = 1;
return 0;
}
-@@ -413,9 +348,9 @@ sio_alsa_start(struct sio_hdl *sh)
+@@ -413,9 +324,9 @@ sio_alsa_start(struct sio_hdl *sh)
hdl->opartial = 0;
}
if (hdl->sio.mode & SIO_REC) {
@@ -413,7 +412,7 @@ index 6107617..fb85434 100644
hdl->sio.eof = 1;
return 0;
}
-@@ -427,17 +362,17 @@ sio_alsa_start(struct sio_hdl *sh)
+@@ -427,17 +338,17 @@ sio_alsa_start(struct sio_hdl *sh)
hdl->ipartial = 0;
}
if ((hdl->sio.mode & SIO_PLAY) && (hdl->sio.mode & SIO_REC)) {
@@ -435,7 +434,7 @@ index 6107617..fb85434 100644
hdl->sio.eof = 1;
return 0;
}
-@@ -449,30 +384,26 @@ static int
+@@ -449,30 +360,26 @@ static int
sio_alsa_flush(struct sio_hdl *sh)
{
struct sio_alsa_hdl *hdl = (struct sio_alsa_hdl *)sh;
@@ -446,7 +445,7 @@ index 6107617..fb85434 100644
- if (err < 0) {
- DALSA("couldn't stop play stream", err);
+ if (pcm_stop(hdl->opcm) != 0) {
-+ DALSA("couldn't stop play stream", pcm->opcm);
++ DALSA("couldn't stop play stream", hdl->opcm);
hdl->sio.eof = 1;
return 0;
}
@@ -472,7 +471,7 @@ index 6107617..fb85434 100644
hdl->sio.eof = 1;
return 0;
}
-@@ -537,143 +468,110 @@ sio_alsa_xrun(struct sio_alsa_hdl *hdl)
+@@ -537,143 +444,110 @@ sio_alsa_xrun(struct sio_alsa_hdl *hdl)
}
static int
@@ -579,6 +578,16 @@ index 6107617..fb85434 100644
- *round = (*round + 31) & ~31;
- err = snd_pcm_hw_params_set_period_size_near(pcm, hwp, round, &dir);
+- if (err < 0) {
+- DALSA("couldn't set period size failed", err);
+- return 0;
+- }
+- err = snd_pcm_hw_params_set_periods_near(pcm, hwp, periods, &dir);
+- if (err < 0) {
+- DALSA("couldn't set period count", err);
+- return 0;
+- }
+- err = snd_pcm_hw_params(pcm, hwp);
+ req_rate = cfg->rate;
+ min = pcm_params_get_min(par, PCM_PARAM_RATE);
+ if (cfg->rate < min)
@@ -623,16 +632,6 @@ index 6107617..fb85434 100644
+
+ err = pcm_set_config(pcm, cfg);
if (err < 0) {
-- DALSA("couldn't set period size failed", err);
-- return 0;
-- }
-- err = snd_pcm_hw_params_set_periods_near(pcm, hwp, periods, &dir);
-- if (err < 0) {
-- DALSA("couldn't set period count", err);
-- return 0;
-- }
-- err = snd_pcm_hw_params(pcm, hwp);
-- if (err < 0) {
- DALSA("couldn't commit params", err);
+ DALSA("couldn't set config", pcm);
return 0;
@@ -684,7 +683,7 @@ index 6107617..fb85434 100644
*chans |= 1 << i;
}
}
-@@ -693,13 +591,13 @@ sio_alsa_getcap(struct sio_hdl *sh, struct sio_cap *cap)
+@@ -693,13 +567,13 @@ sio_alsa_getcap(struct sio_hdl *sh, struct sio_cap *cap)
irates = orates = ifmts = ofmts = ichans = ochans = 0;
if (hdl->sio.mode & SIO_PLAY) {
@@ -700,7 +699,16 @@ index 6107617..fb85434 100644
&irates, &ifmts, &ichans)) {
return 0;
}
-@@ -744,178 +642,72 @@ static int
+@@ -711,7 +585,7 @@ sio_alsa_getcap(struct sio_hdl *sh, struct sio_cap *cap)
+ &cap->enc[i].sig,
+ &cap->enc[i].le);
+ cap->enc[i].bps = SIO_BPS(cap->enc[0].bits);
+- cap->enc[i].msb = 1;
++ cap->enc[i].msb = 0;
+ }
+ for (i = 0; i < CAP_NRATES; i++) {
+ cap->rate[i] = cap_rates[i];
+@@ -744,186 +618,72 @@ static int
sio_alsa_setpar(struct sio_hdl *sh, struct sio_par *par)
{
struct sio_alsa_hdl *hdl = (struct sio_alsa_hdl *)sh;
@@ -711,13 +719,13 @@ index 6107617..fb85434 100644
- unsigned int iperiods, operiods;
- unsigned irate, orate;
- int err;
-+ struct pcm_config icfg, ocfg;
-
+-
- snd_pcm_hw_params_alloca(&ohwp);
- snd_pcm_sw_params_alloca(&oswp);
- snd_pcm_hw_params_alloca(&ihwp);
- snd_pcm_sw_params_alloca(&iswp);
--
++ struct pcm_config icfg, ocfg;
+
- sio_alsa_enctofmt(hdl, &ifmt, par->bits, par->sig, par->le);
- irate = (par->rate == ~0U) ? 48000 : par->rate;
+ sio_alsa_enctofmt(hdl, &icfg.format, par->bits, par->sig, par->le);
@@ -807,7 +815,8 @@ index 6107617..fb85434 100644
+ if (!sio_alsa_fmttopar(hdl, icfg.format,
&hdl->par.bits, &hdl->par.sig, &hdl->par.le))
return 0;
- hdl->par.msb = 1;
+- hdl->par.msb = 1;
++ hdl->par.msb = 0;
hdl->par.bps = SIO_BPS(hdl->par.bits);
- hdl->par.rate = orate;
- hdl->par.round = oround;
@@ -901,10 +910,18 @@ index 6107617..fb85434 100644
- return 0;
- }
- }
- #ifdef DEBUG
- if (_sndio_debug >= 2) {
- if (hdl->sio.mode & SIO_REC)
-@@ -940,7 +732,7 @@ static size_t
+-#ifdef DEBUG
+- if (_sndio_debug >= 2) {
+- if (hdl->sio.mode & SIO_REC)
+- snd_pcm_dump(hdl->ipcm, output);
+- if (hdl->sio.mode & SIO_PLAY)
+- snd_pcm_dump(hdl->opcm, output);
+- }
+-#endif
+ return 1;
+ }
+
+@@ -940,7 +700,7 @@ static size_t
sio_alsa_read(struct sio_hdl *sh, void *buf, size_t len)
{
struct sio_alsa_hdl *hdl = (struct sio_alsa_hdl *)sh;
@@ -913,7 +930,7 @@ index 6107617..fb85434 100644
size_t todo;
if (hdl->ipartial > 0) {
-@@ -959,7 +751,7 @@ sio_alsa_read(struct sio_hdl *sh, void *buf, size_t len)
+@@ -959,7 +719,7 @@ sio_alsa_read(struct sio_hdl *sh, void *buf, size_t len)
todo = len / hdl->ibpf;
if (todo == 0)
return 0;
@@ -922,7 +939,7 @@ index 6107617..fb85434 100644
if (n == -EINTR)
continue;
if (n == -EPIPE || n == -ESTRPIPE) {
-@@ -967,7 +759,7 @@ sio_alsa_read(struct sio_hdl *sh, void *buf, size_t len)
+@@ -967,7 +727,7 @@ sio_alsa_read(struct sio_hdl *sh, void *buf, size_t len)
return 0;
}
if (n != -EAGAIN) {
@@ -931,7 +948,7 @@ index 6107617..fb85434 100644
hdl->sio.eof = 1;
}
return 0;
-@@ -989,7 +781,7 @@ static size_t
+@@ -989,7 +749,7 @@ static size_t
sio_alsa_write(struct sio_hdl *sh, const void *buf, size_t len)
{
struct sio_alsa_hdl *hdl = (struct sio_alsa_hdl *)sh;
@@ -940,7 +957,7 @@ index 6107617..fb85434 100644
size_t todo;
if (len < hdl->obpf || hdl->opartial > 0) {
-@@ -1007,7 +799,7 @@ sio_alsa_write(struct sio_hdl *sh, const void *buf, size_t len)
+@@ -1007,7 +767,7 @@ sio_alsa_write(struct sio_hdl *sh, const void *buf, size_t len)
todo = len / hdl->obpf;
if (todo == 0)
return 0;
@@ -949,7 +966,16 @@ index 6107617..fb85434 100644
if (n == -EINTR)
continue;
if (n == -ESTRPIPE || n == -EPIPE) {
-@@ -1062,16 +854,14 @@ sio_alsa_onmove(struct sio_alsa_hdl *hdl)
+@@ -1015,7 +775,7 @@ sio_alsa_write(struct sio_hdl *sh, const void *buf, size_t len)
+ return 0;
+ }
+ if (n != -EAGAIN) {
+- DALSA("couldn't write data", n);
++ DALSA("couldn't write data", hdl->opcm);
+ hdl->sio.eof = 1;
+ }
+ return 0;
+@@ -1062,16 +822,14 @@ sio_alsa_onmove(struct sio_alsa_hdl *hdl)
static int
sio_alsa_nfds(struct sio_hdl *sh)
{
@@ -968,7 +994,7 @@ index 6107617..fb85434 100644
if (hdl->sio.eof)
return 0;
-@@ -1083,100 +873,86 @@ sio_alsa_pollfd(struct sio_hdl *sh, struct pollfd *pfd, int events)
+@@ -1083,100 +841,86 @@ sio_alsa_pollfd(struct sio_hdl *sh, struct pollfd *pfd, int events)
hdl->events &= ~POLLIN;
if (!hdl->sio.started)
hdl->events = 0;
@@ -1109,7 +1135,7 @@ index 6107617..fb85434 100644
hdl->sio.eof = 1;
return POLLHUP;
}
-@@ -1186,22 +962,23 @@ sio_alsa_revents(struct sio_hdl *sh, struct pollfd *pfd)
+@@ -1186,22 +930,23 @@ sio_alsa_revents(struct sio_hdl *sh, struct pollfd *pfd)
}
}
if (hdl->sio.mode & SIO_REC) {
@@ -1141,5 +1167,5 @@ index 6107617..fb85434 100644
return POLLHUP;
}
--
-2.35.1
+2.37.3
diff --git a/pkg/sndio/patch/0004-alsa-Add-support-for-s24le3-s24be3.patch b/pkg/sndio/patch/0004-alsa-Add-support-for-s24le3-s24be3.patch
@@ -0,0 +1,141 @@
+From 7472a43ccf2f5bae14cd736102daab8b4be0df31 Mon Sep 17 00:00:00 2001
+From: Michael Forney <mforney@mforney.org>
+Date: Mon, 31 Oct 2022 03:47:44 -0700
+Subject: [PATCH] alsa: Add support for s24le3/s24be3
+
+---
+ libsndio/sio_alsa.c | 41 +++++++++++++++++++++++++++++++++--------
+ 1 file changed, 33 insertions(+), 8 deletions(-)
+
+diff --git a/libsndio/sio_alsa.c b/libsndio/sio_alsa.c
+index e460bf6..9a65288 100644
+--- a/libsndio/sio_alsa.c
++++ b/libsndio/sio_alsa.c
+@@ -112,40 +112,60 @@ static enum pcm_format cap_fmts[] = {
+ */
+ static int
+ sio_alsa_fmttopar(struct sio_alsa_hdl *hdl, enum pcm_format fmt,
+- unsigned int *bits, unsigned int *sig, unsigned int *le)
++ unsigned int *bits, unsigned int *bps, unsigned int *sig, unsigned int *le)
+ {
+ switch (fmt) {
+ case PCM_FORMAT_S8:
+ *bits = 8;
++ *bps = 1;
+ *sig = 1;
++ *le = 1;
+ break;
+ case PCM_FORMAT_S16_LE:
+ *bits = 16;
++ *bps = 2;
+ *sig = 1;
+ *le = 1;
+ break;
+ case PCM_FORMAT_S16_BE:
+ *bits = 16;
++ *bps = 2;
++ *sig = 1;
++ *le = 0;
++ break;
++ case PCM_FORMAT_S24_3LE:
++ *bits = 24;
++ *bps = 3;
++ *sig = 1;
++ *le = 1;
++ break;
++ case PCM_FORMAT_S24_3BE:
++ *bits = 24;
++ *bps = 3;
+ *sig = 1;
+ *le = 0;
+ break;
+ case PCM_FORMAT_S24_LE:
+ *bits = 24;
++ *bps = 4;
+ *sig = 1;
+ *le = 1;
+ break;
+ case PCM_FORMAT_S24_BE:
+ *bits = 24;
++ *bps = 4;
+ *sig = 1;
+ *le = 0;
+ break;
+ case PCM_FORMAT_S32_LE:
+ *bits = 32;
++ *bps = 4;
+ *sig = 1;
+ *le = 1;
+ break;
+ case PCM_FORMAT_S32_BE:
+ *bits = 32;
++ *bps = 4;
+ *sig = 1;
+ *le = 0;
+ break;
+@@ -163,13 +183,17 @@ sio_alsa_fmttopar(struct sio_alsa_hdl *hdl, enum pcm_format fmt,
+ */
+ static void
+ sio_alsa_enctofmt(struct sio_alsa_hdl *hdl, enum pcm_format *rfmt,
+- unsigned int bits, unsigned int sig, unsigned int le)
++ unsigned int bits, unsigned int bps, unsigned int sig, unsigned int le)
+ {
++ if (bps == ~0U)
++ bps = SIO_BPS(bits);
+ if (le == ~0U)
+ le = SIO_LE_NATIVE;
+ if (bits == 8)
+ *rfmt = PCM_FORMAT_S8;
+- else if (bits == 24)
++ else if (bits == 24 && bps == 3)
++ *rfmt = le ? PCM_FORMAT_S24_3LE : PCM_FORMAT_S24_3BE;
++ else if (bits == 24 && bps == 4)
+ *rfmt = le ? PCM_FORMAT_S24_LE : PCM_FORMAT_S24_BE;
+ else if (bits == 32)
+ *rfmt = le ? PCM_FORMAT_S32_LE : PCM_FORMAT_S32_BE;
+@@ -450,6 +474,7 @@ sio_alsa_setpar_hw(struct pcm *pcm, struct pcm_params *par,
+ static enum pcm_format fmts[] = {
+ PCM_FORMAT_S32_LE, PCM_FORMAT_S32_BE,
+ PCM_FORMAT_S24_LE, PCM_FORMAT_S24_BE,
++ PCM_FORMAT_S24_3LE, PCM_FORMAT_S24_3BE,
+ PCM_FORMAT_S16_LE, PCM_FORMAT_S16_BE,
+ PCM_FORMAT_S8
+ };
+@@ -582,9 +607,9 @@ sio_alsa_getcap(struct sio_hdl *sh, struct sio_cap *cap)
+ for (i = 0; i < CAP_NFMTS; i++) {
+ sio_alsa_fmttopar(hdl, cap_fmts[i],
+ &cap->enc[i].bits,
++ &cap->enc[i].bps,
+ &cap->enc[i].sig,
+ &cap->enc[i].le);
+- cap->enc[i].bps = SIO_BPS(cap->enc[0].bits);
+ cap->enc[i].msb = 0;
+ }
+ for (i = 0; i < CAP_NRATES; i++) {
+@@ -620,7 +645,8 @@ sio_alsa_setpar(struct sio_hdl *sh, struct sio_par *par)
+ struct sio_alsa_hdl *hdl = (struct sio_alsa_hdl *)sh;
+ struct pcm_config icfg, ocfg;
+
+- sio_alsa_enctofmt(hdl, &icfg.format, par->bits, par->sig, par->le);
++ sio_alsa_enctofmt(hdl, &icfg.format, par->bits, par->bps, par->sig,
++ par->le);
+ icfg.rate = (par->rate == ~0U) ? 48000 : par->rate;
+ if (par->appbufsz != ~0U) {
+ icfg.period_size = (par->round != ~0U) ?
+@@ -674,11 +700,10 @@ sio_alsa_setpar(struct sio_hdl *sh, struct sio_par *par)
+ hdl->sio.eof = 1;
+ return 0;
+ }
+- if (!sio_alsa_fmttopar(hdl, icfg.format,
+- &hdl->par.bits, &hdl->par.sig, &hdl->par.le))
++ if (!sio_alsa_fmttopar(hdl, icfg.format, &hdl->par.bits, &hdl->par.bps,
++ &hdl->par.sig, &hdl->par.le))
+ return 0;
+ hdl->par.msb = 0;
+- hdl->par.bps = SIO_BPS(hdl->par.bits);
+ hdl->par.rate = ocfg.rate;
+ hdl->par.round = ocfg.period_size;
+ hdl->par.bufsz = ocfg.period_size * ocfg.period_count;
+--
+2.37.3
+
diff --git a/pkg/sndio/ver b/pkg/sndio/ver
@@ -1 +1 @@
-1.9.0 r0
+1.9.0 r1