Carla Backend
CarlaHostImpl.hpp
Go to the documentation of this file.
1 /*
2  * Carla Plugin Host
3  * Copyright (C) 2011-2020 Filipe Coelho <falktx@falktx.com>
4  *
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.
9  *
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.
14  *
15  * For a full copy of the GNU General Public License see the doc/GPL.txt file.
16  */
17 
18 #ifndef CARLA_HOST_IMPL_HPP_INCLUDED
19 #define CARLA_HOST_IMPL_HPP_INCLUDED
20 
21 #include "CarlaHost.h"
22 #include "CarlaUtils.h"
23 #include "CarlaEngine.hpp"
24 
25 #ifdef BUILD_BRIDGE
26 # include "CarlaString.hpp"
27 #else
28 # include "CarlaLogThread.hpp"
29 #endif
30 
31 namespace CB = CarlaBackend;
32 using CB::EngineOptions;
33 
34 // --------------------------------------------------------------------------------------------------------------------
35 // Shared code, WIP
36 
37 typedef struct _CarlaHostHandle {
38  // required pointers
40 
41  // flags
42  bool isStandalone : 1;
43  bool isPlugin : 1;
44 
45  _CarlaHostHandle() noexcept
46  : engine(nullptr),
47  isStandalone(false),
48  isPlugin(false) {}
49 } CarlaHostHandleImpl;
50 
51 // --------------------------------------------------------------------------------------------------------------------
52 // Single, standalone engine
53 
54 struct CarlaHostStandalone : CarlaHostHandleImpl {
59 
60 #ifndef BUILD_BRIDGE
62  CarlaLogThread logThread;
64 #endif
65 
66  CarlaString lastError;
67 
69  : CarlaHostHandleImpl(),
70  engineCallback(nullptr),
71  engineCallbackPtr(nullptr),
72  fileCallback(nullptr),
73  fileCallbackPtr(nullptr),
74 #ifndef BUILD_BRIDGE
75  engineOptions(),
76  logThread(),
77  logThreadEnabled(false),
78 #endif
79  lastError()
80  {
81  isStandalone = true;
82  }
83 
85  {
86  CARLA_SAFE_ASSERT(engine == nullptr);
87  }
88 
89  CARLA_PREVENT_HEAP_ALLOCATION
90  CARLA_DECLARE_NON_COPY_STRUCT(CarlaHostStandalone)
91 };
92 
93 // --------------------------------------------------------------------------------------------------------------------
94 
95 #endif // CARLA_HOST_IMPL_HPP_INCLUDED
_CarlaHostHandle
Definition: CarlaHostImpl.hpp:37
EngineOptions
Definition: CarlaEngine.hpp:235
CarlaHostStandalone::~CarlaHostStandalone
~CarlaHostStandalone() noexcept
Definition: CarlaHostImpl.hpp:84
_CarlaHostHandle::isPlugin
bool isPlugin
Definition: CarlaHostImpl.hpp:43
CarlaHostStandalone::engineCallbackPtr
void * engineCallbackPtr
Definition: CarlaHostImpl.hpp:56
CarlaHostStandalone::CarlaHostStandalone
CarlaHostStandalone() noexcept
Definition: CarlaHostImpl.hpp:68
CarlaEngine
Definition: CarlaEngine.hpp:806
CarlaHostStandalone::logThread
CarlaLogThread logThread
Definition: CarlaHostImpl.hpp:62
CarlaHostStandalone::fileCallbackPtr
void * fileCallbackPtr
Definition: CarlaHostImpl.hpp:58
CarlaEngine.hpp
CarlaHostStandalone::fileCallback
FileCallbackFunc fileCallback
Definition: CarlaHostImpl.hpp:57
FileCallbackFunc
const typedef char *(* FileCallbackFunc)(void *ptr, FileCallbackOpcode action, bool isDir, const char *title, const char *filter)
Definition: CarlaBackend.h:1653
_CarlaHostHandle::engine
CarlaEngine * engine
Definition: CarlaHostImpl.hpp:39
CarlaHostStandalone::lastError
CarlaString lastError
Definition: CarlaHostImpl.hpp:66
CarlaHostStandalone::engineCallback
EngineCallbackFunc engineCallback
Definition: CarlaHostImpl.hpp:55
CarlaHostStandalone::engineOptions
EngineOptions engineOptions
Definition: CarlaHostImpl.hpp:61
_CarlaHostHandle::isStandalone
bool isStandalone
Definition: CarlaHostImpl.hpp:42
_CarlaHostHandle::_CarlaHostHandle
_CarlaHostHandle() noexcept
Definition: CarlaHostImpl.hpp:45
CarlaHost.h
CarlaUtils.h
CarlaHostStandalone::logThreadEnabled
bool logThreadEnabled
Definition: CarlaHostImpl.hpp:63
CarlaHostStandalone
Definition: CarlaHostImpl.hpp:54
EngineCallbackFunc
void(* EngineCallbackFunc)(void *ptr, EngineCallbackOpcode action, uint pluginId, int value1, int value2, int value3, float valuef, const char *valueStr)
Definition: CarlaBackend.h:1645