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.

95 lines
2.6KB

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