Lines Matching refs:pWTVoice
59 static EAS_I32 WT_UpdatePhaseInc (S_WT_VOICE *pWTVoice, const S_ARTICULATION *pArt, S_SYNTH_CHANNEL *pChannel, EAS_I32 pitchCents);
60 static EAS_I32 WT_UpdateGain (S_SYNTH_VOICE *pVoice, S_WT_VOICE *pWTVoice, const S_ARTICULATION *pArt, S_SYNTH_CHANNEL *pChannel, EAS_I32 gain);
61 static void WT_UpdateEG1 (S_WT_VOICE *pWTVoice, const S_ENVELOPE *pEnv);
62 static void WT_UpdateEG2 (S_WT_VOICE *pWTVoice, const S_ENVELOPE *pEnv);
70 static void WT_UpdateFilter (S_WT_VOICE *pWTVoice, S_WT_INT_FRAME *pIntFrame, const S_ARTICULATION *pArt);
169 S_WT_VOICE *pWTVoice;
180 pWTVoice = &pVoiceMgr->wtVoices[voiceNum];
181 pArticulation = &pSynth->pEAS->pArticulations[pWTVoice->artIndex];
184 pWTVoice->eg1State = eEnvelopeStateRelease;
185 pWTVoice->eg1Increment = pArticulation->eg1.releaseTime;
194 pWTVoice->eg2State = eEnvelopeStateRelease;
195 pWTVoice->eg2Increment = pArticulation->eg2.releaseTime;
250 S_WT_VOICE *pWTVoice;
261 pWTVoice = &pVoiceMgr->wtVoices[voiceNum];
262 if (pWTVoice->eg1Value < pSynth->pEAS->pArticulations[pWTVoice->artIndex].eg1.sustainLevel)
267 pWTVoice->eg1State = eEnvelopeStateDecay;
313 S_WT_VOICE *pWTVoice;
331 pWTVoice = &pVoiceMgr->wtVoices[voiceNum];
344 pWTVoice->artIndex = pRegion->artIndex;
350 pArt = &pSynth->pEAS->pArticulations[pWTVoice->artIndex];
353 pWTVoice->eg1State = eEnvelopeStateAttack;
354 pWTVoice->eg1Value = 0;
355 pWTVoice->eg1Increment = pArt->eg1.attackTime;
356 pWTVoice->eg2State = eEnvelopeStateAttack;
357 pWTVoice->eg2Value = 0;
358 pWTVoice->eg2Increment = pArt->eg2.attackTime;
361 pWTVoice->modLFO.lfoValue = 0;
362 pWTVoice->modLFO.lfoPhase = -pArt->lfoDelay;
376 EAS_CalcPanControl(pan, &pWTVoice->gainLeft, &pWTVoice->gainRight);
381 pWTVoice->filter.z1 = 0;
382 pWTVoice->filter.z2 = 0;
388 pWTVoice->phaseAccum = 4574296;
389 pWTVoice->loopStart = WT_NOISE_GENERATOR;
390 pWTVoice->loopEnd = 4574295;
399 pWTVoice->phaseAccum = (EAS_U32) pSynth->pEAS->pSamples + pSynth->pEAS->pSampleOffsets[pRegion->waveIndex];
401 pWTVoice->phaseAccum = pSynth->pEAS->pSampleOffsets[pRegion->waveIndex];
403 pWTVoice->phaseAccum = (EAS_U32) pSynth->pEAS->pSamples + pSynth->pEAS->pSampleOffsets[pRegion->waveIndex];
409 pWTVoice->loopStart = pWTVoice->phaseAccum + pRegion->loopStart;
410 pWTVoice->loopEnd = pWTVoice->phaseAccum + pRegion->loopEnd - 1;
412 pWTVoice->loopStart = pWTVoice->phaseAccum + (pRegion->loopStart<<1);
413 pWTVoice->loopEnd = pWTVoice->phaseAccum + (pRegion->loopEnd<<1) - 2;
418 pWTVoice->loopStart = pWTVoice->loopEnd = pWTVoice->phaseAccum + pSynth->pEAS->pSampleLen[pRegion->waveIndex] - 1;
420 pWTVoice->loopStart = pWTVoice->loopEnd = pWTVoice->phaseAccum + pSynth->pEAS->pSampleLen[pRegion->waveIndex] - 2;
429 wtConfig.phaseAccum = pWTVoice->phaseAccum;
430 wtConfig.loopStart = pWTVoice->loopStart;
431 wtConfig.loopEnd = pWTVoice->loopEnd;
435 wtConfig.gainLeft = pWTVoice->gainLeft;
436 wtConfig.gainRight = pWTVoice->gainRight;
460 EAS_BOOL WT_CheckSampleEnd (S_WT_VOICE *pWTVoice, S_WT_INT_FRAME *pWTIntFrame, EAS_BOOL update)
469 endPhaseFrac = pWTVoice->phaseFrac + (pWTIntFrame->frame.phaseIncrement << SYNTH_UPDATE_PERIOD_IN_BITS);
471 endPhaseAccum = pWTVoice->phaseAccum + GET_PHASE_INT_PART(endPhaseFrac);
474 endPhaseAccum = pWTVoice->phaseAccum + (EAS_U32)(endPhaseFrac >> 14);
476 if (endPhaseAccum >= pWTVoice->loopEnd)
479 numSamples = (EAS_I32) (pWTVoice->loopEnd - pWTVoice->phaseAccum);
485 numSamples = (EAS_I32) ((numSamples << NUM_PHASE_FRAC_BITS) - pWTVoice->phaseFrac);
504 pWTVoice->phaseFrac = endPhaseFrac;
505 pWTVoice->phaseAccum = endPhaseAccum;
531 S_WT_VOICE *pWTVoice;
545 pWTVoice = &pVoiceMgr->wtVoices[voiceNum];
547 pArt = &pSynth->pEAS->pArticulations[pWTVoice->artIndex];
552 WT_UpdateEG1(pWTVoice, &pArt->eg1);
553 WT_UpdateEG2(pWTVoice, &pArt->eg2);
556 WT_UpdateLFO(&pWTVoice->modLFO, pArt->lfoFreq);
561 WT_UpdateFilter(pWTVoice, &intFrame, pArt);
567 intFrame.frame.gainTarget = WT_UpdateGain(pVoice, pWTVoice, pArt, pChannel, pWTRegion->gain);
577 intFrame.frame.phaseIncrement = WT_UpdatePhaseInc(pWTVoice, pArt, pChannel, temp);
578 temp = pWTVoice->loopEnd - pWTVoice->loopStart;
585 ALOGW("%p phaseIncrement=%d", pWTVoice, (int)intFrame.frame.phaseIncrement);
596 if ((pWTVoice->loopStart != WT_NOISE_GENERATOR) && (pWTVoice->loopStart == pWTVoice->loopEnd))
597 done = WT_CheckSampleEnd(pWTVoice, &intFrame, (EAS_BOOL) (voiceNum >= NUM_PRIMARY_VOICES));
610 WT_ProcessVoice(pWTVoice, &intFrame);
616 WT_ProcessVoice(pWTVoice, &intFrame);
623 if ((pVoice->voiceState != eVoiceStateStolen) && (pWTVoice->eg1State == eEnvelopeStateMuted))
655 static EAS_I32 WT_UpdatePhaseInc (S_WT_VOICE *pWTVoice, const S_ARTICULATION *pArt, S_SYNTH_CHANNEL *pChannel, EAS_I32 pitchCents)
668 temp = MULT_EG1_EG1(pWTVoice->modLFO.lfoValue, temp);
677 (MULT_EG1_EG1(pWTVoice->eg2Value, pArt->eg2ToPitch)) +
678 (MULT_EG1_EG1(pWTVoice->modLFO.lfoValue, pArt->lfoToPitch));
765 static EAS_I32 WT_UpdateGain (S_SYNTH_VOICE *pVoice, S_WT_VOICE *pWTVoice, const S_ARTICULATION *pArt, S_SYNTH_CHANNEL *pChannel, EAS_I32 gain)
788 lfoGain = MULT_EG1_EG1(pWTVoice->modLFO.lfoValue, pArt->lfoToGain);
796 temp = (EAS_I16)MULT_EG1_EG1(temp, pWTVoice->eg1Value);
820 static void WT_UpdateEG1 (S_WT_VOICE *pWTVoice, const S_ENVELOPE *pEnv)
824 switch (pWTVoice->eg1State)
827 temp = pWTVoice->eg1Value + pWTVoice->eg1Increment;
836 pWTVoice->eg1State = eEnvelopeStateDecay;
837 pWTVoice->eg1Increment = pEnv->decayTime;
844 temp = MULT_EG1_EG1(pWTVoice->eg1Value, pWTVoice->eg1Increment);
854 pWTVoice->eg1State = eEnvelopeStateSustain;
858 pWTVoice->eg1State = eEnvelopeStateMuted;
867 temp = MULT_EG1_EG1(pWTVoice->eg1Value, pWTVoice->eg1Increment);
873 pWTVoice->eg1State = eEnvelopeStateMuted;
887 pWTVoice->eg1State); */ }
893 pWTVoice->eg1Value = (EAS_I16) temp;
913 static void WT_UpdateEG2 (S_WT_VOICE *pWTVoice, const S_ENVELOPE *pEnv)
917 switch (pWTVoice->eg2State)
920 temp = pWTVoice->eg2Value + pWTVoice->eg2Increment;
929 pWTVoice->eg2State = eEnvelopeStateDecay;
931 pWTVoice->eg2Increment = pEnv->decayTime;
938 temp = pWTVoice->eg2Value -pWTVoice->eg2Increment;
947 pWTVoice->eg2State = eEnvelopeStateSustain;
955 temp = pWTVoice->eg2Value - pWTVoice->eg2Increment;
960 pWTVoice->eg2State = eEnvelopeStateMuted;
975 pWTVoice->eg2State); */ }
980 pWTVoice->eg2Value = (EAS_I16) temp;
1040 static void WT_UpdateFilter (S_WT_VOICE *pWTVoice, S_WT_INT_FRAME *pIntFrame, const S_ARTICULATION *pArt)
1052 cutoff = MULT_EG1_EG1(pWTVoice->eg2Value, pArt->eg2ToFc);