MCPcopy Create free account
hub / github.com/OpenFodder/openfodder / LoopingAudioStream

Class LoopingAudioStream

Source/Amiga/audiostream.hpp:98–130  ·  view source on GitHub ↗

* A looping audio stream. This object does nothing besides using * a RewindableAudioStream to play a stream in a loop. */

Source from the content-addressed store, hash-verified

96 * a RewindableAudioStream to play a stream in a loop.
97 */
98class LoopingAudioStream : public AudioStream {
99public:
100 /**
101 * Creates a looping audio stream object.
102 *
103 * Note that on creation of the LoopingAudioStream object
104 * the underlying stream will be rewound.
105 *
106 * @see makeLoopingAudioStream
107 *
108 * @param stream Stream to loop
109 * @param loops How often to loop (0 = infinite)
110 * @param disposeAfterUse Destroy the stream after the LoopingAudioStream has finished playback.
111 */
112 LoopingAudioStream(RewindableAudioStream *stream, size_t loops);
113
114 int readBuffer(int16 *buffer, const int numSamples);
115 bool endOfData() const;
116 bool endOfStream() const;
117
118 bool isStereo() const { return _parent->isStereo(); }
119 int getRate() const { return _parent->getRate(); }
120
121 /**
122 * Returns number of loops the stream has played.
123 */
124 size_t getCompleteIterations() const { return _completeIterations; }
125private:
126 RewindableAudioStream* _parent;
127
128 size_t _loops;
129 size_t _completeIterations;
130};
131
132/**
133 * Wrapper functionality to efficiently create a stream, which might be looped.

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected