A question regarding the PCM

Ask anything your want about Mega/SegaCD programming.

Moderator: Mask of Destiny

Post Reply
Bitybity
Interested
Posts: 36
Joined: Wed Dec 07, 2011 2:09 am

A question regarding the PCM

Post by Bitybity » Sun Oct 07, 2012 12:40 am

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.

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

Post by Stef » Mon Oct 08, 2012 9:32 am

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.

Bitybity
Interested
Posts: 36
Joined: Wed Dec 07, 2011 2:09 am

Post by Bitybity » Mon Oct 08, 2012 11:03 am

The problem comes from gens, and, now I see, comes from hardware too D:

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

Post by Stef » Mon Oct 08, 2012 3:28 pm

Hehe, the hardware do not fit your needs ? :D

Mask of Destiny
Very interested
Posts: 615
Joined: Thu Nov 30, 2006 6:30 am

Post by Mask of Destiny » Mon Oct 08, 2012 9:39 pm

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.

Post Reply