모종의 음모/force feedback

fftest 소스코드와 설정 값

구차니 2024. 10. 13. 21:55

아래 소스를 보고 설정을 보니 조금 이해가 가는 느낌 0.1mg

/* download a periodic sinusoidal effect */
memset(&effects[0],0,sizeof(effects[0]));
effects[0].type = FF_PERIODIC;
effects[0].id = -1;
effects[0].u.periodic.waveform = FF_SINE;
effects[0].u.periodic.period = 100; /* 0.1 second */
effects[0].u.periodic.magnitude = 0x7fff; /* 0.5 * Maximum magnitude */
effects[0].u.periodic.offset = 0;
effects[0].u.periodic.phase = 0;
effects[0].direction = 0x4000; /* Along X axis */
effects[0].u.periodic.envelope.attack_length = 1000;
effects[0].u.periodic.envelope.attack_level = 0x7fff;
effects[0].u.periodic.envelope.fade_length = 1000;
effects[0].u.periodic.envelope.fade_level = 0x7fff;
effects[0].trigger.button = 0;
effects[0].trigger.interval = 0;
effects[0].replay.length = 20000;  /* 20 seconds */
effects[0].replay.delay = 1000;

/* download a constant effect */
effects[1].type = FF_CONSTANT;
effects[1].id = -1;
effects[1].u.constant.level = 0x2000; /* Strength : 25 % */
effects[1].direction = 0x6000; /* 135 degrees */
effects[1].u.constant.envelope.attack_length = 1000;
effects[1].u.constant.envelope.attack_level = 0x1000;
effects[1].u.constant.envelope.fade_length = 1000;
effects[1].u.constant.envelope.fade_level = 0x1000;
effects[1].trigger.button = 0;
effects[1].trigger.interval = 0;
effects[1].replay.length = 20000;  /* 20 seconds */
effects[1].replay.delay = 0;

/* download a condition spring effect */
effects[2].type = FF_SPRING;
effects[2].id = -1;
effects[2].u.condition[0].right_saturation = 0x7fff;
effects[2].u.condition[0].left_saturation = 0x7fff;
effects[2].u.condition[0].right_coeff = 0x2000;
effects[2].u.condition[0].left_coeff = 0x2000;
effects[2].u.condition[0].deadband = 0x0;
effects[2].u.condition[0].center = 0x0;
effects[2].u.condition[1] = effects[2].u.condition[0];
effects[2].trigger.button = 0;
effects[2].trigger.interval = 0;
effects[2].replay.length = 20000;  /* 20 seconds */
effects[2].replay.delay = 0;

/* download a condition damper effect */
effects[3].type = FF_DAMPER;
effects[3].id = -1;
effects[3].u.condition[0].right_saturation = 0x7fff;
effects[3].u.condition[0].left_saturation = 0x7fff;
effects[3].u.condition[0].right_coeff = 0x2000;
effects[3].u.condition[0].left_coeff = 0x2000;
effects[3].u.condition[0].deadband = 0x0;
effects[3].u.condition[0].center = 0x0;
effects[3].u.condition[1] = effects[3].u.condition[0];
effects[3].trigger.button = 0;
effects[3].trigger.interval = 0;
effects[3].replay.length = 20000;  /* 20 seconds */
effects[3].replay.delay = 0;

/* a strong rumbling effect */
effects[4].type = FF_RUMBLE;
effects[4].id = -1;
effects[4].u.rumble.strong_magnitude = 0x8000;
effects[4].u.rumble.weak_magnitude = 0;
effects[4].replay.length = 5000;
effects[4].replay.delay = 1000;

/* a weak rumbling effect */
effects[5].type = FF_RUMBLE;
effects[5].id = -1;
effects[5].u.rumble.strong_magnitude = 0;
effects[5].u.rumble.weak_magnitude = 0xc000;
effects[5].replay.length = 5000;
effects[5].replay.delay = 0;

[링크 : https://github.com/flosse/linuxconsole/blob/master/utils/fftest.c]

[링크 : https://www.kernel.org/doc/html/v5.2/input/ff.html] 리눅스 커널에서의 ffb 내용

 

weak/strong rumble 하려면 다 안넣어줘도 된다는 거군..

 

attack fade는 충격의 앞/뒤라고 보면 될 듯

[링크 : https://learn.microsoft.com/en-us/previous-versions/windows/desktop/ee416225(v=vs.85)]