shithub: neindaw

Download patch

ref: 5cf2a66d5a71fad0128b2f9d0b088cea743c0d60
parent: c951f1864a755bb827da3031c03d9578b648b7a6
author: Sigrid Haflínudóttir <[email protected]>
date: Sun Mar 22 15:37:13 EDT 2020

dsp: add "clone" method, will need that for polyphony

--- a/dsp/arch.c
+++ b/dsp/arch.c
@@ -10,6 +10,10 @@
 <<includeIntrinsic>>
 <<includeclass>>
 
+static mydsp *clonemydsp(mydsp *dsp) {
+	return memmove(newmydsp(), dsp, sizeof(*dsp));
+}
+
 #define DSP mydsp
 
 #include "dspf.h"
@@ -16,6 +20,7 @@
 
 static DSPf dspf = {
 	.new = newmydsp,
+	.clone = clonemydsp,
 	.init = instanceInitmydsp,
 	.delete = deletemydsp,
 	.metadata = metadatamydsp,
--- a/dsp/dspf.h
+++ b/dsp/dspf.h
@@ -1,5 +1,6 @@
 typedef struct {
 	DSP *(*new)(void);
+	DSP *(*clone)(DSP *dsp);
 	void (*init)(DSP *dsp, int sample_rate);
 	void (*delete)(DSP *dsp);
 	void (*metadata)(MetaGlue *glue);
--- a/dsp/kick_drum.c
+++ b/dsp/kick_drum.c
@@ -338,6 +338,10 @@
 }
 #endif
 
+static KickDrum *cloneKickDrum(KickDrum *dsp) {
+	return memmove(newKickDrum(), dsp, sizeof(*dsp));
+}
+
 #define DSP KickDrum
 
 #include "dspf.h"
@@ -344,6 +348,7 @@
 
 static DSPf dspf = {
 	.new = newKickDrum,
+	.clone = cloneKickDrum,
 	.init = instanceInitKickDrum,
 	.delete = deleteKickDrum,
 	.metadata = metadataKickDrum,