hrydgard / ppsspp

A PSP emulator for Android, Windows, Mac and Linux, written in C++. Want to contribute? Join us on Discord at https://discord.gg/5NJB6dD or just send pull requests / issues. For discussion use the forums at forums.ppsspp.org.
https://www.ppsspp.org
Other
11.01k stars 2.15k forks source link

Audio problem (Kaitou Apricot) #15233

Open glitchengineer opened 2 years ago

glitchengineer commented 2 years ago

Game or games this happens in

Kaitou Apricot (ULJM05276)

What area of the game / PPSSPP

A single audio track (Track 14 - Smile Brightly) plays around 8 seconds before cutting off, while all the other tracks play normally. This happens in both cutscenes and the music player in the game.

What should happen

I've tested the game on an actual psp and it plays normally on it.

Logs

The Log Console had these pop up when the track stopped:

49:30:300 ATRAC3 play E[ME]: HLE\sceAtrac.cpp:600 avcodec_decode_audio4: Error decoding audio -1094995529 / bebbb1b7 49:30:300 ATRAC3 play E[ME]: HLE\sceAtrac.cpp:1527 UNIMPL sceAtracGetInternalErrorInfo(0, 09efea20)

Platform

Windows

Mobile phone model or graphics card

NVIDIA GeForce GTX 1070

PPSSPP version affected

v1.12.3

Last working version

No response

Graphics backend (3D API)

OpenGL / GLES

Checklist

Panderner commented 2 years ago

@glitchengineer can you record the audio?

glitchengineer commented 2 years ago

@Panderner

Sure. The sound in the beginning is just a sound effect from choosing the song.

ULJM05276_2021-12-13_22-20-14.zip

sum2012 commented 2 years ago

ppsspp-v1.13.1-347-g6cc8ca517 log: https://gist.githubusercontent.com/sum2012/5f8261e0ccba21cdfbf346e75846d565/raw/7246a1cf0748a5dfb0b206d732b6bb96f17d3678/gistfile1.txt

A small note:jpcsp emulator (version b7e383b) play the song no problem. Can we ignore the error for the "I[ME]: HW\MediaEngine.cpp:87 FF: Invalid gain location: ch=1, sb=5, pos=1, val=0" for atrac->remainFrames == 0 ? Or just this game ?

sum2012 commented 2 years ago

JPCSPTrace (Real PSP log): https://gist.github.com/sum2012/114745df24936c15abf81e7e8a356720 01:05.994 ATRAC3 play thread - sceAtracDecodeData 0x0, 0x88F5D6C, 0x09EF9A2C(0x800), 0x09EF9A28(0x0), 0x09EF9A24(0x0) = 0x0 NOTE: sample number is 0x800,finish flag 0,remainframe flag 0

unknownbrackets commented 2 years ago

https://github.com/FFmpeg/FFmpeg/blob/2d764069be3b4092dc986467660607d922023332/libavcodec/atrac3plus.c#L1241

If you play the atrac3+ file in an audio player or ffplay or similar, does it log this error? I think the question is - is this an error in the file, or is it a problem in when the buffer data is being read?

-[Unknown]

sum2012 commented 2 years ago

ffplay now required add "SDL_AUDIODRIVER" ,"directsound " ,in "Environment Variables" https://stackoverflow.com/questions/46835811/ffplay-wasapi-cant-initialize-audio-client-ffmpeg-3-4-binaries Anyway ,it play the atrac3+ file no error\no warning 1

unknownbrackets commented 2 years ago

Then it's probably one of these cases:

I haven't really dug into Atrac in a while, but I remember originally it was all built to try to reconstruct the file in a copy in memory, which was very incorrect and error prone. I think for some buffer types we still do that, rather than using the game RAM directly. I suspect that's the most likely cause.

-[Unknown]

sum2012 commented 2 years ago

Just a note:The game's atrac->bufferState_ = ATRAC_STATUS_STREAMED_LOOP_FROM_END

sum2012 commented 10 months ago

I get a work around of this game but need pull request 18392 merged first

glitchengineer commented 10 months ago

That's great to hear! Thanks for creating a workaround for it.

sum2012 commented 10 months ago

You can test the windows 64 bit build in https://github.com/hrydgard/ppsspp/actions/runs/6761291714#artifacts