shithub: neindaw

Download patch

ref: 0b84baedbd43d85ef11794026326ad6ce44e3e38
parent: 99b0f582fbf5ce5af8c54baa1992215d316dc576
author: Sigrid Haflínudóttir <[email protected]>
date: Wed Mar 18 16:30:26 EDT 2020

dsp: update build to work on OpenBSD

--- a/dsp/dsp2c
+++ b/dsp/dsp2c
@@ -7,10 +7,10 @@
 	out=$(echo $i | sed 's/dsp$/c/')
 	faust -lang c -a arch.c -cn $class $@ $i -o "$out"
 	# in C () is not the same as (void) so fix it
-	sed 's/new\([^(]*\)() /new\1(void) /' -i "$out"
+	sed -e 's/new\([^(]*\)() /new\1(void) /' -i "$out"
 	# mark "dsp", "sample_rate", and "inputs" args as USED
-	sed 's/'$class'[A-Z0-9]*\* dsp.*{/&\n\tUSED(dsp);/g' -i "$out"
-	sed 's/ \(sample_rate\|inputs\).*{/&\n\tUSED(\1);/g' -i "$out"
-	# empty structs: add a dummy field
-	sed -z 's/typedef struct {\n\+}/typedef struct {\n      int dummy;\n}/g' -i "$out"
+	sed -e 's/'$class'[A-Z0-9]*\* dsp.*{/&\
+	USED(dsp);/g' -i "$out"
+	sed -E -e 's/ (sample_rate|inputs).*{/&\
+	USED(\1);/g' -i "$out"
 done
--- a/dsp/kick_drum.c
+++ b/dsp/kick_drum.c
@@ -1,6 +1,6 @@
 /* ------------------------------------------------------------
 name: "Kick Drum"
-Code generated with Faust 2.21.5 (https://faust.grame.fr)
+Code generated with Faust 2.23.2 (https://faust.grame.fr)
 Compilation options: -lang c -scal -ftz 0
 ------------------------------------------------------------ */
 
@@ -113,8 +113,8 @@
 	float fConst0;
 	float fConst1;
 	FAUSTFLOAT fHslider1;
-	FAUSTFLOAT fHslider2;
 	FAUSTFLOAT fCheckbox0;
+	FAUSTFLOAT fHslider2;
 	FAUSTFLOAT fHslider3;
 	int iRec2[2];
 	FAUSTFLOAT fHslider4;
@@ -141,7 +141,7 @@
 	m->declare(m->metaInterface, "envelopes.lib/copyright", "GRAME");
 	m->declare(m->metaInterface, "envelopes.lib/license", "LGPL with exception");
 	m->declare(m->metaInterface, "envelopes.lib/name", "Faust Envelope Library");
-	m->declare(m->metaInterface, "envelopes.lib/version", "0.0");
+	m->declare(m->metaInterface, "envelopes.lib/version", "0.1");
 	m->declare(m->metaInterface, "filename", "kick_drum.dsp");
 	m->declare(m->metaInterface, "group", "Synthesis");
 	m->declare(m->metaInterface, "maths.lib/author", "GRAME");
@@ -148,10 +148,12 @@
 	m->declare(m->metaInterface, "maths.lib/copyright", "GRAME");
 	m->declare(m->metaInterface, "maths.lib/license", "LGPL with exception");
 	m->declare(m->metaInterface, "maths.lib/name", "Faust Math Library");
-	m->declare(m->metaInterface, "maths.lib/version", "2.1");
+	m->declare(m->metaInterface, "maths.lib/version", "2.2");
 	m->declare(m->metaInterface, "name", "Kick Drum");
 	m->declare(m->metaInterface, "oscillators.lib/name", "Faust Oscillator Library");
 	m->declare(m->metaInterface, "oscillators.lib/version", "0.0");
+	m->declare(m->metaInterface, "platform.lib/name", "Generic Platform Library");
+	m->declare(m->metaInterface, "platform.lib/version", "0.1");
 }
 
 int getSampleRateKickDrum(KickDrum* dsp) {
@@ -207,8 +209,8 @@
 	dsp->fHslider0 = (FAUSTFLOAT)1.0f;
 	dsp->fButton0 = (FAUSTFLOAT)0.0f;
 	dsp->fHslider1 = (FAUSTFLOAT)100.0f;
-	dsp->fHslider2 = (FAUSTFLOAT)-5.0f;
 	dsp->fCheckbox0 = (FAUSTFLOAT)0.0f;
+	dsp->fHslider2 = (FAUSTFLOAT)-5.0f;
 	dsp->fHslider3 = (FAUSTFLOAT)0.001f;
 	dsp->fHslider4 = (FAUSTFLOAT)0.001f;
 	dsp->fHslider5 = (FAUSTFLOAT)0.001f;
@@ -307,7 +309,7 @@
 	float fSlow0 = (float)dsp->fHslider0;
 	float fSlow1 = (float)dsp->fButton0;
 	float fSlow2 = (float)dsp->fHslider1;
-	float fSlow3 = ((float)dsp->fHslider2 * (float)dsp->fCheckbox0);
+	float fSlow3 = ((float)dsp->fCheckbox0 * (float)dsp->fHslider2);
 	float fSlow4 = max(1.0f, (dsp->fConst0 * (float)dsp->fHslider3));
 	float fSlow5 = (1.0f / fSlow4);
 	float fSlow6 = (1.0f / max(1.0f, (dsp->fConst0 * (float)dsp->fHslider4)));
--- a/dsp/mkfile
+++ b/dsp/mkfile
@@ -19,7 +19,7 @@
 </sys/src/cmd/mkmany
 
 %.c: %.dsp
-	os -d `{../osdir} nix-shell ../nix/shell.nix --run './dsp2c '^$"prereq || \
+	os -d `{../osdir} ./dsp2c $"prereq || \
 	{ echo $target needs to be regenerated with "./dsp2c $prereq"; exit 1 }
 
 $BIN/%:	$O.%