diff options
Diffstat (limited to 'sound/flac.cpp')
-rw-r--r-- | sound/flac.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/sound/flac.cpp b/sound/flac.cpp index bb633b8352..8fc7440ff5 100644 --- a/sound/flac.cpp +++ b/sound/flac.cpp @@ -87,8 +87,6 @@ protected: Common::SeekableReadStream *_inStream; bool _disposeAfterUse; - uint _numLoops; - ::FLAC__SeekableStreamDecoder *_decoder; /** Header of the stream */ @@ -103,6 +101,9 @@ protected: /** total play time */ int32 _totalPlayTime; + uint _numLoops; ///< Number of loops to play + uint _numPlayedLoops; ///< Number of loops which have been played + /** true if the last sample was decoded from the FLAC-API - there might still be data in the buffer */ bool _lastSampleWritten; @@ -146,6 +147,9 @@ public: bool isStreamDecoderReady() const { return getStreamDecoderState() == FLAC__STREAM_DECODER_SEARCH_FOR_FRAME_SYNC ; } + void setNumLoops(uint numLoops = 1) { _numLoops = numLoops; } + uint getNumPlayedLoops() { return _numPlayedLoops; } + protected: uint getChannels() const { return MIN<uint>(_streaminfo.channels, MAX_OUTPUT_CHANNELS); } @@ -193,6 +197,7 @@ FlacInputStream::FlacInputStream(Common::SeekableReadStream *inStream, bool disp _inStream(inStream), _disposeAfterUse(dispose), _numLoops(numLoops), + _numPlayedLoops(0), _firstSample(0), _lastSample(0), _outBuffer(NULL), _requestedSamples(0), _lastSampleWritten(false), _methodConvertBuffers(&FlacInputStream::convertBuffersGeneric) @@ -373,6 +378,7 @@ int FlacInputStream::readBuffer(int16 *buffer, const int numSamples) { if (_lastSampleWritten && _numLoops != 1) { if (_numLoops != 0) _numLoops--; + _numPlayedLoops++; seekAbsolute(_firstSample); state = getStreamDecoderState(); } |