gbadev.org forum archive

This is a read-only mirror of the content originally found on forum.gbadev.org (now offline), salvaged from Wayback machine copies. A new forum can be found here.

DS development > Playing a SOUND_ONE_SHOT sample after a SOUND_REPEAT one...

#162416 - sverx - Tue Sep 02, 2008 5:07 pm

Hi there. This time it's not a question... well, not a question about programming the DS at least ;)

The fact is that: it's since a couple of days I've been in struggle to find why -sometimes- sound samples weren't reproduced as they were expected. The problem in the beginning appeared randomly then I found a pattern: the problem appeared when playing some samples AFTER some others. Then I noticed the problem appeared only when playing a SOUND_ONE_SHOT sample after a SOUND_REPEAT one.

Well, so I added
Code:
SCHANNEL_REPEAT_POINT(channel) = 0;

to reset the repeat point, even if I thought that SCHANNEL_REPEAT_POINT was ignored in SOUND_ONE_SHOT mode.

Now it works (!!!). So, should I think that SCHANNEL_REPEAT_POINT(chn) value isn't ignored? And if it's not, does anybody of you knows the usage of this in the SOUND_ONE_SHOT case?

Thanks :)

#162417 - eKid - Tue Sep 02, 2008 5:15 pm

In one shot mode, the sample length is calculated as "PNT+LEN"

In repeat mode, the 'PNT' part is played once, and the 'LEN' is looped forever.

#162418 - sverx - Tue Sep 02, 2008 5:28 pm

eKid wrote:
In one shot mode, the sample length is calculated as "PNT+LEN"


That's what I was thinking too. But... what for? Since we don't have any loop, isn't it easyer to have just LEN and ignore PNT?

By the way I believe a lot of people just started from that piece of code here, that forgot to set PNT to 0, and went forth with loops...

ok, I just fallen in a common mistake... I see :|