Tweak template patch locations

Signed-off-by: falkTX <falktx@falktx.com>
This commit is contained in:
falkTX 2022-07-24 18:18:46 +01:00
parent c957357781
commit 2aa9142437
No known key found for this signature in database
GPG key ID: CDBAA37ABC74FBA0
20 changed files with 587 additions and 56 deletions

2
dpf

@ -1 +1 @@
Subproject commit d200db475b74a20e244bbfc2031527666c614eb4
Subproject commit d41b971d77dceadcb76a7736908d0b6a36ff1469

268
patches/init/wasm.vcv Normal file
View file

@ -0,0 +1,268 @@
{
"version": "2.1.2",
"unsaved": true,
"zoom": 1.0,
"modules": [
{
"id": 8712245256622475,
"plugin": "Cardinal",
"model": "TextEditor",
"version": "2.0",
"params": [],
"leftModuleId": 799138358763949,
"data": {
"filepath": "",
"lang": "None",
"etext": "Welcome to Cardinal!\n\nThis is the Web/Wasm variant\nIt has 2 audio outputs, enabled by default.\nUse Engine menu to enable input and/or MIDI.\n\nA basic VCO + ADSR + VCA is the default patch\n\n",
"width": 23
},
"pos": [
49,
0
]
},
{
"id": 5726895899473528,
"plugin": "Fundamental",
"model": "ADSR",
"version": "2.0",
"params": [
{
"value": 0.5,
"id": 0
},
{
"value": 0.5,
"id": 1
},
{
"value": 0.5,
"id": 2
},
{
"value": 0.5,
"id": 3
},
{
"value": 0.0,
"id": 4
},
{
"value": 0.0,
"id": 5
},
{
"value": 0.0,
"id": 6
},
{
"value": 0.0,
"id": 7
},
{
"value": 0.0,
"id": 8
}
],
"leftModuleId": 8601159184541723,
"rightModuleId": 4828178296911509,
"pos": [
18,
0
]
},
{
"id": 4828178296911509,
"plugin": "Fundamental",
"model": "VCA-1",
"version": "2.0",
"params": [
{
"value": 1.0,
"id": 0
},
{
"value": 1.0,
"id": 1
}
],
"leftModuleId": 5726895899473528,
"rightModuleId": 1,
"pos": [
27,
0
]
},
{
"id": 8601159184541723,
"plugin": "Fundamental",
"model": "VCO",
"version": "2.0",
"params": [
{
"value": 0.0,
"id": 0
},
{
"value": 1.0,
"id": 1
},
{
"value": 0.0,
"id": 2
},
{
"value": 0.0,
"id": 3
},
{
"value": 0.0,
"id": 4
},
{
"value": 0.5,
"id": 5
},
{
"value": 0.0,
"id": 6
},
{
"value": 0.0,
"id": 7
}
],
"leftModuleId": 2,
"rightModuleId": 5726895899473528,
"pos": [
9,
0
]
},
{
"id": 1,
"plugin": "Cardinal",
"model": "HostAudio2",
"version": "2.0",
"params": [
{
"value": 0.79432821273803711,
"id": 0
}
],
"leftModuleId": 4828178296911509,
"rightModuleId": 799138358763949,
"data": {
"dcFilter": true
},
"pos": [
30,
0
]
},
{
"id": 2,
"plugin": "Cardinal",
"model": "HostMIDI",
"version": "2.0",
"params": [],
"rightModuleId": 8601159184541723,
"data": {
"pwRange": 0.0,
"smooth": false,
"channels": 1,
"polyMode": 0,
"lastPitch": 8192,
"lastMod": 0,
"inputChannel": 0,
"outputChannel": 0
},
"pos": [
0,
0
]
},
{
"id": 799138358763949,
"plugin": "Cardinal",
"model": "HostMIDIMap",
"version": "2.0",
"params": [],
"leftModuleId": 1,
"rightModuleId": 8712245256622475,
"data": {
"maps": [
{
"cc": -1,
"moduleId": -1,
"paramId": 0
}
],
"smooth": true,
"channel": 0
},
"pos": [
38,
0
]
}
],
"cables": [
{
"id": 5155876120487880,
"outputModuleId": 2,
"outputId": 1,
"inputModuleId": 5726895899473528,
"inputId": 4,
"color": "#ff9352"
},
{
"id": 781753834216137,
"outputModuleId": 2,
"outputId": 6,
"inputModuleId": 5726895899473528,
"inputId": 5,
"color": "#ffd452"
},
{
"id": 3464471860196875,
"outputModuleId": 5726895899473528,
"outputId": 0,
"inputModuleId": 4828178296911509,
"inputId": 0,
"color": "#e8ff52"
},
{
"id": 739552540616113,
"outputModuleId": 4828178296911509,
"outputId": 0,
"inputModuleId": 1,
"inputId": 0,
"color": "#52beff"
},
{
"id": 6701970185765111,
"outputModuleId": 2,
"outputId": 0,
"inputModuleId": 8601159184541723,
"inputId": 0,
"color": "#ff5252"
},
{
"id": 6959800657121782,
"outputModuleId": 2,
"outputId": 2,
"inputModuleId": 8601159184541723,
"inputId": 1,
"color": "#52ff7d"
},
{
"id": 1598271319373837,
"outputModuleId": 8601159184541723,
"outputId": 0,
"inputModuleId": 4828178296911509,
"inputId": 1,
"color": "#a8ff52"
}
]
}

