Possible reasons:
-
MegaPCM_LoadSampleTable
returns an error, but Sonic 1's stock error handler fails to render it.How to diagnose: It's highly recommended to install MD Debugger and Error handler for proper error reporting, because Mega PCM 2 integrates natively with it. With MD Debugger you should be able to see detailed error description, if it's
MegaPCM_LoadSampleTable
.How to fix: Some samples likely have invalid formats. Follow error description provided by the debugger to fix this.
-
MegaPCM_LoadDriver
or the main sound driver is getting stuck in an inifite loop waiting for Z80 to release bus.How to diagnose: If you have MD Debugger and there aren't any displayed exceptions, your CPU is most likely stuck in an infinite loop. If your emulator has a built-in M68K debugger, you should be able to verify it.
How to fix: Revisit "Step 2. Remove Z80 stops globally" of the installation guide. Make sure you don't have any orphaned "stopZ80" commands. Make sure you modified the main sound driver properly.
Some samples likely have invalid formats. Follow error description provided by the debugger to fix this.
Possible reasons:
- Make sure the expected sample table is loaded (
MegaPCM_LoadSampleTable
is called upon boot); - Make sure sample number is correct. It should be $81 or above ($81 = first sample, $82 = second etc);
- A high priority SFX sample is being played at the same time. As of version 2.0 you cannot play any samples while a sample with
FLAGS_SFX
is being played. The only workaround is to callMegaPCM_StopPlayback
, wait 1 frame and play the desired sample. - Mega PCM 2 doesn't recognize sample type; if sample type isn't
TYPE_PCM
,TYPE_PCM_TURBO
orTYPE_DPCM
, Mega PCM 2 will ignore it (make sure it's notTYPE_NONE
, make sure sample table is loaded correctly); - If you modified volume (
MegaPCM_SetVolume
,MegaPCM_SetSFXVolume
), make sure it's loud enough; - Make sure you didn't call
MegaPCM_SetPan
orMegaPCM_SetSFXPan
with the value of$00
, this effectively disables playback. - Make sure you don't call
MegaPCM_PausePlayback
,MegaPCM_UnpausePlayback
,MegaPCM_StopPlayback
in the same frame; these calls override last requested sample ID, which Mega PCM fetches only once per frame. - If you handle YM writes manually, make sure to always invoke
MPCM_ensureYMWriteReady
afterMPCM_stopZ80
.
Your installation of Mega PCM 2 is likely incorrect. Revisit installation guide and pay attention to all sound driver modifications. You must always restore YM's DAC register ($2A
) after any write to YM.
Mega PCM 2 guarantees that DAC playback is ultra-clean thanks to its "DMA protection" system, but you should guarantee that you eleminate all Z80 stops on DMA (graphic transfers). See "Step 2. Remove Z80 stops globally" of the installation guide.
Another reason why playback may get slightly worse at times is when the main sound driver writes to YM too frequently (this is the only time where Z80 must be stopped shortly). These shouldn't be too noticeable unless you play a new SFX every frame. Unfortunately, there isn't a proper solution to this, as because there are limits to everything.