Proper CDDA fix for Fantastic Pinball Kyuutenkai (and remove CDDA playthread as it...
[pcsx_rearmed.git] / libpcsxcore / cdrom.c
index 4e312fd..47e4037 100644 (file)
@@ -46,6 +46,7 @@
 
 cdrStruct cdr;
 static unsigned char *pTransfer;
+static s16 read_buf[CD_FRAMESIZE_RAW/2];
 
 /* CD-ROM magic numbers */
 #define CdlSync        0  /* nocash documentation : "Uh, actually, returns error code 40h = Invalid Command...?" */
@@ -434,8 +435,7 @@ static void cdrPlayInterrupt_Autopause()
        u32 abs_lev_max = 0;
        boolean abs_lev_chselect;
        u32 i;
-       s16 read_buf[CD_FRAMESIZE_RAW/2];
-       
+
        if ((cdr.Mode & MODE_AUTOPAUSE) && cdr.TrackChanged) {
                CDR_LOG( "CDDA STOP\n" );
 
@@ -452,7 +452,6 @@ static void cdrPlayInterrupt_Autopause()
        }
        else if (cdr.Mode & MODE_REPORT) {
                CDR_readCDDA(cdr.SetSectorPlay[0], cdr.SetSectorPlay[1], cdr.SetSectorPlay[2], (u8 *)read_buf);
-
                cdr.Result[0] = cdr.StatP;
                cdr.Result[1] = cdr.subq.Track;
                cdr.Result[2] = cdr.subq.Index;
@@ -533,6 +532,12 @@ void cdrPlayInterrupt()
                cdrPlayInterrupt_Autopause();
 
        if (!cdr.Play) return;
+       
+       if (CDR_readCDDA && !cdr.Muted && cdr.Mode & MODE_REPORT) {
+               cdrAttenuate((u8 *)read_buf, CD_FRAMESIZE_RAW / 4, 1);
+               if (SPU_playCDDAchannel)
+                       SPU_playCDDAchannel((u8 *)read_buf, CD_FRAMESIZE_RAW);
+       }
 
        cdr.SetSectorPlay[2]++;
        if (cdr.SetSectorPlay[2] == 75) {