mer-curious Posted February 27, 2022 Share Posted February 27, 2022 Hey Tux! I was trying to create sound associations for the KOF2001 game and then stumbled upon some issues which I think could be fixed or improved. I'll number them below to help us with the discussion on each of them: 1. The "play track" function is broken in the new SDL2 versions. When we select "play track" both the associated track and the sound command are played simultaneously. 2. The loop check-box is no longer functional in the SDL2 versions, neither by pressing the space bar or by clicking in the box with the mouse cursor. 3. It would be useful that when we had the loop check-box marked for a track it also looped in the Raine player so we could preview the looping effect before starting the game. 4. I don't know what the "Test this" option is for. 5. Since the loop feature is broken in the SDL2 versions, I used an SDL1.2 version to create the sound associations for KOF2001. Then when I tried it with the latest Raine version I noticed there is an issue with the loop feature and the track played in the KOF2001 character select screen (file SND01_00041.mp3 from my pack). The loop is applied before the end of the track (maybe 1 or 2 seconds to the end). This produces a noticeable seam effect when the track loops, which doesn't happen in the SDL1.2 version I tested. I suppose this is happening because the track is too short (just 8 seconds)? Anyway, it would sound better if it could loop perfectly in the most recent versions as well as we had in the SDL1.2 ones. 6. There is a bug in a part of the game in which we leave a stage straight to a story demo. Two tracks are played at the same time, which wasn't supposed to happen. The only track that should play in this part is file SND01_00048.mp3 (sound command 37h). Here's a save state right before you enter this cutscene: https://drive.google.com/file/d/1FjLgfoq8zvRf1AEWQbAUrfzq3KjBT2_L/view?usp=sharing 7. I don't know if this is related to the "Sound associations" settings, but if you click on "Manage associations" and then return to the game the colors will be pinkish, take a look: https://drive.google.com/file/d/1Db0Den6qU0ttR_Qt2CJEy2lywwXinadh/view?usp=sharing I guess these are all the issues I've found so far with the sound commands feature. I'm sharing my games.cfg file together with my KOF2001 soundtrack pack to help you reproduce the problems: https://drive.google.com/file/d/15V40Yph1yVsw1crovgIDJ9oKIfdSV84O/view?usp=sharing Thank you so much in advance for your help. PS: In the following post I will report a slowdown issue which I'm experiencing in KOF2001. Link to comment Share on other sites More sharing options...
mer-curious Posted February 27, 2022 Author Share Posted February 27, 2022 So, I'm also experiencing a weird slowdown in the order select screen in KOF2001. The cursor movement becomes very slow when I try to move left or right. I also notice that the animations in the screen as well as the CPU order selection are also affected by this slowdown. For comparison, I went and tried this game with FBNeo and couldn't reproduce this slowdown there. I've made a video of the issue showing in Raine and then comparing it to how FBNeo performs with this game: https://drive.google.com/file/d/1SaypCppv08YnY5WZ5XRjsWO1XB5McJpR/view?usp=sharing I don't if it's possible to see the slowdown, but it's very easy to feel it when trying to move the cursor with a controller or keyboard. When the CPU order is finished, the speed returns to normal. It's not an issue that hinders the game-play though, but maybe it could also affect other moments of the game which I'm yet to realize if I start playing more KOF2001. Anyway, I'm reporting it in case it was an unknown issue. Thank you so much again for your time and attention. Link to comment Share on other sites More sharing options...
Tux Posted February 27, 2022 Share Posted February 27, 2022 Test this is just to test a specific command, displayed in the field just before. Actually it's equivalent to entering a number in the field and just press return, it's tested as a sound command. Useful mainly when trying to understand how the song codes work for a game, it's normally useless for the games you are using, except when you already know a sound effect number and want to play it directly without browsing the others in the top menu. For the rest, I'll look later, I'm having a little break for now... ! 1 Link to comment Share on other sites More sharing options...
Tux Posted February 27, 2022 Share Posted February 27, 2022 (edited) 7 hours ago, mer-curious said: Hey Tux! I was trying to create sound associations for the KOF2001 game and then stumbled upon some issues which I think could be fixed or improved. I'll number them below to help us with the discussion on each of them: 1. The "play track" function is broken in the new SDL2 versions. When we select "play track" both the associated track and the sound command are played simultaneously. I don't have this, only the associated track is played for me. There is a problem about the loop setting though, it plays in loop if there was a sample which was playing in loop when going to this dialog, which is not very reasonable. Tested on the intro song 21h of course, with a short wav sample looping, I hear only the wav file when doing "play track". 7 hours ago, mer-curious said: 2. The loop check-box is no longer functional in the SDL2 versions, neither by pressing the space bar or by clicking in the box with the mouse cursor. Yeah you can't see if the box is checked or not, but it seems to accept a change of setting (the setting is correctly saved in the config file but you don't see it on screen). Yeah I know where it's coming from, it's annoying. 7 hours ago, mer-curious said: 3. It would be useful that when we had the loop check-box marked for a track it also looped in the Raine player so we could preview the looping effect before starting the game. Yeah well for now associate something which loops to the 1st song, 21h, and when the song starts ingame, go to play anything in this dialog, it should loop ! Yeah I know, it's ridiculous... ! 7 hours ago, mer-curious said: 4. I don't know what the "Test this" option is for. Already replied. Its main purpose was to find the sound effects commands actually, starting a song the usual way, then testing what a given command does to it. 7 hours ago, mer-curious said: 5. Since the loop feature is broken in the SDL2 versions, I used an SDL1.2 version to create the sound associations for KOF2001. Then when I tried it with the latest Raine version I noticed there is an issue with the loop feature and the track played in the KOF2001 character select screen (file SND01_00041.mp3 from my pack). The loop is applied before the end of the track (maybe 1 or 2 seconds to the end). This produces a noticeable seam effect when the track loops, which doesn't happen in the SDL1.2 version I tested. I suppose this is happening because the track is too short (just 8 seconds)? Anyway, it would sound better if it could loop perfectly in the most recent versions as well as we had in the SDL1.2 ones. I don't have that, I used a 1.79s wav, and it loops perfectly... After seeing at the end of the post that you posted directly your files : encoding problem apparently, I used 2 players to play the file, mpg123 and mpv and both stop before the end, so if it loops it creates this effect, normal. Maybe switching to cbr (constant bitrate) can work around this, or change the encoder. Actually I don't have any player which can play this file to the end, they all stop before it. 7 hours ago, mer-curious said: 6. There is a bug in a part of the game in which we leave a stage straight to a story demo. Two tracks are played at the same time, which wasn't supposed to happen. The only track that should play in this part is file SND01_00048.mp3 (sound command 37h). Here's a save state right before you enter this cutscene: https://drive.google.com/file/d/1FjLgfoq8zvRf1AEWQbAUrfzq3KjBT2_L/view?usp=sharing Ok, bad news for you, you are by far the one who uses this function the most, and since you didn't test kof2001 thoroughly and neither did I, there remained bugs ! For the little story, like all the last games, its z80 rom is based on garou, but it's an evolution of it, and the 2nd array of offsets was wrong here, I was a little rusty for this stuff so it took me a little while to find something which works everywhere (assuming we don't forget another game). It seems to work now. 7 hours ago, mer-curious said: 7. I don't know if this is related to the "Sound associations" settings, but if you click on "Manage associations" and then return to the game the colors will be pinkish, take a look: https://drive.google.com/file/d/1Db0Den6qU0ttR_Qt2CJEy2lywwXinadh/view?usp=sharing I don't have this, but I don't even have the neogeo music playing for this game, probably a neogeo bios setting. I tried ingame, but it doesn't change colors... Might be windows specific ? Yep, windows specific, I can reproduce it in wine... ! Oh well... switch to linux ? 7 hours ago, mer-curious said: I guess these are all the issues I've found so far with the sound commands feature. I'm sharing my games.cfg file together with my KOF2001 soundtrack pack to help you reproduce the problems: https://drive.google.com/file/d/15V40Yph1yVsw1crovgIDJ9oKIfdSV84O/view?usp=sharing Thank you so much in advance for your help. PS: In the following post I will report a slowdown issue which I'm experiencing in KOF2001. Edited February 27, 2022 by Tux 1 Link to comment Share on other sites More sharing options...
Tux Posted February 27, 2022 Share Posted February 27, 2022 7 hours ago, mer-curious said: So, I'm also experiencing a weird slowdown in the order select screen in KOF2001. The cursor movement becomes very slow when I try to move left or right. I also notice that the animations in the screen as well as the CPU order selection are also affected by this slowdown. For comparison, I went and tried this game with FBNeo and couldn't reproduce this slowdown there. I've made a video of the issue showing in Raine and then comparing it to how FBNeo performs with this game: https://drive.google.com/file/d/1SaypCppv08YnY5WZ5XRjsWO1XB5McJpR/view?usp=sharing I don't if it's possible to see the slowdown, but it's very easy to feel it when trying to move the cursor with a controller or keyboard. When the CPU order is finished, the speed returns to normal. It's not an issue that hinders the game-play though, but maybe it could also affect other moments of the game which I'm yet to realize if I start playing more KOF2001. Anyway, I'm reporting it in case it was an unknown issue. Thank you so much again for your time and attention. I seem to remember you found something very similar in another kof game, and we never found the solution, and there was no over slow-down found. I might try to take a look, but not now... it's the kind of thing where I'll search for a long time, and it's probably not worth it. 1 Link to comment Share on other sites More sharing options...
mer-curious Posted February 28, 2022 Author Share Posted February 28, 2022 (edited) 4 hours ago, Tux said: I don't have this, only the associated track is played for me. There is a problem about the loop setting though, it plays in loop if there was a sample which was playing in loop when going to this dialog, which is not very reasonable. Tested on the intro song 21h of course, with a short wav sample looping, I hear only the wav file when doing "play track". Hey Tux! Thanks for your super fast reply! You are correct, this feature is working fine here. I had the impression it was playing both the sound command and external file because I only tested this with KOF2001 and the new tracks for this game were very poorly arranged due to the SNK's bankruptcy in the beginning of the 2000's, to the point I thought I was listening to the original music files, when it was actually playing the PS2 enhanced ones. I'm sorry for that! 4 hours ago, Tux said: Yeah you can't see if the box is checked or not, but it seems to accept a change of setting (the setting is correctly saved in the config file but you don't see it on screen). Yeah I know where it's coming from, it's annoying. Ok, thanks for the info! It's probably a graphical glitch in the GUI then, right? 4 hours ago, Tux said: Yeah well for now associate something which loops to the 1st song, 21h, and when the song starts ingame, go to play anything in this dialog, it should loop ! Yeah I know, it's ridiculous... ! Ok, this is not a big deal. It's just that being able to preview the looping effect makes the association settings more user-friendly. 4 hours ago, Tux said: Already replied. Its main purpose was to find the sound effects commands actually, starting a song the usual way, then testing what a given command does to it. Thank you for your clarification. I guess now this option makes more sense there. 👍 4 hours ago, Tux said: I don't have that, I used a 1.79s wav, and it loops perfectly... After seeing at the end of the post that you posted directly your files : encoding problem apparently, I used 2 players to play the file, mpg123 and mpv and both stop before the end, so if it loops it creates this effect, normal. Maybe switching to cbr (constant bitrate) can work around this, or change the encoder. Actually I don't have any player which can play this file to the end, they all stop before it. Interesting. Here I can play this track normally until the end in all the players I've tested with it, namely foobar2000, Media Player Classic, VLC, Windows Media Player and Chrome. I used foobar2000 to convert the wav tracks to mp3 using the LAME encoder, which is a very popular mp3 encoder. Also, Raine 0.91.18 plays fine this file without cutting the last second. I've tried to convert the file with LAME encoder again using a constant bit rate profile but it still kept skipping the last part of the track. Then I tried a generic mp3 encoder in VLC and the cut not only persisted but got worse in Raine. Finally, I tried this new converted file in Raine 0.91.18 and there was no cut there. So there seems to be some kind of incompatibility with Raine SDL2 in terms of playing (some) mp3 files integrally? Anyway, converting the tracks using the Ogg Vorbis format works around this issue for the moment with the latest Raine versions. 4 hours ago, Tux said: Ok, bad news for you, you are by far the one who uses this function the most, and since you didn't test kof2001 thoroughly and neither did I, there remained bugs ! For the little story, like all the last games, its z80 rom is based on garou, but it's an evolution of it, and the 2nd array of offsets was wrong here, I was a little rusty for this stuff so it took me a little while to find something which works everywhere (assuming we don't forget another game). It seems to work now. Thank you for this fast fix. 👍 4 hours ago, Tux said: Yep, windows specific, I can reproduce it in wine... ! Oh well... switch to linux ? I'm happy you were able to reproduce it somehow. I could try to switch to Linux eventually, but I suppose it's also good to have this stability parity between different operational systems. 3 hours ago, Tux said: I seem to remember you found something very similar in another kof game, and we never found the solution, and there was no over slow-down found. I might try to take a look, but not now... it's the kind of thing where I'll search for a long time, and it's probably not worth it. Interesting. I don't remember that exactly now. But anyway, I guess fixing this slowdown could benefit other NG games too perhaps? Thank you so much again for your attention and time spent with all this testing. 🙏 Edited February 28, 2022 by mer-curious Link to comment Share on other sites More sharing options...
Tux Posted February 28, 2022 Share Posted February 28, 2022 8 hours ago, mer-curious said: Ok, thanks for the info! It's probably a graphical glitch in the GUI then, right? Sadly no, it's an "update glitch" you could say, with sdl1.2 I could update just tiny regions of what is displayed, now I can't anymore, the whole thing must be redrawn, and it creates problems in this kind of case. 8 hours ago, mer-curious said: Interesting. Here I can play this track normally until the end in all the players I've tested with it, namely foobar2000, Media Player Classic, VLC, Windows Media Player and Chrome. I used foobar2000 to convert the wav tracks to mp3 using the LAME encoder, which is a very popular mp3 encoder. Also, Raine 0.91.18 plays fine this file without cutting the last second. I've tried to convert the file with LAME encoder again using a constant bit rate profile but it still kept skipping the last part of the track. Then I tried a generic mp3 encoder in VLC and the cut not only persisted but got worse in Raine. Finally, I tried this new converted file in Raine 0.91.18 and there was no cut there. So there seems to be some kind of incompatibility with Raine SDL2 in terms of playing (some) mp3 files integrally? Anyway, converting the tracks using the Ogg Vorbis format works around this issue for the moment with the latest Raine versions. My bad, I used audacity to load that, actually the track was playing fine, it's just you don't often hear tracks ending like that, so I confirm there is indeed a problem with the loop setting while using mp3 ! Maybe some other formats. Only way to fix it for now : convert to wav (using audacity for example !), and edit your games.cfg to use the wav version instead of the mp3, it will work flawlessly. Notice that I was stuck at an audacity v2.x, the latest one 3.1.3 has a nice loop button with a tutorial on how to make nice loops, but for this track it seems to loop perfectly without updating it (in wav !). I'll try to fix the mp3 problem later, it's odd we never noticed that earlier though, it's still sdl_sound, I don't think they changed the way they played mp3, so it's probably been there for quite some time... 8 hours ago, mer-curious said: I'm happy you were able to reproduce it somehow. I could try to switch to Linux eventually, but I suppose it's also good to have this stability parity between different operational systems. Yeah no worry, I'll have a look, I don't know yet what it is though. 8 hours ago, mer-curious said: Interesting. I don't remember that exactly now. But anyway, I guess fixing this slowdown could benefit other NG games too perhaps? Yeah yeah but it's not easy usually ! 8 hours ago, mer-curious said: Thank you so much again for your attention and time spent with all this testing. 🙏 1 Link to comment Share on other sites More sharing options...
Tux Posted February 28, 2022 Share Posted February 28, 2022 (edited) The invisible cross in the loop checkboxes was simply a bad handling of its colors, it's because the colors changed their encoding in sdl2, I tried to keep some compatibility with the old ones, but it's the last problem here, I switch to the new colors, so next time you'll run raine, you'll have to use the "revert to" option in the colors menu (from options). The sound which loops badly is specific to the mp3 format, at least for me, I don't have it in wav or ogg format. This has been reported there : https://github.com/icculus/SDL_sound/issues/27 The problem is that the author doesn't seem to react much. So for now the best solution is to use ogg or wav instead of mp3, it's not specific to the vbr contrary to what I thought 1st, it cuts the end even with a plain 128k mp3 ! It's possible the problem doesn't happen in the sdl1.2 version, they changed their sound decoders in sdl2_sound, and might have chosen wrongly the mp3 decoder here. It's fixable since it's open source, but it's not an easy task ! Just checked : it also works correctly with flac, it's really specific to mp3 for me. Ok problem fixed by taking back the old mp3 decoder we had for sdl-1.2, and which used mpg123 (it uses minimp3 here). It works, but it requires to link with libmpg123, which means 1 more dll for windows, yeah !!! Edited February 28, 2022 by Tux 1 Link to comment Share on other sites More sharing options...
Tux Posted February 28, 2022 Share Posted February 28, 2022 And finally found a workaround for your weird colors in game in windows after displaying the sound association dialog : it can't be fixed, because it's totally crazy ! Actually the color you see is the color used by the lines of the cross to indicate a loop is enabled. Here you couldn't even see the lines since their alpha was 0, but the color indexes still counted ! So the only way I could find to work around it is to make sure the last line drawn here is white, this way there is no color applied to the game bitmap and everything is fine ! I am glad it's windows specific, because it doesn't make any sense ! So you'll notice now there is 1 green line and 1 white line for the cross... temporary workaround until someone finds something better ! The fix is in windows only of course, I keep the normal cross otherwise. I think that's the end of the fixes for your problems, I had a quick look at the slowdown in the game menu, and no idea for now ! 1 Link to comment Share on other sites More sharing options...
mer-curious Posted March 1, 2022 Author Share Posted March 1, 2022 (edited) 16 hours ago, Tux said: The problem is that the author doesn't seem to react much. So for now the best solution is to use ogg or wav instead of mp3, it's not specific to the vbr contrary to what I thought 1st, it cuts the end even with a plain 128k mp3 ! It's possible the problem doesn't happen in the sdl1.2 version, they changed their sound decoders in sdl2_sound, and might have chosen wrongly the mp3 decoder here. It's fixable since it's open source, but it's not an easy task ! Just checked : it also works correctly with flac, it's really specific to mp3 for me. Ok problem fixed by taking back the old mp3 decoder we had for sdl-1.2, and which used mpg123 (it uses minimp3 here). It works, but it requires to link with libmpg123, which means 1 more dll for windows, yeah !!! Hey Tux! I'm really glad you could detect the problem and fix it. It's a pity they haven't fixed that yet in the source but hopefully they will sooner or later and then you could return to new SDL2 decoder again. I guess I hadn't noticed this bug in the latest releases because most of the associated tracks I use come from official releases such as soundtrack albums or NGCD games, and they generally have silence added to the end of each track. But I took the KOF2001 tracks from the PS2 release of the game using a program to extract sound files from the ISO image, so that's why they are unedited once the effects such as fade out or loop are applied on the fly by the game code itself. 9 hours ago, Tux said: And finally found a workaround for your weird colors in game in windows after displaying the sound association dialog : it can't be fixed, because it's totally crazy ! Actually the color you see is the color used by the lines of the cross to indicate a loop is enabled. Here you couldn't even see the lines since their alpha was 0, but the color indexes still counted ! So the only way I could find to work around it is to make sure the last line drawn here is white, this way there is no color applied to the game bitmap and everything is fine ! I am glad it's windows specific, because it doesn't make any sense ! So you'll notice now there is 1 green line and 1 white line for the cross... temporary workaround until someone finds something better ! The fix is in windows only of course, I keep the normal cross otherwise. What a crazy bug indeed! But fortunately you found a way to work it around. Thanks for that! 9 hours ago, Tux said: I think that's the end of the fixes for your problems, I had a quick look at the slowdown in the game menu, and no idea for now ! Just out of curiosity I tried the KOF2001 PS2 release in the PCSX2 emulator and I also have some frame drops in this screen there. So maybe this part is really CPU intensive for some reason or it was not correctly programmed by the game creators, which also happened with Metal Slug 2 (plagued with slowdowns) and then fixed in Metal Slug X. But then FBNeo doesn't show this slowdown in this screen, so it seems there is really something going on here... 🤔 Anyway, thank you so much for your work in this great set of fixes and improvements! Edited March 1, 2022 by mer-curious Link to comment Share on other sites More sharing options...
Tux Posted March 1, 2022 Share Posted March 1, 2022 Well it does a lot of rom bank switches while on this screen, a few / frame, which is a little weird, I wonder what it needs to fetch while on a selection screen, but anyway the bank switches are just emulated by a pointer which changes, it's extremely fast, and you can see that with the profiler %, they remain low. I thought maybe some kind of weird input which is checked, but it's neogeo, meaning all the games use the same inputs normally (cartridges !). So for now no idea... For the fix for sdl_sound, I just reverted to the decoder used in the 1.2 version, which worked well, so it means you wouldn't have this bug in the 1.2 version. I think it's quite unlikely to see that fixed, the author seems to have mostly abandoned the project, plus the bug is not in sdl_sound itself, it's in the decoder he chose, which is too experimental. It was convenient though, very small and very fast, so can be merged without needing an external lib, libmpg123 which I use now is huge in comparison ! Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now