[XGM] PCM sfx doesn't start

SGDK only sub forum

Moderator: Stef

Post Reply
tryphon
Very interested
Posts: 316
Joined: Sat Aug 17, 2013 9:38 pm
Location: France

[XGM] PCM sfx doesn't start

Post by tryphon » Thu Oct 24, 2019 5:32 pm

I noticed sometimes, PCM sfx doesn't start when I call XGM_playPCM. Especially when I play very close sfx.

Therefore I have the 3 questions :

1) is the priority the only thing that can prevent a PCM to be played ?

2) does a priority of 15 mean that the PCM will overpass any playing PCM (so it can't be muted)

3) is the following command :

Code: Select all

if (!XGM_isPlayingPCM(SOUND_PCM_CH1_MSK)) {
    // do stuff
}
the right way to test if a PCM channel is "free", or is it rather something like :

Code: Select all

if (!(XGM_isPlayingPCM(0xFFFF) & SOUND_PCM_CH1_MSK)) {
    // do stuff
}
?

Thanks in advance !

tryphon
Very interested
Posts: 316
Joined: Sat Aug 17, 2013 9:38 pm
Location: France

Re: [XGM] PCM sfx doesn't start

Post by tryphon » Thu Oct 24, 2019 8:06 pm

After some texts, I think the problem is related to XGM_isPCMPlaying...

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

Re: [XGM] PCM sfx doesn't start

Post by Stef » Fri Oct 25, 2019 9:26 am

Yeah priority 15 is the maximum priority and should always play :)
About play PCM status, I think we already discussed that point ?
The problem is that XGM commands may take 1 or even 2 frames (as in reality it's just a bit more than 1 frame in some situation) to be processed so XGM_isPCMPlaying() may has 1/2 frame latency to return the information.

tryphon
Very interested
Posts: 316
Joined: Sat Aug 17, 2013 9:38 pm
Location: France

Re: [XGM] PCM sfx doesn't start

Post by tryphon » Fri Oct 25, 2019 1:53 pm

Yes we did, and you're right, that's indeed the problem. At first I thought I had a priority problem, then that isPlayingPCM was releasing info too early, but it's the contrary : it takes too much time to consider the channel used.

I'll update my "pcm manager" to block a channel during the 2 first frames, THEN use isPlayingPCM to free the channel. I'm getting old :P

Post Reply