diff options
author | endolf <[email protected]> | 2005-08-30 19:54:25 +0000 |
---|---|---|
committer | endolf <[email protected]> | 2005-08-30 19:54:25 +0000 |
commit | e4a5aae99eb8c3ce0a68a77da5859d6fd575aae1 (patch) | |
tree | 7882867d50bd3764f426d2f0b521348e24413c4d /plugins/linux/src | |
parent | 321ce0606e9c9178010fd50a96017ca6437a486c (diff) |
It appears as though linux can't cope with scaling the effect, it's on
or off. So i'm having to play with the strong/weak rumble settings.
git-svn-id: file:///home/sven/projects/JOGL/git-svn/svn-server-sync/jinput/trunk@121 e343933a-64c8-49c5-92b1-88f2ce3e89e8
Diffstat (limited to 'plugins/linux/src')
-rw-r--r-- | plugins/linux/src/native/EventDevice.cpp | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/plugins/linux/src/native/EventDevice.cpp b/plugins/linux/src/native/EventDevice.cpp index d5cefbf..b77f2b7 100644 --- a/plugins/linux/src/native/EventDevice.cpp +++ b/plugins/linux/src/native/EventDevice.cpp @@ -430,7 +430,7 @@ void EventDevice::rumble(float force) { if(force<-1) force=-1; //LOG_TRACE("Rumbling at %d%%, (shh, pretend)\n", (int)(force*100)); - if(effect_playing==true && force==0) { + if(effect_playing==true) { stop.type=EV_FF; stop.code = effect.id; stop.value=0; @@ -441,6 +441,24 @@ void EventDevice::rumble(float force) { effect_playing=false; } } + + if(force>0.666666) { + effect.u.rumble.strong_magnitude = (int)(0x8000*force); + effect.u.rumble.weak_magnitude = (int)(0xc000*force); + } else if(force>0.3333333) { + effect.u.rumble.strong_magnitude = (int)(0x8000*force); + effect.u.rumble.weak_magnitude = (int)(0xc000*0); + } else { + effect.u.rumble.strong_magnitude = (int)(0x8000*0); + effect.u.rumble.weak_magnitude = (int)(0xc000*force); + } + + LOG_TRACE("Uploading effect %d\n", effect.id); + if (ioctl(fd, EVIOCSFF, &effect) == -1) { + perror("Upload effect"); + } + LOG_TRACE("Uploaded effect %d\n", effect.id); + if(effect_playing==false && force!=0) { play.type = EV_FF; play.code=effect.id; |