MCPcopy Create free account
hub / github.com/360Controller/360Controller / EffectProc

Method EffectProc

Feedback360/Feedback360.cpp:602–629  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

600}
601
602void Feedback360::EffectProc( void *params )
603{
604 Feedback360 *cThis = (Feedback360 *)params;
605
606 LONG LeftLevel = 0;
607 LONG RightLevel = 0;
608 LONG Gain = cThis->Gain;
609 LONG CalcResult = 0;
610
611 if (cThis->Actuator == true)
612 {
613 for (Feedback360EffectIterator effectIterator = cThis->EffectList.begin(); effectIterator != cThis->EffectList.end(); ++effectIterator)
614 {
615 if(((CurrentTimeUsingMach() - cThis->LastTime)*1000*1000) >= effectIterator->DiEffect.dwSamplePeriod) {
616 CalcResult = effectIterator->Calc(&LeftLevel, &RightLevel);
617 }
618 }
619 }
620
621 if ((cThis->PrvLeftLevel != LeftLevel || cThis->PrvRightLevel != RightLevel) && (CalcResult != -1))
622 {
623 //fprintf(stderr, "PL: %d, PR: %d; L: %d, R: %d; \n", cThis->PrvLeftLevel, cThis->PrvRightLevel, LeftLevel, RightLevel);
624 cThis->SetForce((unsigned char)min(SCALE_MAX, LeftLevel * Gain / 10000),(unsigned char)min(SCALE_MAX, RightLevel * Gain / 10000 ));
625
626 cThis->PrvLeftLevel = LeftLevel;
627 cThis->PrvRightLevel = RightLevel;
628 }
629}
630
631HRESULT Feedback360::GetEffectStatus(FFEffectDownloadID EffectHandle, FFEffectStatusFlag *Status)
632{

Callers

nothing calls this directly

Calls 3

CurrentTimeUsingMachFunction · 0.70
CalcMethod · 0.45
SetForceMethod · 0.45

Tested by

no test coverage detected