StartADSR(ch);
StartREVERB(ch);
- s_chan[ch].pCurr=s_chan[ch].pStart; // set sample start
+ // fussy timing issues - do in VoiceOn
+ //s_chan[ch].pCurr=s_chan[ch].pStart; // set sample start
+ //s_chan[ch].bStop=0;
+ //s_chan[ch].bOn=1;
s_chan[ch].s_1=0; // init mixing vars
s_chan[ch].s_2=0;
s_chan[ch].iSBPos=28;
s_chan[ch].bNew=0; // init channel flags
- s_chan[ch].bStop=0;
- s_chan[ch].bOn=1;
s_chan[ch].SB[29]=0; // init our interpolation helpers
s_chan[ch].SB[30]=0;
static void *MAINThread(void *arg)
{
- int s_1,s_2,fa,ns;
+ int s_1,s_2,fa,ns,ns_from,ns_to;
#if !defined(_MACOSX) && !defined(__arm__)
int voldiv = iVolume;
#else
//--------------------------------------------------// continue from irq handling in timer mode?
+ ns_from=0;
+ ns_to=NSSIZE;
+ ch=0;
if(lastch>=0) // will be -1 if no continue is pending
{
- ch=lastch; ns=lastns; lastch=-1; // -> setup all kind of vars to continue
- goto GOON; // -> directly jump to the continue point
+ ch=lastch; ns_from=lastns+1; lastch=-1; // -> setup all kind of vars to continue
}
//--------------------------------------------------//
//- main channel loop -//
//--------------------------------------------------//
{
- for(ch=0;ch<MAXCHAN;ch++) // loop em all... we will collect 1 ms of sound of each playing channel
+ for(;ch<MAXCHAN;ch++) // loop em all... we will collect 1 ms of sound of each playing channel
{
if(s_chan[ch].bNew) StartSound(ch); // start new sound
if(!s_chan[ch].bOn) continue; // channel not playing? next
if(s_chan[ch].iActFreq!=s_chan[ch].iUsedFreq) // new psx frequency?
VoiceChangeFrequency(ch);
- ns=0;
- while(ns<NSSIZE) // loop until 1 ms of data is reached
+ for(ns=ns_from;ns<ns_to;ns++) // loop until 1 ms of data is reached
{
if(s_chan[ch].bFMod==1 && iFMod[ns]) // fmod freq channel
FModChangeFrequency(ch,ns);
{
iSpuAsyncWait=1;
bIRQReturn=1;
+ lastch=ch;
+ lastns=ns;
+ ns_to=ns+1;
}
}
}
s_chan[ch].s_1=s_1;
s_chan[ch].s_2=s_2;
- if(bIRQReturn) // special return for "spu irq - wait for cpu action"
- {
- bIRQReturn=0;
- if(iUseTimer!=2)
- {
- DWORD dwWatchTime=timeGetTime_spu()+2500;
-
- while(iSpuAsyncWait && !bEndThread &&
- timeGetTime_spu()<dwWatchTime)
- usleep(1000L);
- }
- else
- {
- lastch=ch;
- lastns=ns;
-
- return 0;
- }
- }
-
GOON: ;
}
////////////////////////////////////////////////
// ok, go on until 1 ms data of this channel is collected
- ns++;
s_chan[ch].spos += s_chan[ch].sinc;
-
}
ENDX: ;
}
}
+ if(bIRQReturn) // special return for "spu irq - wait for cpu action"
+ {
+ bIRQReturn=0;
+ if(iUseTimer!=2)
+ {
+ DWORD dwWatchTime=timeGetTime_spu()+2500;
+
+ while(iSpuAsyncWait && !bEndThread &&
+ timeGetTime_spu()<dwWatchTime)
+ usleep(1000L);
+ continue;
+ }
+ else
+ {
+ return 0;
+ }
+ }
+
+
//---------------------------------------------------//
//- here we have another 1 ms of sound data
//---------------------------------------------------//
pMixIrq = 0;
memset((void *)s_chan, 0, (MAXCHAN + 1) * sizeof(SPUCHAN));
pSpuIrq = 0;
- iSPUIRQWait = 0;
+ //iSPUIRQWait = 0;
lastch = -1;
- ReadConfigSPU(); // read user stuff
+ //ReadConfigSPU(); // read user stuff
SetupStreams(); // prepare streaming
return 0;
#ifdef _MACOSX
DoConfiguration();
#else
- StartCfgTool("CFG");
+// StartCfgTool("CFG");
#endif
return 0;
}
#ifdef _MACOSX
DoAbout();
#else
- StartCfgTool("ABOUT");
+// StartCfgTool("ABOUT");
#endif
}