Page 1 of 1

A question regarding the PCM

Posted: Sun Oct 07, 2012 12:40 am
by Bitybity
Hey guys, I have been trying to play a song in PCM (yes, in PCM; I'm preparing an "easter egg", and of course, can't be in CDDA).

The song takes actually 1024 KB.
I tried to get rid of this by loading a 32kb portion to somewhere in RAM, and another 32kb portion to other place; once a portion finished playing, I try to play the other portion, meanwhile the first one reloads other data, and once it finish playing the second, goes back to the first portion while the second reloads new data.

I tried to do this using an example code a friend gave me, which he told is taken from the 32xDdk.
The first times I tried it, had a lag when going from one portion to another.
After I thought I fixed it, the transitions between the two portions failed in gens.

Any idea about how to do this?

The code (most of the uncommented code before InitPCM is unknown for me):
http://pastebin.com/a8mqCZqk

Thank you very much, and excuse my terrible english.

Posted: Mon Oct 08, 2012 9:32 am
by Stef
Hi,

That pastebin code share stuff seems really neat :p
About your problem, i am not very familiar with MegaCD PCM stuff but you should test your code both on Kega Fusion and Gens to be sure that the problem comes from your code and not from Gens.

Posted: Mon Oct 08, 2012 11:03 am
by Bitybity
The problem comes from gens, and, now I see, comes from hardware too D:

Posted: Mon Oct 08, 2012 3:28 pm
by Stef
Hehe, the hardware do not fit your needs ? :D

Posted: Mon Oct 08, 2012 9:39 pm
by Mask of Destiny
I don't see where you setup the next chunk in the linked code. It looks to me like you just load up the first 64K of the sample, start playing it and then loop forever without ever loading more data in to PCM RAM.

That said, I think you're making this more complicated than it needs to be. It's been a while since I last did anything with the PCM chip, but I'm pretty sure playback will loop around back to PCM RAM address 0 when the counter overflows. So you shouldn't need to mess around with LSL and LSH and the 0xFF stop byte until you get to the end of the sample.