Continue biset changes, plugin-accessible cardinal context

Signed-off-by: falkTX <falktx@falktx.com>
This commit is contained in:
falkTX 2024-04-11 10:34:10 +02:00 committed by Filipe Coelho
parent 8e17cf4ece
commit 7948f66eb4
26 changed files with 223 additions and 259 deletions

View file

@ -1,6 +1,6 @@
/* /*
* DISTRHO Cardinal Plugin * 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 * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as * 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 /* NOTE all the other MIDI stuff (drivers, ports etc) is purposefully missing here, unwanted in Cardinal
*/ */
struct Port; struct Port;

@ -1 +1 @@
Subproject commit 43dc87d98e0da2e99b1f03f7f0c4b7e5bccab01d Subproject commit a3acddc30732700b91f27075488b914c38b9dcdf

View file

@ -1,11 +1,11 @@
/* /*
* AIDA-X Cardinal plugin * AIDA-X Cardinal plugin
* Copyright (C) 2022-2023 Massimo Pennazio <maxipenna@libero.it> * 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 * SPDX-License-Identifier: GPL-3.0-or-later
*/ */
#include "plugincontext.hpp" #include "plugin.hpp"
#include "ModuleWidgets.hpp" #include "ModuleWidgets.hpp"
#ifndef HEADLESS #ifndef HEADLESS
@ -250,7 +250,6 @@ struct AidaPluginModule : Module {
NUM_LIGHTS NUM_LIGHTS
}; };
CardinalPluginContext* const pcontext;
bool fileChanged = false; bool fileChanged = false;
std::string currentFile; std::string currentFile;
@ -272,7 +271,6 @@ struct AidaPluginModule : Module {
#endif #endif
AidaPluginModule() AidaPluginModule()
: pcontext(static_cast<CardinalPluginContext*>(APP))
{ {
config(NUM_PARAMS, NUM_INPUTS, NUM_OUTPUTS, NUM_LIGHTS); config(NUM_PARAMS, NUM_INPUTS, NUM_OUTPUTS, NUM_LIGHTS);
@ -656,8 +654,6 @@ struct AidaPluginModule : Module {
cachedParams[kParameterPRESENCE]); cachedParams[kParameterPRESENCE]);
} }
#endif #endif
DISTRHO_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(AidaPluginModule)
}; };
// -------------------------------------------------------------------------------------------------------------------- // --------------------------------------------------------------------------------------------------------------------
@ -1093,8 +1089,6 @@ struct AidaWidget : ModuleWidgetWithSideScrews<23> {
menu->addChild(new LoadModelFileItem(module)); menu->addChild(new LoadModelFileItem(module));
} }
DISTRHO_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(AidaWidget)
}; };
#else #else
struct AidaWidget : ModuleWidget { struct AidaWidget : ModuleWidget {

View file

@ -1,6 +1,6 @@
/* /*
* DISTRHO Cardinal Plugin * 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 * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as * 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. * For a full copy of the GNU General Public License see the LICENSE file.
*/ */
#include "plugin.hpp"
#include "plugincontext.hpp" #include "plugincontext.hpp"
#include "ModuleWidgets.hpp" #include "ModuleWidgets.hpp"
#include "extra/Runner.hpp" #include "extra/Runner.hpp"
@ -39,6 +40,7 @@ const NativePluginDescriptor* carla_getNativePluginDescriptor(const std::size_t
// -------------------------------------------------------------------------------------------------------------------- // --------------------------------------------------------------------------------------------------------------------
using namespace CARLA_BACKEND_NAMESPACE; using namespace CARLA_BACKEND_NAMESPACE;
using namespace DISTRHO_NAMESPACE;
static uint32_t host_get_buffer_size(NativeHostHandle); static uint32_t host_get_buffer_size(NativeHostHandle);
static double host_get_sample_rate(NativeHostHandle); static double host_get_sample_rate(NativeHostHandle);
@ -335,8 +337,6 @@ struct CarlaInternalPluginModule : Module, Runner {
0, 0, nullptr, e.sampleRate); 0, 0, nullptr, e.sampleRate);
fCarlaPluginDescriptor->activate(fCarlaPluginHandle); fCarlaPluginDescriptor->activate(fCarlaPluginHandle);
} }
DISTRHO_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(CarlaInternalPluginModule)
}; };
// ----------------------------------------------------------------------------------------------------------- // -----------------------------------------------------------------------------------------------------------
@ -679,8 +679,6 @@ struct AudioFileWidget : ModuleWidgetWithSideScrews<23> {
menu->addChild(new LoadAudioFileItem(module)); menu->addChild(new LoadAudioFileItem(module));
} }
DISTRHO_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(AudioFileWidget)
}; };
#else #else
struct AudioFileWidget : ModuleWidget { struct AudioFileWidget : ModuleWidget {

View file

@ -1,7 +1,7 @@
/* /*
* DISTRHO Cardinal Plugin * DISTRHO Cardinal Plugin
* Copyright (C) 2021-2022 Bram Giesen * 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 * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as * 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. * For a full copy of the GNU General Public License see the LICENSE file.
*/ */
#include "plugincontext.hpp" #include "plugin.hpp"
#include "ModuleWidgets.hpp" #include "ModuleWidgets.hpp"
#include "Widgets.hpp" #include "Widgets.hpp"
@ -24,8 +24,6 @@ extern "C" {
#include "aubio.h" #include "aubio.h"
} }
USE_NAMESPACE_DISTRHO;
// -------------------------------------------------------------------------------------------------------------------- // --------------------------------------------------------------------------------------------------------------------
// aubio setup values (tested under 48 kHz sample rate) // aubio setup values (tested under 48 kHz sample rate)

View file

@ -1,6 +1,6 @@
/* /*
* DISTRHO Cardinal Plugin * 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 * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as * 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. * For a full copy of the GNU General Public License see the LICENSE file.
*/ */
#include "plugin.hpp"
#include "plugincontext.hpp" #include "plugincontext.hpp"
#include "Expander.hpp" #include "Expander.hpp"
#include "ModuleWidgets.hpp" #include "ModuleWidgets.hpp"
@ -427,8 +428,6 @@ struct CarlaModule : Module {
0, 0, nullptr, e.sampleRate); 0, 0, nullptr, e.sampleRate);
fCarlaPluginDescriptor->activate(fCarlaPluginHandle); 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"); 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); e.consume(this);
showUI(); showUI();
} }
DISTRHO_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(CarlaModuleWidget)
}; };
static void host_ui_closed(NativeHostHandle handle) static void host_ui_closed(NativeHostHandle handle)

