Author |
Message |
- Joined: 27 Apr 2021
- Posts: 29
|
devkitSMS and PSGlib
Posted: Mon Aug 02, 2021 12:55 pm
|
Hi everybody.
I'm making a game with devkitSMS and I wanted to add some sfx.
I'm still learning the SMS architecture I understood the common things like banking, palettes, interrupts, etc... BUT I'm a total noob when it comes to sound :)
For testing I used theSFX.psg from the PSGlibDemo-SMS so I'm sure that the sfx is valid :)
Here is my process :
I add the sfx to my bank using assets2banks :
Quote assets2banks directory/data_bank2 --firstbank=2
In the code I'm calling like this :
Quote #include "PSGlib.h"
...
PSGSFXPlay( theSFX_psg, SFX_CHANNEL2 );
...
And I link the project like this :
Quote sdcc -o main.ihx rel/crt0_sms.rel rel/PSGlib.rel lib/SMSlib.lib $(FILES_O)
Technically, I got no errors when I build the final rom but...
Nothing happens when I should get the sound :/
So my question is simple : Is there anything I do wrong ? Or maybe I missed a step ?
Thanks a lot for helping.
|
|
|
- Joined: 29 Mar 2012
- Posts: 885
- Location: Spain
|
Posted: Mon Aug 02, 2021 1:41 pm
|
are you selecting the resource bank before playing the sound?
|
|
|
- Joined: 27 Apr 2021
- Posts: 29
|
Posted: Tue Aug 03, 2021 5:53 am
|
kusfo wrote are you selecting the resource bank before playing the sound?
Yes :(
|
|
|
- Joined: 04 Jul 2010
- Posts: 540
- Location: Angers, France
|
Posted: Tue Aug 03, 2021 5:56 am
|
Are you updating PSGSFXFrame ?
like PSGFrame it need to be updated each frame.
Better to place them in vbl (at start) for linearity of each call.
|
|
|
- Joined: 27 Apr 2021
- Posts: 29
|
Posted: Tue Aug 03, 2021 8:30 am
|
ichigobankai wrote Are you updating PSGSFXFrame ?
like PSGFrame it need to be updated each frame.
Better to place them in vbl (at start) for linearity of each call.
Thanks a lot !
I added PSGSFXFrame into my main loop and it's working perfect :)
|
|
|
- Joined: 05 Sep 2013
- Posts: 3811
- Location: Stockholm, Sweden
|
Posted: Wed Aug 04, 2021 5:52 pm
|
Naarshakta wrote assets2banks directory/data_bank2 --firstbank=2
assets2banks can directly handle your assets in multiple banks
I mean, you don't need to keep them in separate folders
|
|
|
- Joined: 27 Apr 2021
- Posts: 29
|
Posted: Fri Aug 06, 2021 5:18 pm
|
sverx wrote assets2banks can directly handle your assets in multiple banks
I mean, you don't need to keep them in separate folders
Yeah I saw but I want to have more control over it :)
|
|
|
- Joined: 05 Sep 2013
- Posts: 3811
- Location: Stockholm, Sweden
|
Posted: Sun Aug 08, 2021 1:37 pm
|
I'm curious to know what control you need exactly.
Assets grouping (which is supported by assets2banks) should give you enough control to assure you don't ever need to have more control over your assets...
|
|
|
- Joined: 27 Apr 2021
- Posts: 29
|
Posted: Mon Aug 09, 2021 7:42 am
|
Yes, in fact maybe you can help me ^^
I don't really know the architecture so I was assuming that bank switching is time-consumming and the major problem I had is that I had to switch bank during display to access differents tilemaps stored in differents banks...
So I moved every assets I need in one "moment" of the game in the same bank
BUT maybe I'm wrong ^^
Also, for dev purpose and I temporally need somes of the assets to be in the same bank ( easier to test ) . If everything goes well, in the end , I won't need this anymore.
|
|
|
- Joined: 05 Sep 2013
- Posts: 3811
- Location: Stockholm, Sweden
|
Posted: Mon Aug 09, 2021 9:28 am
|
the bank switch is a pretty fast operation, the time it requires is the same as writing a single byte to RAM memory - because in fact that's what it happens.
as for keeping some assets together in the same bank, that's fairly common, exactly for the reason you described: you might need to access data from two assets at the same time and having to bank-switch back and forth would be a waste, that's why assets2banks supports assets grouping
let's imagine you have 3 assets called tilemap_a.bin, tilemap_b.bin and tilemap_c.bin and you need them to be allocated in the same bank: in your assets folder you would create an assets2banks.cfg file with this content:
{
tilemap_a.bin
tilemap_b.bin
tilemap_c.bin
}
then you can bank-switch to any of those assets the way you would normally do, and be sure you would have all them accessible :)
|
|
|
- Joined: 27 Apr 2021
- Posts: 29
|
Posted: Mon Aug 09, 2021 1:45 pm
|
Yeah I saw that I could configure the assets2bank.cfg but I didn't take time to look at :p
For the moment I use my Makefile to do it but in the future I will look into the cfg file for assets2bank ^^
PS : thanks for help !
|
|
|
- Joined: 05 Sep 2013
- Posts: 3811
- Location: Stockholm, Sweden
|
Posted: Tue Aug 10, 2021 2:05 pm
|
no worries, and you can do things the way you prefer, of course! :)
|
|
|