Audio plugin host https://kx.studio/carla
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.

51 lines
1.0KB

  1. /***************************************************/
  2. /*! \class Echo
  3. \brief STK echo effect class.
  4. This class implements an echo effect.
  5. by Perry R. Cook and Gary P. Scavone, 1995-2011.
  6. */
  7. /***************************************************/
  8. #include "Echo.h"
  9. #include <iostream>
  10. namespace stk {
  11. Echo :: Echo( unsigned long maximumDelay ) : Effect()
  12. {
  13. this->setMaximumDelay( maximumDelay );
  14. delayLine_.setDelay( length_ >> 1 );
  15. effectMix_ = 0.5;
  16. this->clear();
  17. }
  18. void Echo :: clear( void )
  19. {
  20. delayLine_.clear();
  21. lastFrame_[0] = 0.0;
  22. }
  23. void Echo :: setMaximumDelay( unsigned long delay )
  24. {
  25. if ( delay == 0 ) {
  26. oStream_ << "Echo::setMaximumDelay: parameter cannot be zero!";
  27. handleError( StkError::WARNING ); return;
  28. }
  29. delayLine_.setMaximumDelay( delay );
  30. }
  31. void Echo :: setDelay( unsigned long delay )
  32. {
  33. if ( delay > length_ ) {
  34. oStream_ << "Echo::setDelay: parameter is greater than maximum delay length!";
  35. handleError( StkError::WARNING ); return;
  36. }
  37. delayLine_.setDelay( delay );
  38. }
  39. } // stk namespace