Page 2 of 3
Posted: Fri Jan 17, 2014 9:07 am
by nolddor
nolddor wrote:kubilus1 wrote:Someday there will be a VGM_resumePlay (); ...... xD
Perhaps, what do you mean exactly?
Nowadays, SGDK hasn't a SND_resumePlay_VGM();... only it has a Stop o Start function.
This function is very useful when you push pause into a game.
Posted: Fri Jan 17, 2014 12:45 pm
by Stef
kubilus1 wrote:Also, the above patch will allow resuming play of VGM files.
Stop the playing track ->
SND_stopPlay_VGM();
Resume the playing track ->
SND_resumePlay_VGM();
Should be useful when pausing, and such.
Wonderful ! That would be really helpful ! Thanks a tons

Posted: Fri Jan 17, 2014 8:12 pm
by Stef
By the way do you have any date for the update ? i though the driver was in the demo posted but only client file without the driver itself :p
I'm planning a new version of SGDK soon and it would be really nice to have the new VGM driver included =)
Posted: Sat Jan 18, 2014 12:56 am
by kubilus1
It would be awesome to have this included!
The zip should contain the sound driver as well vgm_drv.h. I think with the SGDK setup this will become z80_vgm.c and z80_vgm.h.
Also, I am hosting the code here:
http://code.google.com/p/gendev/source/ ... r%2Fdriver
...which I believe contains the .bin that the .h was made into
I don't see myself having time to make any changes right now, so the one I posted should be good. The code is extremely ugly ATM, once work lets up a bit I should be able to get back to it and clean things up some more.
Posted: Sat Jan 18, 2014 11:00 am
by Stef
Oh yeah sorry i did not look into the vgm_drv.h file ! Thanks a tons !
Posted: Mon Jan 20, 2014 9:06 am
by Stef
I updated SGDK to the last VGM driver, i experienced some playback issues with one of the sample i am providing in the "sound" sample exemple. Actually it seems to be the classic sonic 1 green hill theme... did you meet any problem with it ? or maybe i did something wrong with my patch code (or the client changed a bit and i did not see it).
Posted: Mon Jan 20, 2014 7:15 pm
by Stef
Oh it seems there is something wrong about the DAC in the last VGM driver, at least the one we can get the C pre compiled version. Any music using PCM sound completly off, DAC value seems completly random :-/
Edit: my fault ! I was not clearing Z80 memory when loading a new driver, that could be useful :p
Posted: Mon Jan 20, 2014 7:59 pm
by kubilus1
Okay, glad that this is working! I'll look to see if there are some uninitialized variables so that this could be better prevented.
Posted: Wed Jan 29, 2014 1:09 am
by sigflup
in VGM_debug, what is bank_8x and bank_bkp? The rest make sense to me
Posted: Wed Jan 29, 2014 2:08 am
by kubilus1
bank_8x is the bank for the 0x8? style PCM calls. This is filled in when the driver sees a 0xe0 command.
bank_bkp preserves the bank of the original PCM call when a sound effect changes the bank.
When the PCM playback is playing a SFX and reaches a point where the effect is done, the PCM pointer and bank is returned to the original playback location.
Eventually, I would love to be able to mix maybe multiple sound effects, possibly with the original PCM data, the trouble is the time it takes to change banks. If I could buffer then this could possibly be solved, but that has it's own challenges:
1. PCM samples and SFX have to be randomly accessible. We never know ahead of time when and where these will be played from (practically speaking.)
2. Buffering will require some down-time during the playback. It would seem possible that really busy tracks would not have enough down-time between samples to buffer.
Just making the VGM file itself buffer is probably the next step. Since the VGM playback is linear and consistent, I only have to worry about issue #2, which I think is unlikely to really be a problem, I hope. I should have time to then mix two PCMs (SFX + Sample or SFX + SFX) at 8khz.
Posted: Sat Feb 01, 2014 2:20 am
by sigflup
Here's my patched version:
http://theadesilva.com/vgm_drv.h
It's a real ugly hack but provides some usefulness if you're making a musicdisk *ehem*.
z80 ram address 0x1a00 contains fm_bank
z80 ram address 0x1a01 contains psg_bank
z80 ram address 0x1a03 contains stop
fm_bank is incremented by one every time fm gets written. This is useful if you have a status bar or something that you're checking every v refresh. The number in there is the length of your bar, just write it to zero after you read it.
psg_bank is the same thing but for the psg
stop turns to 1 when the music stops or loops
Posted: Sat Feb 01, 2014 4:46 am
by sigflup
Not sure why this track doesn't play well yet.....
http://theadesilva.com/track4.vgm
Posted: Sat Feb 01, 2014 10:45 am
by Stef
I also observed that some VGM does not play well. Missing notes or instrument... not really sure why though.
Posted: Sat Feb 01, 2014 11:24 am
by bastien
i have tested this new driver's too.
First , thanks for your works , SGDK intégration seems to works very well
But i have also a little speed problem , here is my simple test rom :
http://sega4ever.power-heberg.com/tutod ... M_Test.zip
Posted: Sat Feb 01, 2014 4:31 pm
by kubilus1
Sigflup, I see the problem with track4.vgm. It has a completely empty PCM data block (67 66 00 00 00 00 00). I'll add some logic to handle this situation.
Bastien, could you send me the original VGM files so I can take a look. It appears that this is the same problem for the ffv song.