Page 1 of 5
PVsneslib - SNES JUKEBOX
Posted: Tue Jul 01, 2014 3:45 am
by Mills
UPDATE: Au 2016
Thanks to
pvsneslib i made a cool jukebox for SNES, including lots of impulse tracker files i edited from games or pop music

.
Now (2016) I found my little rom and I tried to improve it. But i can't compile roms anymore with snesdev, this is the error:
Code: Select all
CHECK HEADERS: the object files are from different projects
How could I solve that?
I attached the last version I could compile, it includes changing backgrounds and new music.
This is the source:
https://db.tt/CMODHxWu
Thanks
Re: PVsneslib Layer problem - SNES JUKEBOX
Posted: Tue Jul 01, 2014 5:52 am
by mic_
Bit 13 of each BG map entry is a priority bit. Try using a low prio (0) for the BG0 and BG1 tiles, and a high priority for the BG2 tiles (if you're using mode 2, 4 or 6 the priority bit for BG2 has a different meaning).
If you're using display mode 1 there's also a BG2 priority setting in bit 3 of BGMODE ($2105) to take into account.
Re: PVsneslib Layer problem - SNES JUKEBOX
Posted: Tue Jul 01, 2014 6:10 am
by Mills
mic_ wrote:Bit 13 of each BG map entry is a priority bit. Try using a low prio (0) for the BG0 and BG1 tiles, and a high priority for the BG2 tiles (if you're using mode 2, 4 or 6 the priority bit for BG2 has a different meaning).
If you're using display mode 1 there's also a BG2 priority setting in bit 3 of BGMODE ($2105) to take into account.
I'm very noob at programming, i'm using C (pvsneslib) I don't know if i can acces the bit priority with this library. Or maybe i can edit it while converting maps with gfx2snes.
I´m using mode 1.
Thanks
Re: PVsneslib Layer problem - SNES JUKEBOX
Posted: Tue Jul 01, 2014 6:58 am
by alekmaul
I replied with PM, as you sent me a PM like this topic.
BG3_MODE1_PRORITY_HIGH is to use when setting mode.
Code: Select all
setMode(BG_MODE1,BG3_MODE1_PRORITY_HIGH);
Re: PVsneslib Layer problem - SNES JUKEBOX
Posted: Wed Jul 02, 2014 4:19 am
by Mills
alekmaul wrote:I replied with PM, as you sent me a PM like this topic.
BG3_MODE1_PRORITY_HIGH is to use when setting mode.
Code: Select all
setMode(BG_MODE1,BG3_MODE1_PRORITY_HIGH);
Thanks! That worked perfect.
Another problem now with music.
I can convert a song.it to spc and the music will play OK in many music players emulating the snes.
But when creating soundbanks for pvsneslib, some songs use two banks, for example like this:
Code: Select all
;
.include "hdr.asm"
.bank 4
.section "SOUNDBANK" ; need dedicated bank(s)
SONGBANK1:
.incbin "soundbank.bnk" read $8000
.ends
.bank 5
.section "SOUNDBANK1" ; need dedicated bank(s)
SONGBANK2:
.incbin "soundbank.bnk" skip $8000
.ends
If i try to play this song inside pvsneslib i just can select one of the banks:
Code: Select all
spcSetBank(&SONGBANK1);
spcAllocateSoundRegion(39);
spcLoad(SONG);
spcPlay(0);
The music plays with missing samples.
How do I play the song correctly?
Thanks a lot
Re: PVsneslib Layer problem - SNES JUKEBOX
Posted: Wed Jul 02, 2014 11:49 am
by tepples
Assuming that .bank specifies a 32768-byte LoROM bank:
Perhaps the easiest way to just get it working is to copy the whole song into WRAM, the first bank into $7F0000-$7F7FFF and the second into $7F8000-$7FFFFF, and then copy from there to the SPC700.
Re: PVsneslib Layer problem - SNES JUKEBOX
Posted: Wed Jul 02, 2014 12:07 pm
by ARM9
Or you can recompile tcc816 for hirom (iirc you can just modify the wla header) and modify your projects header to use hirom, but I don't know if pvsneslib plays nice with hirom.
Re: PVsneslib - SNES JUKEBOX
Posted: Wed Jul 02, 2014 12:17 pm
by alekmaul
Well, the 1st bank is number #1 for spcLoad, the second one (SOUNDBANK1) if #2, and so on
So ...
As explain in example, you must :
spcAllocateSoundRegion(39); -> only 1st time with big value you need (often you must set 0)
spcSetBank(&SONGBANK1); -> no, just need to set the spcLoad function
spcStop(); spcLoad(SONG);spcPlay(0); -> yes, that should work.
Tell me if it works for you.
Just check example, it works fine with it file
By the way, don't forget mod emulation with the current issues wrote in pvsneslib_snesmod.txt file
Re: PVsneslib - SNES JUKEBOX
Posted: Wed Jul 02, 2014 12:17 pm
by Mills
I'll test it now alekmaul.
For the moment i reduced the size of some "huge" samples, so that the song fits inside one 32768-byte LoROM bank.
Surely i was expecting more from the spc sound. It looks like samples have some lenght limit, so big samples did not play very well (even if they fit in a rom bank).
I nearly finished my jukebox, now i just have to optimize some songs to play better.

Re: PVsneslib - SNES JUKEBOX
Posted: Wed Jul 02, 2014 12:20 pm
by alekmaul
Mills wrote:
I nearly finished my jukebox, now i just have to optimize some songs to play better.
That's great, i can help regarding songs. Kungfu Furby also sent me some advices regarding mod/it files to be comaptible with my current snesmod adaptation (remember that it is only a mukunda rewrite of his driver for PVSneslib

)
Nice to see some things written with PvSnesLib, that's great

!
Re: PVsneslib - SNES JUKEBOX
Posted: Wed Jul 02, 2014 12:39 pm
by Mills
alekmaul wrote:
That's great, i can help regarding songs. Kungfu Furby also sent me some advices regarding mod/it files to be comaptible with my current snesmod adaptation (remember that it is only a mukunda rewrite of his driver for PVSneslib

)
Nice to see some things written with PvSnesLib, that's great

!
Tested the big song without "spcSetBank(&SONGBANK1);" it did nothing...
I first tested songs with some plugin that plays them in windows so the driver was different.
This is one of the .it that converted to spc, plays well using winamp plugin for windows, and does not play well on pvsneslib. Maybe it is too much for the real snes
It was a .mod i found long time ago, and then decided to add the voice samples.
Re: PVsneslib - SNES JUKEBOX
Posted: Wed Jul 02, 2014 1:18 pm
by KungFuFurby
I have an ASM trick to get around that 32,768 byte limit (which is WLA DX deleting "unused banks"). Just have the first character in the name of the sections above the 32K limit be an exclamation point, and that problem should go away.
Thus, this is your new result...
Code: Select all
;
.include "hdr.asm"
.bank 4
.section "SOUNDBANK" ; need dedicated bank(s)
SONGBANK1:
.incbin "soundbank.bnk" read $8000
.ends
.bank 5
.section "!SOUNDBANK1" ; need dedicated bank(s)
SONGBANK2:
.incbin "soundbank.bnk" skip $8000
.ends
Either that, or call the spcSetBank routine for each ROM bank (this is what alekmaul does with multi-LoROM-bank soundbanks), ending with the actual starting point of the soundbank.
I suspect misconceptions about the limit applying to the SPC700 partially comes from this problem.
The actual length limit for samples is more along the lines of a little more than 100,000 (that's prior to conversion, and it does not matter whether it is 8 bits or 16 bits... they both have the exact same filesize)... but that's if you
really want to fill up the entire SPC700 memory with just a single sample (and not much pattern data).
Re: PVsneslib - SNES JUKEBOX
Posted: Wed Jul 02, 2014 1:28 pm
by Mills
Problem is I need to specify the "SONGBANK1:" to play a song...
About songs. How can i create soundbanks from spc's?
I think converting then to .it and reconverting to spc will not be very good.
Re: PVsneslib - SNES JUKEBOX
Posted: Wed Jul 02, 2014 1:31 pm
by KungFuFurby
Soundbanks have to be created from the .it files... not the .spc files.
The biggest reason why is because you might be dealing with completely different sound drivers in the .spc files.
Re: PVsneslib - SNES JUKEBOX
Posted: Wed Jul 02, 2014 2:43 pm
by tepples
Does resetting the SPC700 to its IPL require resetting the entire console? If so, and you want to play SPCs that use different engines, you'll need to either find a reset command in each engine or add a circuit that momentarily pulls the reset pin low.