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.

91 lines
3.4KB

  1. /*
  2. ==============================================================================
  3. This file is part of the JUCE library.
  4. Copyright (c) 2013 - Raw Material Software 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. #include "JuceHeader.h"
  18. #include "InternalFilters.h"
  19. #include "FilterGraph.h"
  20. //==============================================================================
  21. InternalPluginFormat::InternalPluginFormat()
  22. {
  23. {
  24. AudioProcessorGraph::AudioGraphIOProcessor p (AudioProcessorGraph::AudioGraphIOProcessor::audioOutputNode);
  25. p.fillInPluginDescription (audioOutDesc);
  26. }
  27. {
  28. AudioProcessorGraph::AudioGraphIOProcessor p (AudioProcessorGraph::AudioGraphIOProcessor::audioInputNode);
  29. p.fillInPluginDescription (audioInDesc);
  30. }
  31. {
  32. AudioProcessorGraph::AudioGraphIOProcessor p (AudioProcessorGraph::AudioGraphIOProcessor::midiInputNode);
  33. p.fillInPluginDescription (midiInDesc);
  34. }
  35. {
  36. AudioProcessorGraph::AudioGraphIOProcessor p (AudioProcessorGraph::AudioGraphIOProcessor::midiOutputNode);
  37. p.fillInPluginDescription (midiOutDesc);
  38. }
  39. }
  40. AudioPluginInstance* InternalPluginFormat::createInstanceFromDescription (const PluginDescription& desc,
  41. double /*sampleRate*/, int /*blockSize*/)
  42. {
  43. if (desc.name == audioOutDesc.name)
  44. return new AudioProcessorGraph::AudioGraphIOProcessor (AudioProcessorGraph::AudioGraphIOProcessor::audioOutputNode);
  45. if (desc.name == audioInDesc.name)
  46. return new AudioProcessorGraph::AudioGraphIOProcessor (AudioProcessorGraph::AudioGraphIOProcessor::audioInputNode);
  47. if (desc.name == midiInDesc.name)
  48. return new AudioProcessorGraph::AudioGraphIOProcessor (AudioProcessorGraph::AudioGraphIOProcessor::midiInputNode);
  49. if (desc.name == midiOutDesc.name)
  50. return new AudioProcessorGraph::AudioGraphIOProcessor (AudioProcessorGraph::AudioGraphIOProcessor::midiOutputNode);
  51. return 0;
  52. }
  53. const PluginDescription* InternalPluginFormat::getDescriptionFor (const InternalFilterType type)
  54. {
  55. switch (type)
  56. {
  57. case audioInputFilter: return &audioInDesc;
  58. case audioOutputFilter: return &audioOutDesc;
  59. case midiInputFilter: return &midiInDesc;
  60. case midiOutputFilter: return &midiOutDesc;
  61. default: break;
  62. }
  63. return 0;
  64. }
  65. void InternalPluginFormat::getAllTypes (OwnedArray <PluginDescription>& results)
  66. {
  67. for (int i = 0; i < (int) endOfFilterTypes; ++i)
  68. results.add (new PluginDescription (*getDescriptionFor ((InternalFilterType) i)));
  69. }