View file

@ -0,0 +1,268 @@
{
"version": "2.1.2",
"unsaved": true,
"zoom": 1.0,
"modules": [
{
"id": 8712245256622475,
"plugin": "Cardinal",
"model": "TextEditor",
"version": "2.0",
"params": [],
"leftModuleId": 799138358763949,
"data": {
"filepath": "",
"lang": "None",
"etext": "Welcome to Cardinal!\n\nThis is the Web/Wasm variant\nIt has 2 audio outputs, enabled by default.\nUse Engine menu to enable input and/or MIDI.\n\nA basic VCO + ADSR + VCA is the default patch\n\n",
"width": 23
},
"pos": [
49,
0
]
},
{
"id": 5726895899473528,
"plugin": "Fundamental",
"model": "ADSR",
"version": "2.0",
"params": [
{
"value": 0.5,
"id": 0
},
{
"value": 0.5,
"id": 1
},
{
"value": 0.5,
"id": 2
},
{
"value": 0.5,
"id": 3
},
{
"value": 0.0,
"id": 4
},
{
"value": 0.0,
"id": 5
},
{
"value": 0.0,
"id": 6
},
{
"value": 0.0,
"id": 7
},
{
"value": 0.0,
"id": 8
}
],
"leftModuleId": 8601159184541723,
"rightModuleId": 4828178296911509,
"pos": [
18,
0
]
},
{
"id": 4828178296911509,
"plugin": "Fundamental",
"model": "VCA-1",
"version": "2.0",
"params": [
{
"value": 1.0,
"id": 0
},
{
"value": 1.0,
"id": 1
}
],
"leftModuleId": 5726895899473528,
"rightModuleId": 1,
"pos": [
27,
0
]
},
{
"id": 8601159184541723,
"plugin": "Fundamental",
"model": "VCO",
"version": "2.0",
"params": [
{
"value": 0.0,
"id": 0
},
{
"value": 1.0,
"id": 1
},
{
"value": 0.0,
"id": 2
},
{
"value": 0.0,
"id": 3
},
{
"value": 0.0,
"id": 4
},
{
"value": 0.5,
"id": 5
},
{
"value": 0.0,
"id": 6
},
{
"value": 0.0,
"id": 7
}
],
"leftModuleId": 2,
"rightModuleId": 5726895899473528,
"pos": [
9,
0
]
},
{
"id": 1,
"plugin": "Cardinal",
"model": "HostAudio2",
"version": "2.0",
"params": [
{
"value": 0.79432821273803711,
"id": 0
}
],
"leftModuleId": 4828178296911509,
"rightModuleId": 799138358763949,
"data": {
"dcFilter": true
},
"pos": [
30,
0
]
},
{
"id": 2,
"plugin": "Cardinal",
"model": "HostMIDI",
"version": "2.0",
"params": [],
"rightModuleId": 8601159184541723,
"data": {
"pwRange": 0.0,
"smooth": false,
"channels": 1,
"polyMode": 0,
"lastPitch": 8192,
"lastMod": 0,
"inputChannel": 0,
"outputChannel": 0
},
"pos": [
0,
0
]
},
{
"id": 799138358763949,
"plugin": "Cardinal",
"model": "HostMIDIMap",
"version": "2.0",
"params": [],
"leftModuleId": 1,
"rightModuleId": 8712245256622475,
"data": {
"maps": [
{
"cc": -1,
"moduleId": -1,
"paramId": 0
}
],
"smooth": true,
"channel": 0
},
"pos": [
38,
0
]
}
],
"cables": [
{
"id": 5155876120487880,
"outputModuleId": 2,
"outputId": 1,
"inputModuleId": 5726895899473528,
"inputId": 4,
"color": "#ff9352"
},
{
"id": 781753834216137,
"outputModuleId": 2,
"outputId": 6,
"inputModuleId": 5726895899473528,
"inputId": 5,
"color": "#ffd452"
},
{
"id": 3464471860196875,
"outputModuleId": 5726895899473528,
"outputId": 0,
"inputModuleId": 4828178296911509,
"inputId": 0,
"color": "#e8ff52"
},
{
"id": 739552540616113,
"outputModuleId": 4828178296911509,
"outputId": 0,
"inputModuleId": 1,
"inputId": 0,
"color": "#52beff"
},
{
"id": 6701970185765111,
"outputModuleId": 2,
"outputId": 0,
"inputModuleId": 8601159184541723,
"inputId": 0,
"color": "#ff5252"
},
{
"id": 6959800657121782,
"outputModuleId": 2,
"outputId": 2,
"inputModuleId": 8601159184541723,
"inputId": 1,
"color": "#52ff7d"
},
{
"id": 1598271319373837,
"outputModuleId": 8601159184541723,
"outputId": 0,
"inputModuleId": 4828178296911509,
"inputId": 1,
"color": "#a8ff52"
}
]
}

