Alternative folder setup for custom files, override MenuBar.cpp
Signed-off-by: falkTX <falktx@falktx.com>
This commit is contained in:
parent
0a0f09bc8a
commit
88beb01572
11 changed files with 951 additions and 294 deletions
57
src/override/context.cpp
Normal file
57
src/override/context.cpp
Normal file
|
|
@ -0,0 +1,57 @@
|
|||
#include <context.hpp>
|
||||
#include <window/Window.hpp>
|
||||
#include <patch.hpp>
|
||||
#include <engine/Engine.hpp>
|
||||
#include <app/Scene.hpp>
|
||||
#include <history.hpp>
|
||||
#include <settings.hpp>
|
||||
|
||||
#include "DistrhoPluginUtils.hpp"
|
||||
|
||||
|
||||
namespace rack {
|
||||
|
||||
|
||||
Context::~Context() {
|
||||
// Deleting NULL is safe in C++.
|
||||
|
||||
// Set pointers to NULL so other objects will segfault when attempting to access them
|
||||
|
||||
delete window;
|
||||
window = NULL;
|
||||
|
||||
delete patch;
|
||||
patch = NULL;
|
||||
|
||||
delete scene;
|
||||
scene = NULL;
|
||||
|
||||
delete event;
|
||||
event = NULL;
|
||||
|
||||
delete history;
|
||||
history = NULL;
|
||||
|
||||
delete engine;
|
||||
engine = NULL;
|
||||
}
|
||||
|
||||
|
||||
static thread_local Context* threadContext = nullptr;
|
||||
|
||||
Context* contextGet() {
|
||||
DISTRHO_SAFE_ASSERT(threadContext != nullptr);
|
||||
return threadContext;
|
||||
}
|
||||
|
||||
// Apple's clang incorrectly compiles this function when -O2 or higher is enabled.
|
||||
#ifdef ARCH_MAC
|
||||
__attribute__((optnone))
|
||||
#endif
|
||||
void contextSet(Context* const context) {
|
||||
// DISTRHO_SAFE_ASSERT(threadContext == nullptr);
|
||||
threadContext = context;
|
||||
}
|
||||
|
||||
|
||||
} // namespace rack
|
||||
Loading…
Add table
Add a link
Reference in a new issue