 |
WiiLi.org a new revolution
|
| View previous topic :: View next topic |
| Author |
Message |
ijed
Joined: 22 Feb 2007 Posts: 7
Digg It |
Posted: Thu Feb 22, 2007 9:07 pm Post subject: wiimote to midi cc data problem |
|
|
hi,
have posted this in the scripts section but thought this might be a GlovePIE issue and not a scripting issue.
trying to map the CC parameters 0..31 to wii+chuk movements:
| Code: |
var.c5 = floor(MapEnsureRange(Wiimote1.roll, -180,180, 0, 128))
midi.PortamentoTime = var.c5
|
I get a nice even roll when I look at the variable window but
when I look at the data in MidiOX it seems to only set the fine value
and when I use just midi.PortamentoTimeCoarse it doesn't respond at all.
It seems to work if I set the MIDI control in my program to read the fine CC (i.e 37) and set GlovePIE to output to both (i.e CC5) but then will only respond to a control change of 40-43 (4 positions)
Any ideas?
and will using the force data:
| Code: |
var.c5 = floor(MapEnsureRange(Wiimote1.Nunchuk.RawForceX, -47,47, 0,128))
midi.PortamentoTime = var.c5
|
work the same way?
Thanks, I'm so close...
BTW using GlovePIE 0.29 |
|
| Back to top |
|
 |
ijed
Joined: 22 Feb 2007 Posts: 7
Digg It |
Posted: Fri Feb 23, 2007 7:39 am Post subject: |
|
|
i finally figured it out thanks to this bit from wiimote2midi.pie on crustea dot vjfrance dot com :
| Code: |
var.xRot = Wiimote.RawForceX + var.xOffset
midi1.Slider1 = (MapRange(var.xRot, 26,-26, 1,128)-1)/127
|
So a floating point between 0..1 sets the coarse and fine values of the controller from 0..256.
I can't believe I missed that
Yay! Let the fun begin... |
|
| Back to top |
|
 |
Vattu
Joined: 11 Jan 2007 Posts: 96
Digg It |
Posted: Fri Feb 23, 2007 8:35 am Post subject: |
|
|
I changed the 2nd line. it does the same thing, but with less calculations. And I think it's better to change MapRange to EnsureMapRange, since I don't know how the program reacts if it gets slider-data below -1 or over 1.
| Code: | var.xRot = Wiimote.RawForceX + var.xOffset
midi1.Slider1 = (EnsureMapRange(var.xRot, 26,-26, 0,1) |
|
|
| Back to top |
|
 |
crustea
Joined: 23 Feb 2007 Posts: 4
Digg It |
Posted: Fri Feb 23, 2007 4:50 pm Post subject: |
|
|
Wicked, thanks Vattu !
Also, I changed midi.sliders to midi.Control31, 32 and 33, and it fixed a bug (extra jumping CC values coming from nowhere..)
new script here:
crustea -dot- vjfrance -dot- com -slash- article-127406.html |
|
| Back to top |
|
 |
crustea
Joined: 23 Feb 2007 Posts: 4
Digg It |
Posted: Fri Feb 23, 2007 4:54 pm Post subject: |
|
|
Also, I didn't manage to map the CC values from 0 to 100 instead of 0 to 127.. especially with the new:
(EnsureMapRange(var.xRot, 26,-26, 0,1)
Any ideas ? is EnsureMapRange documented somewhere ? |
|
| Back to top |
|
 |
CarlKenner Site Admin
Joined: 29 Nov 2006 Posts: 614
Digg It |
Posted: Sat Feb 24, 2007 9:10 am Post subject: |
|
|
EnsureMapRange is just a combination of EnsureRange and MapRange. These functions are the same as their Delphi equivalents.
MapRange(value, oldmin, oldmax, newmin, newmax)
EnsureRange(value, min, max)
EnsureMapRange(value, oldmin, oldmax, newmin, newmax)
aka MapEnsureRange(value, oldmin, oldmax, newmin, newmax)
EnsureMapRange will always return a value between newmin and newmax. If value was between oldmin and oldmax then it will be the same distance between newmin and newmax. If value was outside oldmin or oldmax then it will be equal to either newmin or newmax.
MapRange, on the other hand, will return values outside newmin and newmax if value was outside oldmin and oldmax.
EnsureRange doesn't change the range, but it does force values outside the range to become either min or max. |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|