View file

@ -1,6 +1,6 @@
/* /*
* DISTRHO Cardinal Plugin * 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 * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as * 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. * For a full copy of the GNU General Public License see the LICENSE file.
*/ */
#include "plugin.hpp"
#include "plugincontext.hpp" #include "plugincontext.hpp"
#include "ModuleWidgets.hpp" #include "ModuleWidgets.hpp"
#include "Widgets.hpp" #include "Widgets.hpp"
#include "engine/TerminalModule.hpp"
// ----------------------------------------------------------------------------------------------------------- // -----------------------------------------------------------------------------------------------------------

View file

@ -1,6 +1,6 @@
/* /*
* DISTRHO Cardinal Plugin * 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 * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as * 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. * For a full copy of the GNU General Public License see the LICENSE file.
*/ */
#include "plugin.hpp"
#include "plugincontext.hpp" #include "plugincontext.hpp"
#include "ModuleWidgets.hpp" #include "ModuleWidgets.hpp"
#include "engine/TerminalModule.hpp"
// ----------------------------------------------------------------------------------------------------------- // -----------------------------------------------------------------------------------------------------------

View file

@ -1,6 +1,6 @@
/* /*
* DISTRHO Cardinal Plugin * 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 * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as * 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. * the License, or (at your option) any later version.
*/ */
#include "plugin.hpp"
#include "plugincontext.hpp" #include "plugincontext.hpp"
#include "ModuleWidgets.hpp" #include "ModuleWidgets.hpp"
#include "Widgets.hpp" #include "Widgets.hpp"
#include "engine/TerminalModule.hpp"
#include <algorithm> #include <algorithm>

View file

@ -1,6 +1,6 @@
/* /*
* DISTRHO Cardinal Plugin * 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 * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as * 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. * the License, or (at your option) any later version.
*/ */
#include "plugin.hpp"
#include "plugincontext.hpp" #include "plugincontext.hpp"
#include "ModuleWidgets.hpp" #include "ModuleWidgets.hpp"
#include "Widgets.hpp" #include "Widgets.hpp"
#include "engine/TerminalModule.hpp"
#include <algorithm> #include <algorithm>

View file

@ -1,6 +1,6 @@
/* /*
* DISTRHO Cardinal Plugin * 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 * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as * 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. * the License, or (at your option) any later version.
*/ */
#include "plugin.hpp"
#include "plugincontext.hpp" #include "plugincontext.hpp"
#include "ModuleWidgets.hpp" #include "ModuleWidgets.hpp"
#include "Widgets.hpp" #include "Widgets.hpp"
#include "engine/TerminalModule.hpp"
#include <algorithm> #include <algorithm>

