- int sval;
-
- if(!(dwChannelOn&(1<<ch))) break; // something turned ch off (adsr or flags)
-
- if(s_chan[ch].bFMod==1 && iFMod[ns]) // fmod freq channel
- FModChangeFrequency(ch,ns);
-
- while(s_chan[ch].spos>=0x10000L)
- {
- if(s_chan[ch].iSBPos==28) // 28 reached?
- {
- d = decode_block(ch);
- if(d && iSPUIRQWait) // -> option: wait after irq for main emu
- {
- bIRQReturn=1;
- lastch=ch;
- lastns=ns_to=ns;
- goto ENDX; // do remaining chans unil this ns
- }
- }
-
- fa=s_chan[ch].SB[s_chan[ch].iSBPos++]; // get sample data
-
- StoreInterpolationVal(ch,fa); // store val for later interpolation
-
- s_chan[ch].spos -= 0x10000L;
- }
-
- if(s_chan[ch].bNoise)
- fa=iGetNoiseVal(ch); // get noise val
- else fa=iGetInterpolationVal(ch); // get sample val
-
- sval = (MixADSR(ch) * fa) / 1024; // mix adsr
-
- if(s_chan[ch].bFMod==2) // fmod freq channel
- iFMod[ns]=sval; // -> store 1T sample data, use that to do fmod on next channel
- else // no fmod freq channel
- {
- //////////////////////////////////////////////
- // ok, left/right sound volume (psx volume goes from 0 ... 0x3fff)
-
- 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
-
- if(s_chan[ch].bRVBActive) StoreREVERB(ch,ns,sval);
- }