finalburnneo / FBNeo

FinalBurn Neo - We are Team FBNeo.
http://neo-source.com
Other
926 stars 362 forks source link

PS3 fbneo samples sound rushing #191

Closed angomania closed 4 years ago

angomania commented 4 years ago

I´m using Retroarch and the fbneo core. All fbneo games working fine.

But games who need samples like zaxxon or dkong have only a loud sound rushing. The samples are in the right folder (system/fbneo/samples/*.zip). I´m using the same samples from my PC retroarch and fbneo core. There are no problems with the samples.

barbudreadmon commented 4 years ago

Since this is on PS3, it's probably some kind of big endian issue. Maybe @dinkc64 can help with this, however he is quite busy atm so don't expect a fix anytime soon.

dinkc64 commented 4 years ago

angomania, I'll try to figure out what is wrong and post back here.

barbudreadmon, IMO pivotal classic games like that need to be working right, though. for everyone:)

dinkc64 commented 4 years ago

@angomania, I just checked in a test-fix for the sample soundcore on big endian systems, please give it a try (when the update is available) and please let me know if it fixes the problem. Sometimes these things can be difficult and take 1-3 tries :) Thanks for your bug report - they're always appreciated!

best regards, -dink

angomania commented 4 years ago

Thank you very much @dinkc64 :) I will give the next update a try and report back.

barbudreadmon commented 4 years ago

I will give the next update a try and report back.

The new version should be available right now.

angomania commented 4 years ago

I will give the next update a try and report back.

The new version should be available right now.

Yes, I saw the changes. Unfortunately I have no programing skills. So I have to wait for a new PS3 core on xbins.org bevore I can test it

barbudreadmon commented 4 years ago

a new PS3 core on xbins.org

Yeah, as i said it should already be available

angomania commented 4 years ago

I´ve Tested the updated core. Problem still exists.

dinkc64 commented 4 years ago

Thanks for testing, endian issues are usually quite insidious and hard to get right on the first time.

I'll have another go at it today and let you know!

best regards,

ghost commented 4 years ago

@dinkc64 just a quick question does your rom/sampling loading routines take machine endian into account when loading roms/samples. If so it could be that msb or lsb flag isint being defined correctly in the makefile. As im not familiar with your code base.

Just to show you what i mean from the mame source of 2003 here is what im talking about.

ifdef MSB_FIRST

define mame_fread_msbfirst mame_fread

define mame_fwrite_msbfirst mame_fwrite

define mame_fread_lsbfirst mame_fread_swap

define mame_fwrite_lsbfirst mame_fwrite_swap

else

define mame_fread_msbfirst mame_fread_swap

define mame_fwrite_msbfirst mame_fwrite_swap

define mame_fread_lsbfirst mame_fread

define mame_fwrite_lsbfirst mame_fwrite

endif

dinkc64 commented 4 years ago

angomania, can you try updating the core again? I can't locate any other endian issues in the sample playback core. I just wonder if the fix and the core on the xbins site crossed paths or something.
also can you get me the logfile (if possible?)? This might help me locate the problem.

best regards,

angomania commented 4 years ago

Ok, tested again. Same error. However, I noticed that the last core is the same as the one before. I think I have to wait until the new core is online. I'll try again later.

I´ve uploaded the logfile here.

Btw I´ve tested the game and sample with core mame_2003 without problems. The samples were loaded successfully. For a better understanding I´ve made a little video of the problem.

barbudreadmon commented 4 years ago

@angomania there was no new fix, dink only wanted to double check that you were using the latest version. Can you do some kind of recording ? Maybe seeing what happens exactly will help figuring out the issue.

@grant2258 i confirm ps3 is built as a big endian target in fbneo

dinkc64 commented 4 years ago

angomania, thank you for the log and video, I will certainly give it another go tonight :) also is it possible you can post(attach) the zaxxon samples file, so I can check it against mine?

best regards,

ghost commented 4 years ago

One thing I did notice in your logs is your sample names are showing up with odd characters in the debug lines 41 - 52

dinkc64 commented 4 years ago

grant, that's alright - the bad names are due to a clash between dbcs (unicode) vs. regular 8bit characters.

ghost commented 4 years ago

apparently fbneo will run in the ps3 emulator for testing. I guess you would need an official sdk to build it though if you wanted to make changes.

dinkc64 commented 4 years ago

I didn't have time to check into this further, but will hopefully soon!

ghost commented 4 years ago

@barbudreadmon sorry i wasnt real clear on this.What i mean is the code here.

https://github.com/finalburnneo/FBNeo/blob/bddf08ddc30af4ddcc0084c84ac6e7b498c07ee7/src/burn/burnint.h#L19-L34

that was what i was referring too for the mame 095 i was working on I set it this way

include

if __BYTE_ORDER == ORDER_LITTLE_ENDIAN__

define LSB_FIRST 1

else

define MSB_FIRST 1

endif

typedef union {

ifdef MSB_FIRST

struct { UINT8 h3,h2,h,l; } b;
struct { UINT16 h,l; } w;

else

struct { UINT8 l,h,h2,h3; } b;
struct { UINT16 l,h; } w;

endif

UINT32 d;

} PAIR;

I know the code is there it could be right im not the best with makefiles like i said before

https://github.com/libretro/FBNeo/blob/de0820247067e7fc9fad6cadc55bca1495aba244/src/burner/libretro/Makefile#L199

should that be reading

else ifeq (,$(filter $(platform), ps3 sncps3 psl1ght))

apologizes if the logic is right

barbudreadmon commented 4 years ago

@grant2258 the code is defered to burn_endian.h, which is a port specific file, in the case of the libretro port it is located at https://github.com/libretro/FBNeo/blob/master/src/burner/libretro/burn_endian.h

I can't guarantee the BURN_ENDIAN_SWAP_* macros are right for ps3, but i think it was originally written by @CaptainCPS, an old fbalpha contributor and owner of ps3, he probably tested those. The only thing i can confirm is that the nintendo ones, which are really similar, are ok (a bunch of big endian issues were solved for wii/wiiu owners in the past).

dinkc64 commented 4 years ago

@angomania, I just committed another test-fix for this problem, please give it a try when you can :) best regards,

angomania commented 4 years ago

@dinkc64 ... as soon as there is an update on xbin :)

barbudreadmon commented 4 years ago

as soon as there is an update on xbin

The update has been there for 2 days already.

angomania commented 4 years ago

@barbudreadmon ...hmm, I´m looking since 2 days on xbin but there is no update. I´ve compared the "fbneo_libretro_ps3.SELF" from my installed version with the one from xbin, but they are the same. (only the date of the file changes on xbin)

barbudreadmon commented 4 years ago

Actually it's more like 3 days. I don't understand the part where you say you "compared" but only the date changed. Can you just update/reinstall/whatever & check that the new version is bf6c36b88d1340ffbe6c5ee0c9e4ac1b6cd09782 as expected ?

angomania commented 4 years ago

I compared the installed core (fbneo_libretro_ps3.SELF more like 8 days old) with the new one from Xbin with TotalCommander (File compare) and I don't see any difference, the files are identical. Only the the time stamp from the Xbin core is different. I think the xbin repo is not up to date.

I am sorry if I am not understood correctly. My English is not very good.

dinkc64 commented 4 years ago

angomania, maybe xbins fbneo core not up-to-date? :(

barbudreadmon commented 4 years ago

@angomania Tell me what version you currently have (bottom left corner of RA menu). I want the full string of the version, should be something like "FinalBurn Neo (v0.2.97.44 blahblah)", the blahblah part is especially important. Then force a reinstall, and tell me again the exact version.

angomania commented 4 years ago

@barbudreadmon Ok, I tested a lot today.

Did a clean install on my PS3 with the officially package from retroarch and I found other abnormalities with the FBNeo core.

I´ve updated the core manually, latest version is v0.2.97.44 d454549 , the problem with external Wav files still exists.

Tested also the latest PS3 package from XBins. FBNeo core version is v0.2.97.44 d454549. Unfortunately this version has no online update function, but there are the same problems with the fbneo core.

barbudreadmon commented 4 years ago

latest version is v0.2.97.44 d454549

This version is from mid november, which means @dinkc64 's first attempt at fixing this is not even included. We'll have to revert second attempt at fixing this, and find out why the core isn't rebuilt.

In the manin menu there are a lot of "Load Core *****" entrys.

That's normal, fbneo uses RA's subsystems to emulate various consoles & computers.

Also the entry "Core Updater" is missing

It's below the "Load Core *****" entries for me

dinkc64 commented 4 years ago

barbudreadmon is right, I'll revert the second fix - I'm quite confident that the first fix will do the trick. now does anyone know why the ps3 core isn't being built? :)

barbudreadmon commented 4 years ago

@angomania I'm trying to get to the bottom of this, however it seems those ps3 builds aren't managed by the libretro team, so it might take some time before i get in touch with the people managing this buildbot. I'll let you know when i learn something.

angomania commented 4 years ago

In the manin menu there are a lot of "Load Core *****" entrys.

That's normal, fbneo uses RA's subsystems to emulate various consoles & computers.

... ok that makes sense, sorry :)

Also the entry "Core Updater" is missing

It's below the "Load Core *****" entries for me

I checked again. On the PC it´s below "Load Core *****", but the entry is missing on the PS3.

angomania commented 4 years ago

... accidentally closed, sorry

angomania commented 4 years ago

I read in the forum that there are problems with the new PS3 retroarch 1.8.2 version: "Something seems to have happened with the people that usually provide those builds. We haven’t spoken to them about it yet, but unless/until they get something going for it, users will need to compile it themselves."

I don't have programming skills ... could someone build the latest PS3 fbneo core for testing, please?

barbudreadmon commented 4 years ago

could someone build the latest PS3 fbneo core for testing, please?

Not gonna happen, sorry, i don't own the software, i don't even know how to legally acquire it, and afaik it's really pricy (several thousands of dollars), which is why the libretro team doesn't provide those binaries.

dinkc64 commented 4 years ago

I work on the windows version, and have no idea how to compile it for PS3, sorry about that!

angomania commented 4 years ago

@barbudreadmon good news :) I´ve visited Xbins and was surprised there was a PS3 update. Retroarch 1.8.2 and the nightlys are up to date. I´ve tested the FBNeo Core v0.2.97.44 6514055 and voila, samples are working fine.

The only thing I had to change in the core options, was to set the sample rate from 4800 to 4100, otherwise the samples sound distorted.

barbudreadmon commented 4 years ago

was to set the sample rate from 48000 to 44100

Yes, i heard the samples must match the samplerate, i think pack for different samplerates can be found on the web, the ones you are using are probably for 44100.

Anyway, thanks for the heads-up, i'll close !

dinkc64 commented 4 years ago

Hey this is great news :) @angomania can you please make a video/recording of how the samples sound when set the rate to 48000 ? our samplecore should automatically upscale or downscale to the correct rate, and the distortion makes me think something might be wrong here still.

thanks and best regards,

angomania commented 4 years ago

@dinkc64 here is a sample. I took it with my handy about 3 meters away from the tv. The first one is sample rate 44100 the second one is sample rate 48000.

Wavefile: test.zip

barbudreadmon commented 4 years ago

our samplecore should automatically upscale or downscale to the correct rate

Indeed it does, i can't remember where i heard about the matching samplerate stuff, it might have been about MAME actually.

dinkc64 commented 4 years ago

angomania, thanks :)

barbudreadmon commented 4 years ago

@dinkc64 Well, actually it doesn't seem fixed to me, using same samples on x86_64 & ps3, zaxxon seemed ok at 44100, applying the clipping fix from neocd (i.e storing to a short before clipping) even seemed to help with the conversion. However, in the case of dkong, whatever samplerate i used (my samples for this one are 11025hz btw), the result was totally different from x86_64, i have distorted/missing sound and "blank" sound isn't that blank

barbudreadmon commented 4 years ago

It turns out i had the wrong idea about dkong, there might be a problem indeed with samples, which seems somehow fixed (it breaks zaxxon though...) by replacing the cast with (INT16) at https://github.com/finalburnneo/FBNeo/blob/66108ebeccb191f2c02a32bab4a15eb2bbf7e171/src/burn/snd/samples.cpp#L151-L152

But there is also a separate issue with dac !

Edit : i think the proper fix for samples.cpp upsampling is

INT16 temp_l = BURN_ENDIAN_SWAP_INT16(poin[prev_offs * channels + 0             ]);
INT16 temp_r = BURN_ENDIAN_SWAP_INT16(poin[prev_offs * channels + (channels / 2)]);
buffer_l[3] = (INT32)temp_l;
buffer_r[3] = (INT32)temp_r;
barbudreadmon commented 4 years ago

dkong and zaxxon now sound perfect on big-endian, closing !

dinkc64 commented 4 years ago

woohoo, finally! :)