shithub: neindaw

ref: e71361d5f47f408ca3192ecdf2a44de48c0aeef9
dir: /fs.h/

View raw version
typedef struct Aux Aux;
typedef struct Auxdsp Auxdsp;
typedef struct Fs Fs;
typedef struct State State;

typedef enum {
	Xclone,
	Xctl,
	Xmetadata,

	Xdsp,
	Xdspctl,
	Xdspdata,

	Xui,
	Xuictl,
	Xuimeta,
}Auxtype;

struct UI;

struct Aux {
	Auxtype type;
	int id;
	int ctl;
	int data;
	int metadata;

	struct UI *ui;
	State *state;
};

struct Fs {
	Srv srv;
	char *metadata;

	struct {
		Auxdsp *(*new)(void);
		void (*free)(Auxdsp *dsp);
		void (*reset)(Auxdsp *dsp);

		/* optional, atm this one is needed only for autovoicing to work */
		Auxdsp *(*clone)(Auxdsp *dsp);
		/* optional, for autovoicing. this is ugly */
		void *(*state)(Auxdsp *dsp, int *sz);

		/* optional, n is always modulo number of channels */
		int (*read)(Auxdsp *dsp, float *b, int n);

		/* optional, n is always modulo number of channels */
		int (*write)(Auxdsp *dsp, float *b, int n);
	}dsp;
};

struct State {
	float *mixer;
	int mixersz;

	Auxdsp **voice;
	int nvoice;

	int silent; /* that's about the first voice only */
};

void fsinit(void *fs);