View file

@ -1,6 +1,6 @@
/* /*
* DISTRHO Cardinal Plugin * 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 * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as * 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. * the License, or (at your option) any later version.
*/ */
#include "plugin.hpp"
#include "plugincontext.hpp" #include "plugincontext.hpp"
#include "engine/TerminalModule.hpp"
#include "ModuleWidgets.hpp" #include "ModuleWidgets.hpp"
#include <algorithm> #include <algorithm>

View file

@ -1,6 +1,6 @@
/* /*
* DISTRHO Cardinal Plugin * 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 * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as * 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. * the License, or (at your option) any later version.
*/ */
#include "plugin.hpp"
#include "plugincontext.hpp" #include "plugincontext.hpp"
#include "ModuleWidgets.hpp" #include "ModuleWidgets.hpp"
#include "Widgets.hpp" #include "Widgets.hpp"
#include "engine/TerminalModule.hpp"
// ----------------------------------------------------------------------------------------------------------- // -----------------------------------------------------------------------------------------------------------

View file

@ -1,6 +1,6 @@
/* /*
* DISTRHO Cardinal Plugin * 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 * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as * 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. * For a full copy of the GNU General Public License see the LICENSE file.
*/ */
#include "plugin.hpp"
#include "plugincontext.hpp" #include "plugincontext.hpp"
#include "ModuleWidgets.hpp" #include "ModuleWidgets.hpp"
#include "engine/TerminalModule.hpp"
// ----------------------------------------------------------------------------------------------------------- // -----------------------------------------------------------------------------------------------------------

View file

@ -1,6 +1,6 @@
/* /*
* DISTRHO Cardinal Plugin * 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 * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as * 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. * For a full copy of the GNU General Public License see the LICENSE file.
*/ */
#include "plugin.hpp"
#include "plugincontext.hpp" #include "plugincontext.hpp"
#include "ModuleWidgets.hpp" #include "ModuleWidgets.hpp"
#include "engine/TerminalModule.hpp"
// -------------------------------------------------------------------------------------------------------------------- // --------------------------------------------------------------------------------------------------------------------

View file

@ -1,6 +1,6 @@
/* /*
* DISTRHO Cardinal Plugin * 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 * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as * 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. * the License, or (at your option) any later version.
*/ */
#include "plugin.hpp"
#include "plugincontext.hpp" #include "plugincontext.hpp"
#include "Expander.hpp" #include "Expander.hpp"
@ -98,6 +99,7 @@ namespace ildaeil {
// -------------------------------------------------------------------------------------------------------------------- // --------------------------------------------------------------------------------------------------------------------
using namespace CARLA_BACKEND_NAMESPACE; using namespace CARLA_BACKEND_NAMESPACE;
using namespace DISTRHO_NAMESPACE;
static uint32_t host_get_buffer_size(NativeHostHandle); static uint32_t host_get_buffer_size(NativeHostHandle);
static double host_get_sample_rate(NativeHostHandle); static double host_get_sample_rate(NativeHostHandle);
@ -768,8 +770,6 @@ struct IldaeilModule : Module {
0, 0, nullptr, e.sampleRate); 0, 0, nullptr, e.sampleRate);
fCarlaPluginDescriptor->activate(fCarlaPluginHandle); fCarlaPluginDescriptor->activate(fCarlaPluginHandle);
} }
DISTRHO_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(IldaeilModule)
}; };
// ----------------------------------------------------------------------------------------------------------- // -----------------------------------------------------------------------------------------------------------
@ -2252,8 +2252,6 @@ struct IldaeilWidget : ImGuiWidget, IdleCallback, Runner {
ImGui::End(); ImGui::End();
} }
DISTRHO_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(IldaeilWidget)
}; };
// -------------------------------------------------------------------------------------------------------------------- // --------------------------------------------------------------------------------------------------------------------
@ -2435,8 +2433,6 @@ struct IldaeilModuleWidget : ModuleWidgetWithSideScrews<26> {
ModuleWidgetWithSideScrews<26>::step(); ModuleWidgetWithSideScrews<26>::step();
} }
DISTRHO_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(IldaeilModuleWidget)
}; };
#else #else
static void host_ui_parameter_changed(NativeHostHandle, uint32_t, float) {} static void host_ui_parameter_changed(NativeHostHandle, uint32_t, float) {}

View file

