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"
29 # include "CarlaString.hpp"
32 namespace CB
= CARLA_BACKEND_NAMESPACE
;
33 using CB::EngineOptions
;
35 // --------------------------------------------------------------------------------------------------------------------
38 typedef struct _CarlaHostHandle
{
43 bool isStandalone
: 1;
46 _CarlaHostHandle() noexcept
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
;
67 CarlaString lastError
;
69 CarlaHostStandalone() noexcept
70 : CarlaHostHandleImpl(),
71 engineCallback(nullptr),
72 engineCallbackPtr(nullptr),
73 fileCallback(nullptr),
74 fileCallbackPtr(nullptr),
76 #ifdef CARLA_CAN_USE_LOG_THREAD
78 logThreadEnabled(false),
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