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.

82 lines
3.1KB

  1. /*
  2. ==============================================================================
  3. This file is part of the JUCE library - "Jules' Utility Class Extensions"
  4. Copyright 2004-11 by Raw Material Software Ltd.
  5. ------------------------------------------------------------------------------
  6. JUCE can be redistributed and/or modified under the terms of the GNU General
  7. Public License (Version 2), as published by the Free Software Foundation.
  8. A copy of the license is included in the JUCE distribution, or can be found
  9. online at www.gnu.org/licenses.
  10. JUCE is distributed in the hope that it will be useful, but WITHOUT ANY
  11. WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
  12. A PARTICULAR PURPOSE. See the GNU General Public License for more details.
  13. ------------------------------------------------------------------------------
  14. To release a closed-source product which uses JUCE, commercial licenses are
  15. available: visit www.rawmaterialsoftware.com/juce for more information.
  16. ==============================================================================
  17. */
  18. #ifndef __JUCE_POSITIONABLEAUDIOSOURCE_JUCEHEADER__
  19. #define __JUCE_POSITIONABLEAUDIOSOURCE_JUCEHEADER__
  20. #include "juce_AudioSource.h"
  21. //==============================================================================
  22. /**
  23. A type of AudioSource which can be repositioned.
  24. The basic AudioSource just streams continuously with no idea of a current
  25. time or length, so the PositionableAudioSource is used for a finite stream
  26. that has a current read position.
  27. @see AudioSource, AudioTransportSource
  28. */
  29. class JUCE_API PositionableAudioSource : public AudioSource
  30. {
  31. protected:
  32. //==============================================================================
  33. /** Creates the PositionableAudioSource. */
  34. PositionableAudioSource() noexcept {}
  35. public:
  36. /** Destructor */
  37. ~PositionableAudioSource() {}
  38. //==============================================================================
  39. /** Tells the stream to move to a new position.
  40. Calling this indicates that the next call to AudioSource::getNextAudioBlock()
  41. should return samples from this position.
  42. Note that this may be called on a different thread to getNextAudioBlock(),
  43. so the subclass should make sure it's synchronised.
  44. */
  45. virtual void setNextReadPosition (int64 newPosition) = 0;
  46. /** Returns the position from which the next block will be returned.
  47. @see setNextReadPosition
  48. */
  49. virtual int64 getNextReadPosition() const = 0;
  50. /** Returns the total length of the stream (in samples). */
  51. virtual int64 getTotalLength() const = 0;
  52. /** Returns true if this source is actually playing in a loop. */
  53. virtual bool isLooping() const = 0;
  54. /** Tells the source whether you'd like it to play in a loop. */
  55. virtual void setLooping (bool shouldLoop) { (void) shouldLoop; }
  56. };
  57. #endif // __JUCE_POSITIONABLEAUDIOSOURCE_JUCEHEADER__