mirror of
https://github.com/libretro/scummvm.git
synced 2024-12-05 00:36:57 +00:00
- Fix a bug in Channel::pause for recursive pausing.
- Fix bug in Channel:getElapsedTime, when called while the channel is paused. svn-id: r47029
This commit is contained in:
parent
cc87f4a741
commit
50888f5b65
@ -79,15 +79,19 @@ public:
|
||||
void pause(bool paused) {
|
||||
//assert((paused && _pauseLevel >= 0) || (!paused && _pauseLevel));
|
||||
|
||||
if (paused)
|
||||
if (paused) {
|
||||
_pauseLevel++;
|
||||
else if (_pauseLevel > 0)
|
||||
|
||||
if (_pauseLevel == 1)
|
||||
_pauseStartTime = g_system->getMillis();
|
||||
} else if (_pauseLevel > 0) {
|
||||
_pauseLevel--;
|
||||
|
||||
if (_pauseLevel > 0)
|
||||
_pauseStartTime = g_system->getMillis();
|
||||
else
|
||||
_pauseTime += (g_system->getMillis() - _pauseStartTime);
|
||||
if (!_pauseLevel) {
|
||||
_pauseTime = (g_system->getMillis() - _pauseStartTime);
|
||||
_pauseStartTime = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
bool isPaused() {
|
||||
return _pauseLevel != 0;
|
||||
@ -441,7 +445,6 @@ void Channel::mix(int16 *data, uint len) {
|
||||
_samplesConsumed = _samplesDecoded;
|
||||
_mixerTimeStamp = g_system->getMillis();
|
||||
_pauseTime = 0;
|
||||
|
||||
_samplesDecoded += _converter->flow(*_input, data, len, vol_l, vol_r);
|
||||
}
|
||||
}
|
||||
@ -451,7 +454,12 @@ uint32 Channel::getElapsedTime() {
|
||||
return 0;
|
||||
|
||||
const uint32 rate = _mixer->getOutputRate();
|
||||
const uint32 delta = g_system->getMillis() - _mixerTimeStamp - _pauseTime;
|
||||
uint32 delta = 0;
|
||||
|
||||
if (isPaused())
|
||||
delta = _pauseStartTime - _mixerTimeStamp;
|
||||
else
|
||||
delta = g_system->getMillis() - _mixerTimeStamp - _pauseTime;
|
||||
|
||||
// Convert the number of samples into a time duration.
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user