View file

@ -26,7 +26,12 @@
#endif
#ifdef DISTRHO_OS_WASM
# define CARDINAL_IMPORTED_TEMPLATE_FILENAME "/imported.vcv"
# define CARDINAL_WASM_IMPORTED_TEMPLATE_FILENAME "/imported.vcv"
# ifdef STATIC_BUILD
# define CARDINAL_WASM_WELCOME_TEMPLATE_FILENAME "welcome-wasm.vcv"
# else
# define CARDINAL_WASM_WELCOME_TEMPLATE_FILENAME "welcome-wasm-mini.vcv"
# endif
#endif
extern const std::string CARDINAL_VERSION;

View file

@ -28,12 +28,18 @@
#define DISTRHO_PLUGIN_BRAND "DISTRHO"
#define DISTRHO_PLUGIN_URI "https://distrho.kx.studio/plugins/cardinal#fx"
#ifdef __MOD_DEVICES__
#define DISTRHO_PLUGIN_NAME "Cardinal Mini"
#define DISTRHO_PLUGIN_LABEL "CardinalMini"
#if defined(DISTRHO_OS_WASM) && defined(STATIC_BUILD)
# define DISTRHO_PLUGIN_NAME "Mini Cardinal"
# define DISTRHO_PLUGIN_LABEL "MiniCardinal"
#elif defined(DISTRHO_OS_WASM)
# define DISTRHO_PLUGIN_NAME "Cardinal"
# define DISTRHO_PLUGIN_LABEL "Cardinal"
#elif defined(__MOD_DEVICES__)
# define DISTRHO_PLUGIN_NAME "Cardinal Mini"
# define DISTRHO_PLUGIN_LABEL "CardinalMini"
#else
#define DISTRHO_PLUGIN_NAME "Cardinal FX"
#define DISTRHO_PLUGIN_LABEL "CardinalFX"
# define DISTRHO_PLUGIN_NAME "Cardinal FX"
# define DISTRHO_PLUGIN_LABEL "CardinalFX"
#endif
#ifdef HEADLESS

View file

