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.

52 lines
1.1KB

  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--2017.
  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. length_ = delay;
  30. delayLine_.setMaximumDelay( delay );
  31. }
  32. void Echo :: setDelay( unsigned long delay )
  33. {
  34. if ( delay > length_ ) {
  35. oStream_ << "Echo::setDelay: parameter is greater than maximum delay length!";
  36. handleError( StkError::WARNING ); return;
  37. }
  38. delayLine_.setDelay( delay );
  39. }
  40. } // stk namespace