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
3.3KB

  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 the ISC license
  6. http://www.isc.org/downloads/software-support-policy/isc-license/
  7. Permission to use, copy, modify, and/or distribute this software for any
  8. purpose with or without fee is hereby granted, provided that the above
  9. copyright notice and this permission notice appear in all copies.
  10. THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH REGARD
  11. TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
  12. FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT,
  13. OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
  14. USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
  15. TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
  16. OF THIS SOFTWARE.
  17. -----------------------------------------------------------------------------
  18. To release a closed-source product which uses other parts of JUCE not
  19. licensed under the ISC terms, commercial licenses are available: visit
  20. www.juce.com for more information.
  21. ==============================================================================
  22. */
  23. /** This topology source holds and applies a set of rules for transforming
  24. one device topology into another one that may involve virtual and/or
  25. aggregate devices.
  26. Given an input PhysicalTopologySource and a set of Rule objects, this class
  27. will apply the rules and present the resulting topology to clients.
  28. */
  29. class RuleBasedTopologySource : public TopologySource
  30. {
  31. public:
  32. /** Creates a RuleBasedTopologySource which wraps another TopologySource
  33. passed in here.
  34. */
  35. RuleBasedTopologySource (TopologySource&);
  36. /** Destructor. */
  37. ~RuleBasedTopologySource();
  38. //==========================================================================
  39. /** Returns the currently active topology. */
  40. BlockTopology getCurrentTopology() const;
  41. /** A rule that can transform parts of a topology. */
  42. struct Rule
  43. {
  44. virtual ~Rule() {}
  45. /** Subclasses should implement this method and use it as their opportunity to
  46. examine the given topology and modify it. For example they may want to substitute
  47. one or more blocks for more specialised, aggregated Block objects.
  48. */
  49. virtual void transformTopology (BlockTopology&) = 0;
  50. };
  51. /** Clears the list of active rules.
  52. Calling this method will cause an asynchronous topology update if the new rule-set
  53. results in a change to the topology.
  54. */
  55. void clearRules();
  56. /** Adds a rule to the list that will be applied.
  57. The object passed-in will be owned by this object, so don't keep any references
  58. to it.
  59. Calling this method will cause an asynchronous topology update if the new rule-set
  60. results in a change to the topology.
  61. */
  62. void addRule (Rule*);
  63. private:
  64. //==========================================================================
  65. struct Internal;
  66. juce::ScopedPointer<Internal> internal;
  67. };