ref: 503d29c4e565dcc5c36c1dee563913147dd0e85d
dir: /arch.c/
/*
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);
}