mirror of
https://github.com/libretro/scummvm.git
synced 2025-03-05 01:38:36 +00:00
TITANIC: Properly flag audio buffer as finished when song is done
This commit is contained in:
parent
55947e8ae8
commit
23a6533c95
@ -44,7 +44,7 @@ private:
|
||||
* Leave a critical section
|
||||
*/
|
||||
void leaveCriticalSection();
|
||||
public:
|
||||
private:
|
||||
bool _finished;
|
||||
public:
|
||||
CAudioBuffer(int maxSize);
|
||||
@ -74,6 +74,11 @@ public:
|
||||
*/
|
||||
bool full() const { return _data.full(); }
|
||||
|
||||
/**
|
||||
* Returns true if the audio buffering is finished
|
||||
*/
|
||||
bool isFinished() const { return _finished && empty(); }
|
||||
|
||||
/**
|
||||
* Adds a value to the buffer
|
||||
*/
|
||||
@ -93,6 +98,11 @@ public:
|
||||
* Reads out a specified number of samples
|
||||
*/
|
||||
int read(int16 *values, int count);
|
||||
|
||||
/**
|
||||
* Marks the buffer as finishing, and that no more new data will arrive
|
||||
*/
|
||||
void finalize() { _finished = true; }
|
||||
};
|
||||
|
||||
} // End of namespace Titanic
|
||||
|
@ -232,6 +232,10 @@ void CMusicRoomHandler::updateAudio() {
|
||||
_audioBuffer->push(audioData, size);
|
||||
delete[] audioData;
|
||||
}
|
||||
|
||||
if (_instrumentsActive == 0)
|
||||
// Reaching end of music
|
||||
_audioBuffer->finalize();
|
||||
}
|
||||
|
||||
void CMusicRoomHandler::updateInstruments() {
|
||||
|
@ -52,7 +52,7 @@ int AudioBufferStream::readBuffer(int16 *buffer, const int numSamples) {
|
||||
}
|
||||
|
||||
bool AudioBufferStream::endOfData() const {
|
||||
return _audioBuffer->_finished;
|
||||
return _audioBuffer->isFinished();
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------------------*/
|
||||
|
Loading…
x
Reference in New Issue
Block a user