diff --git a/hosts/daisy/examples/bluemchen/dusting/src/signaletic-nehcmeulb-dusting.cpp b/hosts/daisy/examples/bluemchen/dusting/src/signaletic-nehcmeulb-dusting.cpp index 77b7d6f..9af8929 100644 --- a/hosts/daisy/examples/bluemchen/dusting/src/signaletic-nehcmeulb-dusting.cpp +++ b/hosts/daisy/examples/bluemchen/dusting/src/signaletic-nehcmeulb-dusting.cpp @@ -31,10 +31,10 @@ struct sig_daisy_FilteredCVIn* durationKnob; struct sig_daisy_AudioIn* clockIn; struct sig_dsp_ClockFreqDetector* clockFrequency; struct sig_dsp_BinaryOp* densityClockSum; -struct cc_sig_DustGate* cvDustGate; +struct sig_dsp_DustGate* cvDustGate; struct sig_dsp_BinaryOp* audioDensity; struct sig_dsp_ConstantValue* audioDensityScale; -struct cc_sig_DustGate* audioDustGate; +struct sig_dsp_DustGate* audioDustGate; struct sig_daisy_CVOut* dustCVOut; struct sig_daisy_CVOut* clockCVOut; struct sig_daisy_AudioOut* leftAudioOut; @@ -100,7 +100,7 @@ void buildGraph(struct sig_SignalContext* context, struct sig_Status* status) { densityClockSum->inputs.left = clockFrequency->outputs.main; densityClockSum->inputs.right = densityKnob->outputs.main; - cvDustGate = cc_sig_DustGate_new(&allocator, context); + cvDustGate = sig_dsp_DustGate_new(&allocator, context); sig_List_append(&signals, cvDustGate, status); cvDustGate->inputs.density = densityClockSum->outputs.main; cvDustGate->inputs.durationPercentage = durationKnob->outputs.main; @@ -124,7 +124,7 @@ void buildGraph(struct sig_SignalContext* context, struct sig_Status* status) { audioDensity->inputs.left = densityClockSum->outputs.main; audioDensity->inputs.right = audioDensityScale->outputs.main; - audioDustGate = cc_sig_DustGate_new(&allocator, context); + audioDustGate = sig_dsp_DustGate_new(&allocator, context); sig_List_append(&signals, audioDustGate, status); audioDustGate->parameters.bipolar = 1.0f; audioDustGate->inputs.density = audioDensity->outputs.main; diff --git a/libsignaletic/include/libsignaletic.h b/libsignaletic/include/libsignaletic.h index 2a3432c..a4f596f 100644 --- a/libsignaletic/include/libsignaletic.h +++ b/libsignaletic/include/libsignaletic.h @@ -1414,19 +1414,19 @@ void sig_dsp_TimedGate_destroy(struct sig_Allocator* allocator, struct sig_dsp_TimedGate* self); -struct cc_sig_DustGate_Inputs { +struct sig_dsp_DustGate_Inputs { float_array_ptr density; float_array_ptr durationPercentage; }; -struct cc_sig_DustGate_Parameters { +struct sig_dsp_DustGate_Parameters { float bipolar; }; -struct cc_sig_DustGate { +struct sig_dsp_DustGate { struct sig_dsp_Signal signal; - struct cc_sig_DustGate_Inputs inputs; - struct cc_sig_DustGate_Parameters parameters; + struct sig_dsp_DustGate_Inputs inputs; + struct sig_dsp_DustGate_Parameters parameters; struct sig_dsp_Signal_SingleMonoOutput outputs; struct sig_dsp_Dust* dust; struct sig_dsp_BinaryOp* reciprocalDensity; @@ -1434,16 +1434,16 @@ struct cc_sig_DustGate { struct sig_dsp_TimedGate* gate; }; -struct cc_sig_DustGate* cc_sig_DustGate_new(struct sig_Allocator* allocator, +struct sig_dsp_DustGate* sig_dsp_DustGate_new(struct sig_Allocator* allocator, struct sig_SignalContext* context); -void cc_sig_DustGate_init(struct cc_sig_DustGate* self, +void sig_dsp_DustGate_init(struct sig_dsp_DustGate* self, struct sig_SignalContext* context); -void cc_sig_DustGate_generate(void* signal); +void sig_dsp_DustGate_generate(void* signal); -void cc_sig_DustGate_destroy(struct sig_Allocator* allocator, - struct cc_sig_DustGate* self); +void sig_dsp_DustGate_destroy(struct sig_Allocator* allocator, + struct sig_dsp_DustGate* self); struct sig_dsp_ClockFreqDetector_Inputs { diff --git a/libsignaletic/src/libsignaletic.c b/libsignaletic/src/libsignaletic.c index b0aa0ca..48b3d57 100644 --- a/libsignaletic/src/libsignaletic.c +++ b/libsignaletic/src/libsignaletic.c @@ -44,6 +44,8 @@ inline float sig_clamp(float value, float min, float max) { return sig_fminf(sig_fmaxf(value, min), max); } +// TODO: Implement a fast fmodf +// See: https://github.com/electro-smith/DaisySP/blob/0cc02b37579e3619efde73be49a1fa01ffee5cf6/Source/Utility/dsp.h#L89-L95 // TODO: Unit tests inline float sig_flooredfmodf(float numer, float denom) { float remain = fmodf(numer, denom); @@ -1789,10 +1791,10 @@ void sig_dsp_TimedGate_destroy(struct sig_Allocator* allocator, } -struct cc_sig_DustGate* cc_sig_DustGate_new(struct sig_Allocator* allocator, +struct sig_dsp_DustGate* sig_dsp_DustGate_new(struct sig_Allocator* allocator, struct sig_SignalContext* context) { - struct cc_sig_DustGate* self = sig_MALLOC(allocator, - struct cc_sig_DustGate); + struct sig_dsp_DustGate* self = sig_MALLOC(allocator, + struct sig_dsp_DustGate); self->reciprocalDensity = sig_dsp_Div_new(allocator, context); self->reciprocalDensity->inputs.left = context->unity->outputs.main; @@ -1808,22 +1810,22 @@ struct cc_sig_DustGate* cc_sig_DustGate_new(struct sig_Allocator* allocator, self->gate->inputs.duration = self->densityDurationMultiplier->outputs.main; - cc_sig_DustGate_init(self, context); + sig_dsp_DustGate_init(self, context); self->outputs.main = self->gate->outputs.main; return self; } -void cc_sig_DustGate_init(struct cc_sig_DustGate* self, +void sig_dsp_DustGate_init(struct sig_dsp_DustGate* self, struct sig_SignalContext* context) { - sig_dsp_Signal_init(self, context, *cc_sig_DustGate_generate); + sig_dsp_Signal_init(self, context, *sig_dsp_DustGate_generate); sig_CONNECT_TO_SILENCE(self, density, context); sig_CONNECT_TO_SILENCE(self, durationPercentage, context); }; -void cc_sig_DustGate_generate(void* signal) { - struct cc_sig_DustGate* self = (struct cc_sig_DustGate*) signal; +void sig_dsp_DustGate_generate(void* signal) { + struct sig_dsp_DustGate* self = (struct sig_dsp_DustGate*) signal; // Bind all parameters (remove this when we have change events). self->dust->inputs.density = self->inputs.density; @@ -1842,8 +1844,8 @@ void cc_sig_DustGate_generate(void* signal) { } -void cc_sig_DustGate_destroy(struct sig_Allocator* allocator, - struct cc_sig_DustGate* self) { +void sig_dsp_DustGate_destroy(struct sig_Allocator* allocator, + struct sig_dsp_DustGate* self) { sig_dsp_TimedGate_destroy(allocator, self->gate); sig_dsp_Mul_destroy(allocator, self->densityDurationMultiplier);