early-access version 2832
This commit is contained in:
parent
18b71d75ce
commit
23cb074b8a
3 changed files with 15 additions and 5 deletions
|
@ -1,7 +1,7 @@
|
||||||
yuzu emulator early access
|
yuzu emulator early access
|
||||||
=============
|
=============
|
||||||
|
|
||||||
This is the source code for early-access 2830.
|
This is the source code for early-access 2832.
|
||||||
|
|
||||||
## Legal Notice
|
## Legal Notice
|
||||||
|
|
||||||
|
|
|
@ -24,7 +24,16 @@ void DeviceSinkCommand::Process(const ADSP::CommandListProcessor& processor) {
|
||||||
constexpr s32 max = std::numeric_limits<s16>::max();
|
constexpr s32 max = std::numeric_limits<s16>::max();
|
||||||
|
|
||||||
auto stream{processor.GetOutputSinkStream()};
|
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{
|
Sink::SinkBuffer out_buffer{
|
||||||
.frames{TargetSampleCount},
|
.frames{TargetSampleCount},
|
||||||
|
@ -33,13 +42,13 @@ void DeviceSinkCommand::Process(const ADSP::CommandListProcessor& processor) {
|
||||||
.consumed{false},
|
.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};
|
const auto offset{inputs[channel] * out_buffer.frames};
|
||||||
|
|
||||||
for (u32 index = 0; index < out_buffer.frames; index++) {
|
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));
|
static_cast<s16>(std::clamp(sample_buffer[offset + index], min, max));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -499,6 +499,7 @@ CubebSink::CubebSink(std::string_view target_device_name) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO: Implement upmixing, not all games will provide 6 channel audio.
|
||||||
cubeb_get_max_channel_count(ctx, &device_channels);
|
cubeb_get_max_channel_count(ctx, &device_channels);
|
||||||
device_channels = std::clamp(device_channels, 2U, 6U);
|
device_channels = std::clamp(device_channels, 2U, 6U);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue