FreeBSD/contrib/ntp/ntpd/refclock_wwv.c
/*
 * wwv_gain - adjust codec gain
 *
 * This routine is called at the end of each second. During the second
 * the number of signal clips above the MAXAMP threshold (6000). If
 * there are no clips, the gain is bumped up; if there are more than
 * MAXCLP clips (100), it is bumped down. The decoder is relatively
 * insensitive to amplitude, so this crudity works just peachy. The
 * routine also jiggles the input port and selectively mutes the
 * monitor.
 */
adjust codec gain
This routine is called at the end of each second. During the second
the number of signal clips above the MAXAMP threshold (6000). If
there are no clips, the gain is bumped up; if there are more than
MAXCLP clips (100), it is bumped down. The decoder is relatively
insensitive to amplitude, so this crudity works just peachy. The
routine also jiggles the input port and selectively mutes the
monitor.
adjust codec gain This routine is called at the end of each second . During the second the number of signal clips above the MAXAMP threshold ( 6000 ) . If there are no clips the gain is bumped up ; if there are more than MAXCLP clips ( 100 ) it is bumped down . The decoder is relatively insensitive to amplitude so this crudity works just peachy . The routine also jiggles the input port and selectively mutes the monitor .
static void
wwv_gain(
	struct peer *peer	
	)
{
	struct refclockproc *pp;
	struct wwvunit *up;
	pp = peer->procptr;
	up = pp->unitptr;
	if (up->clipcnt == 0) {
		up->gain += 4;
		if (up->gain > MAXGAIN)
			up->gain = MAXGAIN;
	} else if (up->clipcnt > MAXCLP) {
		up->gain -= 4;
		if (up->gain < 0)
			up->gain = 0;
	}
	audio_gain(up->gain, up->mongain, up->port);
	up->clipcnt = 0;
#if DEBUG
	if (debug > 1)
		audio_show();
#endif
}
static void wwv_gain ( struct peer * peer ) { struct refclockproc * pp ; struct wwvunit * up ; pp = peer -> procptr ; up = pp -> unitptr ; if ( up -> clipcnt == 0 ) { up -> gain += 4 ; if ( up -> gain > MAXGAIN ) up -> gain = MAXGAIN ; } else if ( up -> clipcnt > MAXCLP ) { up -> gain -= 4 ; if ( up -> gain < 0 ) up -> gain = 0 ; } audio_gain ( up -> gain , up -> mongain , up -> port ) ; up -> clipcnt = 0 ; #if DEBUG if ( debug > 1 ) audio_show ( ) ; #endif }
wwv_gain - adjust codec gain
 This routine is called at the end of each second.
wwv_gain - adjust codec gain This routine is called at the end of each second .
/* peer structure pointer */ /*
	 * Apparently, the codec uses only the high order bits of the
	 * gain control field. Thus, it may take awhile for changes to
	 * wiggle the hardware bits.
	 */