New XGM driver !
Moderator: Stef
So xgmtool crashes when converting: https://dl.dropboxusercontent.com/u/101 ... jae_eb.vgm
This VGM has a ton of samples in it in the old 1.5x style format.
The crash occurs due to a crazy Hz calculation from a dvision by zero around vgm.c line 591. For some reason, endPlayWait is zero. I'm not entirely clear on the logic for the program yet, but it appears that at line 550, the isPCM check is failing which leads endPlayWait to never be updated.
This VGM has a ton of samples in it in the old 1.5x style format.
The crash occurs due to a crazy Hz calculation from a dvision by zero around vgm.c line 591. For some reason, endPlayWait is zero. I'm not entirely clear on the logic for the program yet, but it appears that at line 550, the isPCM check is failing which leads endPlayWait to never be updated.
-
- Very interested
- Posts: 3131
- Joined: Thu Nov 30, 2006 9:46 pm
- Location: France - Sevres
- Contact:
I posted a new version of XGMTool on the SVN :
https://sgdk.googlecode.com/svn/trunk/bin/xgmtool.exe
It should fix some problems !
https://sgdk.googlecode.com/svn/trunk/bin/xgmtool.exe
It should fix some problems !
Cool, that certainly fixes the crash on tjae_eb.vgm file. However, the resulting xgm does not seem to play correctly, it's like some of the samples are missing.
Also, here is another VGM to try converting: https://dl.dropboxusercontent.com/u/101 ... bhb_s1.vgm
In this case, the conversion seems to get into an endless loop.
Also, here is another VGM to try converting: https://dl.dropboxusercontent.com/u/101 ... bhb_s1.vgm
In this case, the conversion seems to get into an endless loop.
-
- Very interested
- Posts: 3131
- Joined: Thu Nov 30, 2006 9:46 pm
- Location: France - Sevres
- Contact:
Actually i only tested the VGM optimization part, i was confident about the VGM to XGM conversion but i was wrong :pkubilus1 wrote:Cool, that certainly fixes the crash on tjae_eb.vgm file. However, the resulting xgm does not seem to play correctly, it's like some of the samples are missing.
Also, here is another VGM to try converting: https://dl.dropboxusercontent.com/u/101 ... bhb_s1.vgm
In this case, the conversion seems to get into an endless loop.
Thanks for testing and reporting bugs, that really help =)
Yeah i tested on this one, hopefully it should fix the sample problem with VGM export from deflemask.I want to add that the Sonic1 vgm sound perfect now with the xgm conversion update!
-
- Very interested
- Posts: 3131
- Joined: Thu Nov 30, 2006 9:46 pm
- Location: France - Sevres
- Contact:
I put a new version on the SVN:kubilus1 wrote:Cool, that certainly fixes the crash on tjae_eb.vgm file. However, the resulting xgm does not seem to play correctly, it's like some of the samples are missing.
Also, here is another VGM to try converting: https://dl.dropboxusercontent.com/u/101 ... bhb_s1.vgm
In this case, the conversion seems to get into an endless loop.
https://sgdk.googlecode.com/svn/trunk/bin/xgmtool.exe
It should fix the missing samples issues.
About the second VGM file, actually it converts correctly but just take age to do it because the VGM contains many play sample commands and so analyzing samples take more time.
I recommend to convert it to optimized VGM with xgmtool for once then you can have quick convert to XGM format.
Although the VGM optimization throw many warning messages (because the small sample can't be correctly restored) i don't really heard any difference in the final music.
Last edited by Stef on Sat Nov 29, 2014 11:04 am, edited 1 time in total.
-
- Very interested
- Posts: 3131
- Joined: Thu Nov 30, 2006 9:46 pm
- Location: France - Sevres
- Contact:
Thanks, that is a good news =)
Honestly i think that some bugs remains and i do know that some VGM won't convert correctly (because of sub frame timing) but it is already working nicely in its state.
About the size reduction of your file, looks like you were using an already quite optimized VGM file, in which case the result is not much different.
Honestly i think that some bugs remains and i do know that some VGM won't convert correctly (because of sub frame timing) but it is already working nicely in its state.
About the size reduction of your file, looks like you were using an already quite optimized VGM file, in which case the result is not much different.
The new version works much better! I think the only remaining issue is samples not playing unless FM channel 6 is already set to PCM mode in the song. Other than that, it appears to be working very well.
An odd thing about that bio hazard battle track, it apparently does not actually set channel 6 to PCM mode, however it feeds data using the PCM commands. I could be missing something, but I couldn't find a command to enable DAC anywhere in that. I just noticed that when digging through these!
An odd thing about that bio hazard battle track, it apparently does not actually set channel 6 to PCM mode, however it feeds data using the PCM commands. I could be missing something, but I couldn't find a command to enable DAC anywhere in that. I just noticed that when digging through these!
-
- Very interested
- Posts: 3131
- Joined: Thu Nov 30, 2006 9:46 pm
- Location: France - Sevres
- Contact:
Yeah the remaining issue is about how the XGM driver handle PCM command, it does not automatically set DAC mode...
I will try to modify it to automatically set the DAC mode on PCM play command and set back to FM when no more PCM are playing. I'm almost certain i don't have enough space to add even a small part of code like this one (i have about only 50 bytes free :p) but i can probably optimize others pieces
About Bio hazard, well that would explain why even if the XGM driver can't restore all PCM play command it does not make any change in the music.
That is also the reason why i did not included automatic DAC mode on PCM play command at first as i already sax invalid DAC write in VGM file.
Maybe i can add this in the XGMTool : if DAC is not enabled just ignore all DAC writes commands.
I will try to modify it to automatically set the DAC mode on PCM play command and set back to FM when no more PCM are playing. I'm almost certain i don't have enough space to add even a small part of code like this one (i have about only 50 bytes free :p) but i can probably optimize others pieces
About Bio hazard, well that would explain why even if the XGM driver can't restore all PCM play command it does not make any change in the music.
That is also the reason why i did not included automatic DAC mode on PCM play command at first as i already sax invalid DAC write in VGM file.
Maybe i can add this in the XGMTool : if DAC is not enabled just ignore all DAC writes commands.
Last edited by Stef on Mon Dec 01, 2014 4:27 pm, edited 1 time in total.
With the Bio hazard battle song, I assumed that this was being used to generate some kind of sound, perhaps the weird stick rattle noise? Perhaps this is just some hacky way to do a pause?
It would be interesting to see if that was the case by changing the 0x80 to the proper 0x7x commands.
If the weird BHB mode is simply a hacky pause then the logic of sending a 0x2b 0x80 at PCM start and a 0x2b 0x00 at PCM end should be sufficient I would think to fix SFX. Keep in mind that this would need to be wrapping every time a string of bytes were written.
For instance if the VGM plays 10 PCM bytes and then does some other FM operation and then plays 10 more PCM bytes, around each 10 PCM bytes, enabling and disabling PCM would need to occur. At least for SFX since there is no telling if the other FM operations would be on channel 6 or not.
If the BHB mode is in fact streaming data to FM channel 6 to make sound, then I really am not quite sure. Perhaps the logic would need to track if PCM mode has been enabled in the VGM by detecting 0x2b 0x80 and then enable PCM mode for SFX playback and return it to whatever the original state was when done.
It would be interesting to see if that was the case by changing the 0x80 to the proper 0x7x commands.
If the weird BHB mode is simply a hacky pause then the logic of sending a 0x2b 0x80 at PCM start and a 0x2b 0x00 at PCM end should be sufficient I would think to fix SFX. Keep in mind that this would need to be wrapping every time a string of bytes were written.
For instance if the VGM plays 10 PCM bytes and then does some other FM operation and then plays 10 more PCM bytes, around each 10 PCM bytes, enabling and disabling PCM would need to occur. At least for SFX since there is no telling if the other FM operations would be on channel 6 or not.
If the BHB mode is in fact streaming data to FM channel 6 to make sound, then I really am not quite sure. Perhaps the logic would need to track if PCM mode has been enabled in the VGM by detecting 0x2b 0x80 and then enable PCM mode for SFX playback and return it to whatever the original state was when done.
-
- Very interested
- Posts: 3131
- Joined: Thu Nov 30, 2006 9:46 pm
- Location: France - Sevres
- Contact:
Yeah, i think the most common way of doing it is to store the current "DAC enabled" state set by the VGM data. Actually VGM data should never affects the hardware DAC enabled state, only changes the variable which store the value. the XGM driver should deal with DAC enabled by its own : set it on PCM play and restore the stored DAC enabled state at PCM end play.