Skip to content

Unreal plugin 4.7.0, reverb crackles if output channel is not 2 #486

@wxfred

Description

@wxfred

System Information
Please provide the following information about your system:

  • Steam Audio version: 4.7.0

  • (If applicable) Unreal Engine version: 5.6

  • Operating System and version: Win11

  • (Optional) CPU architecture (e.g. x86-64, armv7): x86-64

Issue Description
If the output device in Windows is set to 4 channels, the reverb in Steam Audio produces a "hissing" sound. After comparing with the source code of Resonance Audio, I noticed that they handle the reverb submix based on the number of output channels.

void FResonanceAudioReverb::ProcessMixedAudio(const FSoundEffectSubmixInputData& InData, FSoundEffectSubmixOutputData& OutData)
{
	// This is where we trigger Resonance Audio processing.
	if (OutData.NumChannels == 2)
	{
		...
	}
	else if (OutData.NumChannels > 2)
	{
		...
	}
	else if (OutData.NumChannels == 1)
	{
		...
	}
}

I imitated their logic and modified the plugin code for Steam Audio.

void FSteamAudioReverbSubmixPlugin::OnProcessAudio(const FSoundEffectSubmixInputData& InData, FSoundEffectSubmixOutputData& OutData)
{
	...
        if (bHasOutput && HRTF && AmbisonicsDecodeEffect && IndirectBuffer.data && OutBuffer.data)
        {
            ...

            // iplAudioBufferInterleave(Context, &OutBuffer, OutBufferData);

            if (OutData.NumChannels == 1)
            {
                iplAudioBufferDownmix(Context, &OutBuffer, &MonoBuffer);
                FMemory::Memcpy(MonoBuffer.data, OutBufferData, InData.NumFrames * sizeof(float));
            }
            else if (OutData.NumChannels == 2)
            {
                iplAudioBufferInterleave(Context, &OutBuffer, OutBufferData);
            }
            else
            {
                int32 output_offset = 0;
                for (int32 i = 0; i < InData.NumFrames; ++i)
                {
                    OutBufferData[output_offset] = OutBuffer.data[0][i];
                    OutBufferData[output_offset + 1] = OutBuffer.data[1][i];
                    output_offset += OutData.NumChannels;
                }
            }
        }
	}
}

After testing, the hissing sound disappeared, and there were no issues (I only tested with 4 channels).
This is probably a bug, right?

Steps To Reproduce
Steps to reproduce the behavior:
1.Click the bottom right corner of Windows 11.
2.On the right side of the volume slider, click "Select volume output."
3.Click "More volume settings."
4.Go to "Advanced" -> "More sound settings."
5.Click on the currently selected playback device.
6.Click "Configure" in the bottom left corner.
7.Select "Quadraphonic", and keep clicking "Next" to confirm.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions