Lines Matching refs:pWTVoice
55 static EAS_I32 WT_UpdatePhaseInc (S_WT_VOICE *pWTVoice, const S_ARTICULATION *pArt, S_SYNTH_CHANNEL *pChannel, EAS_I32 pitchCents);
56 static EAS_I32 WT_UpdateGain (S_SYNTH_VOICE *pVoice, S_WT_VOICE *pWTVoice, const S_ARTICULATION *pArt, S_SYNTH_CHANNEL *pChannel, EAS_I32 gain);
57 static void WT_UpdateEG1 (S_WT_VOICE *pWTVoice, const S_ENVELOPE *pEnv);
58 static void WT_UpdateEG2 (S_WT_VOICE *pWTVoice, const S_ENVELOPE *pEnv);
66 static void WT_UpdateFilter (S_WT_VOICE *pWTVoice, S_WT_INT_FRAME *pIntFrame, const S_ARTICULATION *pArt);
165 S_WT_VOICE *pWTVoice;
176 pWTVoice = &pVoiceMgr->wtVoices[voiceNum];
177 pArticulation = &pSynth->pEAS->pArticulations[pWTVoice->artIndex];
180 pWTVoice->eg1State = eEnvelopeStateRelease;
181 pWTVoice->eg1Increment = pArticulation->eg1.releaseTime;
190 pWTVoice->eg2State = eEnvelopeStateRelease;
191 pWTVoice->eg2Increment = pArticulation->eg2.releaseTime;
246 S_WT_VOICE *pWTVoice;
257 pWTVoice = &pVoiceMgr->wtVoices[voiceNum];
258 if (pWTVoice->eg1Value < pSynth->pEAS->pArticulations[pWTVoice->artIndex].eg1.sustainLevel)
263 pWTVoice->eg1State = eEnvelopeStateDecay;
309 S_WT_VOICE *pWTVoice;
327 pWTVoice = &pVoiceMgr->wtVoices[voiceNum];
340 pWTVoice->artIndex = pRegion->artIndex;
346 pArt = &pSynth->pEAS->pArticulations[pWTVoice->artIndex];
349 pWTVoice->eg1State = eEnvelopeStateAttack;
350 pWTVoice->eg1Value = 0;
351 pWTVoice->eg1Increment = pArt->eg1.attackTime;
352 pWTVoice->eg2State = eEnvelopeStateAttack;
353 pWTVoice->eg2Value = 0;
354 pWTVoice->eg2Increment = pArt->eg2.attackTime;
357 pWTVoice->modLFO.lfoValue = 0;
358 pWTVoice->modLFO.lfoPhase = -pArt->lfoDelay;
372 EAS_CalcPanControl(pan, &pWTVoice->gainLeft, &pWTVoice->gainRight);
377 pWTVoice->filter.z1 = 0;
378 pWTVoice->filter.z2 = 0;
384 pWTVoice->phaseAccum = 4574296;
385 pWTVoice->loopStart = WT_NOISE_GENERATOR;
386 pWTVoice->loopEnd = 4574295;
395 pWTVoice->phaseAccum = (EAS_U32) pSynth->pEAS->pSamples + pSynth->pEAS->pSampleOffsets[pRegion->waveIndex];
397 pWTVoice->phaseAccum = pSynth->pEAS->pSampleOffsets[pRegion->waveIndex];
399 pWTVoice->phaseAccum = (EAS_U32) pSynth->pEAS->pSamples + pSynth->pEAS->pSampleOffsets[pRegion->waveIndex];
404 pWTVoice->loopStart = pWTVoice->phaseAccum + pRegion->loopStart;
405 pWTVoice->loopEnd = pWTVoice->phaseAccum + pRegion->loopEnd - 1;
408 pWTVoice->loopStart = pWTVoice->loopEnd = pWTVoice->phaseAccum + pSynth->pEAS->pSampleLen[pRegion->waveIndex] - 1;
415 wtConfig.phaseAccum = pWTVoice->phaseAccum;
416 wtConfig.loopStart = pWTVoice->loopStart;
417 wtConfig.loopEnd = pWTVoice->loopEnd;
421 wtConfig.gainLeft = pWTVoice->gainLeft;
422 wtConfig.gainRight = pWTVoice->gainRight;
446 EAS_BOOL WT_CheckSampleEnd (S_WT_VOICE *pWTVoice, S_WT_INT_FRAME *pWTIntFrame, EAS_BOOL update)
455 endPhaseFrac = pWTVoice->phaseFrac + (pWTIntFrame->frame.phaseIncrement << SYNTH_UPDATE_PERIOD_IN_BITS);
456 endPhaseAccum = pWTVoice->phaseAccum + GET_PHASE_INT_PART(endPhaseFrac);
457 if (endPhaseAccum >= pWTVoice->loopEnd)
460 numSamples = (EAS_I32) (pWTVoice->loopEnd - pWTVoice->phaseAccum);
464 numSamples = (EAS_I32) ((numSamples << NUM_PHASE_FRAC_BITS) - pWTVoice->phaseFrac);
478 pWTVoice->phaseFrac = endPhaseFrac;
479 pWTVoice->phaseAccum = endPhaseAccum;
505 S_WT_VOICE *pWTVoice;
519 pWTVoice = &pVoiceMgr->wtVoices[voiceNum];
521 pArt = &pSynth->pEAS->pArticulations[pWTVoice->artIndex];
526 WT_UpdateEG1(pWTVoice, &pArt->eg1);
527 WT_UpdateEG2(pWTVoice, &pArt->eg2);
530 WT_UpdateLFO(&pWTVoice->modLFO, pArt->lfoFreq);
535 WT_UpdateFilter(pWTVoice, &intFrame, pArt);
541 intFrame.frame.gainTarget = WT_UpdateGain(pVoice, pWTVoice, pArt, pChannel, pWTRegion->gain);
551 intFrame.frame.phaseIncrement = WT_UpdatePhaseInc(pWTVoice, pArt, pChannel, temp);
559 if ((pWTVoice->loopStart != WT_NOISE_GENERATOR) && (pWTVoice->loopStart == pWTVoice->loopEnd))
560 done = WT_CheckSampleEnd(pWTVoice, &intFrame, (EAS_BOOL) (voiceNum >= NUM_PRIMARY_VOICES));
570 WT_ProcessVoice(pWTVoice, &intFrame);
576 WT_ProcessVoice(pWTVoice, &intFrame);
583 if ((pVoice->voiceState != eVoiceStateStolen) && (pWTVoice->eg1State == eEnvelopeStateMuted))
615 static EAS_I32 WT_UpdatePhaseInc (S_WT_VOICE *pWTVoice, const S_ARTICULATION *pArt, S_SYNTH_CHANNEL *pChannel, EAS_I32 pitchCents)
628 temp = MULT_EG1_EG1(pWTVoice->modLFO.lfoValue, temp);
637 (MULT_EG1_EG1(pWTVoice->eg2Value, pArt->eg2ToPitch)) +
638 (MULT_EG1_EG1(pWTVoice->modLFO.lfoValue, pArt->lfoToPitch));
725 static EAS_I32 WT_UpdateGain (S_SYNTH_VOICE *pVoice, S_WT_VOICE *pWTVoice, const S_ARTICULATION *pArt, S_SYNTH_CHANNEL *pChannel, EAS_I32 gain)
748 lfoGain = MULT_EG1_EG1(pWTVoice->modLFO.lfoValue, pArt->lfoToGain);
756 temp = (EAS_I16)MULT_EG1_EG1(temp, pWTVoice->eg1Value);
780 static void WT_UpdateEG1 (S_WT_VOICE *pWTVoice, const S_ENVELOPE *pEnv)
784 switch (pWTVoice->eg1State)
787 temp = pWTVoice->eg1Value + pWTVoice->eg1Increment;
796 pWTVoice->eg1State = eEnvelopeStateDecay;
797 pWTVoice->eg1Increment = pEnv->decayTime;
804 temp = MULT_EG1_EG1(pWTVoice->eg1Value, pWTVoice->eg1Increment);
814 pWTVoice->eg1State = eEnvelopeStateSustain;
818 pWTVoice->eg1State = eEnvelopeStateMuted;
827 temp = MULT_EG1_EG1(pWTVoice->eg1Value, pWTVoice->eg1Increment);
833 pWTVoice->eg1State = eEnvelopeStateMuted;
847 pWTVoice->eg1State); */ }
853 pWTVoice->eg1Value = (EAS_I16) temp;
873 static void WT_UpdateEG2 (S_WT_VOICE *pWTVoice, const S_ENVELOPE *pEnv)
877 switch (pWTVoice->eg2State)
880 temp = pWTVoice->eg2Value + pWTVoice->eg2Increment;
889 pWTVoice->eg2State = eEnvelopeStateDecay;
891 pWTVoice->eg2Increment = pEnv->decayTime;
898 temp = pWTVoice->eg2Value -pWTVoice->eg2Increment;
907 pWTVoice->eg2State = eEnvelopeStateSustain;
915 temp = pWTVoice->eg2Value - pWTVoice->eg2Increment;
920 pWTVoice->eg2State = eEnvelopeStateMuted;
935 pWTVoice->eg2State); */ }
940 pWTVoice->eg2Value = (EAS_I16) temp;
1000 static void WT_UpdateFilter (S_WT_VOICE *pWTVoice, S_WT_INT_FRAME *pIntFrame, const S_ARTICULATION *pArt)
1012 cutoff = MULT_EG1_EG1(pWTVoice->eg2Value, pArt->eg2ToFc);