Steve Longerbeam wrote:
Jaroslav Kysela wrote:
<snip>
Please, resend your patch with this modification. Thanks.
ok, here it is again, with CARD/DEV defaults moved out of alsa.conf and into dsnoop_softvol.conf.
I realized I wasn't handling max_dB < 0 (svol->zero_dB_val = 0) in all cases.
Patch attached again along with an interdiff from my last patch.
Steve
diff -u b/src/pcm/pcm_softvol.c b/src/pcm/pcm_softvol.c --- b/src/pcm/pcm_softvol.c Fri May 04 09:22:49 2007 -0700 +++ b/src/pcm/pcm_softvol.c Fri May 04 10:25:39 2007 -0700 @@ -594,14 +594,17 @@ { int err; int i; - + unsigned int def_val; + err = snd_ctl_elem_add_integer(svol->ctl, &cinfo->id, count, 0, svol->max_val, 0); if (err < 0) return err; add_tlv_info(svol, cinfo); - /* set zero dB value as default */ + /* set zero dB value as default, or max_val if + there is no 0 dB setting */ + def_val = svol->zero_dB_val ? svol->zero_dB_val : svol->max_val; for (i = 0; i < count; i++) - svol->elem.value.integer.value[i] = svol->zero_dB_val; + svol->elem.value.integer.value[i] = def_val; return snd_ctl_elem_write(svol->ctl, &svol->elem); }
@@ -706,7 +709,8 @@ double v = (pow(10.0, db / 20.0) * (double)(1 << VOL_SCALE_SHIFT)); svol->dB_value[i] = (unsigned int)v; } - svol->dB_value[svol->zero_dB_val] = 65535; + if (svol->zero_dB_val) + svol->dB_value[svol->zero_dB_val] = 65535; #else SNDERR("Cannot handle the given dB range and resolution"); return -EINVAL;