spu: handle loop write vs loop flag race (bIgnoreLoop alternative)
[pcsx_rearmed.git] / plugins / dfsound / externals.h
index 73134d0..c9f20ca 100644 (file)
@@ -46,7 +46,8 @@
 \r
 // ~ 1 ms of data\r
 // note: must be even due to the way reverb works now\r
-#define NSSIZE 46\r
+#define FRAG_MSECS 2\r
+#define NSSIZE ((44100 * FRAG_MSECS / 1000 + 1) & ~1)\r
 \r
 ///////////////////////////////////////////////////////////\r
 // struct defines\r
@@ -106,32 +107,22 @@ typedef struct
  int               spos;\r
  int               sinc;\r
 \r
- unsigned char *   pStart;                             // start ptr into sound mem\r
  unsigned char *   pCurr;                              // current pos in sound mem\r
  unsigned char *   pLoop;                              // loop ptr in sound mem\r
 \r
  unsigned int      bStop:1;                            // is channel stopped (sample _can_ still be playing, ADSR Release phase)\r
  unsigned int      bReverb:1;                          // can we do reverb on this channel? must have ctrl register bit, to get active\r
- unsigned int      bIgnoreLoop:1;                      // ignore loop bit, if an external loop address is used\r
  unsigned int      bRVBActive:1;                       // reverb active flag\r
  unsigned int      bNoise:1;                           // noise active flag\r
  unsigned int      bFMod:2;                            // freq mod (0=off, 1=sound channel, 2=freq channel)\r
+ unsigned int      bJump:1;                            // last decoded block jumped\r
 \r
- int               iActFreq;                           // current psx pitch\r
- int               iUsedFreq;                          // current pc pitch\r
  int               iLeftVolume;                        // left volume\r
  int               iRightVolume;                       // right volume\r
- int               s_1;                                // last decoding infos\r
- int               s_2;\r
  ADSRInfoEx        ADSRX;\r
  int               iRawPitch;                          // raw pitch (0...3fff)\r
 \r
- int               iRVBOffset;                         // reverb offset\r
- int               iRVBRepeat;                         // reverb repeat\r
- int               iRVBNum;                            // another reverb helper\r
- int               iOldNoise;                          // old noise val for this channel   \r
-\r
- int               SB[32+32];\r
+ int               SB[32+4];\r
 } SPUCHAN;\r
 \r
 ///////////////////////////////////////////////////////////\r
@@ -205,6 +196,9 @@ extern unsigned char * spuMemC;
 extern unsigned char * pSpuIrq;\r
 extern unsigned char * pSpuBuffer;\r
 \r
+#define regAreaGet(ch,offset) \\r
+  regArea[((ch<<4)|(offset))>>1]\r
+\r
 // user settings\r
 \r
 extern int        iVolume;\r
@@ -233,6 +227,7 @@ extern int      bSpuInit;
 extern unsigned int dwNewChannel;\r
 extern unsigned int dwChannelOn;\r
 extern unsigned int dwPendingChanOff;\r
+extern unsigned int dwChannelDead;\r
 \r
 extern int      SSumR[];\r
 extern int      SSumL[];\r