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.

77 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. /** 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. };