diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..73de3c1 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +build +*.prlgunit diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..f865f3d --- /dev/null +++ b/.gitmodules @@ -0,0 +1,6 @@ +[submodule "eurorack"] + path = eurorack + url = https://github.com/peterall/eurorack.git +[submodule "logue-sdk"] + path = logue-sdk + url = https://github.com/korginc/logue-sdk.git diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..377f43a --- /dev/null +++ b/Makefile @@ -0,0 +1,10 @@ +TOPTARGETS := all clean + +OSCILLATORS := $(wildcard *mk) + +$(TOPTARGETS): $(OSCILLATORS) +$(OSCILLATORS): + @rm -fR .dep ./build + @$(MAKE) -f $@ $(MAKECMDGOALS) + +.PHONY: $(TOPTARGETS) $(OSCILLATORS) diff --git a/eurorack b/eurorack new file mode 160000 index 0000000..1cf95b2 --- /dev/null +++ b/eurorack @@ -0,0 +1 @@ +Subproject commit 1cf95b2f26edd6cd9f89d038c2746f958abefae4 diff --git a/logue-sdk b/logue-sdk new file mode 160000 index 0000000..3b34875 --- /dev/null +++ b/logue-sdk @@ -0,0 +1 @@ +Subproject commit 3b34875aaff41752c9e34439fce6d6a32dac2fa0 diff --git a/macro-oscillator2.cc b/macro-oscillator2.cc new file mode 100644 index 0000000..5cb5237 --- /dev/null +++ b/macro-oscillator2.cc @@ -0,0 +1,165 @@ +#include "userosc.h" +#include "stmlib/dsp/dsp.h" +#include "plaits/dsp/dsp.h" + +#ifdef OSC_VA +#include "plaits/dsp/engine/virtual_analog_engine.h" +plaits::VirtualAnalogEngine engine; +float out_gain = 0.8f, aux_gain = 0.8f; +#endif + +#ifdef OSC_WS +#include "plaits/dsp/engine/waveshaping_engine.h" +plaits::WaveshapingEngine engine; +float out_gain = 0.7f, aux_gain = 0.6f; +#endif + +#ifdef OSC_FM +#include "plaits/dsp/engine/fm_engine.h" +plaits::FMEngine engine; +float out_gain = 0.6f, aux_gain = 0.6f; +#endif + +#ifdef OSC_GR +#include "plaits/dsp/engine/grain_engine.h" +plaits::GrainEngine engine; +float out_gain = 0.7f, aux_gain = 0.6f; +#endif + +#ifdef OSC_AD +#include "plaits/dsp/engine/additive_engine.h" +plaits::AdditiveEngine engine; +float out_gain = 0.8f, aux_gain = 0.8f; +#endif + +plaits::EngineParameters parameters = { + .trigger = plaits::TRIGGER_UNPATCHED, + .note = 0, + .timbre = 0, + .morph = 0, + .harmonics = 0, + .accent = 0 +}; + +float harmonics = 0, + timbre = 0, + morph = 0, + auxmix = 0, + shape = 0, + shiftshape = 0; + +int param_mode = 0; + +void OSC_INIT(uint32_t platform, uint32_t api) +{ + static uint8_t engine_buffer[plaits::kMaxBlockSize*sizeof(float)]; + stmlib::BufferAllocator allocator; + allocator.Init(engine_buffer, sizeof(engine_buffer)); + engine.Init(&allocator); +} + +void OSC_CYCLE(const user_osc_param_t *const params, + int32_t *yn, + const uint32_t frames) +{ + static float out[plaits::kMaxBlockSize], aux[plaits::kMaxBlockSize]; + static bool enveloped; + + parameters.note = ((float)(params->pitch >> 8)) + ((params->pitch & 0xFF) * k_note_mod_fscale); + + float shape_lfo = clip01f(shape + q31_to_f32(params->shape_lfo)); + + switch(param_mode) { + case 0: + parameters.timbre = shape_lfo; + parameters.morph = shiftshape; + parameters.harmonics = harmonics; + break; + case 1: + parameters.timbre = shape_lfo; + parameters.morph = morph; + parameters.harmonics = shiftshape; + break; + case 2: + parameters.timbre = shiftshape; + parameters.morph = shape_lfo; + parameters.harmonics = harmonics; + break; + case 3: + parameters.timbre = timbre; + parameters.morph = shape_lfo; + parameters.harmonics = shiftshape; + break; + case 4: + parameters.timbre = shiftshape; + parameters.morph = morph; + parameters.harmonics = shape_lfo; + break; + case 5: + parameters.timbre = timbre; + parameters.morph = shiftshape; + parameters.harmonics = shape_lfo; + break; + } + + engine.Render(parameters, out, aux, (size_t)frames, &enveloped); + + for(size_t i=0;i $@ + @echo + @$(SZ) $< + @echo + +%.list: %.elf + @echo Creating $@ + @$(OD) -S $< > $@ + +clean: + @echo Cleaning + -rm -fR .dep $(BUILDDIR) $(PKGARCH) + @echo + @echo Done + +package: + @echo Packaging to ./$(PKGARCH) + @mkdir -p $(PKGDIR) + @cp -a $(MANIFEST) $(PKGDIR)/ + @sed -ie 's/%OSCILLATOR%/$(OSCILLATOR)/g' $(PKGDIR)/$(MANIFEST) + @rm $(PKGDIR)/$(MANIFEST)e + @cp -a $(BUILDDIR)/$(PROJECT).bin $(PKGDIR)/$(PAYLOAD) + @$(ZIP) $(ZIP_ARGS) $(PROJECT).zip $(PKGDIR) + @mv $(PROJECT).zip $(PKGARCH) + @echo + @echo Done diff --git a/manifest.json b/manifest.json new file mode 100644 index 0000000..417f69e --- /dev/null +++ b/manifest.json @@ -0,0 +1,20 @@ +{ + "header" : + { + "platform" : "prologue", + "module" : "osc", + "api" : "1.0-0", + "dev_id" : 0, + "prg_id" : 0, + "version" : "1.0-0", + "name" : "mo2 %OSCILLATOR%", + "num_param" : 5, + "params" : [ + ["Harmonics", 0, 100, "%"], + ["Timbre", 0, 100, "%"], + ["Morph", 0, 100, "%"], + ["Out/Aux", 0, 100, "%"], + ["ParamMode", 0, 5, ""] + ] + } +} diff --git a/osc_ad.mk b/osc_ad.mk new file mode 100644 index 0000000..83ff624 --- /dev/null +++ b/osc_ad.mk @@ -0,0 +1,8 @@ +OSCILLATOR = ad + +UCXXSRC = macro-oscillator2.cc \ + eurorack/plaits/dsp/engine/additive_engine.cc \ + eurorack/plaits/resources.cc \ + eurorack/stmlib/dsp/units.cc + +include makefile.inc diff --git a/osc_fm.mk b/osc_fm.mk new file mode 100644 index 0000000..23dbb8e --- /dev/null +++ b/osc_fm.mk @@ -0,0 +1,8 @@ +OSCILLATOR = fm + +UCXXSRC = macro-oscillator2.cc \ + eurorack/plaits/dsp/engine/fm_engine.cc \ + eurorack/plaits/resources.cc \ + eurorack/stmlib/dsp/units.cc + +include makefile.inc diff --git a/osc_gr.mk b/osc_gr.mk new file mode 100644 index 0000000..de7daad --- /dev/null +++ b/osc_gr.mk @@ -0,0 +1,8 @@ +OSCILLATOR = gr + +UCXXSRC = macro-oscillator2.cc \ + eurorack/plaits/dsp/engine/grain_engine.cc \ + eurorack/plaits/resources.cc \ + eurorack/stmlib/dsp/units.cc + +include makefile.inc diff --git a/osc_va.mk b/osc_va.mk new file mode 100644 index 0000000..d10011a --- /dev/null +++ b/osc_va.mk @@ -0,0 +1,7 @@ +OSCILLATOR = va + +UCXXSRC = macro-oscillator2.cc \ + eurorack/plaits/dsp/engine/virtual_analog_engine.cc \ + eurorack/stmlib/dsp/units.cc + +include makefile.inc diff --git a/osc_ws.mk b/osc_ws.mk new file mode 100644 index 0000000..780107d --- /dev/null +++ b/osc_ws.mk @@ -0,0 +1,8 @@ +OSCILLATOR = ws + +UCXXSRC = macro-oscillator2.cc \ + eurorack/plaits/dsp/engine/waveshaping_engine.cc \ + eurorack/plaits/resources.cc \ + eurorack/stmlib/dsp/units.cc + +include makefile.inc