int32 PCECD_Init() { if (!CDIF_Init()) return -1; CDDAVolumeSetting = (double)MDFN_GetSettingUI("pce.cddavolume"); if(CDDAVolumeSetting != 100) { MDFN_printf(_("CD-DA Volume: %d%%\n"), (int)CDDAVolumeSetting); } CDDAVolumeSetting /= 100; CurrentCDVolume = InitialCdVolume = 65536; VolumeStep = InitialCdVolume / 100; bFadeOut = FALSE; bFadeIn = FALSE; ADPCM_SetNotificationFunction(adpcm_state_notification_callback_function); SCSICD_Init(SCSICD_PCE, 1 * pce_overclocked, &sbuf[0], &sbuf[1], 126000 * MDFN_GetSettingUI("pce.cdspeed"), 7159091 * pce_overclocked, CDIRQ, StuffSubchannel); SyncCDVolume(); #ifdef WANT_DEBUGGER MDFNDBG_AddRegGroup(&PCECDRegsGroup); #endif return 0; }
void PCECD_Init(const PCECD_Settings *settings, void (*irqcb)(bool), double master_clock, int32* adbuf, int32* hrbuf_l, int32* hrbuf_r) { try { ADPCM.last_pcm = 0; ADPCM.integrate_accum = 0; ADPCM.lp1p_fstate = 0; memset(ADPCM.lp2p_fstate, 0, sizeof(ADPCM.lp2p_fstate)); lastts = 0; IRQCB = irqcb; ADPCMBuf = adbuf; SCSICD_Init(SCSICD_PCE, 3, hrbuf_l, hrbuf_r, 126000, master_clock, CDIRQ, StuffSubchannel); ADPCM.RAM = new uint8[0x10000]; PCECD_SetSettings(settings); ADPCM.bigdivacc = (int64)((double)master_clock * 65536 / 32087.5); } catch(...) { Cleanup(); throw; } }