Context
plugins/sine.c is implemented against the raw C API (Methcla_SynthDef with C function pointers). plugins/README.md declares the C++ wrapper API "preferred". This issue migrates sine to the wrapper and renames the file to .cpp.
Outcome: sine uses the wrapper API; the last .c source under plugins/ is gone.
Scope
Delete plugins/sine.c and create plugins/sine.cpp as a full rewrite using StaticSynthDef. Behavioural preservation:
- Phase carried across blocks.
freqToPhaseInc = 2π / sampleRate.
sinf semantics.
Key shape:
class Sine
{
float* m_ports[SinePorts::numPorts()];
double m_phase;
double m_freqToPhaseInc;
public:
Sine(const World<Sine>& world, const Methcla_SynthDef*, const NoOptions&)
: m_phase(0.)
, m_freqToPhaseInc(2. * kPi / world.sampleRate())
{}
// connect, process as usual
};
StaticSynthDef<Sine, NoOptions, SinePorts> kSineDef;
Files
plugins/sine.c — delete
plugins/sine.cpp — new (rewrite using wrapper)
plugins/CMakeLists.txt — line 23: replace sine.c with sine.cpp in the foreach. The if(source MATCHES ".*\\.c$") block on line 14 self-disables once no .c source remains.
plugins/README.md — line 9: sine.c → sine.cpp; update the "Implementation styles" table row to move sine under the wrapper category.
CHANGELOG.md — add a ### Changed entry under ## [Unreleased] referencing this issue (mention the file rename).
Verification
pre-commit run --all-files
cmake --preset debug
cmake --build build/debug
ctest --test-dir build/debug --output-on-failure
Confirm methcla_plugin_sine builds. Existence + load is sufficient — no nontrivial state to behaviourally diff.
Context
plugins/sine.cis implemented against the raw C API (Methcla_SynthDefwith C function pointers).plugins/README.mddeclares the C++ wrapper API "preferred". This issue migratessineto the wrapper and renames the file to.cpp.Outcome:
sineuses the wrapper API; the last.csource underplugins/is gone.Scope
Delete
plugins/sine.cand createplugins/sine.cppas a full rewrite usingStaticSynthDef. Behavioural preservation:freqToPhaseInc = 2π / sampleRate.sinfsemantics.Key shape:
Files
plugins/sine.c— deleteplugins/sine.cpp— new (rewrite using wrapper)plugins/CMakeLists.txt— line 23: replacesine.cwithsine.cppin the foreach. Theif(source MATCHES ".*\\.c$")block on line 14 self-disables once no.csource remains.plugins/README.md— line 9:sine.c→sine.cpp; update the "Implementation styles" table row to move sine under the wrapper category.CHANGELOG.md— add a### Changedentry under## [Unreleased]referencing this issue (mention the file rename).Verification
Confirm
methcla_plugin_sinebuilds. Existence + load is sufficient — no nontrivial state to behaviourally diff.