diff options
author | Max Horn | 2008-01-05 20:40:27 +0000 |
---|---|---|
committer | Max Horn | 2008-01-05 20:40:27 +0000 |
commit | 2c8910ade855c1bee56026ba7ad2f40bedc88803 (patch) | |
tree | a14db2829e25d898d8881691d4679756c620f3e3 /sound | |
parent | 89da803724467f94aa0973d867ed25b5e3bdf228 (diff) | |
download | scummvm-rg350-2c8910ade855c1bee56026ba7ad2f40bedc88803.tar.gz scummvm-rg350-2c8910ade855c1bee56026ba7ad2f40bedc88803.tar.bz2 scummvm-rg350-2c8910ade855c1bee56026ba7ad2f40bedc88803.zip |
This 'if' should not be necessary anymore
svn-id: r30254
Diffstat (limited to 'sound')
-rw-r--r-- | sound/flac.cpp | 62 |
1 files changed, 30 insertions, 32 deletions
diff --git a/sound/flac.cpp b/sound/flac.cpp index 103d222589..e9d00650d0 100644 --- a/sound/flac.cpp +++ b/sound/flac.cpp @@ -331,44 +331,42 @@ int FlacInputStream::readBuffer(int16 *buffer, const int numSamples) { bool decoderOk = true; - if (!_lastSampleWritten) { - FLAC__StreamDecoderState state = getStreamDecoderState(); - - // Keep poking FLAC to process more samples until we completely satisfied the request - // respectively until we run out of data. - while (!_lastSampleWritten && _requestedSamples > 0 && state == FLAC__STREAM_DECODER_SEARCH_FOR_FRAME_SYNC) { - assert(_sampleCache.bufFill == 0); - assert(_requestedSamples % numChannels == 0); - processSingleBlock(); - state = getStreamDecoderState(); - - if (state == FLAC__STREAM_DECODER_END_OF_STREAM) { - _lastSampleWritten = true; - } + FLAC__StreamDecoderState state = getStreamDecoderState(); - // If we reached the end of the stream, and looping is enabled: Try to rewind - if (_lastSampleWritten && _numLoops != 1) { - if (_numLoops != 0) - _numLoops--; - seekAbsolute(_firstSample); - state = getStreamDecoderState(); - } + // Keep poking FLAC to process more samples until we completely satisfied the request + // respectively until we run out of data. + while (!_lastSampleWritten && _requestedSamples > 0 && state == FLAC__STREAM_DECODER_SEARCH_FOR_FRAME_SYNC) { + assert(_sampleCache.bufFill == 0); + assert(_requestedSamples % numChannels == 0); + processSingleBlock(); + state = getStreamDecoderState(); + + if (state == FLAC__STREAM_DECODER_END_OF_STREAM) { + _lastSampleWritten = true; } - // Error handling - switch (state) { - case FLAC__STREAM_DECODER_END_OF_STREAM: - _lastSampleWritten = true; - break; - case FLAC__STREAM_DECODER_SEARCH_FOR_FRAME_SYNC: - break; - default: - decoderOk = false; - warning("FlacInputStream: An error occured while decoding. DecoderState is: %s", - FLAC__StreamDecoderStateString[getStreamDecoderState()]); + // If we reached the end of the stream, and looping is enabled: Try to rewind + if (_lastSampleWritten && _numLoops != 1) { + if (_numLoops != 0) + _numLoops--; + seekAbsolute(_firstSample); + state = getStreamDecoderState(); } } + // Error handling + switch (state) { + case FLAC__STREAM_DECODER_END_OF_STREAM: + _lastSampleWritten = true; + break; + case FLAC__STREAM_DECODER_SEARCH_FOR_FRAME_SYNC: + break; + default: + decoderOk = false; + warning("FlacInputStream: An error occured while decoding. DecoderState is: %s", + FLAC__StreamDecoderStateString[getStreamDecoderState()]); + } + // Compute how many samples we actually produced const int samples = (int)(_outBuffer - buffer); assert(samples % numChannels == 0); |