From 946cba3e98866847e3b0ed9150c7c72b5c485d63 Mon Sep 17 00:00:00 2001 From: falkTX Date: Tue, 16 Nov 2021 10:57:32 +0000 Subject: [PATCH] Update to latest published Rack code Signed-off-by: falkTX --- plugins/Core.json | 22 ++++---- plugins/plugins.cpp | 31 ++++++----- src/Rack | 2 +- src/override/Engine.cpp | 24 ++++++-- src/override/RemoteWindow.cpp | 5 ++ src/override/common.cpp | 6 +- src/override/context.cpp | 41 +++++++++----- src/override/dep.cpp | 102 +++++++++++++++++++++++++++------- src/override/library.cpp | 5 +- src/template.vcv | 2 +- 10 files changed, 166 insertions(+), 74 deletions(-) diff --git a/plugins/Core.json b/plugins/Core.json index 100e64d..118cdbb 100644 --- a/plugins/Core.json +++ b/plugins/Core.json @@ -16,7 +16,7 @@ "modules": [ { "slug": "AudioInterface2", - "name": "Audio-2", + "name": "Audio 2", "description": "Sends audio and CV to/from an audio device", "manualUrl": "https://vcvrack.com/manual/Core#Audio", "tags": [ @@ -25,7 +25,7 @@ }, { "slug": "AudioInterface", - "name": "Audio-8", + "name": "Audio 8", "description": "Sends audio and CV to/from an audio device", "manualUrl": "https://vcvrack.com/manual/Core#Audio", "tags": [ @@ -34,7 +34,7 @@ }, { "slug": "AudioInterface16", - "name": "Audio-16", + "name": "Audio 16", "description": "Sends audio and CV to/from an audio device", "manualUrl": "https://vcvrack.com/manual/Core#Audio", "tags": [ @@ -43,7 +43,7 @@ }, { "slug": "MIDIToCVInterface", - "name": "MIDI-CV", + "name": "MIDI to CV", "description": "Converts MIDI from an external device to CV and gates", "manualUrl": "https://vcvrack.com/manual/Core#MIDI-CV", "tags": [ @@ -54,7 +54,7 @@ }, { "slug": "MIDICCToCVInterface", - "name": "MIDI-CC", + "name": "MIDI CC to CV", "description": "Converts MIDI CC from an external device to CV", "manualUrl": "https://vcvrack.com/manual/Core#MIDI-CC", "tags": [ @@ -64,7 +64,7 @@ }, { "slug": "MIDITriggerToCVInterface", - "name": "MIDI-Gate", + "name": "MIDI to Gate", "description": "Converts MIDI notes from an external device to gates", "manualUrl": "https://vcvrack.com/manual/Core#MIDI-Gate", "tags": [ @@ -74,7 +74,7 @@ }, { "slug": "MIDI-Map", - "name": "MIDI-Map", + "name": "MIDI Map", "description": "Controls parameters (knobs, sliders, switches) directly with MIDI CC", "manualUrl": "https://vcvrack.com/manual/Core#MIDI-Map", "tags": [ @@ -84,7 +84,7 @@ }, { "slug": "CV-MIDI", - "name": "CV-MIDI", + "name": "CV to MIDI", "description": "Converts CV to MIDI and sends to an external device", "manualUrl": "https://vcvrack.com/manual/Core#CV-MIDI", "tags": [ @@ -95,7 +95,7 @@ }, { "slug": "CV-CC", - "name": "CV-CC", + "name": "CV to MIDI CC", "description": "Converts CV to MIDI CC and sends to an external device", "manualUrl": "https://vcvrack.com/manual/Core#CV-CC", "tags": [ @@ -105,7 +105,7 @@ }, { "slug": "CV-Gate", - "name": "CV-Gate", + "name": "Gate to MIDI", "description": "Converts gates to MIDI notes and sends to an external device", "manualUrl": "https://vcvrack.com/manual/Core#CV-Gate", "tags": [ @@ -132,4 +132,4 @@ ] } ] -} +} \ No newline at end of file diff --git a/plugins/plugins.cpp b/plugins/plugins.cpp index ef96a35..7dea819 100644 --- a/plugins/plugins.cpp +++ b/plugins/plugins.cpp @@ -15,7 +15,8 @@ * For a full copy of the GNU General Public License see the LICENSE file. */ -#include +#include "rack.hpp" +#include "plugin.hpp" #include "DistrhoUtils.hpp" @@ -335,16 +336,16 @@ std::string pluginPath(const std::string& dirname); // core plugins namespace core { -extern Model* modelAudioInterface; -extern Model* modelAudioInterface2; -extern Model* modelAudioInterface16; +extern Model* modelAudio2; +extern Model* modelAudio8; +extern Model* modelAudio16; extern Model* modelMIDI_CV; -extern Model* modelMIDI_CC; +extern Model* modelMIDICC_CV; extern Model* modelMIDI_Gate; -extern Model* modelMIDI_Map; +extern Model* modelMIDIMap; extern Model* modelCV_MIDI; -extern Model* modelCV_CC; -extern Model* modelCV_Gate; +extern Model* modelCV_MIDICC; +extern Model* modelGate_MIDI; extern Model* modelBlank; extern Model* modelNotes; } @@ -415,16 +416,16 @@ static void initStatic__Core() const StaticPluginLoader spl(p, "Core"); if (spl.ok()) { - p->addModel(rack::core::modelAudioInterface); - p->addModel(rack::core::modelAudioInterface2); - p->addModel(rack::core::modelAudioInterface16); + p->addModel(rack::core::modelAudio2); + p->addModel(rack::core::modelAudio8); + p->addModel(rack::core::modelAudio16); p->addModel(rack::core::modelMIDI_CV); - p->addModel(rack::core::modelMIDI_CC); + p->addModel(rack::core::modelMIDICC_CV); p->addModel(rack::core::modelMIDI_Gate); - p->addModel(rack::core::modelMIDI_Map); + p->addModel(rack::core::modelMIDIMap); p->addModel(rack::core::modelCV_MIDI); - p->addModel(rack::core::modelCV_CC); - p->addModel(rack::core::modelCV_Gate); + p->addModel(rack::core::modelCV_MIDICC); + p->addModel(rack::core::modelGate_MIDI); p->addModel(rack::core::modelBlank); p->addModel(rack::core::modelNotes); } diff --git a/src/Rack b/src/Rack index 219bbaf..588342d 160000 --- a/src/Rack +++ b/src/Rack @@ -1 +1 @@ -Subproject commit 219bbaf137d5dc70c96bd4206c3f8aad5524a81b +Subproject commit 588342d73b4c6a2909b00a262da64b2565e844a5 diff --git a/src/override/Engine.cpp b/src/override/Engine.cpp index 3464d33..45107ea 100644 --- a/src/override/Engine.cpp +++ b/src/override/Engine.cpp @@ -359,7 +359,6 @@ void Engine::stepBlock(int frames) { double startTime = system::getTime(); ReadLock lock(internal->mutex); - // Configure thread random::init(); @@ -611,6 +610,11 @@ bool Engine::hasModule(Module* module) { Module* Engine::getModule(int64_t moduleId) { ReadLock lock(internal->mutex); + return getModule_NoLock(moduleId); +} + + +Module* Engine::getModule_NoLock(int64_t moduleId) { auto it = internal->modulesCache.find(moduleId); if (it == internal->modulesCache.end()) return NULL; @@ -886,6 +890,11 @@ void Engine::removeParamHandle_NoLock(ParamHandle* paramHandle) { ParamHandle* Engine::getParamHandle(int64_t moduleId, int paramId) { ReadLock lock(internal->mutex); + return getParamHandle_NoLock(moduleId, paramId); +} + + +ParamHandle* Engine::getParamHandle_NoLock(int64_t moduleId, int paramId) { auto it = internal->paramHandlesCache.find(std::make_tuple(moduleId, paramId)); if (it == internal->paramHandlesCache.end()) return NULL; @@ -899,7 +908,12 @@ ParamHandle* Engine::getParamHandle(Module* module, int paramId) { void Engine::updateParamHandle(ParamHandle* paramHandle, int64_t moduleId, int paramId, bool overwrite) { - ReadLock lock(internal->mutex); + WriteLock lock(internal->mutex); + updateParamHandle_NoLock(paramHandle, moduleId, paramId, overwrite); +} + + +void Engine::updateParamHandle_NoLock(ParamHandle* paramHandle, int64_t moduleId, int paramId, bool overwrite) { // Check that it exists auto it = internal->paramHandles.find(paramHandle); DISTRHO_SAFE_ASSERT_RETURN(it != internal->paramHandles.end(),); @@ -912,8 +926,7 @@ void Engine::updateParamHandle(ParamHandle* paramHandle, int64_t moduleId, int p if (paramHandle->moduleId >= 0) { // Replace old ParamHandle, or reset the current ParamHandle - // TODO Maybe call getParamHandle_NoLock()? - ParamHandle* oldParamHandle = getParamHandle(moduleId, paramId); + ParamHandle* oldParamHandle = getParamHandle_NoLock(moduleId, paramId); if (oldParamHandle) { if (overwrite) { oldParamHandle->moduleId = -1; @@ -930,8 +943,7 @@ void Engine::updateParamHandle(ParamHandle* paramHandle, int64_t moduleId, int p // Set module pointer if the above block didn't reset it if (paramHandle->moduleId >= 0) { - // TODO Maybe call getModule_NoLock()? - paramHandle->module = getModule(paramHandle->moduleId); + paramHandle->module = getModule_NoLock(paramHandle->moduleId); } Engine_refreshParamHandleCache(this); diff --git a/src/override/RemoteWindow.cpp b/src/override/RemoteWindow.cpp index df0185f..aa1a914 100644 --- a/src/override/RemoteWindow.cpp +++ b/src/override/RemoteWindow.cpp @@ -397,6 +397,11 @@ void Window::step() { } +void Window::activateContext() { + // glfwMakeContextCurrent(win); +} + + void Window::screenshot(const std::string&) { } diff --git a/src/override/common.cpp b/src/override/common.cpp index 0fb286b..b43bc25 100644 --- a/src/override/common.cpp +++ b/src/override/common.cpp @@ -53,11 +53,11 @@ const std::string APP_EDITION_NAME = "Audio Plugin"; const std::string APP_VERSION_MAJOR = "2"; const std::string APP_VERSION = "2.0"; #if defined(ARCH_WIN) -const std::string APP_ARCH = "win"; +const std::string APP_OS = "win"; #elif defined(ARCH_MAC) -const std::string APP_ARCH = "mac"; +const std::string APP_OS = "mac"; #else -const std::string APP_ARCH = "lin"; +const std::string APP_OS = "lin"; #endif const std::string API_URL = ""; diff --git a/src/override/context.cpp b/src/override/context.cpp index 4f1cddf..391aaa9 100644 --- a/src/override/context.cpp +++ b/src/override/context.cpp @@ -1,3 +1,30 @@ +/* + * DISTRHO Cardinal Plugin + * Copyright (C) 2021 Filipe Coelho + * + * 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. + */ + +/** + * This file is an edited version of VCVRack's context.cpp + * Copyright (C) 2016-2021 VCV. + * + * 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 (at your option) any later version. + */ + #include #include #include @@ -12,20 +39,8 @@ #include "DistrhoUtils.hpp" -/** - * This file is an edited version of VCVRack's context.cpp - * Copyright (C) 2016-2021 VCV. - * - * 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 (at your option) any later version. - */ - - namespace rack { - Context::~Context() { // Deleting NULL is safe in C++. @@ -50,7 +65,6 @@ Context::~Context() { engine = NULL; } - static thread_local Context* threadContext = nullptr; Context* contextGet() { @@ -67,5 +81,4 @@ void contextSet(Context* const context) { threadContext = context; } - } // namespace rack diff --git a/src/override/dep.cpp b/src/override/dep.cpp index da7b17d..bc336dd 100644 --- a/src/override/dep.cpp +++ b/src/override/dep.cpp @@ -49,48 +49,103 @@ static const struct { const char* shapes[4]; } pathsToFilterOut[] = { { - "/Core/AudioInterface.svg", - {"path39377","path39381","path39383","path39379"} + "/Core/Audio2.svg", + { + "af0e935f-6d5d-444c-895d-4ef87ed070e2", + "a86c2c4c-97ac-4697-a68a-6850586e2c02", + "bcf7f738-a2ee-4f24-a05e-79080795ecac", + "a97fec2c-c9d1-4f34-979d-c2ed13bb4b13" + } }, { - "/Core/AudioInterface2.svg", - {"path18733","path18737","path18731","path18735"} + "/Core/Audio8.svg", + { + "a0f6228c-5a83-4e0f-aae7-549956d6c592", + "ab26ff62-9ae1-4a5d-a800-ae8a9605590e", + "a5905f87-4917-4633-8c97-2c26610c8dd4", + "b9c0a0ed-e7c4-4727-8d9a-2f8d91fb0687" + } }, { - "/Core/AudioInterface16.svg", - {"path40283","path40287","path40289","path40285"} + "/Core/Audio16.svg", + { + "b1f50144-7f61-4995-a84e-7c733562b87a", + "bc1bc3f6-2589-483f-a045-f4d5b20fb1bb", + "aa22e3a2-cd01-4140-bbb6-d7011a95a8a2", + "ea03e764-3d44-4889-a575-96635de1afbe" + } }, { - "/Core/CV-CC.svg", - {"path12881","path12885","path12887","path12883"} + "/Core/CV_MIDI.svg", + { + "bccecf5a-8b5e-488a-8cf7-650646675413", + "e23862c8-ee12-4114-8f76-5ec17e2f6556", + "ecee65f0-2e8f-465d-a3f5-7c42fd129ac0", + "e5f4878f-ccca-4a7b-9150-00a37e0f7a74" + } }, { - "/Core/CV-Gate.svg", - {"path13127","path13131","path13133","path13129"} + "/Core/CV_MIDICC.svg", + { + "a00f3f95-93a1-4715-a488-46304d54fe4f", + "a08adb03-865c-43cd-8cb5-971a122dc23b", + "acc2b450-a2fc-418e-a77e-156a2488ec7a", + "e06020ad-ee93-4ba3-893c-67c2998ab6cb" + } }, { - "/Core/CV-MIDI.svg", - {"path12747","path12751","path12753","path12749"} + "/Core/Gate_MIDI.svg", + { + "f2d57f2b-4ac3-4488-87ca-eb36011b7ce2", + "bc89b1d7-8b88-4c7a-af75-dfc0ea49931b", + "a11340bf-b366-408c-b4b3-38117f4076dc", + "aa3e2e62-1159-407f-836f-d2ff19be0436" + } }, { - "/Core/MIDI-CC.svg", - {"path9740","path9744","path9746","path9742"} + "/Core/MIDI_CV.svg", + { + "fca6f6f9-431a-4f4f-9eb9-85798d95f9ff", + "a520f07d-0c80-4572-aabf-aa329a17c02b", + "b824fab4-8a48-404a-b94f-d27f4404ee73", + "beded7b3-65dd-4587-af53-097e8e4afb82" + } }, { - "/Core/MIDI-CV.svg", - {"path11803","path11807","path11809","path11805"} + "/Core/MIDI_Gate.svg", + { + "fb3f5bb1-31c5-4a85-95ef-a09d670df926", + "a32f20f9-d55f-46ad-b898-7dc335b20780", + "bf8ce0d6-d9b5-4e48-bf72-dd6ddd7e4866", + "ba9e0012-4a65-4add-bd98-ba3570579a83" + } }, { - "/Core/MIDI-Gate.svg", - {"path11634","path11638","path11640","path11636"} + "/Core/MIDICC_CV.svg", + { + "bc30b86e-2d28-4d36-a374-69ba5693476f", + "ffe265e3-2ac1-4b6b-8361-c3aaecd0b08f", + "e822d5df-0aee-4ddb-9c3d-a6878d3d06e2", + "b4f0f926-0fae-49be-b7d9-5bd02e5798af" + } }, { - "/Core/MIDI-Map.svg", - {"path21209","path21213","path21215","path21211"} + "/Core/MIDIMap.svg", + { + "b3405776-74b5-4087-a983-4efe1be00b3e", + "bd42b57c-2a9e-4cc7-a268-70bc560923d7", + "e2520435-d4b5-45d8-8264-c033ec31cfb4", + "f774ab20-064d-4751-baa5-11632dd31e08" + } }, { "/Core/Notes.svg", - {"path6935","path6939","path6941","path6937"} + { + "b4cb817a-ff42-4dfc-8866-e3d83608b518", + "aa48af94-af91-4b1f-b663-ef6af4b5cf3b", + "a3b43b3b-5987-49ba-834a-210c6d95bb7d", + "a58877fa-d57b-4d74-bbda-a883bf30a365" + } }, { "/Fundamental/8vert.svg", @@ -467,6 +522,11 @@ NSVGimage* nsvgParseFromFileCardinal(const char* const filename, const char* con invertPaint(shape->stroke); } + // replace white background + handle->shapes->fill.type = NSVG_PAINT_COLOR; + handle->shapes->fill.color = 0xff202020; + handle->shapes->stroke.type = NSVG_PAINT_NONE; + return handle; } diff --git a/src/override/library.cpp b/src/override/library.cpp index e8f4475..607b50c 100644 --- a/src/override/library.cpp +++ b/src/override/library.cpp @@ -31,15 +31,16 @@ std::string updateSlug; float updateProgress = 0.f; bool isSyncing = false; bool restartRequested = false; +bool refreshRequested = false; void checkAppUpdate() {} void checkUpdates() {} bool hasUpdates() { return false; } bool isAppUpdateAvailable() { return false; } bool isLoggedIn() { return false; } -void logIn(const std::string&, const std::string&) {} +void logIn(std::string, std::string) {} void logOut() {} -void syncUpdate(const std::string&) {} +void syncUpdate(std::string) {} void syncUpdates() {} } diff --git a/src/template.vcv b/src/template.vcv index 8c5a3ad..064241e 100644 --- a/src/template.vcv +++ b/src/template.vcv @@ -67,7 +67,7 @@ "midi": { "driver": 0, "deviceName": "Cardinal", - "channel": -1 + "channel": 0 } }, "pos": [