VGM Driver Update

Announce (tech) demos or games releases

Moderator: Mask of Destiny

nolddor
Very interested
Posts: 102
Joined: Sun Jun 02, 2013 1:35 pm
Location: Spain

Post by nolddor » Fri Jan 17, 2014 9:07 am

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.

Stef
Very interested
Posts: 3131
Joined: Thu Nov 30, 2006 9:46 pm
Location: France - Sevres
Contact:

Post by Stef » Fri Jan 17, 2014 12:45 pm

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 :)

Stef
Very interested
Posts: 3131
Joined: Thu Nov 30, 2006 9:46 pm
Location: France - Sevres
Contact:

Post by Stef » Fri Jan 17, 2014 8:12 pm

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 =)

kubilus1
Very interested
Posts: 237
Joined: Thu Aug 16, 2012 2:25 am
Contact:

Post by kubilus1 » Sat Jan 18, 2014 12:56 am

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.

Stef
Very interested
Posts: 3131
Joined: Thu Nov 30, 2006 9:46 pm
Location: France - Sevres
Contact:

Post by Stef » Sat Jan 18, 2014 11:00 am

Oh yeah sorry i did not look into the vgm_drv.h file ! Thanks a tons !

Stef
Very interested
Posts: 3131
Joined: Thu Nov 30, 2006 9:46 pm
Location: France - Sevres
Contact:

Post by Stef » Mon Jan 20, 2014 9:06 am

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).

Stef
Very interested
Posts: 3131
Joined: Thu Nov 30, 2006 9:46 pm
Location: France - Sevres
Contact:

Post by Stef » Mon Jan 20, 2014 7:15 pm

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

kubilus1
Very interested
Posts: 237
Joined: Thu Aug 16, 2012 2:25 am
Contact:

Post by kubilus1 » Mon Jan 20, 2014 7:59 pm

Okay, glad that this is working! I'll look to see if there are some uninitialized variables so that this could be better prevented.

sigflup
Very interested
Posts: 111
Joined: Mon Sep 06, 2010 12:05 pm
Contact:

Post by sigflup » Wed Jan 29, 2014 1:09 am

in VGM_debug, what is bank_8x and bank_bkp? The rest make sense to me

kubilus1
Very interested
Posts: 237
Joined: Thu Aug 16, 2012 2:25 am
Contact:

Post by kubilus1 » Wed Jan 29, 2014 2:08 am

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.

sigflup
Very interested
Posts: 111
Joined: Mon Sep 06, 2010 12:05 pm
Contact:

Post by sigflup » Sat Feb 01, 2014 2:20 am

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

sigflup
Very interested
Posts: 111
Joined: Mon Sep 06, 2010 12:05 pm
Contact:

Post by sigflup » Sat Feb 01, 2014 4:46 am

Not sure why this track doesn't play well yet.....http://theadesilva.com/track4.vgm

Stef
Very interested
Posts: 3131
Joined: Thu Nov 30, 2006 9:46 pm
Location: France - Sevres
Contact:

Post by Stef » Sat Feb 01, 2014 10:45 am

I also observed that some VGM does not play well. Missing notes or instrument... not really sure why though.

bastien
Very interested
Posts: 208
Joined: Mon Jun 25, 2007 7:19 pm
Location: Besançon,France
Contact:

Post by bastien » Sat Feb 01, 2014 11:24 am

i have tested this new driver's too.
First , thanks for your works , SGDK intégration seems to works very well :D
But i have also a little speed problem , here is my simple test rom :

http://sega4ever.power-heberg.com/tutod ... M_Test.zip

kubilus1
Very interested
Posts: 237
Joined: Thu Aug 16, 2012 2:25 am
Contact:

Post by kubilus1 » Sat Feb 01, 2014 4:31 pm

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.

Post Reply