MIDI

Official forum for open source FreePIE discussion and development.
CyberVillain
Petrif-Eyed
Posts: 2166
Joined: Mon Jun 22, 2009 8:36 am
Location: Stockholm, Sweden

Re: MIDI

Post by CyberVillain »

It was a long time ago i played with vJoy, but i think it ranges from -int16 / 2 to int16 / 2 so total range is int16

But you can use vjoy[0].axisMax to get the range instead

edit: Glad it worked, that mean we will support most scenarios
DrDim
One Eyed Hopeful
Posts: 24
Joined: Mon Jan 05, 2015 4:33 am

Re: MIDI

Post by DrDim »

Small Offtopic sitenote:

I want to expand my "Midi-to-Vjoy" script to control VJoy with the Keyboard as well.
A small seperate test script looks like this:

Code: Select all

def keyupdate():
   
   if keyboard.getKeyDown(Key.LeftShift) and keyboard.getPressed(Key.W):
         vJoy[0].rz = 16383

if starting:
   keyboard.update += keyupdate
it doesn't work though (keyboard inputs don't do anything). Any Idea why?
CyberVillain
Petrif-Eyed
Posts: 2166
Joined: Mon Jun 22, 2009 8:36 am
Location: Stockholm, Sweden

Re: MIDI

Post by CyberVillain »

Yes the logic for getPressed needs to be executed not only when data comes in from the midi device sorry that is one of the problems I was afraid of, so your need to put the getPressed state outside of the update function
CyberVillain
Petrif-Eyed
Posts: 2166
Joined: Mon Jun 22, 2009 8:36 am
Location: Stockholm, Sweden

Re: MIDI

Post by CyberVillain »

BTW getPressed will trigger once and then require you to release and press again for it to trigger again, I suspect this is not what you want, use keydown If that is the case(it works from update function)
CyberVillain
Petrif-Eyed
Posts: 2166
Joined: Mon Jun 22, 2009 8:36 am
Location: Stockholm, Sweden

Re: MIDI

Post by CyberVillain »

Hang on here I now see that you are doing keyboard. Update, sorry I'm surfing on the phone. I didn't know it had a update event :) I'm not the author of it, but I think is only supports polling :)

Will look at it when I get home, could be a bug that it has a update event
CyberVillain
Petrif-Eyed
Posts: 2166
Joined: Mon Jun 22, 2009 8:36 am
Location: Stockholm, Sweden

Re: MIDI

Post by CyberVillain »

Thanks for finding that bug, update is now removed from keyboard plugin, just do

Code: Select all

if keyboard.getKeyDown(Key.LeftShift) and keyboard.getPressed(Key.W):
   vJoy[0].rz = 16383
from main loop
DrDim
One Eyed Hopeful
Posts: 24
Joined: Mon Jan 05, 2015 4:33 am

Re: MIDI

Post by DrDim »

I have to thank you as well - again! :D
Post Reply

Return to “FreePIE”