diff --git a/libsignaletic/examples/console/src/print-sine.c b/libsignaletic/examples/console/src/print-sine.c index 33e9fb6..4a15412 100644 --- a/libsignaletic/examples/console/src/print-sine.c +++ b/libsignaletic/examples/console/src/print-sine.c @@ -46,7 +46,7 @@ int main(int argc, char *argv[]) { &settings, 0.0f) }; - struct sig_dsp_Sine* sine = sig_dsp_Sine_new(&allocator, + struct sig_dsp_Oscillator* sine = sig_dsp_Sine_new(&allocator, &settings, &inputs); puts("Sine wave (three blocks): "); diff --git a/libsignaletic/tests/test-libsignaletic.c b/libsignaletic/tests/test-libsignaletic.c index b022e9a..35804ad 100644 --- a/libsignaletic/tests/test-libsignaletic.c +++ b/libsignaletic/tests/test-libsignaletic.c @@ -443,10 +443,10 @@ void test_sig_dsp_Sine(void) { struct sig_dsp_Oscillator_Inputs* inputs = createSineInputs( &allocator, &audioSettings, 440.0f, 0.0f, 1.0f, 0.0f); - struct sig_dsp_Sine* sine = sig_dsp_Sine_new(&allocator, + struct sig_dsp_Oscillator* sine = sig_dsp_Sine_new(&allocator, &audioSettings, inputs); - sig_dsp_Sine_generate(sine); + sine->signal.generate(sine); TEST_ASSERT_EQUAL_FLOAT_ARRAY( expected, sine->signal.output, @@ -469,10 +469,10 @@ void test_test_sig_dsp_Sine_isOffset(void) { struct sig_dsp_Oscillator_Inputs* inputs = createSineInputs( &allocator, &audioSettings, 440.0f, 0.0f, 1.0f, 1.0f); - struct sig_dsp_Sine* sine = sig_dsp_Sine_new(&allocator, + struct sig_dsp_Oscillator* sine = sig_dsp_Sine_new(&allocator, &audioSettings, inputs); - sig_dsp_Sine_generate(sine); + sine->signal.generate(sine); TEST_ASSERT_EQUAL_FLOAT_ARRAY( expected, sine->signal.output, @@ -485,13 +485,13 @@ void test_test_sig_dsp_Sine_isOffset(void) { void test_sig_dsp_Sine_accumulatesPhase(void) { struct sig_dsp_Oscillator_Inputs* inputs = createSineInputs( &allocator, audioSettings, 440.0f, 0.0f, 1.0f, 0.0f); - struct sig_dsp_Sine* sine = sig_dsp_Sine_new(&allocator, + struct sig_dsp_Oscillator* sine = sig_dsp_Sine_new(&allocator, audioSettings, inputs); // 440 Hz frequency at 48 KHz sample rate. float phaseStep = 0.05759586393833160400390625f; - sig_dsp_Sine_generate(sine); + sine->signal.generate(sine); TEST_ASSERT_FLOAT_WITHIN_MESSAGE( 0.000001, phaseStep * 48.0, @@ -499,7 +499,7 @@ void test_sig_dsp_Sine_accumulatesPhase(void) { "The phase accumulator should have been incremented for each sample in the block." ); - sig_dsp_Sine_generate(sine); + sine->signal.generate(sine); TEST_ASSERT_FLOAT_WITHIN_MESSAGE( 0.000001, phaseStep * 96.0, @@ -514,12 +514,12 @@ void test_sig_dsp_Sine_accumulatesPhase(void) { void test_sig_dsp_Sine_phaseWrapsAt2PI(void) { struct sig_dsp_Oscillator_Inputs* inputs = createSineInputs( &allocator, audioSettings, 440.0f, 0.0f, 1.0f, 0.0f); - struct sig_dsp_Sine* sine = sig_dsp_Sine_new(&allocator, + struct sig_dsp_Oscillator* sine = sig_dsp_Sine_new(&allocator, audioSettings, inputs); - sig_dsp_Sine_generate(sine); - sig_dsp_Sine_generate(sine); - sig_dsp_Sine_generate(sine); + sine->signal.generate(sine); + sine->signal.generate(sine); + sine->signal.generate(sine); TEST_ASSERT_TRUE_MESSAGE( sine->phaseAccumulator <= sig_TWOPI && diff --git a/libsignaletic/wasm/bindings/libsignaletic-web-bindings.idl b/libsignaletic/wasm/bindings/libsignaletic-web-bindings.idl index f36d335..dad6b8a 100644 --- a/libsignaletic/wasm/bindings/libsignaletic-web-bindings.idl +++ b/libsignaletic/wasm/bindings/libsignaletic-web-bindings.idl @@ -38,10 +38,11 @@ interface Signals { void Sine_destroy(sig_Allocator allocator, sig_dsp_Oscillator sine); - sig_dsp_Oscillator_Inputs Sine_Inputs_new(sig_Allocator allocator, - any freq, any phaseOffset, any mul, any add); + sig_dsp_Oscillator_Inputs Oscillator_Inputs_new( + sig_Allocator allocator, any freq, any phaseOffset, any mul, + any add); - void Sine_Inputs_destroy(sig_Allocator allocator, + void Oscillator_Inputs_destroy(sig_Allocator allocator, sig_dsp_Oscillator_Inputs inputs); diff --git a/libsignaletic/wasm/bindings/src/libsignaletic-web.cpp b/libsignaletic/wasm/bindings/src/libsignaletic-web.cpp index 34650ef..b7dd707 100644 --- a/libsignaletic/wasm/bindings/src/libsignaletic-web.cpp +++ b/libsignaletic/wasm/bindings/src/libsignaletic-web.cpp @@ -101,7 +101,7 @@ class Signals { return inputs; } - void Sine_Inputs_destroy(struct sig_Allocator* allocator, + void Oscillator_Inputs_destroy(struct sig_Allocator* allocator, struct sig_dsp_Oscillator_Inputs* self) { allocator->impl->free(allocator, self); }