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.

83 lines
2.8KB

  1. /*
  2. ==============================================================================
  3. This file is part of the JUCE library.
  4. Copyright (c) 2017 - ROLI Ltd.
  5. JUCE is an open source library subject to commercial or open-source
  6. licensing.
  7. The code included in this file is provided under the terms of the ISC license
  8. http://www.isc.org/downloads/software-support-policy/isc-license. Permission
  9. To use, copy, modify, and/or distribute this software for any purpose with or
  10. without fee is hereby granted provided that the above copyright notice and
  11. this permission notice appear in all copies.
  12. JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER
  13. EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE
  14. DISCLAIMED.
  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. };