shithub: neindaw

ref: 79bf1a7b1c60aa3efc5c6fad853294eba8c88d2f
dir: /dsp/arch.c/

View raw version
/* mydsp Plan 9 C architecture for Faust. */

#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>>

static mydsp *clonemydsp(mydsp *dsp) {
	return memmove(newmydsp(), dsp, sizeof(*dsp));
}

static void *statemydsp(mydsp *dsp, int *sz) {
	*sz = sizeof(*dsp);
	return dsp;
}

#define DSP mydsp

#include "dspf.h"

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

void *
class_init(int rate)
{
	classInitmydsp(rate);
	return &dspf;
}