@ -52,18 +52,14 @@
# include "extra/SharedResourcePointer.hpp"
#endif
#if CARDINAL_VARIANT_FX
# define CARDINAL_FACTORY_TEMPLATE_NAME "template-fx.vcv"
#elif CARDINAL_VARIANT_SYNTH
# define CARDINAL_FACTORY_TEMPLATE_NAME "template-synth.vcv"
#else
# define CARDINAL_FACTORY_TEMPLATE_NAME "template.vcv"
#endif
#ifdef DISTRHO_OS_WASM
# define CARDINAL_TEMPLATE_NAME "template-wasm.vcv"
# define CARDINAL_TEMPLATE_NAME "init/wasm.vcv"
#elif CARDINAL_VARIANT_FX
# define CARDINAL_TEMPLATE_NAME "init/fx.vcv"
#elif CARDINAL_VARIANT_SYNTH
# define CARDINAL_TEMPLATE_NAME "init/synth.vcv"
#else
# define CARDINAL_TEMPLATE_NAME CARDINAL_FACTORY_TEMPLATE_NAME
# define CARDINAL_TEMPLATE_NAME "init/main.vcv"
#endif
static const constexpr uint kCardinalStateBaseCount = 3; // patch, screenshot, comment
@ -78,16 +74,19 @@ static const constexpr uint kCardinalStateCount = kCardinalStateBaseCount;
#endif
namespace rack {
namespace asset {
std::string patchesPath();
}
namespace engine {
void Engine_setAboutToClose(Engine*);
void Engine_setAboutToClose(Engine*);
}
namespace plugin {
void initStaticPlugins();
void destroyStaticPlugins();
void initStaticPlugins();
void destroyStaticPlugins();
}
#ifndef HEADLESS
namespace window {
void WindowInit(Window* window, DISTRHO_NAMESPACE::Plugin* plugin);
void WindowInit(Window* window, DISTRHO_NAMESPACE::Plugin* plugin);
}
#endif
}
@ -183,10 +182,8 @@ struct Initializer
{
if (const char* const resourcePath = getResourcePath(bundlePath))
{
asset::bundlePath = system::join(resourcePath, "PluginManifests");
asset::systemDir = resourcePath;
templatePath = system::join(asset::systemDir, CARDINAL_TEMPLATE_NAME);
factoryTemplatePath = system::join(asset::systemDir, CARDINAL_FACTORY_TEMPLATE_NAME);
asset::bundlePath = system::join(asset::systemDir, "PluginManifests");
}
}
@ -196,13 +193,8 @@ struct Initializer
// Make system dir point to source code location as fallback
asset::systemDir = CARDINAL_PLUGIN_SOURCE_DIR DISTRHO_OS_SEP_STR "Rack";
if (system::exists(system::join(asset::systemDir, "res")))
{
templatePath = CARDINAL_PLUGIN_SOURCE_DIR DISTRHO_OS_SEP_STR CARDINAL_TEMPLATE_NAME;
factoryTemplatePath = CARDINAL_PLUGIN_SOURCE_DIR DISTRHO_OS_SEP_STR CARDINAL_FACTORY_TEMPLATE_NAME;
}
// If source code dir does not exist use install target prefix as system dir
else
if (!system::exists(system::join(asset::systemDir, "res")))
#endif
{
#if defined(DISTRHO_OS_WASM)
@ -218,18 +210,19 @@ struct Initializer
#endif
asset::bundlePath = system::join(asset::systemDir, "PluginManifests");
templatePath = system::join(asset::systemDir, CARDINAL_TEMPLATE_NAME);
factoryTemplatePath = system::join(asset::systemDir, CARDINAL_FACTORY_TEMPLATE_NAME);
}
}
asset::userDir = asset::systemDir;
}
const std::string patchesPath = asset::patchesPath();
#ifdef DISTRHO_OS_WASM
if ((patchStorageSlug = getPatchStorageSlug()) != nullptr)
templatePath = CARDINAL_IMPORTED_TEMPLATE_FILENAME;
templatePath = system::join(patchesPath, CARDINAL_WASM_WELCOME_TEMPLATE_FILENAME);
#else
templatePath = system::join(patchesPath, CARDINAL_TEMPLATE_NAME);
#endif
factoryTemplatePath = system::join(patchesPath, CARDINAL_TEMPLATE_NAME);
// Log environment
INFO("%s %s v%s", APP_NAME.c_str(), APP_EDITION.c_str(), APP_VERSION.c_str());
@ -608,11 +601,13 @@ public:
context->window = new rack::window::Window;
#ifdef DISTRHO_OS_WASM
if (rack::patchStorageSlug == nullptr)
if ((rack::patchStorageSlug = getPatchStorageSlug()) == nullptr)
#endif
{
context->patch->loadTemplate();
context->scene->rackScroll->reset();
// swap to factory template after first load
context->patch->templatePath = context->patch->factoryTemplatePath;
}
#if defined(HAVE_LIBLO) && defined(HEADLESS)

