---------------------------------------------------------------------------------------------- CalcEnvelope ----------------------------------------------------------------------------------------------
| 136 | // CalcEnvelope |
| 137 | //---------------------------------------------------------------------------------------------- |
| 138 | void FeedbackXBOEffect::CalcEnvelope(ULONG Duration, ULONG CurrentPos, LONG *NormalRate, LONG *AttackLevel, LONG *FadeLevel) |
| 139 | { |
| 140 | if( ( DiEffect.dwFlags & FFEP_ENVELOPE ) && DiEffect.lpEnvelope != NULL ) |
| 141 | { |
| 142 | // Calculate attack factor |
| 143 | LONG AttackRate = 0; |
| 144 | ULONG AttackTime = max( (DWORD)1, DiEnvelope.dwAttackTime / 1000 ); |
| 145 | if (CurrentPos < AttackTime) |
| 146 | { |
| 147 | AttackRate = ( AttackTime - CurrentPos ) * 100 / AttackTime; |
| 148 | } |
| 149 | |
| 150 | // Calculate fade factor |
| 151 | LONG FadeRate = 0; |
| 152 | ULONG FadeTime = max( (DWORD)1, DiEnvelope.dwFadeTime / 1000 ); |
| 153 | ULONG FadePos = Duration - FadeTime; |
| 154 | if (FadePos < CurrentPos) |
| 155 | { |
| 156 | FadeRate = ( CurrentPos - FadePos ) * 100 / FadeTime; |
| 157 | } |
| 158 | |
| 159 | *NormalRate = 100 - AttackRate - FadeRate; |
| 160 | *AttackLevel = DiEnvelope.dwAttackLevel * AttackRate; |
| 161 | *FadeLevel = DiEnvelope.dwFadeLevel * FadeRate; |
| 162 | } else { |
| 163 | *NormalRate = 100; |
| 164 | *AttackLevel = 0; |
| 165 | *FadeLevel = 0; |
| 166 | } |
| 167 | } |
| 168 | |
| 169 | void FeedbackXBOEffect::CalcForce(ULONG Duration, ULONG CurrentPos, LONG NormalRate, LONG AttackLevel, LONG FadeLevel, LONG * NormalLevel) |
| 170 | { |
nothing calls this directly
no outgoing calls
no test coverage detected