|
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900 |
- /*
- * Carla Native Plugins
- * Copyright (C) 2012-2014 Filipe Coelho <falktx@falktx.com>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * For a full copy of the GNU General Public License see the doc/GPL.txt file.
- */
-
- #include "CarlaNative.hpp"
-
- #include "JucePluginWindow.hpp"
-
- using namespace juce;
-
- #include "vex/VexArp.h"
- #include "vex/VexChorus.h"
- #include "vex/VexDelay.h"
- #include "vex/VexReverb.h"
-
- #include "vex/PeggyViewComponent.h"
-
- // -----------------------------------------------------------------------
-
- class VexArpPlugin : public NativePluginClass,
- public PeggyViewComponent::Callback
- {
- public:
- enum Params {
- kParamOnOff = 0,
- kParamLength,
- kParamTimeMode,
- kParamSyncMode,
- kParamFailMode,
- kParamVelMode,
- kParamLast,
- kParamCount = kParamLast + VexArpSettings::kVelocitiesSize + VexArpSettings::kGridSize
- };
-
- VexArpPlugin(const NativeHostDescriptor* const host)
- : NativePluginClass(host),
- fArp(&fSettings),
- fNeedsUpdate(true)
- {
- fArp.setSampleRate(getSampleRate());
- fMidiInBuffer.ensureSize(512*4);
- }
-
- protected:
- // -------------------------------------------------------------------
- // Plugin parameter calls
-
- uint32_t getParameterCount() const override
- {
- return kParamCount;
- }
-
- const NativeParameter* getParameterInfo(const uint32_t index) const override
- {
- static NativeParameter paramInfo;
- static NativeParameterScalePoint scalePoints[4];
- static char bufName[24+1];
-
- int hints = PARAMETER_IS_ENABLED|PARAMETER_IS_AUTOMABLE;
-
- paramInfo.name = nullptr;
- paramInfo.unit = nullptr;
- paramInfo.ranges.def = 0.0f;
- paramInfo.ranges.min = 0.0f;
- paramInfo.ranges.max = 1.0f;
- paramInfo.ranges.step = PARAMETER_RANGES_DEFAULT_STEP;
- paramInfo.ranges.stepSmall = PARAMETER_RANGES_DEFAULT_STEP_SMALL;
- paramInfo.ranges.stepLarge = PARAMETER_RANGES_DEFAULT_STEP_LARGE;
- paramInfo.scalePointCount = 0;
- paramInfo.scalePoints = nullptr;
-
- if (index < kParamLast)
- {
- hints |= PARAMETER_IS_INTEGER;
- paramInfo.ranges.step = 1.0f;
- paramInfo.ranges.stepSmall = 1.0f;
- paramInfo.ranges.stepLarge = 1.0f;
-
- switch (index)
- {
- case kParamOnOff:
- hints |= PARAMETER_IS_BOOLEAN;
- paramInfo.name = "On/Off";
- paramInfo.ranges.def = 0.0f;
- paramInfo.ranges.min = 0.0f;
- paramInfo.ranges.max = 1.0f;
- break;
- case kParamLength:
- paramInfo.name = "Length";
- paramInfo.ranges.def = 8.0f;
- paramInfo.ranges.min = 1.0f;
- paramInfo.ranges.max = 16.0f;
- break;
- case kParamTimeMode:
- hints |= PARAMETER_USES_SCALEPOINTS;
- paramInfo.name = "Time Signature";
- paramInfo.ranges.def = 2.0f;
- paramInfo.ranges.min = 1.0f;
- paramInfo.ranges.max = 3.0f;
- paramInfo.scalePointCount = 3;
- paramInfo.scalePoints = scalePoints;
- scalePoints[0].label = "1/8";
- scalePoints[1].label = "1/16";
- scalePoints[2].label = "1/32";
- scalePoints[0].value = 1.0f;
- scalePoints[1].value = 2.0f;
- scalePoints[2].value = 3.0f;
- break;
- case kParamSyncMode:
- hints |= PARAMETER_USES_SCALEPOINTS;
- paramInfo.name = "Sync Mode";
- paramInfo.ranges.def = 1.0f;
- paramInfo.ranges.min = 1.0f;
- paramInfo.ranges.max = 2.0f;
- paramInfo.scalePointCount = 2;
- paramInfo.scalePoints = scalePoints;
- scalePoints[0].label = "Key Sync";
- scalePoints[1].label = "Bar Sync";
- scalePoints[0].value = 1.0f;
- scalePoints[1].value = 2.0f;
- break;
- case kParamFailMode:
- hints |= PARAMETER_USES_SCALEPOINTS;
- paramInfo.name = "Fail Mode";
- paramInfo.ranges.def = 1.0f;
- paramInfo.ranges.min = 1.0f;
- paramInfo.ranges.max = 3.0f;
- paramInfo.scalePointCount = 3;
- paramInfo.scalePoints = scalePoints;
- scalePoints[0].label = "Silent Step";
- scalePoints[1].label = "Skip One";
- scalePoints[2].label = "Skip Two";
- scalePoints[0].value = 1.0f;
- scalePoints[1].value = 2.0f;
- scalePoints[2].value = 3.0f;
- break;
- case kParamVelMode:
- hints |= PARAMETER_USES_SCALEPOINTS;
- paramInfo.name = "Velocity Mode";
- paramInfo.ranges.def = 1.0f;
- paramInfo.ranges.min = 1.0f;
- paramInfo.ranges.max = 3.0f;
- paramInfo.scalePointCount = 3;
- paramInfo.scalePoints = scalePoints;
- scalePoints[0].label = "Pattern Velocity";
- scalePoints[1].label = "Input Velocity";
- scalePoints[2].label = "Sum Velocities";
- scalePoints[0].value = 1.0f;
- scalePoints[1].value = 2.0f;
- scalePoints[2].value = 3.0f;
- break;
- }
- }
- else if (index < kParamLast + VexArpSettings::kVelocitiesSize)
- {
- carla_zeroChar(bufName, 24+1);
- std::snprintf(bufName, 24, "Grid Velocity %i", index - kParamLast);
- paramInfo.name = bufName;
- }
- else
- {
- carla_zeroChar(bufName, 24+1);
- hints |= PARAMETER_IS_BOOLEAN|PARAMETER_IS_INTEGER;
- paramInfo.ranges.step = 1.0f;
- paramInfo.ranges.stepSmall = 1.0f;
- paramInfo.ranges.stepLarge = 1.0f;
-
- carla_zeroChar(bufName, 24+1);
- std::snprintf(bufName, 24, "Grid on/off %i", index - (kParamLast + VexArpSettings::kVelocitiesSize));
- paramInfo.name = bufName;
- }
-
- paramInfo.hints = static_cast<NativeParameterHints>(hints);
- return ¶mInfo;
- }
-
- float getParameterValue(const uint32_t index) const override
- {
- if (index < kParamLast)
- {
- switch (index)
- {
- case kParamOnOff:
- return fSettings.on ? 1.0f : 0.0f;
- case kParamLength:
- return fSettings.length;
- case kParamTimeMode:
- return fSettings.timeMode;
- case kParamSyncMode:
- return fSettings.syncMode;
- case kParamFailMode:
- return fSettings.failMode;
- case kParamVelMode:
- return fSettings.velMode;
- default:
- return 0.0f;
- }
- }
- else if (index < kParamLast + VexArpSettings::kVelocitiesSize)
- {
- return fSettings.velocities[index-kParamLast];
- }
- else
- {
- return fSettings.grid[index-(kParamLast+VexArpSettings::kVelocitiesSize)] ? 1.0f : 0.0f;
- }
- }
-
- // -------------------------------------------------------------------
- // Plugin state calls
-
- void setParameterValue(const uint32_t index, const float value) override
- {
- if (index < kParamLast)
- {
- switch (index)
- {
- case kParamOnOff:
- fSettings.on = (value >= 0.5f);
- break;
- case kParamLength:
- fSettings.length = value;
- break;
- case kParamTimeMode:
- fSettings.timeMode = value;
- break;
- case kParamSyncMode:
- fSettings.syncMode = value;
- break;
- case kParamFailMode:
- fSettings.failMode = value;
- break;
- case kParamVelMode:
- fSettings.velMode = value;
- break;
- }
- }
- else if (index < kParamLast + VexArpSettings::kVelocitiesSize)
- {
- fSettings.velocities[index-kParamLast] = value;
- }
- else
- {
- fSettings.grid[index-(kParamLast+VexArpSettings::kVelocitiesSize)] = (value >= 0.5f);
- }
- }
-
- // -------------------------------------------------------------------
- // Plugin process calls
-
- void process(float**, float**, const uint32_t frames, const NativeMidiEvent* const midiEvents, const uint32_t midiEventCount) override
- {
- if (! fSettings.on)
- {
- for (uint32_t i=0; i < midiEventCount; ++i)
- writeMidiEvent(&midiEvents[i]);
-
- return;
- }
-
- const NativeTimeInfo* const timeInfo(getTimeInfo());
-
- bool timePlaying = false;
- double ppqPos = 0.0;
- double barStartPos = 0.0;
- double bpm = 120.0;
-
- if (timeInfo != nullptr)
- {
- timePlaying = timeInfo->playing;
-
- if (timeInfo->bbt.valid)
- {
- double ppqBar = double(timeInfo->bbt.bar - 1) * timeInfo->bbt.beatsPerBar;
- double ppqBeat = double(timeInfo->bbt.beat - 1);
- double ppqTick = double(timeInfo->bbt.tick) / timeInfo->bbt.ticksPerBeat;
-
- ppqPos = ppqBar + ppqBeat + ppqTick;
- barStartPos = ppqBar;
- bpm = timeInfo->bbt.beatsPerMinute;
- }
- }
-
- fMidiInBuffer.clear();
-
- for (uint32_t i=0; i < midiEventCount; ++i)
- {
- const NativeMidiEvent* const midiEvent(&midiEvents[i]);
- fMidiInBuffer.addEvent(midiEvent->data, midiEvent->size, midiEvent->time);
- }
-
- const MidiBuffer& outMidiBuffer(fArp.processMidi(fMidiInBuffer, timePlaying, ppqPos, barStartPos, bpm, frames));
-
- MidiBuffer::Iterator outBufferIterator(outMidiBuffer);
- const uint8_t* midiData;
- int numBytes;
- int sampleNumber;
-
- NativeMidiEvent tmpEvent;
- tmpEvent.port = 0;
-
- for (; outBufferIterator.getNextEvent(midiData, numBytes, sampleNumber);)
- {
- if (numBytes <= 0 || numBytes > 4)
- continue;
-
- tmpEvent.size = numBytes;
- tmpEvent.time = sampleNumber;
-
- std::memcpy(tmpEvent.data, midiData, sizeof(uint8_t)*tmpEvent.size);
- writeMidiEvent(&tmpEvent);
- }
- }
-
- // -------------------------------------------------------------------
- // Plugin UI calls
-
- void uiShow(const bool show) override
- {
- const MessageManagerLock mmLock;
-
- if (show)
- {
- if (fWindow == nullptr)
- {
- fWindow = new JucePluginWindow();
- fWindow->setName(getUiName());
- }
-
- if (fView == nullptr)
- {
- fView = new PeggyViewComponent(fSettings, this, true);
- fView->setSize(202, 275);
- }
-
- fWindow->show(fView);
- }
- else if (fWindow != nullptr)
- {
- fWindow->hide();
-
- fView = nullptr;
- fWindow = nullptr;
- }
- }
-
- void uiIdle() override
- {
- if (fWindow == nullptr)
- return;
-
- if (fNeedsUpdate)
- {
- if (fView != nullptr)
- {
- const MessageManagerLock mmLock;
- fView->update();
- }
-
- fNeedsUpdate = false;
- }
-
- if (fWindow->wasClosedByUser())
- {
- uiShow(false);
- uiClosed();
- }
- }
-
- void uiSetParameterValue(const uint32_t, const float) override
- {
- if (fView == nullptr)
- return;
-
- fNeedsUpdate = true;
- }
-
- // -------------------------------------------------------------------
- // Plugin dispatcher calls
-
- void sampleRateChanged(const double sampleRate) override
- {
- fArp.setSampleRate(sampleRate);
- }
-
- void uiNameChanged(const char* const uiName) override
- {
- if (fWindow == nullptr)
- return;
-
- const MessageManagerLock mmLock;
- fWindow->setName(uiName);
- }
-
- // -------------------------------------------------------------------
- // Peggy callback
-
- void arpParameterChanged(const uint32_t id) override
- {
- uiParameterChanged(id, getParameterValue(id));
- }
-
- private:
- VexArpSettings fSettings;
- VexArp fArp;
- MidiBuffer fMidiInBuffer;
-
- volatile bool fNeedsUpdate;
-
- ScopedPointer<PeggyViewComponent> fView;
- ScopedPointer<JucePluginWindow> fWindow;
-
- PluginClassEND(VexArpPlugin)
- CARLA_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(VexArpPlugin)
- };
-
- // -----------------------------------------------------------------------
-
- class VexChorusPlugin : public NativePluginClass
- {
- public:
- enum Params {
- kParamRate = 0,
- kParamDepth,
- kParamCount
- };
-
- VexChorusPlugin(const NativeHostDescriptor* const host)
- : NativePluginClass(host),
- fChorus(fParameters)
- {
- std::memset(fParameters, 0, sizeof(float)*92);
-
- fParameters[76] = 0.3f;
- fParameters[77] = 0.6f;
-
- fChorus.setSampleRate(getSampleRate());
- }
-
- protected:
- // -------------------------------------------------------------------
- // Plugin parameter calls
-
- uint32_t getParameterCount() const override
- {
- return kParamCount;
- }
-
- const NativeParameter* getParameterInfo(const uint32_t index) const override
- {
- static NativeParameter paramInfo;
-
- int hints = PARAMETER_IS_ENABLED|PARAMETER_IS_AUTOMABLE;
-
- paramInfo.name = nullptr;
- paramInfo.unit = nullptr;
- paramInfo.ranges.def = 0.0f;
- paramInfo.ranges.min = 0.0f;
- paramInfo.ranges.max = 1.0f;
- paramInfo.ranges.step = PARAMETER_RANGES_DEFAULT_STEP;
- paramInfo.ranges.stepSmall = PARAMETER_RANGES_DEFAULT_STEP_SMALL;
- paramInfo.ranges.stepLarge = PARAMETER_RANGES_DEFAULT_STEP_LARGE;
- paramInfo.scalePointCount = 0;
- paramInfo.scalePoints = nullptr;
-
- switch (index)
- {
- case kParamRate:
- paramInfo.name = "Rate";
- paramInfo.ranges.def = 0.3f;
- break;
- case kParamDepth:
- paramInfo.name = "Depth";
- paramInfo.ranges.def = 0.6f;
- break;
- }
-
- paramInfo.hints = static_cast<NativeParameterHints>(hints);
-
- return ¶mInfo;
- }
-
- float getParameterValue(const uint32_t index) const override
- {
- switch (index)
- {
- case kParamRate:
- return fParameters[76];
- case kParamDepth:
- return fParameters[77];
- default:
- return 0.0f;
- }
- }
-
- // -------------------------------------------------------------------
- // Plugin state calls
-
- void setParameterValue(const uint32_t index, const float value) override
- {
- switch (index)
- {
- case kParamRate:
- fParameters[76] = value;
- break;
- case kParamDepth:
- fParameters[77] = value;
- break;
- default:
- break;
- }
- }
-
- // -------------------------------------------------------------------
- // Plugin process calls
-
- void process(float** const inBuffer, float** const outBuffer, const uint32_t frames, const NativeMidiEvent* const, const uint32_t) override
- {
- if (inBuffer[0] != outBuffer[0])
- FloatVectorOperations::copy(outBuffer[0], inBuffer[0], frames);
- if (inBuffer[1] != outBuffer[1])
- FloatVectorOperations::copy(outBuffer[1], inBuffer[1], frames);
-
- fChorus.processBlock(outBuffer[0], outBuffer[1], frames);
- }
-
- // -------------------------------------------------------------------
- // Plugin dispatcher calls
-
- void sampleRateChanged(const double sampleRate) override
- {
- fChorus.setSampleRate(sampleRate);
- }
-
- private:
- VexChorus fChorus;
- float fParameters[92];
-
- PluginClassEND(VexChorusPlugin)
- CARLA_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(VexChorusPlugin)
- };
-
- // -----------------------------------------------------------------------
-
- class VexDelayPlugin : public NativePluginClass
- {
- public:
- enum Params {
- kParamTime = 0,
- kParamFeedback,
- kParamCount
- };
-
- VexDelayPlugin(const NativeHostDescriptor* const host)
- : NativePluginClass(host),
- fDelay(fParameters)
- {
- std::memset(fParameters, 0, sizeof(float)*92);
-
- fParameters[73] = 0.5f;
- fParameters[74] = 0.4f;
-
- fDelay.setSampleRate(getSampleRate());
- }
-
- protected:
- // -------------------------------------------------------------------
- // Plugin parameter calls
-
- uint32_t getParameterCount() const override
- {
- return kParamCount;
- }
-
- const NativeParameter* getParameterInfo(const uint32_t index) const override
- {
- static NativeParameter paramInfo;
-
- int hints = PARAMETER_IS_ENABLED|PARAMETER_IS_AUTOMABLE;
-
- paramInfo.name = nullptr;
- paramInfo.unit = nullptr;
- paramInfo.ranges.def = 0.0f;
- paramInfo.ranges.min = 0.0f;
- paramInfo.ranges.max = 1.0f;
- paramInfo.ranges.step = PARAMETER_RANGES_DEFAULT_STEP;
- paramInfo.ranges.stepSmall = PARAMETER_RANGES_DEFAULT_STEP_SMALL;
- paramInfo.ranges.stepLarge = PARAMETER_RANGES_DEFAULT_STEP_LARGE;
- paramInfo.scalePointCount = 0;
- paramInfo.scalePoints = nullptr;
-
- switch (index)
- {
- case kParamTime:
- hints |= PARAMETER_IS_INTEGER;
- paramInfo.name = "Time";
- paramInfo.unit = "steps";
- paramInfo.ranges.def = 4.0f;
- paramInfo.ranges.min = 0.0f;
- paramInfo.ranges.max = 8.0f;
- break;
- case kParamFeedback:
- paramInfo.name = "Feedback";
- paramInfo.unit = "%";
- paramInfo.ranges.def = 40.0f;
- paramInfo.ranges.min = 0.0f;
- paramInfo.ranges.max = 100.0f;
- break;
- }
-
- paramInfo.hints = static_cast<NativeParameterHints>(hints);
-
- return ¶mInfo;
- }
-
- float getParameterValue(const uint32_t index) const override
- {
- switch (index)
- {
- case kParamTime:
- return fParameters[73] * 8.0f;
- case kParamFeedback:
- return fParameters[74] * 100.0f;
- default:
- return 0.0f;
- }
- }
-
- // -------------------------------------------------------------------
- // Plugin state calls
-
- void setParameterValue(const uint32_t index, const float value) override
- {
- switch (index)
- {
- case kParamTime:
- fParameters[73] = value/8.0f;
- break;
- case kParamFeedback:
- fParameters[74] = value/100.0f;
- break;
- default:
- break;
- }
- }
-
- // -------------------------------------------------------------------
- // Plugin process calls
-
- void process(float** const inBuffer, float** const outBuffer, const uint32_t frames, const NativeMidiEvent* const, const uint32_t) override
- {
- if (inBuffer[0] != outBuffer[0])
- FloatVectorOperations::copy(outBuffer[0], inBuffer[0], frames);
- if (inBuffer[1] != outBuffer[1])
- FloatVectorOperations::copy(outBuffer[1], inBuffer[1], frames);
-
- const NativeTimeInfo* const timeInfo(getTimeInfo());
- const double bpm((timeInfo != nullptr && timeInfo->bbt.valid) ? timeInfo->bbt.beatsPerMinute : 120.0);
-
- fDelay.processBlock(outBuffer[0], outBuffer[1], frames, bpm);
- }
-
- // -------------------------------------------------------------------
- // Plugin dispatcher calls
-
- void sampleRateChanged(const double sampleRate) override
- {
- fDelay.setSampleRate(sampleRate);
- }
-
- private:
- VexDelay fDelay;
- float fParameters[92];
-
- PluginClassEND(VexDelayPlugin)
- CARLA_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(VexDelayPlugin)
- };
-
- // -----------------------------------------------------------------------
-
- class VexReverbPlugin : public NativePluginClass
- {
- public:
- enum Params {
- kParamSize = 0,
- kParamWidth,
- kParamDamp,
- kParamCount
- };
-
- VexReverbPlugin(const NativeHostDescriptor* const host)
- : NativePluginClass(host),
- fReverb(fParameters)
- {
- std::memset(fParameters, 0, sizeof(float)*92);
-
- fParameters[79] = 0.6f;
- fParameters[80] = 0.7f;
- fParameters[81] = 0.6f;
- }
-
- protected:
- // -------------------------------------------------------------------
- // Plugin parameter calls
-
- uint32_t getParameterCount() const override
- {
- return kParamCount;
- }
-
- const NativeParameter* getParameterInfo(const uint32_t index) const override
- {
- static NativeParameter paramInfo;
-
- int hints = PARAMETER_IS_ENABLED|PARAMETER_IS_AUTOMABLE;
-
- paramInfo.name = nullptr;
- paramInfo.unit = nullptr;
- paramInfo.ranges.def = 0.0f;
- paramInfo.ranges.min = 0.0f;
- paramInfo.ranges.max = 1.0f;
- paramInfo.ranges.step = PARAMETER_RANGES_DEFAULT_STEP;
- paramInfo.ranges.stepSmall = PARAMETER_RANGES_DEFAULT_STEP_SMALL;
- paramInfo.ranges.stepLarge = PARAMETER_RANGES_DEFAULT_STEP_LARGE;
- paramInfo.scalePointCount = 0;
- paramInfo.scalePoints = nullptr;
-
- switch (index)
- {
- case kParamSize:
- paramInfo.name = "Size";
- paramInfo.ranges.def = 0.6f;
- break;
- case kParamWidth:
- paramInfo.name = "Width";
- paramInfo.ranges.def = 0.7f;
- break;
- case kParamDamp:
- paramInfo.name = "Damp";
- paramInfo.ranges.def = 0.6f;
- break;
- }
-
- paramInfo.hints = static_cast<NativeParameterHints>(hints);
-
- return ¶mInfo;
- }
-
- float getParameterValue(const uint32_t index) const override
- {
- switch (index)
- {
- case kParamSize:
- return fParameters[79];
- case kParamWidth:
- return fParameters[80];
- case kParamDamp:
- return fParameters[81];
- default:
- return 0.0f;
- }
- }
-
- // -------------------------------------------------------------------
- // Plugin state calls
-
- void setParameterValue(const uint32_t index, const float value) override
- {
- switch (index)
- {
- case kParamSize:
- fParameters[79] = value;
- break;
- case kParamWidth:
- fParameters[80] = value;
- break;
- case kParamDamp:
- fParameters[81] = value;
- break;
- default:
- break;
- }
- }
-
- // -------------------------------------------------------------------
- // Plugin process calls
-
- void process(float** const inBuffer, float** const outBuffer, const uint32_t frames, const NativeMidiEvent* const, const uint32_t) override
- {
- for (uint32_t i=0; i< frames; ++i)
- FloatVectorOperations::copyWithMultiply(outBuffer[0], inBuffer[0], 0.5f, frames);
- for (uint32_t i=0; i< frames; ++i)
- FloatVectorOperations::copyWithMultiply(outBuffer[1], inBuffer[1], 0.5f, frames);
-
- fReverb.processBlock(outBuffer[0], outBuffer[1], frames);
- }
-
- private:
- VexReverb fReverb;
- float fParameters[92];
-
- PluginClassEND(VexReverbPlugin)
- CARLA_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(VexReverbPlugin)
- };
-
- // -----------------------------------------------------------------------
-
- static const NativePluginDescriptor vexArpDesc = {
- /* category */ PLUGIN_CATEGORY_UTILITY,
- /* hints */ static_cast<NativePluginHints>(PLUGIN_HAS_UI|PLUGIN_NEEDS_UI_JUCE|PLUGIN_USES_TIME),
- /* supports */ static_cast<NativePluginSupports>(PLUGIN_SUPPORTS_EVERYTHING),
- /* audioIns */ 0,
- /* audioOuts */ 0,
- /* midiIns */ 1,
- /* midiOuts */ 1,
- /* paramIns */ VexArpPlugin::kParamCount,
- /* paramOuts */ 0,
- /* name */ "VexArp",
- /* label */ "vexarp",
- /* maker */ "falkTX, Lucio Asnaghi, rockhardbuns",
- /* copyright */ "GNU GPL v2+",
- PluginDescriptorFILL(VexArpPlugin)
- };
-
- static const NativePluginDescriptor vexChorusDesc = {
- /* category */ PLUGIN_CATEGORY_MODULATOR,
- /* hints */ static_cast<NativePluginHints>(PLUGIN_IS_RTSAFE),
- /* supports */ static_cast<NativePluginSupports>(0x0),
- /* audioIns */ 2,
- /* audioOuts */ 2,
- /* midiIns */ 0,
- /* midiOuts */ 0,
- /* paramIns */ VexChorusPlugin::kParamCount,
- /* paramOuts */ 0,
- /* name */ "VexChorus",
- /* label */ "vexchorus",
- /* maker */ "falkTX, Lucio Asnaghi, rockhardbuns",
- /* copyright */ "GNU GPL v2+",
- PluginDescriptorFILL(VexChorusPlugin)
- };
-
- static const NativePluginDescriptor vexDelayDesc = {
- /* category */ PLUGIN_CATEGORY_DELAY,
- /* hints */ static_cast<NativePluginHints>(PLUGIN_IS_RTSAFE|PLUGIN_USES_TIME),
- /* supports */ static_cast<NativePluginSupports>(0x0),
- /* audioIns */ 2,
- /* audioOuts */ 2,
- /* midiIns */ 0,
- /* midiOuts */ 0,
- /* paramIns */ VexDelayPlugin::kParamCount,
- /* paramOuts */ 0,
- /* name */ "VexDelay",
- /* label */ "vexdelay",
- /* maker */ "falkTX, Lucio Asnaghi, rockhardbuns",
- /* copyright */ "GNU GPL v2+",
- PluginDescriptorFILL(VexDelayPlugin)
- };
-
- static const NativePluginDescriptor vexReverbDesc = {
- /* category */ PLUGIN_CATEGORY_DELAY,
- /* hints */ static_cast<NativePluginHints>(PLUGIN_IS_RTSAFE),
- /* supports */ static_cast<NativePluginSupports>(0x0),
- /* audioIns */ 2,
- /* audioOuts */ 2,
- /* midiIns */ 0,
- /* midiOuts */ 0,
- /* paramIns */ VexReverbPlugin::kParamCount,
- /* paramOuts */ 0,
- /* name */ "VexReverb",
- /* label */ "vexreverb",
- /* maker */ "falkTX, Lucio Asnaghi, rockhardbuns",
- /* copyright */ "GNU GPL v2+",
- PluginDescriptorFILL(VexReverbPlugin)
- };
-
- // -----------------------------------------------------------------------
-
- CARLA_EXPORT
- void carla_register_native_plugin_vex_fx()
- {
- carla_register_native_plugin(&vexArpDesc);
- carla_register_native_plugin(&vexChorusDesc);
- carla_register_native_plugin(&vexDelayDesc);
- carla_register_native_plugin(&vexReverbDesc);
- }
-
- // -----------------------------------------------------------------------
|