It is currently Sun Jun 25, 2017 1:02 pm

Reply to topic  [ 3 posts ] 
 FreePIE MIDI input, some questions 
Author Message
One Eyed Hopeful

Joined: Sat Jan 07, 2017 11:30 pm
Posts: 1
I'm attempting to map a MIDI controller to various Vjoy inputs (analogue & digital) but hitting a brick wall. I have read through these:


From the above, I am using a script that allows me to use a slider on the MIDI controller as a throttle in flight sims:

def update():

   vJoy[0].slider = filters.mapRange(midi[0].data.buffer[1], 127, 0, 17873, -17873)
if starting:
   midi[0].update += update

This works nicely on its own. However, any other inputs on the MIDI controller also affect the output (ie. hitting a MIDI key or tweaking a knob also makes my throttle control jump around). I guess this is because the above code is looking at the entire data buffer of the device, not a single channel.

The slider is a volume control, which is MIDI CC 07. So I am trying to get the script to listen to that only, for example:

vJoy[0].slider = filters.mapRange(midi[0].data.buffer[1] == 07, 127, 0, 17873, -17873)

or with additional parentheses:

vJoy[0].slider = filters.mapRange((midi[0].data.buffer[1] == 07), 127, 0, 17873, -17873)

But with any change I make, the output ceases. If I only wanted to use the slider I wouldn't mind, but I would also like to map some button inputs. Can anyone help with the correct syntax?

Sat Jan 07, 2017 11:55 pm

Joined: Mon Jun 22, 2009 8:36 am
Posts: 2156
Location: Stockholm, Sweden

I think you want to look at the data.status and properties too

My blog

Wed Jan 11, 2017 8:20 am
One Eyed Hopeful

Joined: Sat Mar 04, 2017 1:24 am
Posts: 1
I think the magic you want is something like this:

    if (midi[0].data.buffer[0] == 5):
        vJoy[0].x = filters.mapRange(midi[0].data.buffer[1]), 127, 0, 17873, -17873)

    if (midi[0].data.buffer[0] == 6):
        vJoy[0].y = filters.mapRange(midi[0].data.buffer[1]), 127, 0, 17873, -17873)

Sat Mar 04, 2017 3:44 am
Display posts from previous:  Sort by  
Reply to topic   [ 3 posts ] 

Who is online

Users browsing this forum: No registered users and 2 guests

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 post attachments in this forum

Jump to:  
Powered by phpBB® Forum Software © phpBB Group
Designed by STSoftware.