Skip to content

Conversation

@Masusder
Copy link

FADPCM decoder based on vgmstream implementation - I've added necessary vgmstream notice but wasn't sure where I should put it so feel free to change it however it suits you.

I've tried to optimize it the best I could. Tested on soundbanks from Rennsport, Dragon Khan Demo.

I hope you're still active @SamboyCoding and can review this :(

Masusder and others added 2 commits January 12, 2026 20:44
Co-Authored-By: LongerWarrior <37636768+longerwarrior@users.noreply.github.com>

int outIndex = frameBaseOutIndex + ((i * 32 + j * 8 + k) * numChannels);

if (outIndex < outputSpan.Length)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this ever not true?

internal static sbyte GetLowNibbleSigned(byte value) => SignedNibbles[value & 0xF];
internal static short Clamp(short val, short min, short max) => Math.Max(Math.Min(val, max), min);

[MethodImpl(MethodImplOptions.AggressiveInlining)]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The .NET runtime team recommends you never do this unless you benchmark to verify that it actually improves performance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants