Skip to content

Commit 5c9de1e

Browse files
committed
Moves DustGate into the sig_dsp namespace.
1 parent 6ab885c commit 5c9de1e

File tree

3 files changed

+26
-24
lines changed

3 files changed

+26
-24
lines changed

hosts/daisy/examples/bluemchen/dusting/src/signaletic-nehcmeulb-dusting.cpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,10 @@ struct sig_daisy_FilteredCVIn* durationKnob;
3131
struct sig_daisy_AudioIn* clockIn;
3232
struct sig_dsp_ClockFreqDetector* clockFrequency;
3333
struct sig_dsp_BinaryOp* densityClockSum;
34-
struct cc_sig_DustGate* cvDustGate;
34+
struct sig_dsp_DustGate* cvDustGate;
3535
struct sig_dsp_BinaryOp* audioDensity;
3636
struct sig_dsp_ConstantValue* audioDensityScale;
37-
struct cc_sig_DustGate* audioDustGate;
37+
struct sig_dsp_DustGate* audioDustGate;
3838
struct sig_daisy_CVOut* dustCVOut;
3939
struct sig_daisy_CVOut* clockCVOut;
4040
struct sig_daisy_AudioOut* leftAudioOut;
@@ -100,7 +100,7 @@ void buildGraph(struct sig_SignalContext* context, struct sig_Status* status) {
100100
densityClockSum->inputs.left = clockFrequency->outputs.main;
101101
densityClockSum->inputs.right = densityKnob->outputs.main;
102102

103-
cvDustGate = cc_sig_DustGate_new(&allocator, context);
103+
cvDustGate = sig_dsp_DustGate_new(&allocator, context);
104104
sig_List_append(&signals, cvDustGate, status);
105105
cvDustGate->inputs.density = densityClockSum->outputs.main;
106106
cvDustGate->inputs.durationPercentage = durationKnob->outputs.main;
@@ -124,7 +124,7 @@ void buildGraph(struct sig_SignalContext* context, struct sig_Status* status) {
124124
audioDensity->inputs.left = densityClockSum->outputs.main;
125125
audioDensity->inputs.right = audioDensityScale->outputs.main;
126126

127-
audioDustGate = cc_sig_DustGate_new(&allocator, context);
127+
audioDustGate = sig_dsp_DustGate_new(&allocator, context);
128128
sig_List_append(&signals, audioDustGate, status);
129129
audioDustGate->parameters.bipolar = 1.0f;
130130
audioDustGate->inputs.density = audioDensity->outputs.main;

libsignaletic/include/libsignaletic.h

+10-10
Original file line numberDiff line numberDiff line change
@@ -1414,36 +1414,36 @@ void sig_dsp_TimedGate_destroy(struct sig_Allocator* allocator,
14141414
struct sig_dsp_TimedGate* self);
14151415

14161416

1417-
struct cc_sig_DustGate_Inputs {
1417+
struct sig_dsp_DustGate_Inputs {
14181418
float_array_ptr density;
14191419
float_array_ptr durationPercentage;
14201420
};
14211421

1422-
struct cc_sig_DustGate_Parameters {
1422+
struct sig_dsp_DustGate_Parameters {
14231423
float bipolar;
14241424
};
14251425

1426-
struct cc_sig_DustGate {
1426+
struct sig_dsp_DustGate {
14271427
struct sig_dsp_Signal signal;
1428-
struct cc_sig_DustGate_Inputs inputs;
1429-
struct cc_sig_DustGate_Parameters parameters;
1428+
struct sig_dsp_DustGate_Inputs inputs;
1429+
struct sig_dsp_DustGate_Parameters parameters;
14301430
struct sig_dsp_Signal_SingleMonoOutput outputs;
14311431
struct sig_dsp_Dust* dust;
14321432
struct sig_dsp_BinaryOp* reciprocalDensity;
14331433
struct sig_dsp_BinaryOp* densityDurationMultiplier;
14341434
struct sig_dsp_TimedGate* gate;
14351435
};
14361436

1437-
struct cc_sig_DustGate* cc_sig_DustGate_new(struct sig_Allocator* allocator,
1437+
struct sig_dsp_DustGate* sig_dsp_DustGate_new(struct sig_Allocator* allocator,
14381438
struct sig_SignalContext* context);
14391439

1440-
void cc_sig_DustGate_init(struct cc_sig_DustGate* self,
1440+
void sig_dsp_DustGate_init(struct sig_dsp_DustGate* self,
14411441
struct sig_SignalContext* context);
14421442

1443-
void cc_sig_DustGate_generate(void* signal);
1443+
void sig_dsp_DustGate_generate(void* signal);
14441444

1445-
void cc_sig_DustGate_destroy(struct sig_Allocator* allocator,
1446-
struct cc_sig_DustGate* self);
1445+
void sig_dsp_DustGate_destroy(struct sig_Allocator* allocator,
1446+
struct sig_dsp_DustGate* self);
14471447

14481448

14491449
struct sig_dsp_ClockFreqDetector_Inputs {

libsignaletic/src/libsignaletic.c

+12-10
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ inline float sig_clamp(float value, float min, float max) {
4444
return sig_fminf(sig_fmaxf(value, min), max);
4545
}
4646

47+
// TODO: Implement a fast fmodf
48+
// See: https://github.com/electro-smith/DaisySP/blob/0cc02b37579e3619efde73be49a1fa01ffee5cf6/Source/Utility/dsp.h#L89-L95
4749
// TODO: Unit tests
4850
inline float sig_flooredfmodf(float numer, float denom) {
4951
float remain = fmodf(numer, denom);
@@ -1789,10 +1791,10 @@ void sig_dsp_TimedGate_destroy(struct sig_Allocator* allocator,
17891791
}
17901792

17911793

1792-
struct cc_sig_DustGate* cc_sig_DustGate_new(struct sig_Allocator* allocator,
1794+
struct sig_dsp_DustGate* sig_dsp_DustGate_new(struct sig_Allocator* allocator,
17931795
struct sig_SignalContext* context) {
1794-
struct cc_sig_DustGate* self = sig_MALLOC(allocator,
1795-
struct cc_sig_DustGate);
1796+
struct sig_dsp_DustGate* self = sig_MALLOC(allocator,
1797+
struct sig_dsp_DustGate);
17961798

17971799
self->reciprocalDensity = sig_dsp_Div_new(allocator, context);
17981800
self->reciprocalDensity->inputs.left = context->unity->outputs.main;
@@ -1808,22 +1810,22 @@ struct cc_sig_DustGate* cc_sig_DustGate_new(struct sig_Allocator* allocator,
18081810
self->gate->inputs.duration =
18091811
self->densityDurationMultiplier->outputs.main;
18101812

1811-
cc_sig_DustGate_init(self, context);
1813+
sig_dsp_DustGate_init(self, context);
18121814
self->outputs.main = self->gate->outputs.main;
18131815

18141816
return self;
18151817
}
18161818

18171819

1818-
void cc_sig_DustGate_init(struct cc_sig_DustGate* self,
1820+
void sig_dsp_DustGate_init(struct sig_dsp_DustGate* self,
18191821
struct sig_SignalContext* context) {
1820-
sig_dsp_Signal_init(self, context, *cc_sig_DustGate_generate);
1822+
sig_dsp_Signal_init(self, context, *sig_dsp_DustGate_generate);
18211823
sig_CONNECT_TO_SILENCE(self, density, context);
18221824
sig_CONNECT_TO_SILENCE(self, durationPercentage, context);
18231825
};
18241826

1825-
void cc_sig_DustGate_generate(void* signal) {
1826-
struct cc_sig_DustGate* self = (struct cc_sig_DustGate*) signal;
1827+
void sig_dsp_DustGate_generate(void* signal) {
1828+
struct sig_dsp_DustGate* self = (struct sig_dsp_DustGate*) signal;
18271829

18281830
// Bind all parameters (remove this when we have change events).
18291831
self->dust->inputs.density = self->inputs.density;
@@ -1842,8 +1844,8 @@ void cc_sig_DustGate_generate(void* signal) {
18421844
}
18431845

18441846

1845-
void cc_sig_DustGate_destroy(struct sig_Allocator* allocator,
1846-
struct cc_sig_DustGate* self) {
1847+
void sig_dsp_DustGate_destroy(struct sig_Allocator* allocator,
1848+
struct sig_dsp_DustGate* self) {
18471849
sig_dsp_TimedGate_destroy(allocator, self->gate);
18481850

18491851
sig_dsp_Mul_destroy(allocator, self->densityDurationMultiplier);

0 commit comments

Comments
 (0)