From a02bde00b87a7f7b8b7450e71b946bb00538d7de Mon Sep 17 00:00:00 2001 From: falkTX Date: Sat, 6 Jul 2013 05:42:10 +0100 Subject: [PATCH] ZynDistortion ready; Update Native API --- source/backend/CarlaNative.h | 27 +- source/backend/native/audio-file.cpp | 1 + source/backend/native/bypass.c | 1 + source/backend/native/distrho-3bandeq.cpp | 1 + .../backend/native/distrho-3bandsplitter.cpp | 1 + source/backend/native/distrho-nekobi.cpp | 1 + source/backend/native/distrho-notes.cpp | 1 + source/backend/native/distrho-pingpongpan.cpp | 1 + .../backend/native/distrho-stereoenhancer.cpp | 1 + source/backend/native/lfo.c | 1 + source/backend/native/midi-file.cpp | 1 + source/backend/native/midi-sequencer.cpp | 1 + source/backend/native/midi-split.c | 1 + source/backend/native/midi-through.c | 1 + source/backend/native/midi-transpose.c | 1 + .../native/nekobi/nekobee-src/nekobee_synth.c | 1 + source/backend/native/nekofilter.c | 1 + source/backend/native/sunvox-file.cpp | 1 + source/backend/native/zynaddsubfx.cpp | 357 +++++++++++++----- source/backend/plugin/NativePlugin.cpp | 2 + source/backend/standalone/Makefile | 2 +- 21 files changed, 300 insertions(+), 105 deletions(-) diff --git a/source/backend/CarlaNative.h b/source/backend/CarlaNative.h index 5344723de..bb0282043 100644 --- a/source/backend/CarlaNative.h +++ b/source/backend/CarlaNative.h @@ -54,11 +54,22 @@ typedef enum _PluginHints { PLUGIN_IS_SYNTH = 1 << 1, PLUGIN_HAS_GUI = 1 << 2, PLUGIN_USES_GUI_AS_FILE = 1 << 3, - PLUGIN_USES_SINGLE_THREAD = 1 << 4, - PLUGIN_USES_STATE = 1 << 5, - PLUGIN_USES_STATIC_BUFFERS = 1 << 6 + PLUGIN_USES_PANNING = 1 << 4, // uses stereo balance if unset (default) + PLUGIN_USES_SINGLE_THREAD = 1 << 5, + PLUGIN_USES_STATE = 1 << 6, + PLUGIN_USES_STATIC_BUFFERS = 1 << 7 } PluginHints; +typedef enum _PluginSupports { + PLUGIN_SUPPORTS_PROGRAM_CHANGES = 1 << 0, // used in MIDI filters only + PLUGIN_SUPPORTS_CONTROL_CHANGES = 1 << 1, + PLUGIN_SUPPORTS_CHANNEL_PRESSURE = 1 << 2, + PLUGIN_SUPPORTS_NOTE_AFTERTOUCH = 1 << 3, + PLUGIN_SUPPORTS_PITCHBEND = 1 << 4, + PLUGIN_SUPPORTS_ALL_SOUND_OFF = 1 << 5, + PLUGIN_SUPPORTS_EVERYTHING = PLUGIN_SUPPORTS_ALL_SOUND_OFF*2-1 +} PluginSupports; + typedef enum _ParameterHints { PARAMETER_IS_OUTPUT = 1 << 0, PARAMETER_IS_ENABLED = 1 << 1, @@ -81,8 +92,13 @@ typedef enum _PluginDispatcherOpcode { typedef enum _HostDispatcherOpcode { HOST_OPCODE_NULL = 0, // nothing - HOST_OPCODE_SET_PROCESS_PRECISION = 1, // uses value - HOST_OPCODE_UI_UNAVAILABLE = 2 // nothing + HOST_OPCODE_SET_VOLUME = 1, // uses value + HOST_OPCODE_SET_DRYWET = 2, // uses value + HOST_OPCODE_SET_BALANCE_LEFT = 3, // uses value + HOST_OPCODE_SET_BALANCE_RIGHT = 4, // uses value + HOST_OPCODE_SET_PANNING = 5, // uses value + HOST_OPCODE_SET_PROCESS_PRECISION = 6, // uses value + HOST_OPCODE_UI_UNAVAILABLE = 7 // nothing } HostDispatcherOpcode; typedef struct _ParameterScalePoint { @@ -175,6 +191,7 @@ typedef struct _HostDescriptor { typedef struct _PluginDescriptor { const PluginCategory category; const PluginHints hints; + const PluginSupports supports; const uint32_t audioIns; const uint32_t audioOuts; const uint32_t midiIns; diff --git a/source/backend/native/audio-file.cpp b/source/backend/native/audio-file.cpp index 76935ed30..ab1118a9c 100644 --- a/source/backend/native/audio-file.cpp +++ b/source/backend/native/audio-file.cpp @@ -246,6 +246,7 @@ private: static const PluginDescriptor audiofileDesc = { /* category */ PLUGIN_CATEGORY_UTILITY, /* hints */ static_cast(PLUGIN_IS_RTSAFE|PLUGIN_HAS_GUI|PLUGIN_USES_GUI_AS_FILE), + /* supports */ static_cast(0x0), /* audioIns */ 0, /* audioOuts */ 2, /* midiIns */ 0, diff --git a/source/backend/native/bypass.c b/source/backend/native/bypass.c index f92300897..c3cc9d9ae 100644 --- a/source/backend/native/bypass.c +++ b/source/backend/native/bypass.c @@ -48,6 +48,7 @@ static void bypass_process(PluginHandle handle, float** inBuffer, float** outBuf static const PluginDescriptor bypassDesc = { .category = PLUGIN_CATEGORY_NONE, .hints = PLUGIN_IS_RTSAFE, + .supports = 0x0, .audioIns = 1, .audioOuts = 1, .midiIns = 0, diff --git a/source/backend/native/distrho-3bandeq.cpp b/source/backend/native/distrho-3bandeq.cpp index 78d8214f6..d1091fb40 100644 --- a/source/backend/native/distrho-3bandeq.cpp +++ b/source/backend/native/distrho-3bandeq.cpp @@ -32,6 +32,7 @@ START_NAMESPACE_DISTRHO static const PluginDescriptor tBandEqDesc = { /* category */ PLUGIN_CATEGORY_EQ, /* hints */ static_cast(PLUGIN_IS_RTSAFE|PLUGIN_HAS_GUI), + /* supports */ static_cast(0x0), /* audioIns */ DISTRHO_PLUGIN_NUM_INPUTS, /* audioOuts */ DISTRHO_PLUGIN_NUM_OUTPUTS, /* midiIns */ 0, diff --git a/source/backend/native/distrho-3bandsplitter.cpp b/source/backend/native/distrho-3bandsplitter.cpp index 77ff45b1a..3f1c035e0 100644 --- a/source/backend/native/distrho-3bandsplitter.cpp +++ b/source/backend/native/distrho-3bandsplitter.cpp @@ -32,6 +32,7 @@ START_NAMESPACE_DISTRHO static const PluginDescriptor tBandSplitterDesc = { /* category */ PLUGIN_CATEGORY_EQ, /* hints */ static_cast(PLUGIN_IS_RTSAFE|PLUGIN_HAS_GUI), + /* supports */ static_cast(0x0), /* audioIns */ DISTRHO_PLUGIN_NUM_INPUTS, /* audioOuts */ DISTRHO_PLUGIN_NUM_OUTPUTS, /* midiIns */ 0, diff --git a/source/backend/native/distrho-nekobi.cpp b/source/backend/native/distrho-nekobi.cpp index e85af5494..4e19d97cc 100644 --- a/source/backend/native/distrho-nekobi.cpp +++ b/source/backend/native/distrho-nekobi.cpp @@ -32,6 +32,7 @@ START_NAMESPACE_DISTRHO static const PluginDescriptor nekobiDesc = { /* category */ PLUGIN_CATEGORY_EQ, /* hints */ static_cast(PLUGIN_IS_RTSAFE|PLUGIN_IS_SYNTH|PLUGIN_HAS_GUI), + /* supports */ static_cast(PLUGIN_SUPPORTS_CONTROL_CHANGES|PLUGIN_SUPPORTS_ALL_SOUND_OFF), /* audioIns */ DISTRHO_PLUGIN_NUM_INPUTS, /* audioOuts */ DISTRHO_PLUGIN_NUM_OUTPUTS, /* midiIns */ 1, diff --git a/source/backend/native/distrho-notes.cpp b/source/backend/native/distrho-notes.cpp index 2bb1a7eec..be309c986 100644 --- a/source/backend/native/distrho-notes.cpp +++ b/source/backend/native/distrho-notes.cpp @@ -31,6 +31,7 @@ START_NAMESPACE_DISTRHO static const PluginDescriptor notesDesc = { /* category */ PLUGIN_CATEGORY_UTILITY, /* hints */ static_cast(PLUGIN_IS_RTSAFE|PLUGIN_HAS_GUI|PLUGIN_USES_SINGLE_THREAD), + /* supports */ static_cast(0x0), /* audioIns */ DISTRHO_PLUGIN_NUM_INPUTS, /* audioOuts */ DISTRHO_PLUGIN_NUM_OUTPUTS, /* midiIns */ 0, diff --git a/source/backend/native/distrho-pingpongpan.cpp b/source/backend/native/distrho-pingpongpan.cpp index ad92a8a63..1e9cd2161 100644 --- a/source/backend/native/distrho-pingpongpan.cpp +++ b/source/backend/native/distrho-pingpongpan.cpp @@ -32,6 +32,7 @@ START_NAMESPACE_DISTRHO static PluginDescriptor pppDesc = { /* category */ PLUGIN_CATEGORY_UTILITY, /* hints */ static_cast(PLUGIN_IS_RTSAFE|PLUGIN_HAS_GUI), + /* supports */ static_cast(0x0), /* audioIns */ DISTRHO_PLUGIN_NUM_INPUTS, /* audioOuts */ DISTRHO_PLUGIN_NUM_OUTPUTS, /* midiIns */ 0, diff --git a/source/backend/native/distrho-stereoenhancer.cpp b/source/backend/native/distrho-stereoenhancer.cpp index 82d74e0e1..aa227b79e 100644 --- a/source/backend/native/distrho-stereoenhancer.cpp +++ b/source/backend/native/distrho-stereoenhancer.cpp @@ -32,6 +32,7 @@ START_NAMESPACE_DISTRHO static const PluginDescriptor stereoenhancerDesc = { /* category */ PLUGIN_CATEGORY_EQ, /* hints */ static_cast(PLUGIN_IS_RTSAFE|PLUGIN_HAS_GUI), + /* supports */ static_cast(0x0), /* audioIns */ DISTRHO_PLUGIN_NUM_INPUTS, /* audioOuts */ DISTRHO_PLUGIN_NUM_OUTPUTS, /* midiIns */ 0, diff --git a/source/backend/native/lfo.c b/source/backend/native/lfo.c index e82a9b4e4..88daa7582 100644 --- a/source/backend/native/lfo.c +++ b/source/backend/native/lfo.c @@ -270,6 +270,7 @@ static void lfo_process(PluginHandle handle, float** inBuffer, float** outBuffer static const PluginDescriptor lfoDesc = { .category = PLUGIN_CATEGORY_UTILITY, .hints = PLUGIN_IS_RTSAFE, + .supports = 0x0, .audioIns = 0, .audioOuts = 0, .midiIns = 0, diff --git a/source/backend/native/midi-file.cpp b/source/backend/native/midi-file.cpp index dda8bd6e7..c2fc2b888 100644 --- a/source/backend/native/midi-file.cpp +++ b/source/backend/native/midi-file.cpp @@ -221,6 +221,7 @@ private: static const PluginDescriptor midifileDesc = { /* category */ PLUGIN_CATEGORY_UTILITY, /* hints */ static_cast(PLUGIN_IS_RTSAFE|PLUGIN_HAS_GUI|PLUGIN_USES_GUI_AS_FILE), + /* supports */ static_cast(0x0), /* audioIns */ 0, /* audioOuts */ 0, /* midiIns */ 0, diff --git a/source/backend/native/midi-sequencer.cpp b/source/backend/native/midi-sequencer.cpp index ba3623ea0..f9c8bccbe 100644 --- a/source/backend/native/midi-sequencer.cpp +++ b/source/backend/native/midi-sequencer.cpp @@ -235,6 +235,7 @@ private: static const PluginDescriptor midiSequencerDesc = { /* category */ PLUGIN_CATEGORY_UTILITY, /* hints */ PLUGIN_IS_RTSAFE/*|PLUGIN_HAS_GUI*/, + /* supports */ static_cast(0x0), /* audioIns */ 0, /* audioOuts */ 0, /* midiIns */ 1, diff --git a/source/backend/native/midi-split.c b/source/backend/native/midi-split.c index 1018ebf8c..65f203e82 100644 --- a/source/backend/native/midi-split.c +++ b/source/backend/native/midi-split.c @@ -86,6 +86,7 @@ static void midiSplit_process(PluginHandle handle, float** inBuffer, float** out static const PluginDescriptor midiSplitDesc = { .category = PLUGIN_CATEGORY_UTILITY, .hints = PLUGIN_IS_RTSAFE, + .supports = PLUGIN_SUPPORTS_EVERYTHING, .audioIns = 0, .audioOuts = 0, .midiIns = 1, diff --git a/source/backend/native/midi-through.c b/source/backend/native/midi-through.c index 6d89cc465..c56df70e2 100644 --- a/source/backend/native/midi-through.c +++ b/source/backend/native/midi-through.c @@ -67,6 +67,7 @@ static void midiThrough_process(PluginHandle handle, float** inBuffer, float** o static const PluginDescriptor midiThroughDesc = { .category = PLUGIN_CATEGORY_UTILITY, .hints = PLUGIN_IS_RTSAFE, + .supports = PLUGIN_SUPPORTS_EVERYTHING, .audioIns = 0, .audioOuts = 0, .midiIns = 1, diff --git a/source/backend/native/midi-transpose.c b/source/backend/native/midi-transpose.c index c26ce8550..d833375c2 100644 --- a/source/backend/native/midi-transpose.c +++ b/source/backend/native/midi-transpose.c @@ -145,6 +145,7 @@ static void midiTranspose_process(PluginHandle handle, float** inBuffer, float** static const PluginDescriptor midiTransposeDesc = { .category = PLUGIN_CATEGORY_UTILITY, .hints = PLUGIN_IS_RTSAFE, + .supports = PLUGIN_SUPPORTS_EVERYTHING, .audioIns = 0, .audioOuts = 0, .midiIns = 1, diff --git a/source/backend/native/nekobi/nekobee-src/nekobee_synth.c b/source/backend/native/nekobi/nekobee-src/nekobee_synth.c index f86c21abd..94b8376d6 100644 --- a/source/backend/native/nekobi/nekobee-src/nekobee_synth.c +++ b/source/backend/native/nekobi/nekobee-src/nekobee_synth.c @@ -150,6 +150,7 @@ nekobee_synth_control_change(nekobee_synth_t *synth, unsigned int param, signed case MIDI_CTL_LSB_MAIN_VOLUME: nekobee_synth_update_volume(synth); break; + case MIDI_CTL_ALL_SOUNDS_OFF: nekobee_synth_all_voices_off(synth); break; diff --git a/source/backend/native/nekofilter.c b/source/backend/native/nekofilter.c index 09822a977..8941b2358 100644 --- a/source/backend/native/nekofilter.c +++ b/source/backend/native/nekofilter.c @@ -31,6 +31,7 @@ static const PluginDescriptor nekofilterDesc = { #else .hints = PLUGIN_IS_RTSAFE, #endif + .supports = 0x0, .audioIns = 1, .audioOuts = 1, .midiIns = 0, diff --git a/source/backend/native/sunvox-file.cpp b/source/backend/native/sunvox-file.cpp index d3ce3f761..8601de552 100644 --- a/source/backend/native/sunvox-file.cpp +++ b/source/backend/native/sunvox-file.cpp @@ -161,6 +161,7 @@ double SunVoxFilePlugin::sTicksPerFrame = 0.0; static const PluginDescriptor sunvoxfileDesc = { /* category */ PLUGIN_CATEGORY_UTILITY, /* hints */ static_cast(PLUGIN_HAS_GUI|PLUGIN_USES_GUI_AS_FILE), + /* supports */ static_cast(0x0), /* audioIns */ 0, /* audioOuts */ 2, /* midiIns */ 0, diff --git a/source/backend/native/zynaddsubfx.cpp b/source/backend/native/zynaddsubfx.cpp index c7af19fc0..13c3f5275 100644 --- a/source/backend/native/zynaddsubfx.cpp +++ b/source/backend/native/zynaddsubfx.cpp @@ -583,9 +583,10 @@ protected: efxoutl(new float[synth->buffersize]), efxoutr(new float[synth->buffersize]), fWetOnly(false), - kParamCount(paramCount), // real zyn paramCount + kParamCount(paramCount-2), // volume and pan handled by host kProgramCount(programCount) { + hostDispatcher(HOST_OPCODE_SET_DRYWET, 0, 0.5f, nullptr); } ~FxAbstractPlugin() override @@ -616,15 +617,12 @@ protected: uint32_t getParameterCount() final { - return kParamCount-1; // zyn paramCount - 2 + 1 + return kParamCount; } float getParameterValue(const uint32_t index) final { - if (index == 0) - return fWetOnly ? 1.0f : 0.0f; - - return fEffect->getpar(index+1); // + 2 - 1 + return fEffect->getpar(index+2); } // ------------------------------------------------------------------- @@ -640,15 +638,19 @@ protected: void setParameterValue(const uint32_t index, const float value) final { - if (index == 0) - fWetOnly = (value >= 0.5f); - else - fEffect->changepar(index+1, value); // + 2 - 1 + fEffect->changepar(index+2, value); } void setMidiProgram(const uint8_t, const uint32_t, const uint32_t program) final { fEffect->setpreset(program); + + const float volume(float(fEffect->getpar(0))/127.0f); + hostDispatcher(HOST_OPCODE_SET_VOLUME, 0, volume, nullptr); + + const unsigned char pan(fEffect->getpar(1)); + const float panning(float(pan)/63.5f-1.0f); + hostDispatcher(HOST_OPCODE_SET_PANNING, 0, (pan == 64) ? 0.0f : panning, nullptr); } // ------------------------------------------------------------------- @@ -739,10 +741,10 @@ protected: static Parameter param; static ParameterScalePoint scalePoints[2]; - int hints = PARAMETER_IS_ENABLED | PARAMETER_IS_INTEGER; + int hints = PARAMETER_IS_ENABLED|PARAMETER_IS_INTEGER; - param.name = nullptr; - param.unit = nullptr; + param.name = nullptr; + param.unit = nullptr; param.ranges.def = 1.0f; param.ranges.min = 0.0f; param.ranges.max = 127.0f; @@ -755,23 +757,17 @@ protected: switch (index) { case 0: - hints |= PARAMETER_IS_AUTOMABLE|PARAMETER_IS_BOOLEAN; - param.name = "Wet Only"; - param.ranges.def = 0.0f; - param.ranges.max = 1.0f; - break; - case 1: hints |= PARAMETER_IS_AUTOMABLE; param.name = "LFO Frequency"; param.ranges.def = 70.0f; break; - case 2: + case 1: hints |= PARAMETER_IS_AUTOMABLE; param.name = "LFO Randomness"; param.ranges.def = 0.0f; break; - case 3: - hints |= PARAMETER_IS_AUTOMABLE|PARAMETER_USES_SCALEPOINTS; + case 2: + hints |= PARAMETER_IS_AUTOMABLE|PARAMETER_IS_BOOLEAN|PARAMETER_USES_SCALEPOINTS; param.name = "LFO Type"; param.ranges.def = 0.0f; param.ranges.max = 1.0f; @@ -782,32 +778,32 @@ protected: scalePoints[0].value = 0.0f; scalePoints[1].value = 1.0f; break; - case 4: + case 3: hints |= PARAMETER_IS_AUTOMABLE; param.name = "LFO Stereo"; param.ranges.def = 62.0f; break; - case 5: + case 4: hints |= PARAMETER_IS_AUTOMABLE; param.name = "Depth"; param.ranges.def = 60.0f; break; - case 6: + case 5: hints |= PARAMETER_IS_AUTOMABLE; param.name = "Feedback"; param.ranges.def = 105.0f; break; - case 7: + case 6: param.name = "Delay"; param.ranges.def = 25.0f; param.ranges.max = 100.0f; break; - case 8: + case 7: hints |= PARAMETER_IS_AUTOMABLE; - param.name = "Cross"; + param.name = "L/R Cross"; param.ranges.def = 0.0f; break; - case 9: + case 8: hints |= PARAMETER_IS_AUTOMABLE; param.name = "Phase"; param.ranges.def = 64.0f; @@ -831,7 +827,6 @@ protected: midiProg.bank = 0; midiProg.program = index; - midiProg.name = nullptr; switch (index) { @@ -847,6 +842,9 @@ protected: case 3: midiProg.name = "AlienWah4"; break; + default: + midiProg.name = nullptr; + break; } return &midiProg; @@ -877,11 +875,12 @@ protected: return nullptr; static Parameter param; + static ParameterScalePoint scalePoints[2]; - int hints = PARAMETER_IS_ENABLED | PARAMETER_IS_INTEGER; + int hints = PARAMETER_IS_ENABLED|PARAMETER_IS_INTEGER; - param.name = nullptr; - param.unit = nullptr; + param.name = nullptr; + param.unit = nullptr; param.ranges.def = 1.0f; param.ranges.min = 0.0f; param.ranges.max = 127.0f; @@ -894,58 +893,60 @@ protected: switch (index) { case 0: - hints |= PARAMETER_IS_AUTOMABLE|PARAMETER_IS_BOOLEAN; - param.name = "Wet Only"; - param.ranges.def = 0.0f; - param.ranges.max = 1.0f; - break; - case 1: hints |= PARAMETER_IS_AUTOMABLE; param.name = "LFO Frequency"; param.ranges.def = 50.0f; break; - case 2: + case 1: hints |= PARAMETER_IS_AUTOMABLE; param.name = "LFO Randomness"; param.ranges.def = 0.0f; break; - case 3: - hints |= PARAMETER_IS_AUTOMABLE; + case 2: + hints |= PARAMETER_IS_AUTOMABLE|PARAMETER_IS_BOOLEAN|PARAMETER_USES_SCALEPOINTS; param.name = "LFO Type"; param.ranges.def = 0.0f; + param.ranges.max = 1.0f; + param.scalePointCount = 2; + param.scalePoints = scalePoints; + scalePoints[0].label = "Sine"; + scalePoints[1].label = "Triangle"; + scalePoints[0].value = 0.0f; + scalePoints[1].value = 1.0f; break; - case 4: + case 3: hints |= PARAMETER_IS_AUTOMABLE; param.name = "LFO Stereo"; param.ranges.def = 90.0f; break; - case 5: + case 4: hints |= PARAMETER_IS_AUTOMABLE; param.name = "Depth"; param.ranges.def = 40.0f; break; - case 6: + case 5: hints |= PARAMETER_IS_AUTOMABLE; param.name = "Delay"; param.ranges.def = 85.0f; break; - case 7: + case 6: hints |= PARAMETER_IS_AUTOMABLE; param.name = "Feedback"; param.ranges.def = 64.0f; break; - case 8: + case 7: hints |= PARAMETER_IS_AUTOMABLE; - param.name = "Cross"; + param.name = "L/R Cross"; param.ranges.def = 119.0f; break; - case 9: - hints |= PARAMETER_IS_AUTOMABLE; + case 8: + hints |= PARAMETER_IS_AUTOMABLE|PARAMETER_IS_BOOLEAN; param.name = "Flange Mode"; param.ranges.def = 0.0f; + param.ranges.max = 1.0f; break; - case 10: - hints |= PARAMETER_IS_AUTOMABLE; + case 9: + hints |= PARAMETER_IS_AUTOMABLE|PARAMETER_IS_BOOLEAN; param.name = "Subtract Output"; param.ranges.def = 0.0f; param.ranges.max = 1.0f; @@ -969,7 +970,6 @@ protected: midiProg.bank = 0; midiProg.program = index; - midiProg.name = nullptr; switch (index) { @@ -1003,6 +1003,9 @@ protected: case 9: midiProg.name = "Flange5"; break; + default: + midiProg.name = nullptr; + break; } return &midiProg; @@ -1014,13 +1017,13 @@ protected: // ----------------------------------------------------------------------- -class FxReverbPlugin : public FxAbstractPlugin +class FxDistortionPlugin : public FxAbstractPlugin { public: - FxReverbPlugin(const HostDescriptor* const host) - : FxAbstractPlugin(host, 13, 13) + FxDistortionPlugin(const HostDescriptor* const host) + : FxAbstractPlugin(host, 11, 6) { - fEffect = new Reverb(false, efxoutl, efxoutr); + fEffect = new Distorsion(false, efxoutl, efxoutr); } protected: @@ -1033,11 +1036,12 @@ protected: return nullptr; static Parameter param; + static ParameterScalePoint scalePoints[14]; - int hints = PARAMETER_IS_ENABLED | PARAMETER_IS_INTEGER; + int hints = PARAMETER_IS_ENABLED|PARAMETER_IS_INTEGER; - param.name = nullptr; - param.unit = nullptr; + param.name = nullptr; + param.unit = nullptr; param.ranges.def = 1.0f; param.ranges.min = 0.0f; param.ranges.max = 127.0f; @@ -1050,56 +1054,218 @@ protected: switch (index) { case 0: + hints |= PARAMETER_IS_AUTOMABLE; + param.name = "L/R Cross"; + param.ranges.def = 35.0f; + break; + case 1: + hints |= PARAMETER_IS_AUTOMABLE; + param.name = "Drive"; + param.ranges.def = 56.0f; + break; + case 2: + hints |= PARAMETER_IS_AUTOMABLE; + param.name = "Level"; + param.ranges.def = 70.0f; + break; + case 3: + hints |= PARAMETER_IS_AUTOMABLE|PARAMETER_USES_SCALEPOINTS; + param.name = "Type"; + param.ranges.def = 0.0f; + param.ranges.max = 13.0f; + param.scalePointCount = 14; + param.scalePoints = scalePoints; + scalePoints[ 0].label = "Arctangent"; + scalePoints[ 1].label = "Asymmetric"; + scalePoints[ 2].label = "Pow"; + scalePoints[ 3].label = "Sine"; + scalePoints[ 4].label = "Quantisize"; + scalePoints[ 5].label = "Zigzag"; + scalePoints[ 6].label = "Limiter"; + scalePoints[ 7].label = "Upper Limiter"; + scalePoints[ 8].label = "Lower Limiter"; + scalePoints[ 9].label = "Inverse Limiter"; + scalePoints[10].label = "Clip"; + scalePoints[11].label = "Asym2"; + scalePoints[12].label = "Pow2"; + scalePoints[13].label = "sigmoid"; + scalePoints[ 0].value = 0.0f; + scalePoints[ 1].value = 1.0f; + scalePoints[ 2].value = 2.0f; + scalePoints[ 3].value = 3.0f; + scalePoints[ 4].value = 4.0f; + scalePoints[ 5].value = 5.0f; + scalePoints[ 6].value = 6.0f; + scalePoints[ 7].value = 7.0f; + scalePoints[ 8].value = 8.0f; + scalePoints[ 9].value = 9.0f; + scalePoints[10].value = 10.0f; + scalePoints[11].value = 11.0f; + scalePoints[12].value = 12.0f; + scalePoints[13].value = 13.0f; + break; + case 4: hints |= PARAMETER_IS_AUTOMABLE|PARAMETER_IS_BOOLEAN; - param.name = "Wet Only"; + param.name = "Negate"; param.ranges.def = 0.0f; param.ranges.max = 1.0f; break; + case 5: + hints |= PARAMETER_IS_AUTOMABLE; + param.name = "lpf"; + param.ranges.def = 96.0f; + break; + case 6: + hints |= PARAMETER_IS_AUTOMABLE; + param.name = "hpf"; + param.ranges.def = 0.0f; + break; + case 7: + hints |= PARAMETER_IS_AUTOMABLE|PARAMETER_IS_BOOLEAN; + param.name = "Stereo"; + param.ranges.def = 0.0f; + param.ranges.max = 1.0f; + break; + case 8: + hints |= PARAMETER_IS_AUTOMABLE|PARAMETER_IS_BOOLEAN; + param.name = "Pre-Filtering"; + param.ranges.def = 0.0f; + param.ranges.max = 1.0f; + break; + } + + param.hints = static_cast(hints); + + return ¶m; + } + + // ------------------------------------------------------------------- + // Plugin midi-program calls + + const MidiProgram* getMidiProgramInfo(const uint32_t index) override + { + if (index >= kProgramCount) + return nullptr; + + static MidiProgram midiProg; + + midiProg.bank = 0; + midiProg.program = index; + + switch (index) + { + case 0: + midiProg.name = "Overdrive 1"; + break; case 1: + midiProg.name = "Overdrive 2"; + break; + case 2: + midiProg.name = "A. Exciter 1"; + break; + case 3: + midiProg.name = "A. Exciter 2"; + break; + case 4: + midiProg.name = "Guitar Amp"; + break; + case 5: + midiProg.name = "Quantisize"; + break; + default: + midiProg.name = nullptr; + break; + } + + return &midiProg; + } + + ZynPluginDescriptorClassEND(FxDistortionPlugin) + CARLA_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(FxDistortionPlugin) +}; + +// ----------------------------------------------------------------------- + +class FxReverbPlugin : public FxAbstractPlugin +{ +public: + FxReverbPlugin(const HostDescriptor* const host) + : FxAbstractPlugin(host, 13, 13) + { + fEffect = new Reverb(false, efxoutl, efxoutr); + } + +protected: + // ------------------------------------------------------------------- + // Plugin parameter calls + + const Parameter* getParameterInfo(const uint32_t index) override + { + if (index >= kParamCount) + return nullptr; + + static Parameter param; + + int hints = PARAMETER_IS_ENABLED | PARAMETER_IS_INTEGER; + + param.name = nullptr; + param.unit = nullptr; + param.ranges.def = 1.0f; + param.ranges.min = 0.0f; + param.ranges.max = 127.0f; + param.ranges.step = 1.0f; + param.ranges.stepSmall = 1.0f; + param.ranges.stepLarge = 20.0f; + param.scalePointCount = 0; + param.scalePoints = nullptr; + + switch (index) + { + case 0: hints |= PARAMETER_IS_AUTOMABLE; param.name = "Time"; param.ranges.def = 63.0f; break; - case 2: + case 1: param.name = "Delay"; param.ranges.def = 24.0f; break; - case 3: + case 2: hints |= PARAMETER_IS_AUTOMABLE; param.name = "Feedback"; param.ranges.def = 0.0f; break; - case 4: + case 3: hints = 0x0; param.name = "unused1"; break; - case 5: + case 4: hints = 0x0; param.name = "unused2"; break; - case 6: + case 5: param.name = "Low-Pass Filter"; param.ranges.def = 85.0f; break; - case 7: + case 6: param.name = "High-Pass Filter"; param.ranges.def = 5.0f; break; - case 8: + case 7: hints |= PARAMETER_IS_AUTOMABLE; param.name = "Damp"; param.ranges.def = 83.0f; break; - case 9: + case 8: param.name = "Type"; param.ranges.def = 1.0f; param.ranges.max = 2.0f; break; - case 10: + case 9: param.name = "Room size"; param.ranges.def = 64.0f; break; - case 11: + case 10: param.name = "Bandwidth"; param.ranges.def = 20.0f; break; @@ -1122,7 +1288,6 @@ protected: midiProg.bank = 0; midiProg.program = index; - midiProg.name = nullptr; switch (index) { @@ -1165,6 +1330,9 @@ protected: case 12: midiProg.name = "VeryLong2"; break; + default: + midiProg.name = nullptr; + break; } return &midiProg; @@ -1477,7 +1645,8 @@ private: static const PluginDescriptor fxAlienWahDesc = { /* category */ PLUGIN_CATEGORY_MODULATOR, - /* hints */ static_cast(PLUGIN_IS_RTSAFE|PLUGIN_USES_STATIC_BUFFERS), + /* hints */ static_cast(PLUGIN_IS_RTSAFE|PLUGIN_USES_PANNING|PLUGIN_USES_STATIC_BUFFERS), + /* supports */ static_cast(0x0), /* audioIns */ 2, /* audioOuts */ 2, /* midiIns */ 0, @@ -1493,7 +1662,8 @@ static const PluginDescriptor fxAlienWahDesc = { static const PluginDescriptor fxChorusDesc = { /* category */ PLUGIN_CATEGORY_MODULATOR, - /* hints */ static_cast(PLUGIN_USES_STATIC_BUFFERS), + /* hints */ static_cast(PLUGIN_IS_RTSAFE|PLUGIN_USES_PANNING|PLUGIN_USES_STATIC_BUFFERS), + /* supports */ static_cast(0x0), /* audioIns */ 2, /* audioOuts */ 2, /* midiIns */ 0, @@ -1507,15 +1677,15 @@ static const PluginDescriptor fxChorusDesc = { PluginDescriptorFILL(FxChorusPlugin) }; -#if 0 static const PluginDescriptor fxDistortionDesc = { /* category */ PLUGIN_CATEGORY_MODULATOR, - /* hints */ static_cast(PLUGIN_USES_STATIC_BUFFERS), + /* hints */ static_cast(PLUGIN_USES_PANNING|PLUGIN_USES_STATIC_BUFFERS), + /* supports */ static_cast(0x0), /* audioIns */ 2, /* audioOuts */ 2, /* midiIns */ 0, /* midiOuts */ 0, - /* paramIns */ FxDistortionPlugin::kParamCount, + /* paramIns */ 11-1, /* paramOuts */ 0, /* name */ "ZynDistortion", /* label */ "zynDistortion", @@ -1524,9 +1694,11 @@ static const PluginDescriptor fxDistortionDesc = { PluginDescriptorFILL(FxDistortionPlugin) }; +#if 0 static const PluginDescriptor fxDynamicFilterDesc = { /* category */ PLUGIN_CATEGORY_FILTER, - /* hints */ static_cast(PLUGIN_USES_STATIC_BUFFERS), + /* hints */ static_cast(PLUGIN_USES_PANNING|PLUGIN_USES_STATIC_BUFFERS), + /* supports */ static_cast(0x0), /* audioIns */ 2, /* audioOuts */ 2, /* midiIns */ 0, @@ -1542,7 +1714,8 @@ static const PluginDescriptor fxDynamicFilterDesc = { static const PluginDescriptor fxEchoDesc = { /* category */ PLUGIN_CATEGORY_DELAY, - /* hints */ static_cast(PLUGIN_USES_STATIC_BUFFERS), + /* hints */ static_cast(PLUGIN_USES_PANNING|PLUGIN_USES_STATIC_BUFFERS), + /* supports */ static_cast(0x0), /* audioIns */ 2, /* audioOuts */ 2, /* midiIns */ 0, @@ -1556,25 +1729,10 @@ static const PluginDescriptor fxEchoDesc = { PluginDescriptorFILL(FxEchoPlugin) }; -static const PluginDescriptor fxEqDesc = { - /* category */ PLUGIN_CATEGORY_EQ, - /* hints */ static_cast(PLUGIN_USES_STATIC_BUFFERS), - /* audioIns */ 2, - /* audioOuts */ 2, - /* midiIns */ 0, - /* midiOuts */ 0, - /* paramIns */ FxEqPlugin::kParamCount, - /* paramOuts */ 0, - /* name */ "ZynEq", - /* label */ "zynEq", - /* maker */ "falkTX", - /* copyright */ "GNU GPL v2+", - PluginDescriptorFILL(FxEqPlugin) -}; - static const PluginDescriptor fxPhaserDesc = { /* category */ PLUGIN_CATEGORY_MODULATOR, - /* hints */ static_cast(PLUGIN_USES_STATIC_BUFFERS), + /* hints */ static_cast(PLUGIN_USES_PANNING|PLUGIN_USES_STATIC_BUFFERS), + /* supports */ static_cast(0x0), /* audioIns */ 2, /* audioOuts */ 2, /* midiIns */ 0, @@ -1591,7 +1749,8 @@ static const PluginDescriptor fxPhaserDesc = { static const PluginDescriptor fxReverbDesc = { /* category */ PLUGIN_CATEGORY_DELAY, - /* hints */ static_cast(PLUGIN_USES_STATIC_BUFFERS), + /* hints */ static_cast(PLUGIN_USES_PANNING|PLUGIN_USES_STATIC_BUFFERS), + /* supports */ static_cast(0x0), /* audioIns */ 2, /* audioOuts */ 2, /* midiIns */ 0, @@ -1612,6 +1771,7 @@ static const PluginDescriptor zynaddsubfxDesc = { #else /* hints */ static_cast(PLUGIN_IS_SYNTH|PLUGIN_USES_STATE), #endif + /* supports */ static_cast(PLUGIN_SUPPORTS_CONTROL_CHANGES|PLUGIN_SUPPORTS_NOTE_AFTERTOUCH|PLUGIN_SUPPORTS_PITCHBEND|PLUGIN_SUPPORTS_ALL_SOUND_OFF), /* audioIns */ 0, /* audioOuts */ 2, /* midiIns */ 1, @@ -1631,11 +1791,10 @@ void carla_register_native_plugin_zynaddsubfx() { carla_register_native_plugin(&fxAlienWahDesc); carla_register_native_plugin(&fxChorusDesc); -#if 0 carla_register_native_plugin(&fxDistortionDesc); +#if 0 carla_register_native_plugin(&fxDynamicFilterDesc); carla_register_native_plugin(&fxEchoDesc); - carla_register_native_plugin(&fxEqDesc); carla_register_native_plugin(&fxPhaserDesc); #endif carla_register_native_plugin(&fxReverbDesc); diff --git a/source/backend/plugin/NativePlugin.cpp b/source/backend/plugin/NativePlugin.cpp index 2c8b49da3..c2e464b9d 100644 --- a/source/backend/plugin/NativePlugin.cpp +++ b/source/backend/plugin/NativePlugin.cpp @@ -17,6 +17,8 @@ #include "CarlaPluginInternal.hpp" +#define WANT_NATIVE + #ifdef WANT_NATIVE #include "CarlaNative.h" diff --git a/source/backend/standalone/Makefile b/source/backend/standalone/Makefile index 7260187f7..32f342022 100644 --- a/source/backend/standalone/Makefile +++ b/source/backend/standalone/Makefile @@ -138,7 +138,7 @@ debug: # -------------------------------------------------------------- -%.cpp.o: %.cpp ../CarlaBackend.hpp ../CarlaEngine.hpp ../CarlaPlugin.hpp ../CarlaStandalone.hpp +%.cpp.o: %.cpp ../CarlaBackend.hpp ../CarlaEngine.hpp ../CarlaNative.h ../CarlaPlugin.hpp ../CarlaStandalone.hpp $(CXX) $< $(BUILD_CXX_FLAGS) -c -o $@ ../libcarla_standalone.dll: $(OBJS) $(LIBS)