Add valleyaudio-plateau lv2 export, WIP
Signed-off-by: falkTX <falktx@falktx.com>
This commit is contained in:
parent
e861389537
commit
70d73741ee
2 changed files with 181 additions and 29 deletions
|
@ -37,6 +37,7 @@
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
enum NVGalign {};
|
||||||
struct NVGcolor { float a; };
|
struct NVGcolor { float a; };
|
||||||
struct NVGpaint {};
|
struct NVGpaint {};
|
||||||
|
|
||||||
|
@ -56,9 +57,11 @@ inline void nvgImageSize(void*, int, void*, void*) {}
|
||||||
inline NVGpaint nvgImagePattern(void*, float, float, float, float, float, int handle, float) { return {}; }
|
inline NVGpaint nvgImagePattern(void*, float, float, float, float, float, int handle, float) { return {}; }
|
||||||
|
|
||||||
struct json_t {};
|
struct json_t {};
|
||||||
|
json_t* json_boolean(bool) { return NULL; }
|
||||||
json_t* json_integer(int) { return NULL; }
|
json_t* json_integer(int) { return NULL; }
|
||||||
json_t* json_object() { return NULL; }
|
json_t* json_object() { return NULL; }
|
||||||
json_t* json_object_get(json_t*, const char*) { return NULL; }
|
json_t* json_object_get(json_t*, const char*) { return NULL; }
|
||||||
|
bool json_boolean_value(json_t*) { return false; }
|
||||||
int json_integer_value(json_t*) { return 0; }
|
int json_integer_value(json_t*) { return 0; }
|
||||||
void json_object_set_new(json_t*, const char*, json_t*) {}
|
void json_object_set_new(json_t*, const char*, json_t*) {}
|
||||||
|
|
||||||
|
@ -110,6 +113,10 @@ inline float clamp(float x, float a = 0.f, float b = 1.f) {
|
||||||
return std::fmax(std::fmin(x, b), a);
|
return std::fmax(std::fmin(x, b), a);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline float rescale(float x, float xMin, float xMax, float yMin, float yMax) {
|
||||||
|
return yMin + (x - xMin) / (xMax - xMin) * (yMax - yMin);
|
||||||
|
}
|
||||||
|
|
||||||
struct Vec {
|
struct Vec {
|
||||||
float x = 0.f;
|
float x = 0.f;
|
||||||
float y = 0.f;
|
float y = 0.f;
|
||||||
|
@ -547,12 +554,12 @@ struct Module {
|
||||||
float sampleRate;
|
float sampleRate;
|
||||||
float sampleTime;
|
float sampleTime;
|
||||||
};
|
};
|
||||||
virtual void onSampleRateChange(const SampleRateChangeEvent& e) {
|
virtual void onSampleRateChange(const SampleRateChangeEvent&) {
|
||||||
onSampleRateChange();
|
onSampleRateChange();
|
||||||
}
|
}
|
||||||
|
|
||||||
struct ResetEvent {};
|
struct ResetEvent {};
|
||||||
virtual void onReset(const ResetEvent& e) {} // TODO
|
virtual void onReset(const ResetEvent&) {} // TODO
|
||||||
|
|
||||||
virtual void onAdd() {}
|
virtual void onAdd() {}
|
||||||
virtual void onRemove() {}
|
virtual void onRemove() {}
|
||||||
|
@ -595,11 +602,119 @@ struct Widget {
|
||||||
|
|
||||||
using BaseEvent = widget::BaseEvent;
|
using BaseEvent = widget::BaseEvent;
|
||||||
|
|
||||||
|
struct PositionBaseEvent {
|
||||||
|
math::Vec pos;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct HoverEvent : BaseEvent, PositionBaseEvent {
|
||||||
|
math::Vec mouseDelta;
|
||||||
|
};
|
||||||
|
virtual void onHover(const HoverEvent&) {
|
||||||
|
}
|
||||||
|
|
||||||
|
struct ButtonEvent : BaseEvent, PositionBaseEvent {
|
||||||
|
int button;
|
||||||
|
int action;
|
||||||
|
int mods;
|
||||||
|
};
|
||||||
|
virtual void onButton(const ButtonEvent&) {
|
||||||
|
}
|
||||||
|
|
||||||
|
struct DoubleClickEvent : BaseEvent {};
|
||||||
|
virtual void onDoubleClick(const DoubleClickEvent&) {}
|
||||||
|
|
||||||
|
struct KeyBaseEvent {
|
||||||
|
int key;
|
||||||
|
int scancode;
|
||||||
|
std::string keyName;
|
||||||
|
int action;
|
||||||
|
int mods;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct HoverKeyEvent : BaseEvent, PositionBaseEvent, KeyBaseEvent {};
|
||||||
|
virtual void onHoverKey(const HoverKeyEvent&) {
|
||||||
|
}
|
||||||
|
|
||||||
|
struct TextBaseEvent {
|
||||||
|
int codepoint;
|
||||||
|
};
|
||||||
|
struct HoverTextEvent : BaseEvent, PositionBaseEvent, TextBaseEvent {};
|
||||||
|
virtual void onHoverText(const HoverTextEvent&) {
|
||||||
|
}
|
||||||
|
|
||||||
|
struct HoverScrollEvent : BaseEvent, PositionBaseEvent {
|
||||||
|
math::Vec scrollDelta;
|
||||||
|
};
|
||||||
|
virtual void onHoverScroll(const HoverScrollEvent&) {
|
||||||
|
}
|
||||||
|
|
||||||
|
struct EnterEvent : BaseEvent {};
|
||||||
|
virtual void onEnter(const EnterEvent&) {}
|
||||||
|
|
||||||
|
struct LeaveEvent : BaseEvent {};
|
||||||
|
virtual void onLeave(const LeaveEvent&) {}
|
||||||
|
|
||||||
|
struct SelectEvent : BaseEvent {};
|
||||||
|
virtual void onSelect(const SelectEvent&) {}
|
||||||
|
|
||||||
|
struct DeselectEvent : BaseEvent {};
|
||||||
|
virtual void onDeselect(const DeselectEvent&) {}
|
||||||
|
|
||||||
|
struct SelectKeyEvent : BaseEvent, KeyBaseEvent {};
|
||||||
|
virtual void onSelectKey(const SelectKeyEvent&) {}
|
||||||
|
|
||||||
|
struct SelectTextEvent : BaseEvent, TextBaseEvent {};
|
||||||
|
virtual void onSelectText(const SelectTextEvent&) {}
|
||||||
|
|
||||||
|
struct DragBaseEvent : BaseEvent {
|
||||||
|
int button;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct DragStartEvent : DragBaseEvent {};
|
||||||
|
virtual void onDragStart(const DragStartEvent&) {}
|
||||||
|
|
||||||
|
struct DragEndEvent : DragBaseEvent {};
|
||||||
|
virtual void onDragEnd(const DragEndEvent&) {}
|
||||||
|
|
||||||
|
struct DragMoveEvent : DragBaseEvent {
|
||||||
|
math::Vec mouseDelta;
|
||||||
|
};
|
||||||
|
virtual void onDragMove(const DragMoveEvent&) {}
|
||||||
|
|
||||||
|
struct DragHoverEvent : DragBaseEvent, PositionBaseEvent {
|
||||||
|
Widget* origin = NULL;
|
||||||
|
math::Vec mouseDelta;
|
||||||
|
};
|
||||||
|
virtual void onDragHover(const DragHoverEvent&) {
|
||||||
|
}
|
||||||
|
|
||||||
|
struct DragEnterEvent : DragBaseEvent {
|
||||||
|
Widget* origin = NULL;
|
||||||
|
};
|
||||||
|
virtual void onDragEnter(const DragEnterEvent&) {}
|
||||||
|
|
||||||
|
struct DragLeaveEvent : DragBaseEvent {
|
||||||
|
Widget* origin = NULL;
|
||||||
|
};
|
||||||
|
virtual void onDragLeave(const DragLeaveEvent&) {}
|
||||||
|
|
||||||
|
struct DragDropEvent : DragBaseEvent {
|
||||||
|
Widget* origin = NULL;
|
||||||
|
};
|
||||||
|
virtual void onDragDrop(const DragDropEvent&) {}
|
||||||
|
|
||||||
|
struct PathDropEvent : BaseEvent, PositionBaseEvent {
|
||||||
|
PathDropEvent(const std::vector<std::string>& paths) : paths(paths) {}
|
||||||
|
const std::vector<std::string>& paths;
|
||||||
|
};
|
||||||
|
virtual void onPathDrop(const PathDropEvent&) {
|
||||||
|
}
|
||||||
|
|
||||||
struct ActionEvent : BaseEvent {};
|
struct ActionEvent : BaseEvent {};
|
||||||
virtual void onAction(const ActionEvent& e) {}
|
virtual void onAction(const ActionEvent&) {}
|
||||||
|
|
||||||
struct ChangeEvent : BaseEvent {};
|
struct ChangeEvent : BaseEvent {};
|
||||||
virtual void onChange(const ChangeEvent& e) {}
|
virtual void onChange(const ChangeEvent&) {}
|
||||||
|
|
||||||
bool hasChild(Widget* child) { return false; }
|
bool hasChild(Widget* child) { return false; }
|
||||||
void addChild(Widget* child) {}
|
void addChild(Widget* child) {}
|
||||||
|
@ -923,31 +1038,31 @@ struct PulseGenerator {
|
||||||
} // namespace dsp
|
} // namespace dsp
|
||||||
|
|
||||||
namespace event {
|
namespace event {
|
||||||
// using Base = widget::BaseEvent;
|
using Base = widget::BaseEvent;
|
||||||
// using PositionBase = widget::Widget::PositionBaseEvent;
|
using PositionBase = widget::Widget::PositionBaseEvent;
|
||||||
// using KeyBase = widget::Widget::KeyBaseEvent;
|
using KeyBase = widget::Widget::KeyBaseEvent;
|
||||||
// using TextBase = widget::Widget::TextBaseEvent;
|
using TextBase = widget::Widget::TextBaseEvent;
|
||||||
// using Hover = widget::Widget::HoverEvent;
|
using Hover = widget::Widget::HoverEvent;
|
||||||
// using Button = widget::Widget::ButtonEvent;
|
using Button = widget::Widget::ButtonEvent;
|
||||||
// using DoubleClick = widget::Widget::DoubleClickEvent;
|
using DoubleClick = widget::Widget::DoubleClickEvent;
|
||||||
// using HoverKey = widget::Widget::HoverKeyEvent;
|
using HoverKey = widget::Widget::HoverKeyEvent;
|
||||||
// using HoverText = widget::Widget::HoverTextEvent;
|
using HoverText = widget::Widget::HoverTextEvent;
|
||||||
// using HoverScroll = widget::Widget::HoverScrollEvent;
|
using HoverScroll = widget::Widget::HoverScrollEvent;
|
||||||
// using Enter = widget::Widget::EnterEvent;
|
using Enter = widget::Widget::EnterEvent;
|
||||||
// using Leave = widget::Widget::LeaveEvent;
|
using Leave = widget::Widget::LeaveEvent;
|
||||||
// using Select = widget::Widget::SelectEvent;
|
using Select = widget::Widget::SelectEvent;
|
||||||
// using Deselect = widget::Widget::DeselectEvent;
|
using Deselect = widget::Widget::DeselectEvent;
|
||||||
// using SelectKey = widget::Widget::SelectKeyEvent;
|
using SelectKey = widget::Widget::SelectKeyEvent;
|
||||||
// using SelectText = widget::Widget::SelectTextEvent;
|
using SelectText = widget::Widget::SelectTextEvent;
|
||||||
// using DragBase = widget::Widget::DragBaseEvent;
|
using DragBase = widget::Widget::DragBaseEvent;
|
||||||
// using DragStart = widget::Widget::DragStartEvent;
|
using DragStart = widget::Widget::DragStartEvent;
|
||||||
// using DragEnd = widget::Widget::DragEndEvent;
|
using DragEnd = widget::Widget::DragEndEvent;
|
||||||
// using DragMove = widget::Widget::DragMoveEvent;
|
using DragMove = widget::Widget::DragMoveEvent;
|
||||||
// using DragHover = widget::Widget::DragHoverEvent;
|
using DragHover = widget::Widget::DragHoverEvent;
|
||||||
// using DragEnter = widget::Widget::DragEnterEvent;
|
using DragEnter = widget::Widget::DragEnterEvent;
|
||||||
// using DragLeave = widget::Widget::DragLeaveEvent;
|
using DragLeave = widget::Widget::DragLeaveEvent;
|
||||||
// using DragDrop = widget::Widget::DragDropEvent;
|
using DragDrop = widget::Widget::DragDropEvent;
|
||||||
// using PathDrop = widget::Widget::PathDropEvent;
|
using PathDrop = widget::Widget::PathDropEvent;
|
||||||
using Action = widget::Widget::ActionEvent;
|
using Action = widget::Widget::ActionEvent;
|
||||||
using Change = widget::Widget::ChangeEvent;
|
using Change = widget::Widget::ChangeEvent;
|
||||||
// using Dirty = widget::Widget::DirtyEvent;
|
// using Dirty = widget::Widget::DirtyEvent;
|
||||||
|
@ -973,6 +1088,14 @@ struct Plugin {
|
||||||
|
|
||||||
namespace ui {
|
namespace ui {
|
||||||
|
|
||||||
|
struct Button : widget::OpaqueWidget {
|
||||||
|
std::string text;
|
||||||
|
Quantity* quantity = NULL;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct ChoiceButton : Button {
|
||||||
|
};
|
||||||
|
|
||||||
struct Menu : widget::OpaqueWidget {
|
struct Menu : widget::OpaqueWidget {
|
||||||
// Menu* parentMenu = NULL;
|
// Menu* parentMenu = NULL;
|
||||||
// Menu* childMenu = NULL;
|
// Menu* childMenu = NULL;
|
||||||
|
|
29
lv2export/plugins/valleyaudio-plateau.cpp
Normal file
29
lv2export/plugins/valleyaudio-plateau.cpp
Normal file
|
@ -0,0 +1,29 @@
|
||||||
|
/*
|
||||||
|
* DISTRHO Cardinal Plugin
|
||||||
|
* Copyright (C) 2021-2022 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 3 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 LICENSE file.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "ValleyAudio/src/Common/DSP/OnePoleFilters.cpp"
|
||||||
|
#include "ValleyAudio/src/Common/DSP/LinearEnvelope.cpp"
|
||||||
|
#include "ValleyAudio/src/Plateau/Dattorro.cpp"
|
||||||
|
#include "ValleyAudio/src/Plateau/Plateau.cpp"
|
||||||
|
|
||||||
|
|
||||||
|
#define PLUGIN_MODEL modelPlateau
|
||||||
|
#define PLUGIN_CV_INPUTS {0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1}
|
||||||
|
#define PLUGIN_CV_OUTPUTS {0,0}
|
||||||
|
|
||||||
|
#include "lv2plugin.cpp"
|
||||||
|
#include "export.cpp"
|
Loading…
Add table
Add a link
Reference in a new issue