#pragma once #include "EffectApplication.h" #include "../shape/Point.h" #include "../audio/Effect.h" #include "../lua/LuaParser.h" class CustomEffect : public EffectApplication { public: CustomEffect(std::function errorCallback, double (&luaValues)[26]); ~CustomEffect(); // arbitrary UUID static const juce::String FILE_NAME; Point apply(int index, Point input, const std::vector& values, double sampleRate) override; void updateCode(const juce::String& newCode); juce::String getCode(); double frequency = 0; private: const juce::String DEFAULT_SCRIPT = "return { x, y, z }"; juce::String code = DEFAULT_SCRIPT; std::function errorCallback; std::unique_ptr parser = std::make_unique(FILE_NAME, code, errorCallback); juce::SpinLock codeLock; bool defaultScript = true; lua_State *L = nullptr; LuaVariables vars; double(&luaValues)[26]; };