early-access version 2832

This commit is contained in:
pineappleEA
2022-07-14 00:15:38 +02:00
parent 18b71d75ce
commit 23cb074b8a
3 changed files with 15 additions and 5 deletions

View File

@@ -24,7 +24,16 @@ void DeviceSinkCommand::Process(const ADSP::CommandListProcessor& processor) {
constexpr s32 max = std::numeric_limits<s16>::max();
auto stream{processor.GetOutputSinkStream()};
const auto num_channels{stream->GetDeviceChannels()};
const auto num_out_channels{stream->GetDeviceChannels()};
auto system_channels{6U};
for (u32 i = 0; i < inputs.size(); i++) {
if (inputs[i] == 0) {
system_channels = i;
break;
}
}
const auto num_in_channels{std::min(system_channels, stream->GetDeviceChannels())};
Sink::SinkBuffer out_buffer{
.frames{TargetSampleCount},
@@ -33,13 +42,13 @@ void DeviceSinkCommand::Process(const ADSP::CommandListProcessor& processor) {
.consumed{false},
};
std::vector<s16> samples(out_buffer.frames * num_channels);
std::vector<s16> samples(out_buffer.frames * num_out_channels, 0);
for (u32 channel = 0; channel < num_channels; channel++) {
for (u32 channel = 0; channel < num_in_channels; channel++) {
const auto offset{inputs[channel] * out_buffer.frames};
for (u32 index = 0; index < out_buffer.frames; index++) {
samples[index * num_channels + channel] =
samples[index * num_out_channels + channel] =
static_cast<s16>(std::clamp(sample_buffer[offset + index], min, max));
}
}