变速公式
Posted zhangjianying
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了变速公式相关的知识,希望对你有一定的参考价值。
搞了半天才发现正确的修改时间的公式应该是
本次调整时间 = 上次时间 + (当前获取时间 - 上次获取时间) * speed(调速倍率)
private uint StoredTime =0;
private uint timeGetTime_Hooked()
//Debug.WriteLine("timeGetTime_Hooked :"+ this.trackBar1.Value);
uint current = NativeSocketMethod.timeGetTime();
if(StoredTime ==0)
StoredTime = current;
return StoredTime;
int speed = this.trackBar1.Value;
if(speed==0)
StoredTime =(uint)(StoredTime+(NativeSocketMethod.timeGetTime()- StoredTime));
return StoredTime;
if(isJINENGAtt)
Thread setAttStatusThread = new Thread(setAttStatus);
setAttStatusThread.Start();
// isAttStatus = false;
// isJINENGAtt = false;
StoredTime =(uint)(StoredTime + ((NativeSocketMethod.timeGetTime() - StoredTime) * 0.6f));
return StoredTime;
// return (uint)(StoredTime + ((NativeSocketMethod.timeGetTime() * 2.3f )));
// return (uint)(StoredTime + ((NativeSocketMethod.timeGetTime() - StoredTime)* 2.3f ));
float add = 0;
switch(this.trackBar1.Value)
case 1:
add = 0.35f;
break;
case 2:
add = 0.45f;
break;
case 3:
add = 0.65f;
break;
case 4:
add = 0.75f;
break;
case 5:
add = 0.85f;
// add = 2f;
break;
if(isAttStatus)
// Thread setAttStatusThread = new Thread(setAttStatus);
// setAttStatusThread.Start();
isAttStatus = false;
isJINENGAtt = false;
// return StoredTime+NativeSocketMethod.timeGetTime();
// StoredTime= (uint)(StoredTime + ((NativeSocketMethod.timeGetTime() - StoredTime) * add));
// return StoredTime;
// uint lastTime = NativeSocketMethod.timeGetTime();
StoredTime = (uint)(StoredTime + ((NativeSocketMethod.timeGetTime() - StoredTime) * add));
return StoredTime;
// return (uint)(StoredTime + ((NativeSocketMethod.timeGetTime() - StoredTime) ));
以上是关于变速公式的主要内容,如果未能解决你的问题,请参考以下文章