• Just a reminder that providing specifics on, sharing links to, or naming websites where ROMs can be accessed is against the rules. If your post has any of this information it will be removed.
  • Ever thought it'd be cool to have your art, writing, or challenge runs featured on PokéCommunity? Click here for info - we'd love to spotlight your work!
  • Our weekly protagonist poll is now up! Vote for your favorite Trading Card Game 2 protagonist in the poll by clicking here.
  • Welcome to PokéCommunity! Register now and join one of the best fan communities on the 'net to talk Pokémon and more! We are not affiliated with The Pokémon Company or Nintendo.

[Audio] [Pokeemerald] Percussion Instruments Not Making Sound

This is a little embarrassing, seeing that I wrote a tutorial on stuff like this, but I'm running into trouble with some of my voices not making sound in a song that I'm working on. I'm working on this song in a new, up-to-date repo, and I've added in ipatix's sound mixer, following all of the steps of the tutorial, while not doing the optional stuff, like making more room for ram or changing the pcm buffer size. I went into src/m4a_1.s and changed VAR_PCM_BUFFER to 0x410, which I believe is what it needs to be set at to allow for 15 Directsound voices to sound at the same time. I also set both instances of MAX_DIRECTSOUND_CHANNELS to 15.

Despite all of that, I'm having notes (mainly percussion instruments) not come through correctly. When I mute every track other than the percussion track, everything sounds fine. As I start to incorporate the other tracks, certain percussion instruments start to not sustain for as long as they should, and eventually they start making no sound at all. This seems to be a Directsound voice limit issue to me, but I don't think I did anything wrong in increasing that limit to 15, and I know for a fact that less than 15 Directsound notes are being played at these points. I never had this issue with my previous repo, so I'm rather confused as to why this issue is showing up.

If anyone has an idea as to why this is happening, and/or potential solutions to the problem, please let me know. If more information is needed, I'm more than happy to provide it. The only thing I haven't done is changed this line in src/m4a.c from this:
Code:
| (5 << SOUND_MODE_MAXCHN_SHIFT));
to this:
Code:
| (15 << SOUND_MODE_MAXCHN_SHIFT));
I haven't done this, because I seem to recall that doing this cuts into IWRAM unnecessarily. Am I misremembering that?
 
I can confirm that making that line be | (15 << SOUND_MODE_MAXCHN_SHIFT)); does indeed work, but I would still like confirmation on if this is using IWRAM, when it could be using less precious partitions of memory. It may be that using ipatix's mixer makes this change not use IWRAM, but I don't know that for certain, nor would I know where to look to confirm that.
 
I can confirm that making that line be | (15 << SOUND_MODE_MAXCHN_SHIFT)); does indeed work, but I would still like confirmation on if this is using IWRAM, when it could be using less precious partitions of memory. It may be that using ipatix's mixer makes this change not use IWRAM, but I don't know that for certain, nor would I know where to look to confirm that.

At a glance it seems that that line is controlling how many channels the sound engine loops over (SoundInfo.chans?). So while it may control how much memory is accessed, that memory is likely allocated for the sound engine elsewhere.

If you want to analyze IWRAM usage, look at pokeemerald.map. The larger the address of the last IWRAM variable, the more memory you're using.
 
If you want to analyze IWRAM usage, look at pokeemerald.map. The larger the address of the last IWRAM variable, the more memory you're using.

I didn't see any change, since the iwram section seemed to end at 0x8000000 when that line in src/m4a.c used both 5 or 15. Hopefully I read that right, which would mean that it's not using additional IWRAM! Thanks for pointing that out to me.
 
Back
Top