summaryrefslogtreecommitdiffstats
path: root/sys/dev/sound
diff options
context:
space:
mode:
authorthompsa <thompsa@FreeBSD.org>2009-11-20 09:00:38 +0000
committerthompsa <thompsa@FreeBSD.org>2009-11-20 09:00:38 +0000
commit5e7f05ee90c717a559558c628acf8bde14221b60 (patch)
tree7788594fe3c593da0468b436dd14fe06a4330707 /sys/dev/sound
parentc3a431d7190b3a22732569a0a5eb670c4472448c (diff)
downloadFreeBSD-src-5e7f05ee90c717a559558c628acf8bde14221b60.zip
FreeBSD-src-5e7f05ee90c717a559558c628acf8bde14221b60.tar.gz
remove volume alignment (was previously not correctly implemented)
Submitted by: HPS Reported by: Jaakko Heinonen
Diffstat (limited to 'sys/dev/sound')
-rw-r--r--sys/dev/sound/usb/uaudio.c20
1 files changed, 7 insertions, 13 deletions
diff --git a/sys/dev/sound/usb/uaudio.c b/sys/dev/sound/usb/uaudio.c
index 2ac8766..7701c3c 100644
--- a/sys/dev/sound/usb/uaudio.c
+++ b/sys/dev/sound/usb/uaudio.c
@@ -118,7 +118,6 @@ struct uaudio_mixer_node {
int32_t maxval;
#define MIX_MAX_CHAN 8
int32_t wValue[MIX_MAX_CHAN]; /* using nchan */
- uint32_t mod; /* modulus */
uint32_t mul;
uint32_t ctl;
@@ -1318,6 +1317,11 @@ uaudio_chan_init(struct uaudio_softc *sc, struct snd_dbuf *b,
ch->pcm_cap.minspeed = ch->sample_rate;
ch->pcm_cap.maxspeed = ch->sample_rate;
+ /* setup mutex and PCM channel */
+
+ ch->pcm_ch = c;
+ ch->pcm_mtx = c->lock;
+
if (ch->p_asf1d->bNrChannels >= 2)
ch->pcm_cap.fmtlist[0] =
SND_FORMAT(ch->p_fmt->freebsd_fmt, 2, 0);
@@ -1391,8 +1395,6 @@ uaudio_chan_init(struct uaudio_softc *sc, struct snd_dbuf *b,
ch->start = ch->buf;
ch->end = ch->buf + buf_size;
ch->cur = ch->buf;
- ch->pcm_ch = c;
- ch->pcm_mtx = c->lock;
ch->pcm_buf = b;
if (ch->pcm_mtx == NULL) {
@@ -1570,9 +1572,7 @@ uaudio_mixer_add_ctl(struct uaudio_softc *sc, struct uaudio_mixer_node *mc)
if (mc->type == MIX_ON_OFF) {
mc->minval = 0;
mc->maxval = 1;
- mc->mod = 1;
} else if (mc->type == MIX_SELECTOR) {
- mc->mod = 1;
} else {
/* determine min and max values */
@@ -1600,11 +1600,8 @@ uaudio_mixer_add_ctl(struct uaudio_softc *sc, struct uaudio_mixer_node *mc)
/* compute value alignment */
res = uaudio_mixer_get(sc->sc_udev, GET_RES, mc);
- if (res == 0)
- res = 1;
- mc->mod = mc->mul / res;
- if (mc->mod == 0)
- mc->mod = 1;
+
+ DPRINTF("Resolution = %d\n", (int)res);
}
uaudio_mixer_add_ctl_sub(sc, mc);
@@ -3097,9 +3094,6 @@ uaudio_mixer_bsd2value(struct uaudio_mixer_node *mc, int32_t val)
/* compute actual volume */
val = (val * mc->mul) / 255;
- /* align volume level */
- val = val - (val % mc->mod);
-
/* add lower offset */
val = val + mc->minval;
OpenPOWER on IntegriCloud