int iRecordMode=0;
int iUseReverb=2;
int iUseInterpolation=2;
-int iDisStereo=0;
// MAIN infos struct for each channel
{ 115, -52 },
{ 98, -55 },
{ 122, -60 } };
-int SSumR[NSSIZE];
-int SSumL[NSSIZE];
+int SSumLR[NSSIZE*2];
int iFMod[NSSIZE];
int iCycle = 0;
short * pS;
{
// We play this block out first...
//if(!(flags&2)) // 1+2: do loop... otherwise: stop
- if(flags!=3 || s_chan[ch].pLoop==NULL) // PETE: if we don't check exactly for 3, loop hang ups will happen (DQ4, for example)
- { // and checking if pLoop is set avoids crashes, yeah
+ if((flags!=3 && flags!=7) // PETE: if we don't check exactly for 3, loop hang ups will happen (DQ4, for example)
+ || s_chan[ch].pLoop==NULL) // and checking if pLoop is set avoids crashes, yeah
+ {
start = (unsigned char*)-1;
+ // Actua Soccer 2, Jungle Book, other games that check for this condition
+ s_chan[ch].ADSRX.EnvelopeVol = 0;
}
else
{
}
}
+ if (start - spuMemC >= 0x80000)
+ start = (unsigned char*)-1;
+
s_chan[ch].pCurr=start; // store values for next cycle
s_chan[ch].s_1=s_1;
s_chan[ch].s_2=s_2;
//////////////////////////////////////////////
// ok, left/right sound volume (psx volume goes from 0 ... 0x3fff)
- SSumL[ns]+=(sval*s_chan[ch].iLeftVolume)/0x4000L;
- SSumR[ns]+=(sval*s_chan[ch].iRightVolume)/0x4000L;
+ SSumLR[ns*2] +=(sval*s_chan[ch].iLeftVolume)/0x4000L;
+ SSumLR[ns*2+1]+=(sval*s_chan[ch].iRightVolume)/0x4000L;
//////////////////////////////////////////////
// now let us store sound data for reverb
///////////////////////////////////////////////////////
// mix all channels (including reverb) into one buffer
- if(iDisStereo) // no stereo?
- {
- int dl, dr;
- for (ns = 0; ns < NSSIZE; ns++)
- {
- SSumL[ns] += MixREVERBLeft(ns);
-
- dl = SSumL[ns] / voldiv; SSumL[ns] = 0;
- if (dl < -32767) dl = -32767; if (dl > 32767) dl = 32767;
-
- SSumR[ns] += MixREVERBRight();
-
- dr = SSumR[ns] / voldiv; SSumR[ns] = 0;
- if (dr < -32767) dr = -32767; if (dr > 32767) dr = 32767;
- *pS++ = (dl + dr) / 2;
- }
- }
- else // stereo:
- for (ns = 0; ns < NSSIZE; ns++)
+ for (ns = 0; ns < NSSIZE*2; )
{
- SSumL[ns] += MixREVERBLeft(ns);
+ SSumLR[ns] += MixREVERBLeft(ns/2);
- d = SSumL[ns] / voldiv; SSumL[ns] = 0;
+ d = SSumLR[ns] / voldiv; SSumLR[ns] = 0;
if (d < -32767) d = -32767; if (d > 32767) d = 32767;
*pS++ = d;
+ ns++;
- SSumR[ns] += MixREVERBRight();
+ SSumLR[ns] += MixREVERBRight();
- d = SSumR[ns] / voldiv; SSumR[ns] = 0;
+ d = SSumLR[ns] / voldiv; SSumLR[ns] = 0;
if(d < -32767) d = -32767; if(d > 32767) d = 32767;
*pS++ = d;
+ ns++;
}
//////////////////////////////////////////////////////
// SETUPTIMER: init of certain buffers and threads/timers
void SetupTimer(void)
{
- memset(SSumR,0,NSSIZE*sizeof(int)); // init some mixing buffers
- memset(SSumL,0,NSSIZE*sizeof(int));
+ memset(SSumLR,0,sizeof(SSumLR)); // init some mixing buffers
memset(iFMod,0,NSSIZE*sizeof(int));
pS=(short *)pSpuBuffer; // setup soundbuffer pointer
(uint32_t *)malloc(16384 * sizeof(uint32_t));
CDDAEnd = CDDAStart + 16384;
CDDAPlay = CDDAStart;
- CDDAFeed = CDDAStart + 1;
+ CDDAFeed = CDDAStart;
for(i=0;i<MAXCHAN;i++) // loop sound channels
{