Use cached offset
All checks were successful
eden-license / license-header (pull_request) Successful in 21s
All checks were successful
eden-license / license-header (pull_request) Successful in 21s
This commit is contained in:
parent
e9ff13fe34
commit
8b48f5cf29
1 changed files with 13 additions and 7 deletions
|
@ -36,14 +36,20 @@ void DeviceSinkCommand::Process(const AudioRenderer::CommandListProcessor& proce
|
||||||
.consumed{false},
|
.consumed{false},
|
||||||
};
|
};
|
||||||
|
|
||||||
std::array<s16, TargetSampleCount * MaxChannels> samples{};
|
static bool initialized = false;
|
||||||
for (u32 channel = 0; channel < input_count; channel++) {
|
static std::array<s32, MaxChannels> cached_offsets{};
|
||||||
//const auto offset{inputs[channel] * out_buffer.frames};
|
if (!initialized) {
|
||||||
const auto offset{channel * out_buffer.frames};
|
for (u32 channel = 0; channel < input_count; channel++) {
|
||||||
|
cached_offsets[channel] = static_cast<s16>(inputs[channel] * out_buffer.frames);
|
||||||
|
}
|
||||||
|
initialized = true;
|
||||||
|
}
|
||||||
|
|
||||||
for (u32 index = 0; index < out_buffer.frames; index++) {
|
std::array<s16, TargetSampleCount * MaxChannels> samples{};
|
||||||
samples[index * input_count + channel] =
|
for (u32 channel = 0; channel < input_count; ++channel) {
|
||||||
static_cast<s16>(std::clamp(sample_buffer[offset + index], min, max));
|
const s32 offset = cached_offsets[channel];
|
||||||
|
for (u32 index = 0; index < out_buffer.frames; ++index) {
|
||||||
|
samples[index * input_count + channel] = static_cast<s16>(std::clamp(sample_buffer[offset + index], min, max));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue