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.

75 lines
1.3KB

  1. #pragma once
  2. #include <common.hpp>
  3. namespace rack {
  4. namespace history {
  5. struct State;
  6. } // namespace history
  7. namespace engine {
  8. struct Engine;
  9. } // namespace engine
  10. namespace window {
  11. struct Window;
  12. } // namespace window
  13. namespace patch {
  14. struct Manager;
  15. } // namespace patch
  16. namespace widget {
  17. struct EventState;
  18. } // namespace widget
  19. namespace app {
  20. struct Scene;
  21. } // namespace app
  22. namespace midiloopback {
  23. struct Context;
  24. } // namespace midiloopback
  25. /** Rack instance state
  26. */
  27. struct Context {
  28. widget::EventState* event = NULL;
  29. app::Scene* scene = NULL;
  30. engine::Engine* engine = NULL;
  31. window::Window* window = NULL;
  32. history::State* history = NULL;
  33. patch::Manager* patch = NULL;
  34. midiloopback::Context* midiLoopbackContext = NULL;
  35. ~Context();
  36. };
  37. /** Returns the global Context pointer */
  38. Context* contextGet();
  39. /** Sets the context for this thread.
  40. You must set the context when preparing each thread if the code uses the APP macro in that thread.
  41. */
  42. void contextSet(Context* context);
  43. /** Deprecated. Use contextGet() or the APP macro to get the current Context. */
  44. DEPRECATED inline Context* appGet() {
  45. return contextGet();
  46. }
  47. /** Accesses the global Context pointer. Just an alias for contextGet(). */
  48. #define APP rack::contextGet()
  49. } // namespace rack