SequenceReader.h 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  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 SequenceReader.h
  19. * @ingroup sequence
  20. * The SequenceReader class.
  21. */
  22. #include "IReader.h"
  23. #include "devices/ReadDevice.h"
  24. AUD_NAMESPACE_BEGIN
  25. class SequenceHandle;
  26. class SequenceData;
  27. /**
  28. * This reader plays back sequenced entries.
  29. */
  30. class AUD_API SequenceReader : public IReader
  31. {
  32. private:
  33. /**
  34. * The current position.
  35. */
  36. int m_position;
  37. /**
  38. * The read device used to mix the sounds correctly.
  39. */
  40. ReadDevice m_device;
  41. /**
  42. * Saves the sequence the reader belongs to.
  43. */
  44. std::shared_ptr<SequenceData> m_sequence;
  45. /**
  46. * The list of playback handles for the entries.
  47. */
  48. std::list<std::shared_ptr<SequenceHandle> > m_handles;
  49. /**
  50. * Last status read from the sequence.
  51. */
  52. int m_status;
  53. /**
  54. * Last entry status read from the sequence.
  55. */
  56. int m_entry_status;
  57. // delete copy constructor and operator=
  58. SequenceReader(const SequenceReader&) = delete;
  59. SequenceReader& operator=(const SequenceReader&) = delete;
  60. public:
  61. /**
  62. * Creates a resampling reader.
  63. * \param sequence The sequence data.
  64. * \param quality Whether a high quality resample should be used for resampling.
  65. */
  66. SequenceReader(std::shared_ptr<SequenceData> sequence, bool quality = false);
  67. /**
  68. * Destroys the reader.
  69. */
  70. ~SequenceReader();
  71. virtual bool isSeekable() const;
  72. virtual void seek(int position);
  73. virtual int getLength() const;
  74. virtual int getPosition() const;
  75. virtual Specs getSpecs() const;
  76. virtual void read(int& length, bool& eos, sample_t* buffer);
  77. };
  78. AUD_NAMESPACE_END