DelayReader.h 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. /*******************************************************************************
  2. * Copyright 2009-2016 Jörg Müller
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. ******************************************************************************/
  16. #pragma once
  17. /**
  18. * @file DelayReader.h
  19. * @ingroup fx
  20. * The DelayReader class.
  21. */
  22. #include "fx/EffectReader.h"
  23. AUD_NAMESPACE_BEGIN
  24. /**
  25. * This class reads another reader and delays it.
  26. */
  27. class AUD_API DelayReader : public EffectReader
  28. {
  29. private:
  30. /**
  31. * The delay level.
  32. */
  33. const int m_delay;
  34. /**
  35. * The remaining delay for playback.
  36. */
  37. int m_remdelay;
  38. // delete copy constructor and operator=
  39. DelayReader(const DelayReader&) = delete;
  40. DelayReader& operator=(const DelayReader&) = delete;
  41. public:
  42. /**
  43. * Creates a new delay reader.
  44. * \param reader The reader to read from.
  45. * \param delay The delay in seconds.
  46. */
  47. DelayReader(std::shared_ptr<IReader> reader, float delay);
  48. virtual void seek(int position);
  49. virtual int getLength() const;
  50. virtual int getPosition() const;
  51. virtual void read(int& length, bool& eos, sample_t* buffer);
  52. };
  53. AUD_NAMESPACE_END