View file

@ -253,7 +253,7 @@ static void downloadPatchStorageFailed(const char* const filename)
}
using namespace rack;
context->patch->templatePath = system::join(asset::systemDir, "template-synth.vcv"); // FIXME
context->patch->templatePath = system::join(asset::systemDir, "init/wasm.vcv"); // FIXME
context->patch->loadTemplate();
context->scene->rackScroll->reset();
}
@ -277,7 +277,7 @@ static void downloadPatchStorageSucceeded(const char* const filename)
}
try {
context->patch->load(CARDINAL_IMPORTED_TEMPLATE_FILENAME);
context->patch->load(CARDINAL_WASM_IMPORTED_TEMPLATE_FILENAME);
} catch (rack::Exception& e) {
const std::string message = rack::string::f("Could not load patch: %s", e.what());
asyncDialog::create(message.c_str());
@ -428,7 +428,7 @@ public:
void uiIdle() override
{
if (counterForFirstIdlePoint >= 0 && ++counterForFirstIdlePoint == 5)
if (counterForFirstIdlePoint >= 0 && ++counterForFirstIdlePoint == 30)
{
counterForFirstIdlePoint = -1;

View file

@ -311,7 +311,6 @@ endif
CORE_RESOURCES = patches
CORE_RESOURCES += $(subst ../Rack/res/,,$(wildcard ../Rack/res/ComponentLibrary/*.svg ../Rack/res/fonts/*.ttf))
CORE_RESOURCES += $(subst ../,,$(wildcard ../template*.vcv))
LV2_RESOURCES = $(CORE_RESOURCES:%=$(TARGET_DIR)/$(NAME).lv2/resources/%)
VST3_RESOURCES = $(CORE_RESOURCES:%=$(TARGET_DIR)/$(NAME).vst3/Contents/Resources/%)
@ -376,22 +375,6 @@ $(TARGET_DIR)/%/patches: ../../patches
-@mkdir -p "$(shell dirname $@)"
$(SILENT)ln -sf $(abspath $<) $@
$(TARGET_DIR)/%/template.vcv: ../template.vcv
-@mkdir -p "$(shell dirname $@)"
$(SILENT)ln -sf $(abspath $<) $@
$(TARGET_DIR)/%/template-fx.vcv: ../template-fx.vcv
-@mkdir -p "$(shell dirname $@)"
$(SILENT)ln -sf $(abspath $<) $@
$(TARGET_DIR)/%/template-synth.vcv: ../template-synth.vcv
-@mkdir -p "$(shell dirname $@)"
$(SILENT)ln -sf $(abspath $<) $@
$(TARGET_DIR)/%/template-wasm.vcv: ../template-wasm.vcv
-@mkdir -p "$(shell dirname $@)"
$(SILENT)ln -sf $(abspath $<) $@
$(TARGET_DIR)/$(NAME).lv2/resources/%: ../Rack/res/%
-@mkdir -p "$(shell dirname $@)"
$(SILENT)ln -sf $(abspath $<) $@

View file

@ -97,12 +97,15 @@ struct MenuButton : ui::Button {
struct FileButton : MenuButton {
const bool isStandalone;
#if !(defined(DISTRHO_OS_WASM) && defined(STATIC_BUILD))
std::vector<std::string> demoPatches;
#endif
FileButton(const bool standalone)
: MenuButton(), isStandalone(standalone)
{
const std::string patchesDir = asset::patchesPath();
#if !(defined(DISTRHO_OS_WASM) && defined(STATIC_BUILD))
const std::string patchesDir = asset::patchesPath() + DISTRHO_OS_SEP_STR "examples";
if (system::isDirectory(patchesDir))
{
@ -111,6 +114,7 @@ struct FileButton : MenuButton {
return string::lowercase(a) < string::lowercase(b);
});
}
#endif
}
void onAction(const ActionEvent& e) override {
@ -195,6 +199,7 @@ struct FileButton : MenuButton {
}));
#endif
#if !(defined(DISTRHO_OS_WASM) && defined(STATIC_BUILD))
if (!demoPatches.empty())
{
menu->addChild(new ui::MenuSeparator);
@ -220,6 +225,7 @@ struct FileButton : MenuButton {
}));
}));
}
#endif
#ifndef DISTRHO_OS_WASM
if (isStandalone) {