maartentamboer / X-Touch-Mini-FS2020

Control FS2020 with a Behringer X-Touch Mini
https://dev-tty.nl/X-Touch-Mini-FS2020/
MIT License
59 stars 19 forks source link

Setup issue - OSError connecting to X-TOUCH MINI #19

Closed rdmans closed 3 years ago

rdmans commented 3 years ago

Hi,

I got a problem with Behringer x-touch mini and using the X-Touch-Mini-FS2020. The X-TOUCH MINI is setup via the Behringer Editor app, and rotary encoders are set to "Relative 2" mode. When I start MSFS 2020 and then run the x-touch mini-fs2020.exe, the python script gives this error:

OSError: unknown port ‘X-TOUCH MINI 1’ [1228] Failed to execute script main

I also tried changing the Device ID to different values in Behringer Editor, as well as Global CH to other channels, but that didn't solve the issue.

The thing is, the x-touch mini works perfectly fine with my ableton software (with Mackie Control mode). So there is no issue with the detection, drivers etc.

In Device Manager, under "Software devices" I can see "X-TOUCH MINI [0]" and "X-TOUCH MINI [1]" as well as under "Sound, video and game controllers" I can see "X-TOUCH MINI".

I also have an audio interface (EDIROL FA-66) with physical MIDI in/outs, I think that could be the reason why the script can’t connect to my behringer using python’s “mido”.

Edit: If I disable my audio interface under "Sound, video and game controllers", the script can connect without any problems. So it seems the audio interface's midi ports somehow conflict with this script.

Any idea how to fix it?

rdmans commented 3 years ago

Ok, I think I know why it doesn't work. If i import mido and rtmidi in python myself, and then run the code below, I get the list of MIDI devices.

>>> mido.get_output_names() ['FA-66 MIDI OUT 1', 'Microsoft GS Wavetable Synth 0', 'X-TOUCH MINI 2']

However this code in main.py runs this: outport = mido.open_output('X-TOUCH MINI 1')

So I think I should just change it in main.py from ('X-TOUCH MINI 1') to ('X-TOUCH MINI 2'). (and for the input from 0 to 1 ( since 0 is occupied by my audio interface again )

>>> mido.get_input_names() ['FA-66 MIDI IN 0', 'X-TOUCH MINI 1']

But I must say, I don't have any idea how to change this code and build the exe again.. Never did such a thing with python and my coding skills have been diminished very bad. How can I build it? Or can anyone build it and send it to me?

maartentamboer commented 3 years ago

This definitely needs to become a feature to select the midi device in the config file.

I just created a hotfix for you which you that uses 2 as the output device and 1 as the input: https://github.com/maartentamboer/X-Touch-Mini-FS2020/pull/20 https://github.com/maartentamboer/X-Touch-Mini-FS2020/actions/runs/523210791

I've attached the result of that build here X-Touch-Mini-FS2020 (2).zip

I will add the selection of midi device to the config file pretty soon

rdmans commented 3 years ago

Hi Maarten,

Thank you very much, and also the effort for building it again for me :) I can confirm that it works now!

Actually, I also changed it myself and was running it by executing the main.py for the past two days. It would be great to change the midi device, since I think the people buying x-touch not only for sim purposes would've also probably have another midi-equipped audio interfaces as well.

However, occasionally the rotary dials only change the values by 10s (for heading/speed) and by 1000s (for alt), but sometimes it works smooth by changing the values as it should (100s for altitude and 1 for spd/hdg). Somehow when I reset the route and start again, it fixes itself. But I think that's another problem unrelated to this.

maartentamboer commented 3 years ago

https://github.com/maartentamboer/X-Touch-Mini-FS2020/pull/22

maartentamboer commented 3 years ago

Fixed in the latest release https://github.com/maartentamboer/X-Touch-Mini-FS2020/releases/tag/v1.1.0