The JUCE cross-platform C++ framework, with DISTRHO/KXStudio specific changes
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.

85 lines
2.8KB

  1. /*
  2. ==============================================================================
  3. This file is part of the JUCE library.
  4. Copyright (c) 2016 - ROLI Ltd.
  5. Permission is granted to use this software under the terms of either:
  6. a) the GPL v2 (or any later version)
  7. b) the Affero GPL v3
  8. Details of these licenses can be found at: www.gnu.org/licenses
  9. JUCE is distributed in the hope that it will be useful, but WITHOUT ANY
  10. WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
  11. A PARTICULAR PURPOSE. See the GNU General Public License for more details.
  12. ------------------------------------------------------------------------------
  13. To release a closed-source product which uses JUCE, commercial licenses are
  14. available: visit www.juce.com for more information.
  15. ==============================================================================
  16. */
  17. /**
  18. This topology source manages the topology of the physical Blocks devices
  19. that are currently connected. It maintains a list of them and tells
  20. listeners when physical devices are added or removed.
  21. */
  22. class PhysicalTopologySource : public TopologySource
  23. {
  24. public:
  25. /** Constructor. */
  26. PhysicalTopologySource();
  27. /** Destructor. */
  28. ~PhysicalTopologySource();
  29. /** Returns the current physical topology. */
  30. BlockTopology getCurrentTopology() const override;
  31. /** Reset all touches */
  32. void cancelAllActiveTouches() noexcept override;
  33. //==========================================================================
  34. /** For custom transport systems, this represents a connected device */
  35. struct DeviceConnection
  36. {
  37. DeviceConnection();
  38. virtual ~DeviceConnection();
  39. virtual bool sendMessageToDevice (const void* data, size_t dataSize) = 0;
  40. std::function<void (const void* data, size_t dataSize)> handleMessageFromDevice;
  41. };
  42. /** For custom transport systems, this represents a connected device */
  43. struct DeviceDetector
  44. {
  45. DeviceDetector();
  46. virtual ~DeviceDetector();
  47. virtual juce::StringArray scanForDevices() = 0;
  48. virtual DeviceConnection* openDevice (int index) = 0;
  49. };
  50. /** Constructor for custom transport systems. */
  51. PhysicalTopologySource (DeviceDetector& detectorToUse);
  52. static const char* const* getStandardLittleFootFunctions() noexcept;
  53. protected:
  54. virtual bool hasOwnServiceTimer() const;
  55. virtual void handleTimerTick();
  56. private:
  57. //==========================================================================
  58. struct Internal;
  59. struct DetectorHolder;
  60. juce::ScopedPointer<DetectorHolder> detector;
  61. JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (PhysicalTopologySource)
  62. };