Audio plugin host https://kx.studio/carla
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

96 lines
2.6KB

  1. /*
  2. * Carla Plugin Host
  3. * Copyright (C) 2011-2022 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. #ifndef CARLA_HOST_IMPL_HPP_INCLUDED
  18. #define CARLA_HOST_IMPL_HPP_INCLUDED
  19. #include "CarlaHost.h"
  20. #include "CarlaUtils.h"
  21. #include "CarlaEngine.hpp"
  22. #ifdef BUILD_BRIDGE
  23. # include "CarlaString.hpp"
  24. #else
  25. # include "CarlaLogThread.hpp"
  26. #endif
  27. namespace CB = CARLA_BACKEND_NAMESPACE;
  28. using CB::EngineOptions;
  29. // --------------------------------------------------------------------------------------------------------------------
  30. // Shared code, WIP
  31. typedef struct _CarlaHostHandle {
  32. // required pointers
  33. CarlaEngine* engine;
  34. // flags
  35. bool isStandalone : 1;
  36. bool isPlugin : 1;
  37. _CarlaHostHandle() noexcept
  38. : engine(nullptr),
  39. isStandalone(false),
  40. isPlugin(false) {}
  41. } CarlaHostHandleImpl;
  42. // --------------------------------------------------------------------------------------------------------------------
  43. // Single, standalone engine
  44. struct CarlaHostStandalone : CarlaHostHandleImpl {
  45. EngineCallbackFunc engineCallback;
  46. void* engineCallbackPtr;
  47. FileCallbackFunc fileCallback;
  48. void* fileCallbackPtr;
  49. EngineOptions engineOptions;
  50. #ifndef BUILD_BRIDGE
  51. CarlaLogThread logThread;
  52. bool logThreadEnabled;
  53. #endif
  54. CarlaString lastError;
  55. CarlaHostStandalone() noexcept
  56. : CarlaHostHandleImpl(),
  57. engineCallback(nullptr),
  58. engineCallbackPtr(nullptr),
  59. fileCallback(nullptr),
  60. fileCallbackPtr(nullptr),
  61. engineOptions(),
  62. #ifndef BUILD_BRIDGE
  63. logThread(),
  64. logThreadEnabled(false),
  65. #endif
  66. lastError()
  67. {
  68. isStandalone = true;
  69. }
  70. ~CarlaHostStandalone() noexcept
  71. {
  72. CARLA_SAFE_ASSERT(engine == nullptr);
  73. }
  74. CARLA_PREVENT_HEAP_ALLOCATION
  75. CARLA_DECLARE_NON_COPY_STRUCT(CarlaHostStandalone)
  76. };
  77. // --------------------------------------------------------------------------------------------------------------------
  78. #endif // CARLA_HOST_IMPL_HPP_INCLUDED