Signed-off-by: falkTX <falktx@falktx.com>pull/642/head
| @@ -1,6 +1,6 @@ | |||
| /* | |||
| * DISTRHO Cardinal Plugin | |||
| * Copyright (C) 2021-2022 Filipe Coelho <falktx@falktx.com> | |||
| * Copyright (C) 2021-2024 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 | |||
| @@ -111,6 +111,18 @@ struct Message { | |||
| }; | |||
| struct InputQueue { | |||
| struct Internal; | |||
| Internal* internal; | |||
| InputQueue(); | |||
| ~InputQueue(); | |||
| bool tryPop(Message* const messageOut, int64_t maxFrame); | |||
| json_t* toJson() const; | |||
| void fromJson(json_t* rootJ); | |||
| }; | |||
| /* NOTE all the other MIDI stuff (drivers, ports etc) is purposefully missing here, unwanted in Cardinal | |||
| */ | |||
| struct Port; | |||
| @@ -1 +1 @@ | |||
| Subproject commit 43dc87d98e0da2e99b1f03f7f0c4b7e5bccab01d | |||
| Subproject commit a3acddc30732700b91f27075488b914c38b9dcdf | |||
| @@ -1,11 +1,11 @@ | |||
| /* | |||
| * AIDA-X Cardinal plugin | |||
| * Copyright (C) 2022-2023 Massimo Pennazio <maxipenna@libero.it> | |||
| * Copyright (C) 2023 Filipe Coelho <falktx@falktx.com> | |||
| * Copyright (C) 2023-2024 Filipe Coelho <falktx@falktx.com> | |||
| * SPDX-License-Identifier: GPL-3.0-or-later | |||
| */ | |||
| #include "plugincontext.hpp" | |||
| #include "plugin.hpp" | |||
| #include "ModuleWidgets.hpp" | |||
| #ifndef HEADLESS | |||
| @@ -250,7 +250,6 @@ struct AidaPluginModule : Module { | |||
| NUM_LIGHTS | |||
| }; | |||
| CardinalPluginContext* const pcontext; | |||
| bool fileChanged = false; | |||
| std::string currentFile; | |||
| @@ -272,7 +271,6 @@ struct AidaPluginModule : Module { | |||
| #endif | |||
| AidaPluginModule() | |||
| : pcontext(static_cast<CardinalPluginContext*>(APP)) | |||
| { | |||
| config(NUM_PARAMS, NUM_INPUTS, NUM_OUTPUTS, NUM_LIGHTS); | |||
| @@ -656,8 +654,6 @@ struct AidaPluginModule : Module { | |||
| cachedParams[kParameterPRESENCE]); | |||
| } | |||
| #endif | |||
| DISTRHO_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(AidaPluginModule) | |||
| }; | |||
| // -------------------------------------------------------------------------------------------------------------------- | |||
| @@ -1093,8 +1089,6 @@ struct AidaWidget : ModuleWidgetWithSideScrews<23> { | |||
| menu->addChild(new LoadModelFileItem(module)); | |||
| } | |||
| DISTRHO_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(AidaWidget) | |||
| }; | |||
| #else | |||
| struct AidaWidget : ModuleWidget { | |||
| @@ -1,6 +1,6 @@ | |||
| /* | |||
| * DISTRHO Cardinal Plugin | |||
| * Copyright (C) 2021-2022 Filipe Coelho <falktx@falktx.com> | |||
| * Copyright (C) 2021-2024 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 | |||
| @@ -15,6 +15,7 @@ | |||
| * For a full copy of the GNU General Public License see the LICENSE file. | |||
| */ | |||
| #include "plugin.hpp" | |||
| #include "plugincontext.hpp" | |||
| #include "ModuleWidgets.hpp" | |||
| #include "extra/Runner.hpp" | |||
| @@ -39,6 +40,7 @@ const NativePluginDescriptor* carla_getNativePluginDescriptor(const std::size_t | |||
| // -------------------------------------------------------------------------------------------------------------------- | |||
| using namespace CARLA_BACKEND_NAMESPACE; | |||
| using namespace DISTRHO_NAMESPACE; | |||
| static uint32_t host_get_buffer_size(NativeHostHandle); | |||
| static double host_get_sample_rate(NativeHostHandle); | |||
| @@ -335,8 +337,6 @@ struct CarlaInternalPluginModule : Module, Runner { | |||
| 0, 0, nullptr, e.sampleRate); | |||
| fCarlaPluginDescriptor->activate(fCarlaPluginHandle); | |||
| } | |||
| DISTRHO_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(CarlaInternalPluginModule) | |||
| }; | |||
| // ----------------------------------------------------------------------------------------------------------- | |||
| @@ -679,8 +679,6 @@ struct AudioFileWidget : ModuleWidgetWithSideScrews<23> { | |||
| menu->addChild(new LoadAudioFileItem(module)); | |||
| } | |||
| DISTRHO_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(AudioFileWidget) | |||
| }; | |||
| #else | |||
| struct AudioFileWidget : ModuleWidget { | |||
| @@ -1,7 +1,7 @@ | |||
| /* | |||
| * DISTRHO Cardinal Plugin | |||
| * Copyright (C) 2021-2022 Bram Giesen | |||
| * Copyright (C) 2022 Filipe Coelho <falktx@falktx.com> | |||
| * Copyright (C) 2022-2024 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 | |||
| @@ -16,7 +16,7 @@ | |||
| * For a full copy of the GNU General Public License see the LICENSE file. | |||
| */ | |||
| #include "plugincontext.hpp" | |||
| #include "plugin.hpp" | |||
| #include "ModuleWidgets.hpp" | |||
| #include "Widgets.hpp" | |||
| @@ -24,8 +24,6 @@ extern "C" { | |||
| #include "aubio.h" | |||
| } | |||
| USE_NAMESPACE_DISTRHO; | |||
| // -------------------------------------------------------------------------------------------------------------------- | |||
| // aubio setup values (tested under 48 kHz sample rate) | |||
| @@ -1,6 +1,6 @@ | |||
| /* | |||
| * DISTRHO Cardinal Plugin | |||
| * Copyright (C) 2021-2023 Filipe Coelho <falktx@falktx.com> | |||
| * Copyright (C) 2021-2024 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 | |||
| @@ -15,6 +15,7 @@ | |||
| * For a full copy of the GNU General Public License see the LICENSE file. | |||
| */ | |||
| #include "plugin.hpp" | |||
| #include "plugincontext.hpp" | |||
| #include "Expander.hpp" | |||
| #include "ModuleWidgets.hpp" | |||
| @@ -427,8 +428,6 @@ struct CarlaModule : Module { | |||
| 0, 0, nullptr, e.sampleRate); | |||
| fCarlaPluginDescriptor->activate(fCarlaPluginHandle); | |||
| } | |||
| DISTRHO_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(CarlaModule) | |||
| }; | |||
| static_assert((int)CarlaModule::NUM_INPUTS == (int)CarlaModule::NUM_OUTPUTS, "inputs must match outputs"); | |||
| @@ -715,8 +714,6 @@ struct CarlaModuleWidget : ModuleWidgetWith9HP, IdleCallback { | |||
| e.consume(this); | |||
| showUI(); | |||
| } | |||
| DISTRHO_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(CarlaModuleWidget) | |||
| }; | |||
| static void host_ui_closed(NativeHostHandle handle) | |||
| @@ -1,6 +1,6 @@ | |||
| /* | |||
| * DISTRHO Cardinal Plugin | |||
| * Copyright (C) 2021-2022 Filipe Coelho <falktx@falktx.com> | |||
| * Copyright (C) 2021-2024 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 | |||
| @@ -15,9 +15,11 @@ | |||
| * For a full copy of the GNU General Public License see the LICENSE file. | |||
| */ | |||
| #include "plugin.hpp" | |||
| #include "plugincontext.hpp" | |||
| #include "ModuleWidgets.hpp" | |||
| #include "Widgets.hpp" | |||
| #include "engine/TerminalModule.hpp" | |||
| // ----------------------------------------------------------------------------------------------------------- | |||
| @@ -1,6 +1,6 @@ | |||
| /* | |||
| * DISTRHO Cardinal Plugin | |||
| * Copyright (C) 2021-2022 Filipe Coelho <falktx@falktx.com> | |||
| * Copyright (C) 2021-2024 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 | |||
| @@ -15,8 +15,10 @@ | |||
| * For a full copy of the GNU General Public License see the LICENSE file. | |||
| */ | |||
| #include "plugin.hpp" | |||
| #include "plugincontext.hpp" | |||
| #include "ModuleWidgets.hpp" | |||
| #include "engine/TerminalModule.hpp" | |||
| // ----------------------------------------------------------------------------------------------------------- | |||
| @@ -1,6 +1,6 @@ | |||
| /* | |||
| * DISTRHO Cardinal Plugin | |||
| * Copyright (C) 2021-2022 Filipe Coelho <falktx@falktx.com> | |||
| * Copyright (C) 2021-2024 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 | |||
| @@ -25,9 +25,11 @@ | |||
| * the License, or (at your option) any later version. | |||
| */ | |||
| #include "plugin.hpp" | |||
| #include "plugincontext.hpp" | |||
| #include "ModuleWidgets.hpp" | |||
| #include "Widgets.hpp" | |||
| #include "engine/TerminalModule.hpp" | |||
| #include <algorithm> | |||
| @@ -1,6 +1,6 @@ | |||
| /* | |||
| * DISTRHO Cardinal Plugin | |||
| * Copyright (C) 2021-2022 Filipe Coelho <falktx@falktx.com> | |||
| * Copyright (C) 2021-2024 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 | |||
| @@ -25,9 +25,11 @@ | |||
| * the License, or (at your option) any later version. | |||
| */ | |||
| #include "plugin.hpp" | |||
| #include "plugincontext.hpp" | |||
| #include "ModuleWidgets.hpp" | |||
| #include "Widgets.hpp" | |||
| #include "engine/TerminalModule.hpp" | |||
| #include <algorithm> | |||
| @@ -1,6 +1,6 @@ | |||
| /* | |||
| * DISTRHO Cardinal Plugin | |||
| * Copyright (C) 2021-2022 Filipe Coelho <falktx@falktx.com> | |||
| * Copyright (C) 2021-2024 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 | |||
| @@ -25,9 +25,11 @@ | |||
| * the License, or (at your option) any later version. | |||
| */ | |||
| #include "plugin.hpp" | |||
| #include "plugincontext.hpp" | |||
| #include "ModuleWidgets.hpp" | |||
| #include "Widgets.hpp" | |||
| #include "engine/TerminalModule.hpp" | |||
| #include <algorithm> | |||
| @@ -1,6 +1,6 @@ | |||
| /* | |||
| * DISTRHO Cardinal Plugin | |||
| * Copyright (C) 2021-2022 Filipe Coelho <falktx@falktx.com> | |||
| * Copyright (C) 2021-2024 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 | |||
| @@ -25,7 +25,9 @@ | |||
| * the License, or (at your option) any later version. | |||
| */ | |||
| #include "plugin.hpp" | |||
| #include "plugincontext.hpp" | |||
| #include "engine/TerminalModule.hpp" | |||
| #include "ModuleWidgets.hpp" | |||
| #include <algorithm> | |||
| @@ -1,6 +1,6 @@ | |||
| /* | |||
| * DISTRHO Cardinal Plugin | |||
| * Copyright (C) 2021-2022 Filipe Coelho <falktx@falktx.com> | |||
| * Copyright (C) 2021-2024 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 | |||
| @@ -25,9 +25,11 @@ | |||
| * the License, or (at your option) any later version. | |||
| */ | |||
| #include "plugin.hpp" | |||
| #include "plugincontext.hpp" | |||
| #include "ModuleWidgets.hpp" | |||
| #include "Widgets.hpp" | |||
| #include "engine/TerminalModule.hpp" | |||
| // ----------------------------------------------------------------------------------------------------------- | |||
| @@ -1,6 +1,6 @@ | |||
| /* | |||
| * DISTRHO Cardinal Plugin | |||
| * Copyright (C) 2021-2022 Filipe Coelho <falktx@falktx.com> | |||
| * Copyright (C) 2021-2024 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 | |||
| @@ -15,8 +15,10 @@ | |||
| * For a full copy of the GNU General Public License see the LICENSE file. | |||
| */ | |||
| #include "plugin.hpp" | |||
| #include "plugincontext.hpp" | |||
| #include "ModuleWidgets.hpp" | |||
| #include "engine/TerminalModule.hpp" | |||
| // ----------------------------------------------------------------------------------------------------------- | |||
| @@ -1,6 +1,6 @@ | |||
| /* | |||
| * DISTRHO Cardinal Plugin | |||
| * Copyright (C) 2021-2022 Filipe Coelho <falktx@falktx.com> | |||
| * Copyright (C) 2021-2024 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 | |||
| @@ -15,8 +15,10 @@ | |||
| * For a full copy of the GNU General Public License see the LICENSE file. | |||
| */ | |||
| #include "plugin.hpp" | |||
| #include "plugincontext.hpp" | |||
| #include "ModuleWidgets.hpp" | |||
| #include "engine/TerminalModule.hpp" | |||
| // -------------------------------------------------------------------------------------------------------------------- | |||
| @@ -1,6 +1,6 @@ | |||
| /* | |||
| * DISTRHO Cardinal Plugin | |||
| * Copyright (C) 2021-2023 Filipe Coelho <falktx@falktx.com> | |||
| * Copyright (C) 2021-2024 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 | |||
| @@ -25,6 +25,7 @@ | |||
| * the License, or (at your option) any later version. | |||
| */ | |||
| #include "plugin.hpp" | |||
| #include "plugincontext.hpp" | |||
| #include "Expander.hpp" | |||
| @@ -98,6 +99,7 @@ namespace ildaeil { | |||
| // -------------------------------------------------------------------------------------------------------------------- | |||
| using namespace CARLA_BACKEND_NAMESPACE; | |||
| using namespace DISTRHO_NAMESPACE; | |||
| static uint32_t host_get_buffer_size(NativeHostHandle); | |||
| static double host_get_sample_rate(NativeHostHandle); | |||
| @@ -768,8 +770,6 @@ struct IldaeilModule : Module { | |||
| 0, 0, nullptr, e.sampleRate); | |||
| fCarlaPluginDescriptor->activate(fCarlaPluginHandle); | |||
| } | |||
| DISTRHO_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(IldaeilModule) | |||
| }; | |||
| // ----------------------------------------------------------------------------------------------------------- | |||
| @@ -2252,8 +2252,6 @@ struct IldaeilWidget : ImGuiWidget, IdleCallback, Runner { | |||
| ImGui::End(); | |||
| } | |||
| DISTRHO_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(IldaeilWidget) | |||
| }; | |||
| // -------------------------------------------------------------------------------------------------------------------- | |||
| @@ -2435,8 +2433,6 @@ struct IldaeilModuleWidget : ModuleWidgetWithSideScrews<26> { | |||
| ModuleWidgetWithSideScrews<26>::step(); | |||
| } | |||
| DISTRHO_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(IldaeilModuleWidget) | |||
| }; | |||
| #else | |||
| static void host_ui_parameter_changed(NativeHostHandle, uint32_t, float) {} | |||
| @@ -1,6 +1,6 @@ | |||
| /* | |||
| * DISTRHO Cardinal Plugin | |||
| * Copyright (C) 2021-2022 Filipe Coelho <falktx@falktx.com> | |||
| * Copyright (C) 2021-2024 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 | |||
| @@ -15,12 +15,15 @@ | |||
| * For a full copy of the GNU General Public License see the LICENSE file. | |||
| */ | |||
| #include "plugin.hpp" | |||
| #include "plugincontext.hpp" | |||
| #ifndef HEADLESS | |||
| # include "EmbedWidget.hpp" | |||
| # include "extra/ExternalWindow.hpp" | |||
| #endif | |||
| USE_NAMESPACE_DISTRHO; | |||
| // -------------------------------------------------------------------------------------------------------------------- | |||
| struct CardinalEmbedModule : Module { | |||
| @@ -1,6 +1,6 @@ | |||
| /* | |||
| * DISTRHO Cardinal Plugin | |||
| * Copyright (C) 2021-2022 Filipe Coelho <falktx@falktx.com> | |||
| * Copyright (C) 2021-2024 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 | |||
| @@ -15,7 +15,7 @@ | |||
| * For a full copy of the GNU General Public License see the LICENSE file. | |||
| */ | |||
| #include "plugincontext.hpp" | |||
| #include "plugin.hpp" | |||
| #include "ImGuiWidget.hpp" | |||
| #include "sassy/sassy.hpp" | |||
| #include "sassy/sassy_scope.cpp" | |||
| @@ -1,6 +1,6 @@ | |||
| /* | |||
| * DISTRHO Cardinal Plugin | |||
| * Copyright (C) 2021-2022 Filipe Coelho <falktx@falktx.com> | |||
| * Copyright (C) 2021-2024 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 | |||
| @@ -15,7 +15,7 @@ | |||
| * For a full copy of the GNU General Public License see the LICENSE file. | |||
| */ | |||
| #include "plugincontext.hpp" | |||
| #include "plugin.hpp" | |||
| #ifndef HEADLESS | |||
| # include "ImGuiTextEditor.hpp" | |||
| @@ -412,8 +412,6 @@ struct TextEditorModuleWidget : ModuleWidget { | |||
| menu->addChild(new ui::MenuSeparator); | |||
| menu->addChild(createMenuItem("Select all", RACK_MOD_CTRL_NAME "+A", [=]{ textEditorWidget->selectAll(); })); | |||
| } | |||
| DISTRHO_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(TextEditorModuleWidget) | |||
| }; | |||
| #else | |||
| struct TextEditorModuleWidget : ModuleWidget { | |||
| @@ -1,6 +1,6 @@ | |||
| /* | |||
| * DISTRHO Cardinal Plugin | |||
| * Copyright (C) 2021-2022 Filipe Coelho <falktx@falktx.com> | |||
| * Copyright (C) 2021-2024 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 | |||
| @@ -18,11 +18,8 @@ | |||
| #pragma once | |||
| #include "rack.hpp" | |||
| #include "engine/TerminalModule.hpp" | |||
| #ifdef NDEBUG | |||
| # undef DEBUG | |||
| #endif | |||
| // #include "engine/TerminalModule.hpp" | |||
| // #include "plugincontext.hpp" | |||
| using namespace rack; | |||
| @@ -1,89 +0,0 @@ | |||
| /* | |||
| * 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. | |||
| */ | |||
| #pragma once | |||
| #include "plugin.hpp" | |||
| #include "DistrhoUtils.hpp" | |||
| #include "../dgl/Base.hpp" | |||
| // ----------------------------------------------------------------------------------------------------------- | |||
| // from PluginContext.hpp | |||
| START_NAMESPACE_DGL | |||
| class TopLevelWidget; | |||
| template <class BaseWidget> class NanoBaseWidget; | |||
| typedef NanoBaseWidget<TopLevelWidget> NanoTopLevelWidget; | |||
| END_NAMESPACE_DGL | |||
| START_NAMESPACE_DISTRHO | |||
| static constexpr const uint32_t kModuleParameterCount = 24; | |||
| enum CardinalVariant { | |||
| kCardinalVariantMain, | |||
| kCardinalVariantMini, | |||
| kCardinalVariantFX, | |||
| kCardinalVariantNative, | |||
| kCardinalVariantSynth, | |||
| }; | |||
| class Plugin; | |||
| class UI; | |||
| struct MidiEvent { | |||
| static const uint32_t kDataSize = 4; | |||
| uint32_t frame; | |||
| uint32_t size; | |||
| uint8_t data[kDataSize]; | |||
| const uint8_t* dataExt; | |||
| }; | |||
| struct CardinalPluginContext : rack::Context { | |||
| uint32_t bufferSize, processCounter; | |||
| double sampleRate; | |||
| float parameters[kModuleParameterCount]; | |||
| CardinalVariant variant; | |||
| bool bypassed, playing, reset, bbtValid; | |||
| int32_t bar, beat, beatsPerBar, beatType; | |||
| uint64_t frame; | |||
| double barStartTick, beatsPerMinute; | |||
| double tick, tickClock, ticksPerBeat, ticksPerClock, ticksPerFrame; | |||
| uintptr_t nativeWindowId; | |||
| const float* const* dataIns; | |||
| float** dataOuts; | |||
| const MidiEvent* midiEvents; | |||
| uint32_t midiEventCount; | |||
| Plugin* const plugin; | |||
| DGL_NAMESPACE::NanoTopLevelWidget* tlw; | |||
| UI* ui; | |||
| CardinalPluginContext(Plugin* const p); | |||
| void writeMidiMessage(const rack::midi::Message& message, uint8_t channel); | |||
| #ifndef HEADLESS | |||
| bool addIdleCallback(IdleCallback* cb) const; | |||
| void removeIdleCallback(IdleCallback* cb) const; | |||
| #endif | |||
| }; | |||
| #ifndef HEADLESS | |||
| void handleHostParameterDrag(const CardinalPluginContext* pcontext, uint index, bool started); | |||
| #endif | |||
| END_NAMESPACE_DISTRHO | |||
| // ----------------------------------------------------------------------------------------------------------- | |||
| @@ -578,8 +578,8 @@ BIDOO_CUSTOM_PER_FILE = channel channel filterType | |||
| PLUGIN_FILES += $(filter-out Biset/src/plugin.cpp,$(wildcard Biset/src/*.cpp)) | |||
| PLUGIN_FILES += $(wildcard Biset/src/*/*.cpp) | |||
| # # modules/types which are present in other plugins | |||
| BISET_CUSTOM = Blank | |||
| # modules/types which are present in other plugins | |||
| BISET_CUSTOM = Blank ButtonTrigger Clock Tree | |||
| # -------------------------------------------------------------- | |||
| # BogaudioModules | |||
| @@ -1318,6 +1318,7 @@ BUILD_DIR = ../build/plugins | |||
| endif | |||
| BASE_FLAGS += -DBUILDING_PLUGIN_MODULES | |||
| BASE_FLAGS += -DDONT_SET_USING_DISTRHO_NAMESPACE | |||
| BASE_FLAGS += -I$(abspath $(ROOT)/include/osdialog-stub) | |||
| ifeq ($(BSD)$(WASM),true) | |||
| @@ -147,9 +147,13 @@ extern Model* modelChord; | |||
| #include "Bidoo/src/plugin.hpp" | |||
| // Biset | |||
| #define modelBlank modelBisetBlank | |||
| #define modelTree modelBisetTree | |||
| #define Clock BisetClock | |||
| #define ButtonTrigger BisetButtonTrigger | |||
| #include "Biset/src/plugin.hpp" | |||
| #undef modelBlank | |||
| #undef modelTree | |||
| #undef ButtonTrigger | |||
| #undef Clock | |||
| @@ -1629,31 +1633,35 @@ static void initStatic__Biset() | |||
| const StaticPluginLoader spl(p, "Biset"); | |||
| if (spl.ok()) | |||
| { | |||
| #define modelBlank modelBisetBlank | |||
| #define modelTree modelBisetTree | |||
| p->addModel(modelTracker); | |||
| p->addModel(modelTrackerSynth); | |||
| p->addModel(modelTrackerDrum); | |||
| p->addModel(modelTrackerClock); | |||
| p->addModel(modelTrackerPhase); | |||
| p->addModel(modelTrackerQuant); | |||
| p->addModel(modelTrackerState); | |||
| p->addModel(modelTrackerControl); | |||
| p->addModel(modelRegex); | |||
| p->addModel(modelRegexCondensed); | |||
| p->addModel(modelRegexExp); | |||
| p->addModel(modelBisetTree); | |||
| p->addModel(modelBisetTreeSeed); | |||
| p->addModel(modelGbu); | |||
| p->addModel(modelPkm); | |||
| p->addModel(modelIgc); | |||
| p->addModel(modelOmega3); | |||
| p->addModel(modelOmega6); | |||
| p->addModel(modelSegfault); | |||
| p->addModel(modelBlank); | |||
| p->addModel(modelTrackerSynth); | |||
| p->addModel(modelTrackerDrum); | |||
| p->addModel(modelTrackerClock); | |||
| p->addModel(modelTrackerPhase); | |||
| p->addModel(modelTrackerQuant); | |||
| p->addModel(modelTrackerState); | |||
| p->addModel(modelTrackerControl); | |||
| p->addModel(modelRegex); | |||
| p->addModel(modelRegexCondensed); | |||
| p->addModel(modelRegexExp); | |||
| p->addModel(modelTree); | |||
| p->addModel(modelTreeSeed); | |||
| p->addModel(modelGbu); | |||
| p->addModel(modelPkm); | |||
| p->addModel(modelIgc); | |||
| p->addModel(modelOmega3); | |||
| p->addModel(modelOmega6); | |||
| p->addModel(modelSegfault); | |||
| p->addModel(modelBlank); | |||
| #undef modelBlank | |||
| #undef modelTree | |||
| } | |||
| } | |||
| @@ -101,8 +101,6 @@ void destroyStaticPlugins(); | |||
| const std::string CARDINAL_VERSION = "24.04"; | |||
| START_NAMESPACE_DISTRHO | |||
| // ----------------------------------------------------------------------------------------------------------- | |||
| #ifndef HEADLESS | |||
| @@ -126,6 +124,51 @@ void handleHostParameterDrag(const CardinalPluginContext* pcontext, uint index, | |||
| // -------------------------------------------------------------------------------------------------------------------- | |||
| CardinalPluginContext::CardinalPluginContext(Plugin* const p) | |||
| : bufferSize(p != nullptr ? p->getBufferSize() : 0), | |||
| processCounter(0), | |||
| sampleRate(p != nullptr ? p->getSampleRate() : 0.0), | |||
| #if CARDINAL_VARIANT_MAIN | |||
| variant(kCardinalVariantMain), | |||
| #elif CARDINAL_VARIANT_MINI | |||
| variant(kCardinalVariantMini), | |||
| #elif CARDINAL_VARIANT_FX | |||
| variant(kCardinalVariantFX), | |||
| #elif CARDINAL_VARIANT_NATIVE | |||
| variant(kCardinalVariantNative), | |||
| #elif CARDINAL_VARIANT_SYNTH | |||
| variant(kCardinalVariantSynth), | |||
| #else | |||
| #error cardinal variant not set | |||
| #endif | |||
| bypassed(false), | |||
| playing(false), | |||
| reset(false), | |||
| bbtValid(false), | |||
| bar(1), | |||
| beat(1), | |||
| beatsPerBar(4), | |||
| beatType(4), | |||
| frame(0), | |||
| barStartTick(0.0), | |||
| beatsPerMinute(120.0), | |||
| tick(0.0), | |||
| tickClock(0.0), | |||
| ticksPerBeat(0.0), | |||
| ticksPerClock(0.0), | |||
| ticksPerFrame(0.0), | |||
| nativeWindowId(0), | |||
| dataIns(nullptr), | |||
| dataOuts(nullptr), | |||
| midiEvents(nullptr), | |||
| midiEventCount(0), | |||
| plugin(p), | |||
| tlw(nullptr), | |||
| ui(nullptr) | |||
| { | |||
| std::memset(parameters, 0, sizeof(parameters)); | |||
| } | |||
| #ifndef HEADLESS | |||
| bool CardinalPluginContext::addIdleCallback(IdleCallback* const cb) const | |||
| { | |||
| @@ -224,6 +267,86 @@ void CardinalPluginContext::writeMidiMessage(const rack::midi::Message& message, | |||
| // ----------------------------------------------------------------------------------------------------------- | |||
| namespace rack { | |||
| namespace midi { | |||
| struct InputQueue::Internal { | |||
| CardinalPluginContext* const pcontext = static_cast<CardinalPluginContext*>(APP); | |||
| const CardinalDISTRHO::MidiEvent* midiEvents = nullptr; | |||
| uint32_t midiEventsLeft = 0; | |||
| uint32_t lastProcessCounter = 0; | |||
| int64_t lastBlockFrame = 0; | |||
| }; | |||
| InputQueue::InputQueue() { | |||
| internal = new Internal; | |||
| } | |||
| InputQueue::~InputQueue() { | |||
| delete internal; | |||
| } | |||
| bool InputQueue::tryPop(Message* const messageOut, int64_t maxFrame) | |||
| { | |||
| const uint32_t processCounter = internal->pcontext->processCounter; | |||
| const bool processCounterChanged = internal->lastProcessCounter != processCounter; | |||
| if (processCounterChanged) | |||
| { | |||
| internal->lastBlockFrame = pcontext->engine->getBlockFrame(); | |||
| internal->lastProcessCounter = processCounter; | |||
| internal->midiEvents = pcontext->midiEvents; | |||
| internal->midiEventsLeft = pcontext->midiEventCount; | |||
| } | |||
| if (internal->midiEventsLeft == 0 || maxFrame < internal->lastBlockFrame) | |||
| return false; | |||
| const uint32_t frame = maxFrame - internal->lastBlockFrame; | |||
| if (frame > internal->midiEvents->frame) | |||
| return false; | |||
| const CardinalDISTRHO::MidiEvent& midiEvent(*internal->midiEvents); | |||
| const uint8_t* data; | |||
| if (midiEvent.size > CardinalDISTRHO::MidiEvent::kDataSize) | |||
| { | |||
| data = midiEvent.dataExt; | |||
| messageOut->bytes.resize(midiEvent.size); | |||
| } | |||
| else | |||
| { | |||
| data = midiEvent.data; | |||
| } | |||
| messageOut->frame = frame; | |||
| std::memcpy(messageOut->bytes.data(), data, midiEvent.size); | |||
| ++internal->midiEvents; | |||
| --internal->midiEventsLeft; | |||
| return true; | |||
| } | |||
| json_t* InputQueue::toJson() const | |||
| { | |||
| return nullptr; | |||
| } | |||
| void InputQueue::fromJson(json_t* rootJ) | |||
| { | |||
| } | |||
| } | |||
| } | |||
| // ----------------------------------------------------------------------------------------------------------- | |||
| START_NAMESPACE_DISTRHO | |||
| // ----------------------------------------------------------------------------------------------------------- | |||
| #ifdef HAVE_LIBLO | |||
| static void osc_error_handler(int num, const char* msg, const char* path) | |||
| { | |||
| @@ -12,6 +12,8 @@ | |||
| extern const std::string CARDINAL_VERSION; | |||
| struct CardinalPluginContext; | |||
| // ----------------------------------------------------------------------------------------------------------- | |||
| namespace rack { | |||
| @@ -84,7 +86,6 @@ START_NAMESPACE_DISTRHO | |||
| class CardinalBasePlugin; | |||
| class CardinalBaseUI; | |||
| struct CardinalPluginContext; | |||
| struct Initializer | |||
| { | |||
| @@ -36,29 +36,14 @@ | |||
| #ifndef HEADLESS | |||
| # include "DistrhoUI.hpp" | |||
| #else | |||
| # include "Base.hpp" | |||
| START_NAMESPACE_DGL | |||
| class TopLevelWidget; | |||
| template <class BaseWidget> class NanoBaseWidget; | |||
| typedef NanoBaseWidget<TopLevelWidget> NanoTopLevelWidget; | |||
| END_NAMESPACE_DGL | |||
| #endif | |||
| #include "plugincontext.hpp" | |||
| START_NAMESPACE_DISTRHO | |||
| // ----------------------------------------------------------------------------------------------------------- | |||
| static constexpr const uint kModuleParameterCount = 24; | |||
| enum CardinalVariant { | |||
| kCardinalVariantMain, | |||
| kCardinalVariantMini, | |||
| kCardinalVariantFX, | |||
| kCardinalVariantNative, | |||
| kCardinalVariantSynth, | |||
| }; | |||
| enum CardinalParameters { | |||
| kCardinalParameterCountAtModules = kModuleParameterCount, | |||
| kCardinalParameterBypass = kCardinalParameterCountAtModules, | |||
| @@ -126,82 +111,6 @@ static_assert(kCardinalParameterCountAtWindow == kModuleParameterCount + kWindow | |||
| static_assert(DISTRHO_PLUGIN_NUM_INPUTS == kCardinalParameterCountAtMiniBuffers - kCardinalParameterStartMiniBuffers, "valid parameter indexes"); | |||
| #endif | |||
| class UI; | |||
| // ----------------------------------------------------------------------------------------------------------- | |||
| struct CardinalPluginContext : rack::Context { | |||
| uint32_t bufferSize, processCounter; | |||
| double sampleRate; | |||
| float parameters[kModuleParameterCount]; | |||
| CardinalVariant variant; | |||
| bool bypassed, playing, reset, bbtValid; | |||
| int32_t bar, beat, beatsPerBar, beatType; | |||
| uint64_t frame; | |||
| double barStartTick, beatsPerMinute; | |||
| double tick, tickClock, ticksPerBeat, ticksPerClock, ticksPerFrame; | |||
| uintptr_t nativeWindowId; | |||
| const float* const* dataIns; | |||
| float** dataOuts; | |||
| const MidiEvent* midiEvents; | |||
| uint32_t midiEventCount; | |||
| Plugin* const plugin; | |||
| NanoTopLevelWidget* tlw; | |||
| UI* ui; | |||
| CardinalPluginContext(Plugin* const p) | |||
| : bufferSize(p != nullptr ? p->getBufferSize() : 0), | |||
| processCounter(0), | |||
| sampleRate(p != nullptr ? p->getSampleRate() : 0.0), | |||
| #if CARDINAL_VARIANT_MAIN | |||
| variant(kCardinalVariantMain), | |||
| #elif CARDINAL_VARIANT_MINI | |||
| variant(kCardinalVariantMini), | |||
| #elif CARDINAL_VARIANT_FX | |||
| variant(kCardinalVariantFX), | |||
| #elif CARDINAL_VARIANT_NATIVE | |||
| variant(kCardinalVariantNative), | |||
| #elif CARDINAL_VARIANT_SYNTH | |||
| variant(kCardinalVariantSynth), | |||
| #else | |||
| #error cardinal variant not set | |||
| #endif | |||
| bypassed(false), | |||
| playing(false), | |||
| reset(false), | |||
| bbtValid(false), | |||
| bar(1), | |||
| beat(1), | |||
| beatsPerBar(4), | |||
| beatType(4), | |||
| frame(0), | |||
| barStartTick(0.0), | |||
| beatsPerMinute(120.0), | |||
| tick(0.0), | |||
| tickClock(0.0), | |||
| ticksPerBeat(0.0), | |||
| ticksPerClock(0.0), | |||
| ticksPerFrame(0.0), | |||
| nativeWindowId(0), | |||
| dataIns(nullptr), | |||
| dataOuts(nullptr), | |||
| midiEvents(nullptr), | |||
| midiEventCount(0), | |||
| plugin(p), | |||
| tlw(nullptr), | |||
| ui(nullptr) | |||
| { | |||
| std::memset(parameters, 0, sizeof(parameters)); | |||
| } | |||
| void writeMidiMessage(const rack::midi::Message& message, uint8_t channel); | |||
| #ifndef HEADLESS | |||
| bool addIdleCallback(IdleCallback* cb) const; | |||
| void removeIdleCallback(IdleCallback* cb) const; | |||
| #endif | |||
| }; | |||
| // ----------------------------------------------------------------------------------------------------------- | |||
| #if DISTRHO_PLUGIN_WANT_DIRECT_ACCESS | |||