commit - 0f4e0bbca959251f256a285d829b6517430e7401
commit + 7e15a2c893e203a68e2edce3688ffbecb938cd8e
blob - c4104284c0719a3b60be1879dd6c8dd397bb8b80
blob + 0b9e6dd947afa77208f13d812a1b3da2d1f5b74a
--- cw.c
+++ cw.c
void
cwinit(void)
{
+ /* get config from the environment */
+ getenvpct("CW_AMPLITUDE", &);
+ getenvnum("CW_ATTACK", "ms", &rise);
+ fall = rise; /* default */
+ getenvnum("CW_DECAY", "ms", &fall);
+ getenvshape("CW_ATTACK_SHAPE", &risefun);
+ getenvshape("CW_DECAY_SHAPE", &fallfun);
+
+ /*
+ * These two parameters are supposed to account for the fact that the
+ * low end of an envelope is inaudible while the high end is already at
+ * full volume. So where does silence end and beep begin?
+ *
+ * The 'lowtime' variable represents time we consider spent in the
+ * inaudible portion of an attack/decay ramp. Conversely, 'hightime'
+ * represents the rest we consider "high" (audible) in attack/decay.
+ */
+ lowtime = (rise + fall) / 2;
+ hightime = rise + fall - lowtime;
+
/* open sound device and negotiate parameters */
hdl = sio_open(SIO_DEVANY, SIO_PLAY, 0);
if (hdl == NULL)
if ((buf = malloc(bufsz * framesz)) == NULL)
err(1, "malloc");
-
- /* get config from the environment */
- getenvpct("CW_AMPLITUDE", &);
- getenvnum("CW_ATTACK", "ms", &rise);
- fall = rise; /* default */
- getenvnum("CW_DECAY", "ms", &fall);
- getenvshape("CW_ATTACK_SHAPE", &risefun);
- getenvshape("CW_DECAY_SHAPE", &fallfun);
-
- /*
- * These two parameters are supposed to account for the fact that the
- * low end of an envelope is inaudible while the high end is already at
- * full volume. So where does silence end and beep begin?
- *
- * The 'lowtime' variable represents time we consider spent in the
- * inaudible portion of an attack/decay ramp. Conversely, 'hightime'
- * represents the rest we consider "high" (audible) in attack/decay.
- */
- lowtime = (rise + fall) / 2;
- hightime = rise + fall - lowtime;
-
/* register callback to track our position in the output */
sio_onmove(hdl, cb_onmove, NULL);
}