Open rockaddicted opened 6 years ago
Well, the correct setting is indeed 48k, you'll have issues with audio on some games if you are not using this (see http://neosource.1emulation.com/forums/index.php?topic=2487.msg22799#msg22799 and following posts). I'm aware it causes issues in some linux distro, but i don't know why. It seems very unlikely the fba core would be the culprit about this issue, since fba standalone is mainly distributed as a x86_32 executable with 48k samplerate. It definitely seems like a buggy audio implementation on distro's side since it only affects some 32 bits distro.
And yes i had some plan on making it a core option, but i totally forgot. I'll take a look this week-end.
Something came to mind, could you try building with the "FASTCALL=1" parameter ? That's a setting specific to x86_32, i know fbalpha standalone is built with it, perhaps the fact it is disabled for cross-platform compatibility in lr-fbalpha is what is causing this issue.
Hi @barbudreadmon
I tried quickly this morning, but I had build errors once this parameter enabled.
I'll check later.
Thank you.
In file included from src/cpu/m68k/m68k.h:384:0,
from src/cpu/m68k/m68kcpu.h:29,
from src/cpu/m68k/m68kcpu.c:41:
src/cpu/m68k/m68kconf.h:226:25: erreur: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘M68KFetchByte’
unsigned int __fastcall M68KFetchByte(unsigned int a);
^
src/cpu/m68k/m68kconf.h:227:25: erreur: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘M68KFetchWord’
unsigned int __fastcall M68KFetchWord(unsigned int a);
^
src/cpu/m68k/m68kconf.h:228:25: erreur: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘M68KFetchLong’
unsigned int __fastcall M68KFetchLong(unsigned int a);
^
src/cpu/m68k/m68kconf.h:243:25: erreur: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘M68KReadByte’
unsigned int __fastcall M68KReadByte(unsigned int a);
^
src/cpu/m68k/m68kconf.h:244:25: erreur: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘M68KReadWord’
unsigned int __fastcall M68KReadWord(unsigned int a);
^
src/cpu/m68k/m68kconf.h:245:25: erreur: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘M68KReadLong’
unsigned int __fastcall M68KReadLong(unsigned int a);
^
src/cpu/m68k/m68kconf.h:247:17: erreur: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘M68KWriteByte’
void __fastcall M68KWriteByte(unsigned int a, unsigned int d);
^
src/cpu/m68k/m68kconf.h:248:17: erreur: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘M68KWriteWord’
void __fastcall M68KWriteWord(unsigned int a, unsigned int d);
^
src/cpu/m68k/m68kconf.h:249:17: erreur: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘M68KWriteLong’
void __fastcall M68KWriteLong(unsigned int a, unsigned int d);
^
In file included from src/cpu/m68k/m68kcpu.c:41:0:
src/cpu/m68k/m68kcpu.h: In function ‘m68ki_read_imm_16’:
src/cpu/m68k/m68kcpu.h:1077:3: attention : implicit declaration of function ‘M68KFetchWord’ [-Wimplicit-function-declaration]
CPU_PREF_DATA = m68k_read_immediate_16(ADDRESS_68K(CPU_PREF_ADDR));
^
src/cpu/m68k/m68kcpu.h: In function ‘m68ki_read_8_fc’:
src/cpu/m68k/m68kcpu.h:1135:2: attention : implicit declaration of function ‘M68KReadByte’ [-Wimplicit-function-declaration]
return m68k_read_memory_8(ADDRESS_68K(address));
^
src/cpu/m68k/m68kcpu.h: In function ‘m68ki_read_16_fc’:
src/cpu/m68k/m68kcpu.h:1141:2: attention : implicit declaration of function ‘M68KReadWord’ [-Wimplicit-function-declaration]
return m68k_read_memory_16(ADDRESS_68K(address));
^
src/cpu/m68k/m68kcpu.h: In function ‘m68ki_read_32_fc’:
src/cpu/m68k/m68kcpu.h:1147:2: attention : implicit declaration of function ‘M68KReadLong’ [-Wimplicit-function-declaration]
return m68k_read_memory_32(ADDRESS_68K(address));
^
src/cpu/m68k/m68kcpu.h: In function ‘m68ki_write_8_fc’:
src/cpu/m68k/m68kcpu.h:1153:2: attention : implicit declaration of function ‘M68KWriteByte’ [-Wimplicit-function-declaration]
m68k_write_memory_8(ADDRESS_68K(address), value);
^
src/cpu/m68k/m68kcpu.h: In function ‘m68ki_write_16_fc’:
src/cpu/m68k/m68kcpu.h:1159:2: attention : implicit declaration of function ‘M68KWriteWord’ [-Wimplicit-function-declaration]
m68k_write_memory_16(ADDRESS_68K(address), value);
^
src/cpu/m68k/m68kcpu.h: In function ‘m68ki_write_32_fc’:
src/cpu/m68k/m68kcpu.h:1165:2: attention : implicit declaration of function ‘M68KWriteLong’ [-Wimplicit-function-declaration]
m68k_write_memory_32(ADDRESS_68K(address), value);
^
src/cpu/m68k/m68kcpu.h: In function ‘OPER_PCDI_8’:
src/cpu/m68k/m68kcpu.h:1353:1: attention : implicit declaration of function ‘M68KFetchByte’ [-Wimplicit-function-declaration]
INLINE uint OPER_PCDI_8(void) {uint ea = EA_PCDI_8(); return m68ki_read_pcrel_8(ea); }
^
src/cpu/m68k/m68kcpu.h: In function ‘OPER_PCDI_32’:
src/cpu/m68k/m68kcpu.h:1355:1: attention : implicit declaration of function ‘M68KFetchLong’ [-Wimplicit-function-declaration]
INLINE uint OPER_PCDI_32(void) {uint ea = EA_PCDI_32(); return m68ki_read_pcrel_32(ea);}
^
makefile.libretro:389 : la recette pour la cible « src/cpu/m68k/m68kcpu.o » a échouée
make[2]: *** [src/cpu/m68k/m68kcpu.o] Erreur 1
make[2]: *** Attente des tâches non terminées....
In file included from src/cpu/m68k/m68k.h:384:0,
from src/cpu/m68k/m68kcpu.h:29,
from src/cpu/m68k/m68kops.c:1:
src/cpu/m68k/m68kconf.h:226:25: erreur: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘M68KFetchByte’
unsigned int __fastcall M68KFetchByte(unsigned int a);
^
src/cpu/m68k/m68kconf.h:227:25: erreur: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘M68KFetchWord’
unsigned int __fastcall M68KFetchWord(unsigned int a);
^
src/cpu/m68k/m68kconf.h:228:25: erreur: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘M68KFetchLong’
unsigned int __fastcall M68KFetchLong(unsigned int a);
^
src/cpu/m68k/m68kconf.h:243:25: erreur: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘M68KReadByte’
unsigned int __fastcall M68KReadByte(unsigned int a);
^
src/cpu/m68k/m68kconf.h:244:25: erreur: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘M68KReadWord’
unsigned int __fastcall M68KReadWord(unsigned int a);
^
src/cpu/m68k/m68kconf.h:245:25: erreur: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘M68KReadLong’
unsigned int __fastcall M68KReadLong(unsigned int a);
^
src/cpu/m68k/m68kconf.h:247:17: erreur: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘M68KWriteByte’
void __fastcall M68KWriteByte(unsigned int a, unsigned int d);
^
src/cpu/m68k/m68kconf.h:248:17: erreur: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘M68KWriteWord’
void __fastcall M68KWriteWord(unsigned int a, unsigned int d);
^
src/cpu/m68k/m68kconf.h:249:17: erreur: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘M68KWriteLong’
void __fastcall M68KWriteLong(unsigned int a, unsigned int d);
^
In file included from src/cpu/m68k/m68kops.c:1:0:
src/cpu/m68k/m68kcpu.h: In function ‘m68ki_read_imm_16’:
src/cpu/m68k/m68kcpu.h:1077:3: attention : implicit declaration of function ‘M68KFetchWord’ [-Wimplicit-function-declaration]
CPU_PREF_DATA = m68k_read_immediate_16(ADDRESS_68K(CPU_PREF_ADDR));
^
src/cpu/m68k/m68kcpu.h: In function ‘m68ki_read_8_fc’:
src/cpu/m68k/m68kcpu.h:1135:2: attention : implicit declaration of function ‘M68KReadByte’ [-Wimplicit-function-declaration]
return m68k_read_memory_8(ADDRESS_68K(address));
^
src/cpu/m68k/m68kcpu.h: In function ‘m68ki_read_16_fc’:
src/cpu/m68k/m68kcpu.h:1141:2: attention : implicit declaration of function ‘M68KReadWord’ [-Wimplicit-function-declaration]
return m68k_read_memory_16(ADDRESS_68K(address));
^
src/cpu/m68k/m68kcpu.h: In function ‘m68ki_read_32_fc’:
src/cpu/m68k/m68kcpu.h:1147:2: attention : implicit declaration of function ‘M68KReadLong’ [-Wimplicit-function-declaration]
return m68k_read_memory_32(ADDRESS_68K(address));
^
src/cpu/m68k/m68kcpu.h: In function ‘m68ki_write_8_fc’:
src/cpu/m68k/m68kcpu.h:1153:2: attention : implicit declaration of function ‘M68KWriteByte’ [-Wimplicit-function-declaration]
m68k_write_memory_8(ADDRESS_68K(address), value);
^
src/cpu/m68k/m68kcpu.h: In function ‘m68ki_write_16_fc’:
src/cpu/m68k/m68kcpu.h:1159:2: attention : implicit declaration of function ‘M68KWriteWord’ [-Wimplicit-function-declaration]
m68k_write_memory_16(ADDRESS_68K(address), value);
^
src/cpu/m68k/m68kcpu.h: In function ‘m68ki_write_32_fc’:
src/cpu/m68k/m68kcpu.h:1165:2: attention : implicit declaration of function ‘M68KWriteLong’ [-Wimplicit-function-declaration]
m68k_write_memory_32(ADDRESS_68K(address), value);
^
src/cpu/m68k/m68kcpu.h: In function ‘OPER_PCDI_8’:
src/cpu/m68k/m68kcpu.h:1353:1: attention : implicit declaration of function ‘M68KFetchByte’ [-Wimplicit-function-declaration]
INLINE uint OPER_PCDI_8(void) {uint ea = EA_PCDI_8(); return m68ki_read_pcrel_8(ea); }
^
src/cpu/m68k/m68kcpu.h: In function ‘OPER_PCDI_32’:
src/cpu/m68k/m68kcpu.h:1355:1: attention : implicit declaration of function ‘M68KFetchLong’ [-Wimplicit-function-declaration]
INLINE uint OPER_PCDI_32(void) {uint ea = EA_PCDI_32(); return m68ki_read_pcrel_32(ea);}
^
makefile.libretro:389 : la recette pour la cible « src/cpu/m68k/m68kops.o » a échouée
make[2]: *** [src/cpu/m68k/m68kops.o] Erreur 1
Could you try again with my last commit ? It seems the fastcall convention in gcc is different from msvc
Tried, and I have the same build errors.
Yeah, i didn't know those macros had duplicates, try again it should be ok now.
Ok so now it is building well with FASTCALL enabled. But that didn't solve the problem. Started a metal slug, and always this dirty noise during game.
Well, you should probably keep it anyway, this is supposed to have a good impact on speed with x86_32 (see https://en.wikipedia.org/wiki/X86_calling_conventions). x86_64 and arm don't need that, gcc is making the right choice at build time for those arch.
Sorry, nothing else comes to mind at the moment.
haha no problem, if you have any other idea, tell me I'll try. and thank you about the "fastcall" advice, I'll add it in my buildroot package.
do you know if the standalone FBA have the same issue on linux 32bits ?
Do you mean through wine ? I never tried it
While working on #163 , i refactored a few things with audio, perhaps it would be worth checking if it didn't solve this one.
Hello, sorry for delay. I will test that tomorrow.
@barbudreadmon so, found time to test the new master branch, are the sound problem is still present :-/
So, while working on #163, i ended up noticing weird issues with the z80 sound core, so i'm wondering, is this issue affecting all games or only the games using this sound core ? Games from the cps3 driver (which is not using this sound core) are affected ? Also, i ended up refactoring the sound buffer again, and introducing a hotfix for karnovr, does this issue still happens ? And more specifically does it still happen with karnovr if it was happening before with neogeo games?
I don't know if you checked the last commits, there were a few changes to the audio system in lr-fbalpha, but something else came to mind, what's your value for CONFIG_SND_HDA_PREALLOC_SIZE in your linux kernel ? If it's the default 64, i highly recommend to change it to 2048.
Hello and thank you for your feedback.
About the kernel config, I checked and indeed we are using the default 64
value.
I'll give it a try the next days, with a CPS3 game, 2048
value and I'll comment this issue once done.
Thank you.
Also, i tried creating audio settings core options. Sadly, at the moment, you have to totally leave retroarch when you set the samplerate (it seems retroarch crash if i call "retro_audio_sample_batch_t" again, but i need to call it again since the samplerate define the size of the audio buffer and segment length). Perhaps @twinaphex @fr500 could tell me more about this.
Edit : nevermind, it seems i also need to call BurnDrvExit/BurnDrvInit to change the samplerate in fba, so i don't think it will be possible to change samplerate without fully leaving the core anyway.
@barbudreadmon So I tested the current master branch and good news the problem is partially solved. As you suggested, only Z80 games seems to have a problem now. I tested a few games :
Games that are OK now, are not with the core included in last recalbox's version. I have sound issues.
I'll bump it soon.
Good job and thank you.
Hmmm there were a lot of commits affecting sound in the past month, telling me which commit exactly solved the issue with after burner 2, 1945 III, street fighter 3 and alien storm would help a lot with debugging the remaining ones.
ok I'll bisect and tell you which commit solved this sound issue
@rockaddicted i replied to someone having this issue on recalbox's forum, any news from the bissect ? Also, did you try the kernel parameter i mentioned ?
@barbudreadmon hello, sorry but I'm really irl busy for the moment... I didn't have time to bissect and find which commit solved the sound issue... I'll try to find free time in the next days.
About kernel parameter I tried with a neogeo game (a metal slug) and that didn't fix the problem.
@barbudreadmon Hi, I'm opening this issue because on Recalbox X86 build I have this problem: https://github.com/libretro/RetroArch/issues/4359 Indeed switching
AUDIO_SAMPLERATE
from48000
to32000
solve this issue. But I would like to know if you have an idea of the root cause of this problem system's side ? Why only 32bits version is impacted ?Did you plan to make the settings available as core option ?
Thank you.