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.

81 lines
3.1KB

  1. /*
  2. ==============================================================================
  3. This file is part of the JUCE library - "Jules' Utility Class Extensions"
  4. Copyright 2004-11 by Raw Material Software Ltd.
  5. ------------------------------------------------------------------------------
  6. JUCE can be redistributed and/or modified under the terms of the GNU General
  7. Public License (Version 2), as published by the Free Software Foundation.
  8. A copy of the license is included in the JUCE distribution, or can be found
  9. online at www.gnu.org/licenses.
  10. JUCE is distributed in the hope that it will be useful, but WITHOUT ANY
  11. WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
  12. A PARTICULAR PURPOSE. See the GNU General Public License for more details.
  13. ------------------------------------------------------------------------------
  14. To release a closed-source product which uses JUCE, commercial licenses are
  15. available: visit www.rawmaterialsoftware.com/juce for more information.
  16. ==============================================================================
  17. */
  18. #ifndef __JUCE_REVERBAUDIOSOURCE_JUCEHEADER__
  19. #define __JUCE_REVERBAUDIOSOURCE_JUCEHEADER__
  20. #include "juce_AudioSource.h"
  21. #include "../effects/juce_Reverb.h"
  22. //==============================================================================
  23. /**
  24. An AudioSource that uses the Reverb class to apply a reverb to another AudioSource.
  25. @see Reverb
  26. */
  27. class JUCE_API ReverbAudioSource : public AudioSource
  28. {
  29. public:
  30. /** Creates a ReverbAudioSource to process a given input source.
  31. @param inputSource the input source to read from - this must not be null
  32. @param deleteInputWhenDeleted if true, the input source will be deleted when
  33. this object is deleted
  34. */
  35. ReverbAudioSource (AudioSource* inputSource,
  36. bool deleteInputWhenDeleted);
  37. /** Destructor. */
  38. ~ReverbAudioSource();
  39. //==============================================================================
  40. /** Returns the parameters from the reverb. */
  41. const Reverb::Parameters& getParameters() const noexcept { return reverb.getParameters(); }
  42. /** Changes the reverb's parameters. */
  43. void setParameters (const Reverb::Parameters& newParams);
  44. void setBypassed (bool isBypassed) noexcept;
  45. bool isBypassed() const noexcept { return bypass; }
  46. //==============================================================================
  47. void prepareToPlay (int samplesPerBlockExpected, double sampleRate);
  48. void releaseResources();
  49. void getNextAudioBlock (const AudioSourceChannelInfo& bufferToFill);
  50. private:
  51. //==============================================================================
  52. CriticalSection lock;
  53. OptionalScopedPointer<AudioSource> input;
  54. Reverb reverb;
  55. volatile bool bypass;
  56. JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (ReverbAudioSource);
  57. };
  58. #endif // __JUCE_REVERBAUDIOSOURCE_JUCEHEADER__