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.

83 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. #ifndef JUCE_REVERBAUDIOSOURCE_H_INCLUDED
  24. #define JUCE_REVERBAUDIOSOURCE_H_INCLUDED
  25. //==============================================================================
  26. /**
  27. An AudioSource that uses the Reverb class to apply a reverb to another AudioSource.
  28. @see Reverb
  29. */
  30. class JUCE_API ReverbAudioSource : public AudioSource
  31. {
  32. public:
  33. /** Creates a ReverbAudioSource to process a given input source.
  34. @param inputSource the input source to read from - this must not be null
  35. @param deleteInputWhenDeleted if true, the input source will be deleted when
  36. this object is deleted
  37. */
  38. ReverbAudioSource (AudioSource* inputSource,
  39. bool deleteInputWhenDeleted);
  40. /** Destructor. */
  41. ~ReverbAudioSource();
  42. //==============================================================================
  43. /** Returns the parameters from the reverb. */
  44. const Reverb::Parameters& getParameters() const noexcept { return reverb.getParameters(); }
  45. /** Changes the reverb's parameters. */
  46. void setParameters (const Reverb::Parameters& newParams);
  47. void setBypassed (bool isBypassed) noexcept;
  48. bool isBypassed() const noexcept { return bypass; }
  49. //==============================================================================
  50. void prepareToPlay (int samplesPerBlockExpected, double sampleRate) override;
  51. void releaseResources() override;
  52. void getNextAudioBlock (const AudioSourceChannelInfo&) override;
  53. private:
  54. //==============================================================================
  55. CriticalSection lock;
  56. OptionalScopedPointer<AudioSource> input;
  57. Reverb reverb;
  58. volatile bool bypass;
  59. JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (ReverbAudioSource)
  60. };
  61. #endif // JUCE_REVERBAUDIOSOURCE_H_INCLUDED