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

Method EffectProc

XBOBTFF/FFDriver.cpp:638–667  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

636}
637
638void FeedbackXBOBT::EffectProc( void *params )
639{
640 FeedbackXBOBT *cThis = (FeedbackXBOBT *)params;
641
642 LONG LeftLevel = 0;
643 LONG RightLevel = 0;
644 LONG ltLevel = 0;
645 LONG rtLevel = 0;
646 LONG Gain = cThis->Gain;
647 LONG CalcResult = 0;
648
649 if (cThis->Actuator == true)
650 {
651 for (FeedbackXBOEffectIterator effectIterator = cThis->EffectList.begin(); effectIterator != cThis->EffectList.end(); ++effectIterator)
652 {
653 if(((CurrentTimeUsingMach() - cThis->LastTime)*1000*1000) >= effectIterator->DiEffect.dwSamplePeriod) {
654 CalcResult = effectIterator->Calc(&LeftLevel, &RightLevel, &ltLevel, &rtLevel);
655 }
656 }
657 }
658
659 if ((cThis->PrvLeftLevel != LeftLevel || cThis->PrvRightLevel != RightLevel) && (CalcResult != -1))
660 {
661 //fprintf(stderr, "PL: %d, PR: %d; L: %d, R: %d; \n", cThis->PrvLeftLevel, cThis->PrvRightLevel, LeftLevel, RightLevel);
662 cThis->SetForce((unsigned char)min(SCALE_MAX, LeftLevel * Gain / 10000),(unsigned char)min(SCALE_MAX, RightLevel * Gain / 10000 ), (unsigned char)min(SCALE_MAX, ltLevel * Gain / 10000), (unsigned char)min(SCALE_MAX, rtLevel * Gain / 10000));
663
664 cThis->PrvLeftLevel = LeftLevel;
665 cThis->PrvRightLevel = RightLevel;
666 }
667}
668
669HRESULT FeedbackXBOBT::GetEffectStatus(FFEffectDownloadID EffectHandle, FFEffectStatusFlag *Status)
670{

Callers

nothing calls this directly

Calls 3

CurrentTimeUsingMachFunction · 0.70
CalcMethod · 0.45
SetForceMethod · 0.45

Tested by

no test coverage detected