Author |
Topic: Opening MIDI ports automaticaly? (Read 1443 times) |
|
shanio
New Member

 MIDI-OX Rules!
Posts: 8
|
 |
Opening MIDI ports automaticaly?
« on: Jun 1st, 2019, 6:37am » |
Quote Modify
|
Hi, I need to open MIDI ports when the windows deconnect and reconnect interfaces. When it's happen I can do it manually - it works very well - but I need to make it automaticaly. The idea is: when I detect the reconnection of usb I send a message and close/open MIDI ports inside MIDI-OX. Is there any message to do it? I made a little program in C# to detect reconnection of USB and I can send the message to MIDI-OX, but how? tha ks for your help!
|
|
IP Logged |
|
|
|
Breath
Administrator
    

Gender: 
Posts: 1030
|
 |
Re: Opening MIDI ports automaticaly?
« Reply #1 on: Jun 3rd, 2019, 8:02pm » |
Quote Modify
|
You might like to look at the Scripting function. Go to HELP and at the bottom of the Contents is Scripting. Have a read of that page, especially the SysMidiInCount and SysMidiOutCount. If you turn off / on a device it should give a different number after the driver is loaded. Let me know how you get on All the best Royce
|
|
IP Logged |
|
|
|
shanio
New Member

 MIDI-OX Rules!
Posts: 8
|
 |
Re: Opening MIDI ports automaticaly?
« Reply #2 on: Jun 4th, 2019, 4:27pm » |
Quote Modify
|
Yes, I saw the scripting and read the help, but I was searching something like open/close port commande.... SysMidiInCount and SysMidiOutCount have the same fonction? I need to make the same thing like with mouse on the icon, but there is not specific function for this in scripts. When I turn off/on port with mouse the result is exactly what I need - the midi port is reconnected. No pbs for different number for device... I have no acccess to the PC currently, but I will read once more time the help and tell you the result.
|
|
IP Logged |
|
|
|
Breath
Administrator
    

Gender: 
Posts: 1030
|
 |
Re: Opening MIDI ports automaticaly?
« Reply #3 on: Jun 7th, 2019, 12:52am » |
Quote Modify
|
I am unaware of a way to remote access control elements in MidiOx. Perhaps if your C# program had sufficient permissions you could use it to kill -1 the MidiOx process then start it again when a USB Midi port becomes active.. All the best Royce
|
« Last Edit: Jun 7th, 2019, 8:55pm by Breath » |
IP Logged |
|
|
|
shanio
New Member

 MIDI-OX Rules!
Posts: 8
|
 |
Re: Opening MIDI ports automaticaly?
« Reply #4 on: Jun 7th, 2019, 5:21am » |
Quote Modify
|
Thanks Royce for your help. I read again the help about scripting. "SysMidiInCount" look at opened ports. But like you write, once the port is deconnected and after that reconnected MIDI-OX cant' see it - you can close and reopen MIDI-OX or make a icon commande open/close port in window (no commande in menu - strange!). Maybe there is the possibility to create a new instance which will find a ports?... If somebody can help me with this... I asked for code source - maybe it could be more easear to put inside the fonction - but no answer...
|
|
IP Logged |
|
|
|
Breath
Administrator
    

Gender: 
Posts: 1030
|
 |
Re: Opening MIDI ports automaticaly?
« Reply #5 on: Jun 7th, 2019, 8:54pm » |
Quote Modify
|
Hi Perhaps there is a different way to solve your problem. What are you trying to do and with what gear? Royce
|
« Last Edit: Jun 7th, 2019, 8:54pm by Breath » |
IP Logged |
|
|
|
shanio
New Member

 MIDI-OX Rules!
Posts: 8
|
 |
Re: Opening MIDI ports automaticaly?
« Reply #6 on: Jul 6th, 2019, 1:00pm » |
Quote Modify
|
Hi, thanks for message. Sorry, I tried another solution and didn't see your reply! I have a windows 10 tablet HP with one USB port + hub uSB + sound card + 2 midi interfaces. it's something very special installation and no really possible to exchange the hardware. You need to know that all was working perfectly with asus tablet and windows 8... What I observe now are the micro interruptions of USB devices...!! Once it's happen MIDIOX is not able to recognize the device - I think that MIDIOX stays with old adresses of the devices and doesn't know that something changed... Only solution I found is swith on/off MIDI, but it doesn't work every time and sometimes I need to quit MIDIOX and and reopen it. After this MIDIOX recognize the device and all is OK. There is no crash and all environement is working. I made a little software to recognize when the USB is reconnected and I could initilized the MIDIOX, but I need the acces on it to do it... It's why I treid to find the script to do it, but impossible. Only solution is to see the code and modify it to permit this initialisation... I don't see another solution.
|
« Last Edit: Jul 6th, 2019, 1:06pm by shanio » |
IP Logged |
|
|
|
Breath
Administrator
    

Gender: 
Posts: 1030
|
 |
Re: Opening MIDI ports automaticaly?
« Reply #7 on: Jul 6th, 2019, 10:09pm » |
Quote Modify
|
When the USB port is dropped so is the associated driver memory. All the pointers for that interface that MidiOx has obtained are now incorrect. To get the new one that were created when the USB reconnected you need, for both Midi In and Out, to call GetNumDev() then GetDevCaps() and then Open() them. I don't think there is a way to re-initialise MidiOx in this way. I know some Midi things have changed in Win10. Perhaps Jamie will add some port polling to see if there is a Midi port that has been lost and reconnected. Sorry Royce
|
|
IP Logged |
|
|
|
shanio
New Member

 MIDI-OX Rules!
Posts: 8
|
 |
Re: Opening MIDI ports automaticaly?
« Reply #8 on: Jul 7th, 2019, 7:36am » |
Quote Modify
|
Thanks for explanation. If I understand well, in theory it's possible to "reset" the input and output devices like you describe in your message. It's not possible with MIDIOX, but if this possibility is include to the software => it will retrive the midi inputs devices?
|
|
IP Logged |
|
|
|
|