Fix HDD audio cache provider when channels > 1
This commit is contained in:
parent
819d90e9b0
commit
b3b4b96238
1 changed files with 2 additions and 2 deletions
|
@ -38,7 +38,7 @@ class HDAudioProvider final : public AudioProviderWrapper {
|
|||
void FillBuffer(void *buf, int64_t start, int64_t count) const override {
|
||||
auto missing = std::min(count, start + count - decoded_samples);
|
||||
if (missing > 0) {
|
||||
memset(static_cast<int16_t*>(buf) + count - missing, 0, missing * bytes_per_sample);
|
||||
memset(static_cast<int16_t*>(buf) + count - missing, 0, missing * bytes_per_sample * channels);
|
||||
count -= missing;
|
||||
}
|
||||
|
||||
|
@ -69,7 +69,7 @@ public:
|
|||
for (int64_t i = 0; i < num_samples; i += block) {
|
||||
if (cancelled) break;
|
||||
block = std::min(block, num_samples - i);
|
||||
source->GetAudio(file.write(i * bytes_per_sample, block * bytes_per_sample), i, block);
|
||||
source->GetAudio(file.write(i * bytes_per_sample * channels, block * bytes_per_sample * channels), i, block);
|
||||
decoded_samples += block;
|
||||
}
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue