OpenShot Library | OpenShotAudio  0.2.1
juce_PositionableAudioSource.h
1 
2 /** @weakgroup juce_audio_basics-sources
3  * @{
4  */
5 /*
6  ==============================================================================
7 
8  This file is part of the JUCE library.
9  Copyright (c) 2017 - ROLI Ltd.
10 
11  JUCE is an open source library subject to commercial or open-source
12  licensing.
13 
14  The code included in this file is provided under the terms of the ISC license
15  http://www.isc.org/downloads/software-support-policy/isc-license. Permission
16  To use, copy, modify, and/or distribute this software for any purpose with or
17  without fee is hereby granted provided that the above copyright notice and
18  this permission notice appear in all copies.
19 
20  JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER
21  EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE
22  DISCLAIMED.
23 
24  ==============================================================================
25 */
26 
27 namespace juce
28 {
29 
30 //==============================================================================
31 /**
32  A type of AudioSource which can be repositioned.
33 
34  The basic AudioSource just streams continuously with no idea of a current
35  time or length, so the PositionableAudioSource is used for a finite stream
36  that has a current read position.
37 
38  @see AudioSource, AudioTransportSource
39 
40  @tags{Audio}
41 */
43 {
44 protected:
45  //==============================================================================
46  /** Creates the PositionableAudioSource. */
47  PositionableAudioSource() = default;
48 
49 public:
50  /** Destructor */
51  ~PositionableAudioSource() override = default;
52 
53  //==============================================================================
54  /** Tells the stream to move to a new position.
55 
56  Calling this indicates that the next call to AudioSource::getNextAudioBlock()
57  should return samples from this position.
58 
59  Note that this may be called on a different thread to getNextAudioBlock(),
60  so the subclass should make sure it's synchronised.
61  */
62  virtual void setNextReadPosition (int64 newPosition) = 0;
63 
64  /** Returns the position from which the next block will be returned.
65 
66  @see setNextReadPosition
67  */
68  virtual int64 getNextReadPosition() const = 0;
69 
70  /** Returns the total length of the stream (in samples). */
71  virtual int64 getTotalLength() const = 0;
72 
73  /** Returns true if this source is actually playing in a loop. */
74  virtual bool isLooping() const = 0;
75 
76  /** Tells the source whether you'd like it to play in a loop. */
77  virtual void setLooping (bool shouldLoop) { ignoreUnused (shouldLoop); }
78 };
79 
80 } // namespace juce
81 
82 /** @}*/
#define JUCE_API
This macro is added to all JUCE public class declarations.
Base class for objects that can produce a continuous stream of audio.
virtual void setLooping(bool shouldLoop)
Tells the source whether you'd like it to play in a loop.
A type of AudioSource which can be repositioned.