CDDA + PCM conflicts

RockinB

Staff member
When playing CDDA with CDC library and PCM with SGL library, problems occur like system hangs with looping PCM sequences.

The problem is that both things use DMA bus transfer to sound RAM which can cause conflicts.

Options we got to solve the problem:

  • playback mutex

    Don't play them at the same time.
  • DMA mutex

    Ensure that none of both tries DMA to sound RAM while the other already does it.
  • place sound in sound RAM

    This makes transfering from work RAM to sound RAM redundant.

OK, now the first one really is no problem to do, but it's not what I want for the game. It should be able to play both at once. Commercial games can do so, so why could do so, too.

The other two options got some problems:

DMA mutex: unlike GFS file loading, one cannot(at least I don't know how to) control when the DMA transfer from CD buffer to sound RAM is done. I know that the SGL PCMOn() function registers a function for some vblank interupt, that fills some buffer in sound RAM with new data. So for PCM we know when DMA is performed. But for CDDA we don't.

One thought of mine is: playing CDDA with SGL instead of CDC is done with dummy files which point to the tracks on CD. So I guess that the CDDA playback is done the same way like in GFS library so that there won't occur any problems playing PCM and CDDA. But how to insert dummy files? Have jet to find a powerfull ISO tool to make this.

Another thought is to manually pause CDDA playback while vblank interrupt with CDC_Seek().

Placing in sound RAM: I have tried this way and all library functions do this: they place PCM data into sound RAM and play it. Unfortunately the PCM playing functions from SGL(and memory playback mode of SBL's PCM) don't seem to support the playback, when the data is located in and fits totaly into sound RAM. I think the solution can be found with doing some low level hardware stuff with the SCSP.

So please has anyone got a solution for this? I would prefer the DMA mutex, because PCM in work RAM has got library support and there is much more space to store them.

This problem really sucks :puke: !
 

vreuzon

New Member
You can use "Sequences" (functions like slSequenceOn, etc...). That's what I use in leSpin (where the sequences are only one note long). This way, sound data is transfered to the sound RAM only one time. Plus you can use more channel at the same time.
 

vbt

Staff member
I got the same problem I've started to play a PCM file while playing an audio track and it has stopped CDDA playing :(
 

RockinB

Staff member
Maybe in SGL it is assumed that CDDA is played back using the SGL file method (cdda dummy files on data track one which point to the audio tracks), like it's done in various commercial games.

But we haven't yet found a way to create a disk with correct cdda dumm y files.

On the other side...I'm not quite sure, but maybe it worked playing PCM and CDDA together in my later projects, the SoundPlayer and the Saturn Game Tutorial Demo.
 

vbt

Staff member
RockinB said:
Maybe in SGL it is assumed that CDDA is played back using the SGL file method (cdda dummy files on data track one which point to the audio tracks), like it's done in various commercial games.
It looks to be the same with the SBL.

But we haven't yet found a way to create a disk with correct cdda dumm y files.


On the other side...I'm not quite sure, but maybe it worked playing PCM and CDDA together in my later projects, the SoundPlayer and the Saturn Game Tutorial Demo.

I solved my problem by loading PCM in memory before tarting to play audio track :)
 
Top