Skip to content

SimHub plugin to read and send MIDI CC and vJoy events

Notifications You must be signed in to change notification settings

blekenbleu/MIDIio

Repository files navigation

MIDIio SimHub plugin:  now with Joystick support

Note:   requires a recent (9.X) version of SimHub

For one MIDI input and one MIDI destination device, this SimHub plugin routes configured Button, Slider and Knob
Control Change (CC) messages, for e.g. on-the-fly tweaking suitably customized ShakeIt Bass Shaker effects.
Similarly, SimHub properties can be configured for buttons and axes from one Joystick input device.
Unconfigured CC messages received either dynamically generate new properties or are forwarded to a target Device.
MIDI C# code evolved from SimHub's User.PluginSdkDemo, using Melanchall.DryWetMidi's DLL (already in SimHub).

MIDIio also generates DirectInput Button and Axis joystick inputs for games, reusing C# sample code from vJoy.
MIDI CCs and vJoy sends are rescaled values from configured SimHub properties, e.g. ShakeIt Bass Shaker effects.

Motivation and development How-To's
MIDIio Source code files, configuration descriptions
principles of operation
June 2023 revisions provoked by SimHub updates

Notes:

  • This plugin is compatible with SimHub 8.4.3's Controllers input and Control mapper plugins
    • This allows e.g. forwarding real Controllers input properties to MIDIout or vJoy;
      Do NOT configure vJoy properties from Controllers input;  that would provoke feedback loops!
  • This plugin is incompatible with SimHub's Midi Controllers Input plugin
    • Enabling both causes SimHub to crash!!!
  • Like SimHub's Midi Controllers Input plugin,
    MIDIio can automatically set CCn properties for received CCn messages not already configured,
    but (unlike SimHub's) from only the single configured MIDI device.
    This is expected to be used mostly for identifying CC numbers to configure.
  • SimHub bundles vJoy DLL v2.1.8, while vJoy is v2.1.9.1 is available.
  • This plugin is configured using SimHub properties;  it has NO interactive interface window.
    • configure this plugin by editing NCalcScripts\MIDIio.ini, which goes in SimHub\NCalcScripts\ folder

    • check System log for MIDI and/or vJoy related messages:
      log messages

    • check Available properties for MIDI-related values: Properties values

    • Configure button CCn Source events:
      button event names and actions

    • this is not (nor can it become) a "plug and play" solution;
      configuring MIDI on Windows is very much DIY.

  • vJoy button numbering
    • Windows' joy.cpl and vJoy API consider the first button to be 1,
      but SimHub reports that first button as JoystickPlugin.vJoy_Device_B00:
      vJoy
    • For consistency within SimHub, it is configured as MIDIvJoyB00 in NCalcScripts/MIDIio.ini.

For testing, this ShakeIt profile has a custom effect with ShakeITBSV3Plugin properties from MIDI sliders.

18 Jun 2023

SimHub v8.4.3 breakage

  • JoystickPlugin properties are unavailable before MIDIio plugin Init() completes:
[2023-06-18 09:52:41,546] INFO - MIDIio.DoSend(vJoyaxis): null JoystickPlugin.SideWinder_Precision_2_Joystick_X for SourceName[1][0]^M
[2023-06-18 09:52:41,546] INFO - MIDIio.DoSend(vJoyaxis): null JoystickPlugin.SideWinder_Precision_2_Joystick_Y for SourceName[1][1]^M
[2023-06-18 09:52:41,546] INFO - MIDIio.DoSend(vJoyaxis): null JoystickPlugin.SideWinder_Precision_2_Joystick_Slider0 for SourceName[1][2]^M
[2023-06-18 09:52:41,551] INFO - Game successfully loaded^M
[2023-06-18 09:52:42,071] INFO - JoystickManager : Found Load_Cell_Interface_LC-USB, SideWinder_Precision_2_Joystick, vJoy_Device, T500_RS_Gear_Shift^M 

1 Feb 2024

About

SimHub plugin to read and send MIDI CC and vJoy events

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages