PVsneslib - SNES JUKEBOX

Discussion of hardware and software development for Super NES and Super Famicom. See the SNESdev wiki for more information.

Moderator: Moderators

Forum rules
  • For making cartridges of your Super NES games, see Reproduction.
Mills
Posts: 43
Joined: Tue Jul 01, 2014 3:30 am

PVsneslib - SNES JUKEBOX

Post 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

Image

Image

Image

Thanks
Attachments
Music_Player_Snes.rar
(1.48 MiB) Downloaded 320 times
Last edited by Mills on Thu Aug 04, 2016 9:11 am, edited 4 times in total.
mic_
Posts: 922
Joined: Thu Oct 05, 2006 6:29 am

Re: PVsneslib Layer problem - SNES JUKEBOX

Post 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.
Mills
Posts: 43
Joined: Tue Jul 01, 2014 3:30 am

Re: PVsneslib Layer problem - SNES JUKEBOX

Post 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
alekmaul
Posts: 55
Joined: Tue Apr 24, 2012 12:22 pm
Contact:

Re: PVsneslib Layer problem - SNES JUKEBOX

Post 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); 
Mills
Posts: 43
Joined: Tue Jul 01, 2014 3:30 am

Re: PVsneslib Layer problem - SNES JUKEBOX

Post 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
tepples
Posts: 22708
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Re: PVsneslib Layer problem - SNES JUKEBOX

Post 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.
ARM9
Posts: 57
Joined: Sun Aug 11, 2013 6:07 am

Re: PVsneslib Layer problem - SNES JUKEBOX

Post 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.
alekmaul
Posts: 55
Joined: Tue Apr 24, 2012 12:22 pm
Contact:

Re: PVsneslib - SNES JUKEBOX

Post 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
Last edited by alekmaul on Wed Jul 02, 2014 12:18 pm, edited 1 time in total.
Mills
Posts: 43
Joined: Tue Jul 01, 2014 3:30 am

Re: PVsneslib - SNES JUKEBOX

Post 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. :D

Image
alekmaul
Posts: 55
Joined: Tue Apr 24, 2012 12:22 pm
Contact:

Re: PVsneslib - SNES JUKEBOX

Post by alekmaul »

Mills wrote: I nearly finished my jukebox, now i just have to optimize some songs to play better. :D
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 :D !
Mills
Posts: 43
Joined: Tue Jul 01, 2014 3:30 am

Re: PVsneslib - SNES JUKEBOX

Post 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 :D !
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 :D

It was a .mod i found long time ago, and then decided to add the voice samples.
Attachments
whatislove.zip
(81.84 KiB) Downloaded 227 times
KungFuFurby
Posts: 275
Joined: Wed Jul 09, 2008 8:46 pm

Re: PVsneslib - SNES JUKEBOX

Post 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).
Last edited by KungFuFurby on Wed Jul 02, 2014 1:29 pm, edited 1 time in total.
Mills
Posts: 43
Joined: Tue Jul 01, 2014 3:30 am

Re: PVsneslib - SNES JUKEBOX

Post 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.
KungFuFurby
Posts: 275
Joined: Wed Jul 09, 2008 8:46 pm

Re: PVsneslib - SNES JUKEBOX

Post 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.
tepples
Posts: 22708
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Re: PVsneslib - SNES JUKEBOX

Post 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.
Post Reply