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.

79 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. /** This topology source holds and applies a set of rules for transforming
  18. one device topology into another one that may involve virtual and/or
  19. aggregate devices.
  20. Given an input PhysicalTopologySource and a set of Rule objects, this class
  21. will apply the rules and present the resulting topology to clients.
  22. */
  23. class RuleBasedTopologySource : public TopologySource
  24. {
  25. public:
  26. /** Creates a RuleBasedTopologySource which wraps another TopologySource
  27. passed in here.
  28. */
  29. RuleBasedTopologySource (TopologySource&);
  30. /** Destructor. */
  31. ~RuleBasedTopologySource();
  32. //==========================================================================
  33. /** Returns the currently active topology. */
  34. BlockTopology getCurrentTopology() const;
  35. /** A rule that can transform parts of a topology. */
  36. struct Rule
  37. {
  38. virtual ~Rule() {}
  39. /** Subclasses should implement this method and use it as their opportunity to
  40. examine the given topology and modify it. For example they may want to substitute
  41. one or more blocks for more specialised, aggregated Block objects.
  42. */
  43. virtual void transformTopology (BlockTopology&) = 0;
  44. };
  45. /** Clears the list of active rules.
  46. Calling this method will cause an asynchronous topology update if the new rule-set
  47. results in a change to the topology.
  48. */
  49. void clearRules();
  50. /** Adds a rule to the list that will be applied.
  51. The object passed-in will be owned by this object, so don't keep any references
  52. to it.
  53. Calling this method will cause an asynchronous topology update if the new rule-set
  54. results in a change to the topology.
  55. */
  56. void addRule (Rule*);
  57. private:
  58. //==========================================================================
  59. struct Internal;
  60. juce::ScopedPointer<Internal> internal;
  61. };