Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add sample rate field to AAC decoder #5195

Merged
merged 3 commits into from Apr 22, 2020

Conversation

xperia64
Copy link
Contributor

@xperia64 xperia64 commented Apr 11, 2020

Fixes #4649

When AAC was added to HLE, it was entirely RE'd from how Pokemon X used it.

Rhythm Heaven Megamix uses AAC audio with a different sample rate than Pokemon, and by comparing HLE to LLE, it would appear that field 'unknown2' of the audio pipe BinaryResponse corresponds to a sample rate enum.

These sample rates were determined by adjusting the value of the 'unknown2' field and measuring how much the game sped up or slowed down compared to the base sample rate of the game's audio files.

I have also verified that this does not break the audio in Pokemon X.

This is WIP, because I have only tested this implementation with the FDK and ffmpeg decoders. I have not even tried to compile the MediaNDK or WMF implementations.


This change is Reviewable

src/audio_core/hle/decoder.h Outdated Show resolved Hide resolved
@xperia64
Copy link
Contributor Author

xperia64 commented Apr 12, 2020

This fix appears to work on WMF from the MSVC CI build, so MediaNDK is the only other platform that needs to be tested.

@Dragios
Copy link
Contributor

Dragios commented Apr 15, 2020

@Dragios
Copy link
Contributor

Dragios commented Apr 17, 2020

Music also plays with DSP HLE but it play it at a faster rate resulting in high pitch music.

Fixes Pokémon Rumble World music as well

@B3n30
Copy link
Contributor

B3n30 commented Apr 19, 2020

Is this still WIP?

@xperia64
Copy link
Contributor Author

xperia64 commented Apr 19, 2020

Is this still WIP?

Well I can't test the NDK implementation.

I can confirm that it appears to work with FDK, FFmpeg, and WMF.

@xperia64 xperia64 changed the title [WIP] Add sample rate field to AAC decoder Add sample rate field to AAC decoder Apr 20, 2020
@xperia64
Copy link
Contributor Author

xperia64 commented Apr 20, 2020

Reviewing the code paths, it appears both the NDK and WMF backends retrieve the ADTS data and sample rate in the same way, and seeing as how WMF appear to be working fine, I'm going to call the NDK backend fine as well. If issues come up when Android is released, it can be addressed then.

I would like to merge this PR.

@BreadFish64 BreadFish64 merged commit 38c3c9c into citra-emu:master Apr 22, 2020
1 of 3 checks passed
@xperia64 xperia64 deleted the aac_samplerates branch May 31, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants