shithub: neindaw

Download patch

ref: 663bc67e12efaccd4109068b05f8e6d671b7bd23
parent: 1330d1fff8e87caf7a85e4d32c17feb965484bae
author: Sigrid Solveig Haflínudóttir <[email protected]>
date: Wed Aug 25 19:29:15 EDT 2021

export rate from dsp up to ctl

--- a/ay/ay.c
+++ b/ay/ay.c
@@ -179,7 +179,7 @@
 extern File *uif;
 
 static Auxdsp *
-dspnew(int *numin, int *numout)
+dspnew(int *numin, int *numout, int *orate)
 {
 	struct Auxdsp *dsp;
 	UI *ui;
@@ -195,6 +195,7 @@
 
 	*numin = 0;
 	*numout = 1;
+	*orate = rate;
 
 	if ((dsp = malloc(sizeof(*dsp))) == nil)
 		return nil;
--- a/dsp/main.c
+++ b/dsp/main.c
@@ -54,7 +54,7 @@
 }
 
 static Auxdsp *
-dspnew(int *numin, int *numout)
+dspnew(int *numin, int *numout, int *orate)
 {
 	Auxdsp *dsp;
 
@@ -63,6 +63,7 @@
 	dspf->build_ui(dsp->dsp, &uiglue);
 	*numin = dspf->num_in(dsp->dsp);
 	*numout = dspf->num_out(dsp->dsp);
+	*orate = rate;
 
 	return dsp;
 }
--- a/fs.c
+++ b/fs.c
@@ -94,7 +94,7 @@
 
 	uif = f;
 	o->state = uis = calloc(1, sizeof(State));
-	v = newvoice(o->state, fs->dsp.new(&o->numin, &o->numout));
+	v = newvoice(o->state, fs->dsp.new(&o->numin, &o->numout, &o->rate));
 	v->state = Vsilent;
 	closefile(f);
 
@@ -247,7 +247,7 @@
 		break;
 	case Xdspctl:
 		o = auxtype2obj(&a->type);
-		sprint(b, "numin\t%d\nnumout\t%d\n", o->numin, o->numout);
+		sprint(b, "numin\t%d\nnumout\t%d\trate\t%d\n", o->numin, o->numout, o->rate);
 		readstr(r, b);
 		respond(r, nil);
 		break;
--- a/fs.h
+++ b/fs.h
@@ -37,6 +37,7 @@
 
 	int numin;
 	int numout;
+	int rate;
 
 	struct UI *ui;
 	State *state;
@@ -47,7 +48,7 @@
 	char *metadata;
 
 	struct {
-		Auxdsp *(*new)(int *numin, int *numout);
+		Auxdsp *(*new)(int *numin, int *numout, int *rate);
 		void (*free)(Auxdsp *dsp);
 		void (*reset)(Auxdsp *dsp);