Lines Matching refs:pWTVoice
58 static EAS_I32 WT_UpdatePhaseInc (S_WT_VOICE *pWTVoice, const S_ARTICULATION *pArt, S_SYNTH_CHANNEL *pChannel, EAS_I32 pitchCents);
59 static EAS_I32 WT_UpdateGain (S_SYNTH_VOICE *pVoice, S_WT_VOICE *pWTVoice, const S_ARTICULATION *pArt, S_SYNTH_CHANNEL *pChannel, EAS_I32 gain);
60 static void WT_UpdateEG1 (S_WT_VOICE *pWTVoice, const S_ENVELOPE *pEnv);
61 static void WT_UpdateEG2 (S_WT_VOICE *pWTVoice, const S_ENVELOPE *pEnv);
69 static void WT_UpdateFilter (S_WT_VOICE *pWTVoice, S_WT_INT_FRAME *pIntFrame, const S_ARTICULATION *pArt);
168 S_WT_VOICE *pWTVoice;
179 pWTVoice = &pVoiceMgr->wtVoices[voiceNum];
180 pArticulation = &pSynth->pEAS->pArticulations[pWTVoice->artIndex];
183 pWTVoice->eg1State = eEnvelopeStateRelease;
184 pWTVoice->eg1Increment = pArticulation->eg1.releaseTime;
193 pWTVoice->eg2State = eEnvelopeStateRelease;
194 pWTVoice->eg2Increment = pArticulation->eg2.releaseTime;
249 S_WT_VOICE *pWTVoice;
260 pWTVoice = &pVoiceMgr->wtVoices[voiceNum];
261 if (pWTVoice->eg1Value < pSynth->pEAS->pArticulations[pWTVoice->artIndex].eg1.sustainLevel)
266 pWTVoice->eg1State = eEnvelopeStateDecay;
312 S_WT_VOICE *pWTVoice;
330 pWTVoice = &pVoiceMgr->wtVoices[voiceNum];
343 pWTVoice->artIndex = pRegion->artIndex;
349 pArt = &pSynth->pEAS->pArticulations[pWTVoice->artIndex];
352 pWTVoice->eg1State = eEnvelopeStateAttack;
353 pWTVoice->eg1Value = 0;
354 pWTVoice->eg1Increment = pArt->eg1.attackTime;
355 pWTVoice->eg2State = eEnvelopeStateAttack;
356 pWTVoice->eg2Value = 0;
357 pWTVoice->eg2Increment = pArt->eg2.attackTime;
360 pWTVoice->modLFO.lfoValue = 0;
361 pWTVoice->modLFO.lfoPhase = -pArt->lfoDelay;
375 EAS_CalcPanControl(pan, &pWTVoice->gainLeft, &pWTVoice->gainRight);
380 pWTVoice->filter.z1 = 0;
381 pWTVoice->filter.z2 = 0;
387 pWTVoice->phaseAccum = 4574296;
388 pWTVoice->loopStart = WT_NOISE_GENERATOR;
389 pWTVoice->loopEnd = 4574295;
398 pWTVoice->phaseAccum = (EAS_U32) pSynth->pEAS->pSamples + pSynth->pEAS->pSampleOffsets[pRegion->waveIndex];
400 pWTVoice->phaseAccum = pSynth->pEAS->pSampleOffsets[pRegion->waveIndex];
402 pWTVoice->phaseAccum = (EAS_U32) pSynth->pEAS->pSamples + pSynth->pEAS->pSampleOffsets[pRegion->waveIndex];
407 pWTVoice->loopStart = pWTVoice->phaseAccum + pRegion->loopStart;
408 pWTVoice->loopEnd = pWTVoice->phaseAccum + pRegion->loopEnd - 1;
411 pWTVoice->loopStart = pWTVoice->loopEnd = pWTVoice->phaseAccum + pSynth->pEAS->pSampleLen[pRegion->waveIndex] - 1;
418 wtConfig.phaseAccum = pWTVoice->phaseAccum;
419 wtConfig.loopStart = pWTVoice->loopStart;
420 wtConfig.loopEnd = pWTVoice->loopEnd;
424 wtConfig.gainLeft = pWTVoice->gainLeft;
425 wtConfig.gainRight = pWTVoice->gainRight;
449 EAS_BOOL WT_CheckSampleEnd (S_WT_VOICE *pWTVoice, S_WT_INT_FRAME *pWTIntFrame, EAS_BOOL update)
458 endPhaseFrac = pWTVoice->phaseFrac + (pWTIntFrame->frame.phaseIncrement << SYNTH_UPDATE_PERIOD_IN_BITS);
459 endPhaseAccum = pWTVoice->phaseAccum + GET_PHASE_INT_PART(endPhaseFrac);
460 if (endPhaseAccum >= pWTVoice->loopEnd)
463 numSamples = (EAS_I32) (pWTVoice->loopEnd - pWTVoice->phaseAccum);
467 numSamples = (EAS_I32) ((numSamples << NUM_PHASE_FRAC_BITS) - pWTVoice->phaseFrac);
486 pWTVoice->phaseFrac = endPhaseFrac;
487 pWTVoice->phaseAccum = endPhaseAccum;
513 S_WT_VOICE *pWTVoice;
527 pWTVoice = &pVoiceMgr->wtVoices[voiceNum];
529 pArt = &pSynth->pEAS->pArticulations[pWTVoice->artIndex];
534 WT_UpdateEG1(pWTVoice, &pArt->eg1);
535 WT_UpdateEG2(pWTVoice, &pArt->eg2);
538 WT_UpdateLFO(&pWTVoice->modLFO, pArt->lfoFreq);
543 WT_UpdateFilter(pWTVoice, &intFrame, pArt);
549 intFrame.frame.gainTarget = WT_UpdateGain(pVoice, pWTVoice, pArt, pChannel, pWTRegion->gain);
559 intFrame.frame.phaseIncrement = WT_UpdatePhaseInc(pWTVoice, pArt, pChannel, temp);
567 if ((pWTVoice->loopStart != WT_NOISE_GENERATOR) && (pWTVoice->loopStart == pWTVoice->loopEnd))
568 done = WT_CheckSampleEnd(pWTVoice, &intFrame, (EAS_BOOL) (voiceNum >= NUM_PRIMARY_VOICES));
581 WT_ProcessVoice(pWTVoice, &intFrame);
587 WT_ProcessVoice(pWTVoice, &intFrame);
594 if ((pVoice->voiceState != eVoiceStateStolen) && (pWTVoice->eg1State == eEnvelopeStateMuted))
626 static EAS_I32 WT_UpdatePhaseInc (S_WT_VOICE *pWTVoice, const S_ARTICULATION *pArt, S_SYNTH_CHANNEL *pChannel, EAS_I32 pitchCents)
639 temp = MULT_EG1_EG1(pWTVoice->modLFO.lfoValue, temp);
648 (MULT_EG1_EG1(pWTVoice->eg2Value, pArt->eg2ToPitch)) +
649 (MULT_EG1_EG1(pWTVoice->modLFO.lfoValue, pArt->lfoToPitch));
736 static EAS_I32 WT_UpdateGain (S_SYNTH_VOICE *pVoice, S_WT_VOICE *pWTVoice, const S_ARTICULATION *pArt, S_SYNTH_CHANNEL *pChannel, EAS_I32 gain)
759 lfoGain = MULT_EG1_EG1(pWTVoice->modLFO.lfoValue, pArt->lfoToGain);
767 temp = (EAS_I16)MULT_EG1_EG1(temp, pWTVoice->eg1Value);
791 static void WT_UpdateEG1 (S_WT_VOICE *pWTVoice, const S_ENVELOPE *pEnv)
795 switch (pWTVoice->eg1State)
798 temp = pWTVoice->eg1Value + pWTVoice->eg1Increment;
807 pWTVoice->eg1State = eEnvelopeStateDecay;
808 pWTVoice->eg1Increment = pEnv->decayTime;
815 temp = MULT_EG1_EG1(pWTVoice->eg1Value, pWTVoice->eg1Increment);
825 pWTVoice->eg1State = eEnvelopeStateSustain;
829 pWTVoice->eg1State = eEnvelopeStateMuted;
838 temp = MULT_EG1_EG1(pWTVoice->eg1Value, pWTVoice->eg1Increment);
844 pWTVoice->eg1State = eEnvelopeStateMuted;
858 pWTVoice->eg1State); */ }
864 pWTVoice->eg1Value = (EAS_I16) temp;
884 static void WT_UpdateEG2 (S_WT_VOICE *pWTVoice, const S_ENVELOPE *pEnv)
888 switch (pWTVoice->eg2State)
891 temp = pWTVoice->eg2Value + pWTVoice->eg2Increment;
900 pWTVoice->eg2State = eEnvelopeStateDecay;
902 pWTVoice->eg2Increment = pEnv->decayTime;
909 temp = pWTVoice->eg2Value -pWTVoice->eg2Increment;
918 pWTVoice->eg2State = eEnvelopeStateSustain;
926 temp = pWTVoice->eg2Value - pWTVoice->eg2Increment;
931 pWTVoice->eg2State = eEnvelopeStateMuted;
946 pWTVoice->eg2State); */ }
951 pWTVoice->eg2Value = (EAS_I16) temp;
1011 static void WT_UpdateFilter (S_WT_VOICE *pWTVoice, S_WT_INT_FRAME *pIntFrame, const S_ARTICULATION *pArt)
1023 cutoff = MULT_EG1_EG1(pWTVoice->eg2Value, pArt->eg2ToFc);