Open frranck opened 6 years ago
Finally added $50 to this, it's now a bounty!
https://www.bountysource.com/issues/59020062-libretro-playing-music-doesn-t-work
The reason audio doesnt currently play with the mixer is because the functions for getting the audio and chunk size are not implemented. You will need to use the mixer functions in audio_mixer.c iirc to set up a mixing loop for all music.
Hi @mudlord What do you mean ? linking with https://github.com/libretro/libretro-common/blob/master/audio/audio_mixer.c, doesn't change anything.
You are using the functions from audio_mix.c it seems. Those functions are incomplete.
@mudlord Sorry I have no idea how to do that. Could you please submit a PR for this ? There's a bounty.
@twinaphex this has been done here: https://github.com/Javanaise/mrboom-libretro/pull/41 @DevilFrost can claim this bounty...
OK, sure thing.
Seems it's breaking on ios: http://p.0bl.net/64615
Please test the branch ios.
still fails:
cc -arch armv7 -isysroot /Volumes/T2/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS11.4.sdk -miphoneos-version-min=5.0 -miphoneos-version-min=5.0 -DIOS -O3 -DMRBOOM -DHAVE_IBXM -D_FORTIFY_SOURCE=0 -DPLATFORM=\"Darwin\" -DGIT_VERSION=\"" fdffce4"\" -DLIBRETRO -I./libretro-common/include -I./libretro-common -I./ai -I. -Wall -pedantic -fPIC -std=gnu99 -fPIC -c -o libretro-common/audio/conversion/float_to_s16_neon.o libretro-common/audio/conversion/float_to_s16_neon.c cc -arch armv7 -isysroot /Volumes/T2/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS11.4.sdk -miphoneos-version-min=5.0 -miphoneos-version-min=5.0 -DIOS -O3 -DMRBOOM -DHAVE_IBXM -D_FORTIFY_SOURCE=0 -DPLATFORM=\"Darwin\" -DGIT_VERSION=\"" fdffce4"\" -DLIBRETRO -I./libretro-common/include -I./libretro-common -I./ai -I. -Wall -pedantic -fPIC -std=gnu99 -fPIC -c -o libretro-common/ibxm/ibxm.o libretro-common/ibxm/ibxm.c
Update. Please test.
1 file changed, 3 insertions(+), 3 deletions(-) franck-mac-book-air:mrboom-libretro franck$ make -f Makefile platform=ios -j6 2018-11-24 13:13:23.833 xcodebuild[30831:507120] [MT] PluginLoading: Required plug-in compatibility UUID 426A087B-D3AA-431A-AFDF-F135EC00DE1C for plug-in at path '~/Library/Application Support/Developer/Shared/Xcode/Plug-ins/XCActionBar.xcplugin' not present in DVTPlugInCompatibilityUUIDs 2018-11-24 13:13:23.835 xcodebuild[30831:507120] [MT] PluginLoading: Required plug-in compatibility UUID 426A087B-D3AA-431A-AFDF-F135EC00DE1C for plug-in at path '~/Library/Application Support/Developer/Shared/Xcode/Plug-ins/Alcatraz.xcplugin' not present in DVTPlugInCompatibilityUUIDs cc -arch armv7 -isysroot /Volumes/T2/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS11.4.sdk -miphoneos-version-min=5.0 -c -o libretro-common/audio/resampler/drivers/sinc_resampler_neon.o libretro-common/audio/resampler/drivers/sinc_resampler_neon.S cc -arch armv7 -isysroot /Volumes/T2/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS11.4.sdk -miphoneos-version-min=5.0 -miphoneos-version-min=5.0 -DIOS -O3 -DMRBOOM -DHAVE_IBXM -D_FORTIFY_SOURCE=0 -DPLATFORM=\"Darwin\" -DGIT_VERSION=\"" 0384120"\" -DLIBRETRO -I./libretro-common/include -I./libretro-common -I./ai -I. -Wall -pedantic -fPIC -std=gnu99 -fPIC -c -o libretro-common/audio/conversion/s16_to_float_neon.o libretro-common/audio/conversion/s16_to_float_neon.c cc -arch armv7 -isysroot /Volumes/T2/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS11.4.sdk -miphoneos-version-min=5.0 -miphoneos-version-min=5.0 -DIOS -O3 -DMRBOOM -DHAVE_IBXM -D_FORTIFY_SOURCE=0 -DPLATFORM=\"Darwin\" -DGIT_VERSION=\"" 0384120"\" -DLIBRETRO -I./libretro-common/include -I./libretro-common -I./ai -I. -Wall -pedantic -fPIC -std=gnu99 -fPIC -c -o libretro-common/audio/conversion/float_to_s16_neon.o libretro-common/audio/conversion/float_to_s16_neon.c libretro-common/audio/conversion/s16_to_float_neon.c:30:libretro-common/audio/conversion/float_to_s16_neon.c1::30 :1: warning: warning: extension extensionused used[-Wlanguage-extension-token] [-Wlanguage-extension-token]
asm( ^ asm( ^
There should be no s16_to_float_neon.c and float_to_s16_neon.c
make clean?
yes I did a make clean
^ cc -arch armv7 -isysroot /Volumes/T2/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS11.4.sdk -miphoneos-version-min=5.0 -miphoneos-version-min=5.0 -DIOS -O3 -DMRBOOM -DHAVE_IBXM -D_FORTIFY_SOURCE=0 -DPLATFORM=\"Darwin\" -DGIT_VERSION=\"" 0384120"\" -DLIBRETRO -I./libretro-common/include -I./libretro-common -I./ai -I. -Wall -pedantic -fPIC -std=gnu99 -fPIC -c -o libretro-common/audio/conversion/float_to_s16_neon.o libretro-common/audio/conversion/float_to_s16_neon.c libretro-common/audio/conversion/float_to_s16_neon.c:30:1: warning: extension used [-Wlanguage-extension-token] asm( ^
Already up to date.
$ cat Makefile.common | grep -i neon
SOURCES_ASM := $(LIBRETRO_COMM_DIR)/audio/resampler/drivers/sinc_resampler_neon.S \ $(LIBRETRO_COMM_DIR)/audio/conversion/s16_to_float_neon.S \ $(LIBRETRO_COMM_DIR)/audio/conversion/float_to_s16_neon.S
$ git status On branch ios Your branch is up to date with 'origin/ios'.
nothing to commit, working tree clean
$ git log commit 038412015859bfacbd054002d5f02b7003d608bd (HEAD -> ios, origin/ios) Author: Frost 44336975+DevilFrost@users.noreply.github.com Date: Sat Nov 24 09:01:39 2018 +0000
Update Makefile.common
It seems strange that the old version is used when compiling. I updated the file Makefile.common. Please test.
just tried with 6fd524ab2f1a26f682e93ea906288a391d7f5471 its the same. I also double checked the clean was deleting all .o
you expect SOURCES_ASM not to be compiled?
I think I understand what the problem is.
The compiler compiles .c files instead of .S files.
Please test the branch ios-dont.
@DevilFrost yes ios-dont worked
btw would be cool to have a "no music" option...
btw the SDL2 seems broken in ios-dont
make mrboom LIBSDL2=1
Undefined symbols for architecture x86_64: "_convert_float_to_s16", referenced from: _audio_mix_load_wav_file in audio_mix.o "_convert_s16_to_float", referenced from: _audio_mix_load_wav_file in audio_mix.o "_retro_resampler_realloc", referenced from: _audio_mixer_load_wav in audio_mixer.o _audio_mix_load_wav_file in audio_mix.o "_rwav_free", referenced from: _audio_mixer_load_wav in audio_mixer.o _audio_mix_free_chunk in audio_mix.o "_rwav_load", referenced from: _audio_mixer_load_wav in audio_mixer.o _audio_mix_load_wav_file in audio_mix.o ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation) make: *** [mrboom] Error 1
It is very strange that it breaks the x86_64. I updated the Makefile.
there's two x86_64 versions, a libretro and a SDL2, It's getting a bit confusing (the sdl2 version is currently broken in master too, will fix it), can you please make a PR that fixes the ios version ?
Something strange with the PR. Try to create and see.
There was an issue with the make clean, let me check
Current master still fails, can you make a PR with your latest changes?
I can not.
Why not ?
I can not merge any branch.
Ok I added DONT_WANT_ARM_OPTIMIZATIONS and it compiled on iOS. I noticed one weird thing though: on android there's no music only FX.
It is really strange.
On OS X it's weird also, sometime I run it an there's no music only FX. Sometimes there is both.
Something else: you're not using musics_volume? https://github.com/Javanaise/mrboom-libretro/blob/master/common.cpp#L103 Doesn't every song has a different volume?
musics_volume used with the SDL2. The libretro is not used.
Volume is set here: voice = audio_mixer_play(musics[index], true, 1, NULL);
make mrboom LIBSDL2=1
Works with a gcc for x86_64.
@DevilFrost yes I fixed it
@DevilFrost do you have the random bug where the music is not on? which platform are you using?
@frranck there is no such bug. Debian.
OK I fixed the android issue. There still no music on Nintendo switch though.
Made an interesting discovery. Gamecube music sounds really fast, like 2x Windows builds. And it turns out Windows builds are 2x faster than several standalone MOD players. Which explains why some riffs sound so rushed. Changed libretro rate to 22050 and music tempo now feels more relaxed everywhere. So there's a problem in the ibxm player. :shocked:
edit: Or it's the libretro mixer.
Worth pointing out that the XM player got a small update (2017 -> 2019) https://github.com/martincameron/micromod/tree/master/ibxm-ac
And it correctly puts out wave files that sound okay. So now we analyze what libretro is doing that speeds it up.
That should be I thought that would work being 16-bit stereo but not. I'll keep looking at this.int16_t
. I'll patch upstream libretro-common
and update 2019 mod player.
Finally found the music issue. It was skipping samples. https://github.com/libretro/libretro-common/blob/a810c57f8c4e51659ae776beb25d7bd4a7b86251/audio/audio_mixer.c#L999
It should refill when
if (voice->types.mod.samples == 0)
Will test later if gamecube music is fixed.
Submitted a PR to libretro-common. Windows is fixed. Gamecube sounds better but still has stereo separation + very fast tempo, so might be some ibxm endian problem. I don't know if Emscripten or Switch is changed, but I'll PR over here too after common is merged.
Emscripten is not playing music because frontend Makefile.emscripten needs HAVE_IBXM=1
. I'll PR that too. Is Switch ctr platform?
@SimpleTease what do you mean ctr platform?
seems Switch is erasing the CFLAGS https://github.com/Javanaise/mrboom-libretro/blob/master/Makefile#L221
I tried to load .MOD and .XM in that branch https://github.com/Javanaise/mrboom-libretro/tree/adding_music using ibxm but I'm getting some "audio_mixer_play_mod cannot retrieve duration !" errors.
If I change https://github.com/Javanaise/mrboom-libretro/blob/adding_music/libretro-common/audio/audio_mixer.c#L599 to replay = new_replay( module, 48000, 1 ); // ( module, s_rate, 1); I don't get the error message but still don't get the module played...
PS: If you compile the game by default you'll use the data from retro_data.h If you compile the game with: make LOAD_FROM_FILES=1 You will get the data decrunched and read from files inside a temporary directory