forked from mia/Aegisub
Improve audio loading progress reporting
Even without the animation the reported progress was an average of 1.5 blocks behind the actual progress, and with the animation it was two blocks behind. Assuming constant-speed audio decoding it should now be nearly accurate (it still ignores that the last block may be smaller than the rest).
This commit is contained in:
parent
932747e70a
commit
07ad40dd3f
1 changed files with 1 additions and 1 deletions
|
@ -70,9 +70,9 @@ void RAMAudioProvider::FillCache(AudioProvider *source, agi::ProgressSink *ps) {
|
|||
|
||||
int64_t readsize = CacheBlockSize / source->GetBytesPerSample();
|
||||
for (size_t i = 0; i < blockcache.size(); i++) {
|
||||
ps->SetProgress(i + 1, blockcache.size());
|
||||
source->GetAudio(&blockcache[i][0], i * readsize, std::min<int64_t>(readsize, num_samples - i * readsize));
|
||||
|
||||
ps->SetProgress(i, blockcache.size() - 1);
|
||||
if (ps->IsCancelled()) {
|
||||
return;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue