Get rid of JUCE for discovery and utils
[carla.git] / source / backend / CarlaHostImpl.hpp
blob24a885498f11c2f561c0ecebe6d47d827366aa47
1 /*
2 * Carla Plugin Host
3 * Copyright (C) 2011-2022 Filipe Coelho <falktx@falktx.com>
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License as
7 * published by the Free Software Foundation; either version 2 of
8 * the License, or any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * For a full copy of the GNU General Public License see the doc/GPL.txt file.
18 #ifndef CARLA_HOST_IMPL_HPP_INCLUDED
19 #define CARLA_HOST_IMPL_HPP_INCLUDED
21 #include "CarlaHost.h"
22 #include "CarlaUtils.h"
23 #include "CarlaEngine.hpp"
25 #if !(defined(BUILD_BRIDGE) || defined(CARLA_OS_WASM))
26 # define CARLA_CAN_USE_LOG_THREAD
27 # include "CarlaLogThread.hpp"
28 #else
29 # include "CarlaString.hpp"
30 #endif
32 namespace CB = CARLA_BACKEND_NAMESPACE;
33 using CB::EngineOptions;
35 // --------------------------------------------------------------------------------------------------------------------
36 // Shared code, WIP
38 typedef struct _CarlaHostHandle {
39 // required pointers
40 CarlaEngine* engine;
42 // flags
43 bool isStandalone : 1;
44 bool isPlugin : 1;
46 _CarlaHostHandle() noexcept
47 : engine(nullptr),
48 isStandalone(false),
49 isPlugin(false) {}
50 } CarlaHostHandleImpl;
52 // --------------------------------------------------------------------------------------------------------------------
53 // Single, standalone engine
55 struct CarlaHostStandalone : CarlaHostHandleImpl {
56 EngineCallbackFunc engineCallback;
57 void* engineCallbackPtr;
58 FileCallbackFunc fileCallback;
59 void* fileCallbackPtr;
61 EngineOptions engineOptions;
62 #ifdef CARLA_CAN_USE_LOG_THREAD
63 CarlaLogThread logThread;
64 bool logThreadEnabled;
65 #endif
67 CarlaString lastError;
69 CarlaHostStandalone() noexcept
70 : CarlaHostHandleImpl(),
71 engineCallback(nullptr),
72 engineCallbackPtr(nullptr),
73 fileCallback(nullptr),
74 fileCallbackPtr(nullptr),
75 engineOptions(),
76 #ifdef CARLA_CAN_USE_LOG_THREAD
77 logThread(),
78 logThreadEnabled(false),
79 #endif
80 lastError()
82 isStandalone = true;
85 ~CarlaHostStandalone() noexcept
87 CARLA_SAFE_ASSERT(engine == nullptr);
90 CARLA_PREVENT_HEAP_ALLOCATION
91 CARLA_DECLARE_NON_COPYABLE(CarlaHostStandalone)
94 // --------------------------------------------------------------------------------------------------------------------
96 #endif // CARLA_HOST_IMPL_HPP_INCLUDED