shithub: neindaw

ref: 0acd2208855ac7e5c1e2499614c50828a1ace0de
dir: /arch.c/

View raw version
/*
Plan 9 C architecture for Faust.  This provides a file system with UI
elements exported as files and directories.
*/

#include <u.h>
#include <libc.h>
#include "uiglue.h"

#define max(x,y) (((x) > (y)) ? (x) : (y))
#define min(x,y) (((x) < (y)) ? (x) : (y))

<<includeIntrinsic>>
<<includeclass>>

#define DSP mydsp

#include "dspf.h"

static DSPf dspf = {
	.new = newmydsp,
	.init = instanceInitmydsp,
	.delete = deletemydsp,
	.metadata = metadatamydsp,
	.num_in = getNumInputsmydsp,
	.num_out = getNumOutputsmydsp,
	.clear = instanceClearmydsp,
	.reset_ui = instanceResetUserInterfacemydsp,
	.build_ui = buildUserInterfacemydsp,
	.compute = computemydsp,
};

static void
usage(char *prog)
{
	print("usage: %s [-s SAMPLE_RATE]\n", prog);
	exits("usage");
}

void
main(int argc, char **argv)
{
	int sample_rate;

	sample_rate = 44100;
	ARGBEGIN{
	case 's':
		sample_rate = atoi(ARGF());
		break;
	default:
		usage(argv[0]);
	}ARGEND

	classInitmydsp(sample_rate);
	build_fs(&dspf);

	exits(nil);
}