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.

98 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 "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 = CarlaBackend;
  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. #ifndef BUILD_BRIDGE
  50. CarlaString clientNamePrefix;
  51. EngineOptions engineOptions;
  52. CarlaLogThread logThread;
  53. bool logThreadEnabled;
  54. #endif
  55. CarlaString lastError;
  56. CarlaHostStandalone() noexcept
  57. : CarlaHostHandleImpl(),
  58. engineCallback(nullptr),
  59. engineCallbackPtr(nullptr),
  60. fileCallback(nullptr),
  61. fileCallbackPtr(nullptr),
  62. #ifndef BUILD_BRIDGE
  63. clientNamePrefix(),
  64. engineOptions(),
  65. logThread(),
  66. logThreadEnabled(false),
  67. #endif
  68. lastError()
  69. {
  70. isStandalone = true;
  71. }
  72. ~CarlaHostStandalone() noexcept
  73. {
  74. CARLA_SAFE_ASSERT(engine == nullptr);
  75. }
  76. CARLA_PREVENT_HEAP_ALLOCATION
  77. CARLA_DECLARE_NON_COPY_STRUCT(CarlaHostStandalone)
  78. };
  79. // --------------------------------------------------------------------------------------------------------------------
  80. #endif // CARLA_HOST_IMPL_HPP_INCLUDED