RemoteControl.h 1.1 KB

1234567891011121314151617181920212223242526272829303132
  1. #pragma once
  2. #include <functional>
  3. #include <memory>
  4. #include <juce_core/juce_core.h>
  5. namespace lynx
  6. {
  7. class AudioEngine;
  8. // Opt-in, vendor-neutral local control. Disabled means no listener or discovery
  9. // file. The engine and callbacks must outlive this object.
  10. class RemoteControl final
  11. {
  12. public:
  13. static std::unique_ptr<RemoteControl> create (AudioEngine&, bool enabled, std::function<juce::String()> projectName,
  14. std::function<juce::String()> projectPath = {});
  15. ~RemoteControl();
  16. bool active() const noexcept;
  17. juce::File discoveryFile() const;
  18. // Round 190np (LYNX --demo, ui/DemoMode.h): more operations, run by `handler` on the message thread like the others
  19. // (view operations of the window: they take no project guards). Listed by api.describe while set. Message thread.
  20. using Extension = std::function<juce::var (const juce::String& op, const juce::var& args)>;
  21. static void setExtension (juce::StringArray operations, Extension handler);
  22. private:
  23. struct Impl;
  24. explicit RemoteControl (std::unique_ptr<Impl>);
  25. std::unique_ptr<Impl> impl;
  26. };
  27. } // namespace lynx