@ -1,6 +1,6 @@
/* /*
* DISTRHO Cardinal Plugin * 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 * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as * 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. * For a full copy of the GNU General Public License see the LICENSE file.
*/ */
#include "plugin.hpp"
#include "plugincontext.hpp" #include "plugincontext.hpp"
#ifndef HEADLESS #ifndef HEADLESS
# include "EmbedWidget.hpp" # include "EmbedWidget.hpp"
# include "extra/ExternalWindow.hpp" # include "extra/ExternalWindow.hpp"
#endif #endif
USE_NAMESPACE_DISTRHO;
// -------------------------------------------------------------------------------------------------------------------- // --------------------------------------------------------------------------------------------------------------------
struct CardinalEmbedModule : Module { struct CardinalEmbedModule : Module {

View file

@ -1,6 +1,6 @@
/* /*
* DISTRHO Cardinal Plugin * 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 * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as * 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. * For a full copy of the GNU General Public License see the LICENSE file.
*/ */
#include "plugincontext.hpp" #include "plugin.hpp"
#include "ImGuiWidget.hpp" #include "ImGuiWidget.hpp"
#include "sassy/sassy.hpp" #include "sassy/sassy.hpp"
#include "sassy/sassy_scope.cpp" #include "sassy/sassy_scope.cpp"

View file

@ -1,6 +1,6 @@
/* /*
* DISTRHO Cardinal Plugin * 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 * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as * 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. * For a full copy of the GNU General Public License see the LICENSE file.
*/ */
#include "plugincontext.hpp" #include "plugin.hpp"
#ifndef HEADLESS #ifndef HEADLESS
# include "ImGuiTextEditor.hpp" # include "ImGuiTextEditor.hpp"
@ -412,8 +412,6 @@ struct TextEditorModuleWidget : ModuleWidget {
menu->addChild(new ui::MenuSeparator); menu->addChild(new ui::MenuSeparator);
menu->addChild(createMenuItem("Select all", RACK_MOD_CTRL_NAME "+A", [=]{ textEditorWidget->selectAll(); })); menu->addChild(createMenuItem("Select all", RACK_MOD_CTRL_NAME "+A", [=]{ textEditorWidget->selectAll(); }));
} }
DISTRHO_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(TextEditorModuleWidget)
}; };
#else #else
struct TextEditorModuleWidget : ModuleWidget { struct TextEditorModuleWidget : ModuleWidget {

View file

@ -1,6 +1,6 @@
/* /*
* DISTRHO Cardinal Plugin * 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 * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as * modify it under the terms of the GNU General Public License as
@ -18,11 +18,8 @@
#pragma once #pragma once
#include "rack.hpp" #include "rack.hpp"
#include "engine/TerminalModule.hpp" // #include "engine/TerminalModule.hpp"
// #include "plugincontext.hpp"
#ifdef NDEBUG
# undef DEBUG
#endif
using namespace rack; using namespace rack;

View file

@ -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
// -----------------------------------------------------------------------------------------------------------

View file

@ -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 += $(filter-out Biset/src/plugin.cpp,$(wildcard Biset/src/*.cpp))
PLUGIN_FILES += $(wildcard Biset/src/*/*.cpp) PLUGIN_FILES += $(wildcard Biset/src/*/*.cpp)
# # modules/types which are present in other plugins # modules/types which are present in other plugins
BISET_CUSTOM = Blank BISET_CUSTOM = Blank ButtonTrigger Clock Tree
# -------------------------------------------------------------- # --------------------------------------------------------------
# BogaudioModules # BogaudioModules
@ -1318,6 +1318,7 @@ BUILD_DIR = ../build/plugins
endif endif
BASE_FLAGS += -DBUILDING_PLUGIN_MODULES BASE_FLAGS += -DBUILDING_PLUGIN_MODULES
BASE_FLAGS += -DDONT_SET_USING_DISTRHO_NAMESPACE
BASE_FLAGS += -I$(abspath $(ROOT)/include/osdialog-stub) BASE_FLAGS += -I$(abspath $(ROOT)/include/osdialog-stub)
ifeq ($(BSD)$(WASM),true) ifeq ($(BSD)$(WASM),true)

View file

@ -147,9 +147,13 @@ extern Model* modelChord;
#include "Bidoo/src/plugin.hpp" #include "Bidoo/src/plugin.hpp"
// Biset // Biset
#define modelBlank modelBisetBlank
#define modelTree modelBisetTree
#define Clock BisetClock #define Clock BisetClock
#define ButtonTrigger BisetButtonTrigger #define ButtonTrigger BisetButtonTrigger
#include "Biset/src/plugin.hpp" #include "Biset/src/plugin.hpp"
#undef modelBlank
#undef modelTree
#undef ButtonTrigger #undef ButtonTrigger
#undef Clock #undef Clock
@ -1629,31 +1633,35 @@ static void initStatic__Biset()
const StaticPluginLoader spl(p, "Biset"); const StaticPluginLoader spl(p, "Biset");
if (spl.ok()) if (spl.ok())
{ {
#define modelBlank modelBisetBlank
#define modelTree modelBisetTree
p->addModel(modelTracker); p->addModel(modelTracker);
p->addModel(modelTrackerSynth); p->addModel(modelTrackerSynth);
p->addModel(modelTrackerDrum); p->addModel(modelTrackerDrum);
p->addModel(modelTrackerClock); p->addModel(modelTrackerClock);
p->addModel(modelTrackerPhase); p->addModel(modelTrackerPhase);
p->addModel(modelTrackerQuant); p->addModel(modelTrackerQuant);
p->addModel(modelTrackerState); p->addModel(modelTrackerState);
p->addModel(modelTrackerControl); p->addModel(modelTrackerControl);
p->addModel(modelRegex); p->addModel(modelRegex);
p->addModel(modelRegexCondensed); p->addModel(modelRegexCondensed);
p->addModel(modelRegexExp); p->addModel(modelRegexExp);
p->addModel(modelBisetTree); p->addModel(modelTree);
p->addModel(modelBisetTreeSeed); p->addModel(modelTreeSeed);
p->addModel(modelGbu); p->addModel(modelGbu);
p->addModel(modelPkm); p->addModel(modelPkm);
p->addModel(modelIgc); p->addModel(modelIgc);
p->addModel(modelOmega3); p->addModel(modelOmega3);
p->addModel(modelOmega6); p->addModel(modelOmega6);
p->addModel(modelSegfault); p->addModel(modelSegfault);
p->addModel(modelBlank); p->addModel(modelBlank);
#undef modelBlank
#undef modelTree
} }
} }

View file

@ -101,8 +101,6 @@ void destroyStaticPlugins();
const std::string CARDINAL_VERSION = "24.04"; const std::string CARDINAL_VERSION = "24.04";
START_NAMESPACE_DISTRHO
// ----------------------------------------------------------------------------------------------------------- // -----------------------------------------------------------------------------------------------------------
#ifndef HEADLESS #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 #ifndef HEADLESS
bool CardinalPluginContext::addIdleCallback(IdleCallback* const cb) const 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 #ifdef HAVE_LIBLO
static void osc_error_handler(int num, const char* msg, const char* path) static void osc_error_handler(int num, const char* msg, const char* path)
{ {

View file

@ -12,6 +12,8 @@
extern const std::string CARDINAL_VERSION; extern const std::string CARDINAL_VERSION;
struct CardinalPluginContext;
// ----------------------------------------------------------------------------------------------------------- // -----------------------------------------------------------------------------------------------------------
namespace rack { namespace rack {
@ -84,7 +86,6 @@ START_NAMESPACE_DISTRHO
class CardinalBasePlugin; class CardinalBasePlugin;
class CardinalBaseUI; class CardinalBaseUI;
struct CardinalPluginContext;
struct Initializer struct Initializer
{ {

View file

@ -36,29 +36,14 @@
#ifndef HEADLESS #ifndef HEADLESS
# include "DistrhoUI.hpp" # 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 #endif
#include "plugincontext.hpp"
START_NAMESPACE_DISTRHO START_NAMESPACE_DISTRHO
// ----------------------------------------------------------------------------------------------------------- // -----------------------------------------------------------------------------------------------------------
static constexpr const uint kModuleParameterCount = 24;
enum CardinalVariant {
kCardinalVariantMain,
kCardinalVariantMini,
kCardinalVariantFX,
kCardinalVariantNative,
kCardinalVariantSynth,
};
enum CardinalParameters { enum CardinalParameters {
kCardinalParameterCountAtModules = kModuleParameterCount, kCardinalParameterCountAtModules = kModuleParameterCount,
kCardinalParameterBypass = kCardinalParameterCountAtModules, kCardinalParameterBypass = kCardinalParameterCountAtModules,
@ -126,82 +111,6 @@ static_assert(kCardinalParameterCountAtWindow == kModuleParameterCount + kWindow
static_assert(DISTRHO_PLUGIN_NUM_INPUTS == kCardinalParameterCountAtMiniBuffers - kCardinalParameterStartMiniBuffers, "valid parameter indexes"); static_assert(DISTRHO_PLUGIN_NUM_INPUTS == kCardinalParameterCountAtMiniBuffers - kCardinalParameterStartMiniBuffers, "valid parameter indexes");
#endif #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 #if DISTRHO_PLUGIN_WANT_DIRECT_ACCESS