ftp.nice.ch/pub/next/unix/audio/cmusic.bs.N.tar.gz#/src/cmusic/ug.sah.c

This is ug.sah.c in view mode; [Download] [Up]

/* Sample and Hold Generator */

#include "ug.head.h"

#define	IN	1
#define	PERIOD	2
#define	HELD	3
#define	COUNT	4

sah

UGHEAD{
    UGINIT;
    UGLOOP{
	if(VAL(COUNT) < 0.0){
	    VAL(COUNT) = VAL(PERIOD);
	    if(VAL(COUNT) < 0.0)VAL(COUNT) = 0.0;
	    VAL(HELD) = VAL(IN);
	}
	VAL(OUT) = VAL(HELD);
	VAL(COUNT) -= 1.0;
	UGEND(0);
    }
}

These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.