diff --git a/README.md b/README.md index abe026c02..815ce8532 100755 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ yuzu emulator early access ============= -This is the source code for early-access 2830. +This is the source code for early-access 2832. ## Legal Notice diff --git a/src/audio_core/renderer/command/sink/device.cpp b/src/audio_core/renderer/command/sink/device.cpp index 056c38cfa..d7018cdfd 100755 --- a/src/audio_core/renderer/command/sink/device.cpp +++ b/src/audio_core/renderer/command/sink/device.cpp @@ -24,7 +24,16 @@ void DeviceSinkCommand::Process(const ADSP::CommandListProcessor& processor) { constexpr s32 max = std::numeric_limits::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 samples(out_buffer.frames * num_channels); + std::vector 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(std::clamp(sample_buffer[offset + index], min, max)); } } diff --git a/src/audio_core/sink/cubeb_sink.cpp b/src/audio_core/sink/cubeb_sink.cpp index 7486d726e..d80d1ed21 100755 --- a/src/audio_core/sink/cubeb_sink.cpp +++ b/src/audio_core/sink/cubeb_sink.cpp @@ -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); device_channels = std::clamp(device_channels, 2U, 6U); }