Windows service status
Does anybody know of a method by which one can tell whether a specific Windows 10 service has started or not?
I have my project (standalone) run automatically at system start-up and one of its initialisation actions is to load another application (Mixing-Station) that it communicates with. No problems there, thanks to @11Olsen!
The hardware being controlled by Max has to be connected via ethernet connections and that requires a software package (rtpMIDI) to provide the virtual MIDI ports as a Windows service. (Yes, I know it comes "built in" with OSX and iOS but I'm poor! Ha! Ha!) Again, it all works fine, except...
Windows, being a law unto itself, never loads stuff in the same order twice. I can never be sure if the rtpMIDI service has been started by the time my application runs and things can occasionally get messed up if Max and Mixing-Station can't find all the MIDI ports in time. I can delay my application being run for a minute at system startup but I'd really like to be able to test to see if the rtpMIDI service is running and use that to control the sequence.
The question is how? 11Olsen's excellent 11globalForgroundWindow external can test for applications running but seemingly not services. Has anybody comes across a way of doing this before?
Thanks.
sc queryex service name
returns it's status
https://ss64.com/nt/sc.html
Thanks, but I was looking for a way to do it from within Max.
use shell object for that.
I can paste the needed code if you supply exact service name of rtpMIDI.
But can it not be done easier -
Max can detect if midi ports are available or not.
and if yes, start the other app,
if not start rtpMIDI and check again.
Should work even on Windows
Thanks. I've got it working with shell.
@Source Audio Ok, I've had lots of fun playing with shell to do all sorts of things. I can make sure rtpMIDIService and loopMIDI are both running and I can ping my X-Touch units to see if they are turned on.
However, there is still a lag of up to 30secs or so between rtpMIDIService loading and it connecting the X-Touch units to their virtual rtpMIDI ports and I have no way I can find to detect that.
You mentioned that Max can detect if a MIDI port is available or not - how does that work? I have all my MIDI ports mapped to letters via the MIDI setup. Should I try access them by port name for this test?
That is definitely a good idea.
I don't use rtpMIDI ports, so can't really tell, but if you can list them in
umenu using midiinfo, they should appear only if really present.
you can dump umenu populated with midi devicesa and use sel or similar to bang if found
or to act if not.
Also midi objects have matchport argument,
that way one can avoid sending midi to unwanted destinations
---------
Main question though is what is causing this delay after system booted
and started the network...
P.S. I just realised you mention both loopMidi AND rtpMIDI, do they coexist without any problems ?
To answer the second question first - yes! - Tobias Erichsen has written all his MIDI port emmulators to run happily alongside each other and even connect to each other. rtpMIDI connects network devices to MIDI ports, loopMIDI creates virtual ports linked to each other with virtual data cords, and virtualMIDI connects other hardware devices to a virtual MIDI port. I use rtpMIDI to attach the X-Touch units to Max and loopMIDI to connect Max to Mixing-Station and Cubase. It all works perfectly.
When I turn the X-Touch units on, they display their IP address and a message to "Wait...". However, they appear on the network within a second or two and I can ping them with a shell command. When rtpMIDIService starts, it starts looking for the X-Touch units and some handshaking goes on but I'm not sure what form that takes. It can take anything up to 30secs or so before rtpMIDI finally connects the X-Touch to the virtual MIDI port it has created or the connection fails. Once the X-Touch has connected, the display goes blank and it's ready to interact. Unfortunately, neither rtpMIDI or the X-Touch sends any data out to acknowledge this and there is no RT sensing or MIDI command that I can send that would generate a response (loopback test).
My problem is that if Max starts initialising the X-Touch setup or either Mixing-Station or Cubase starts sending MIDI commands before the X-Touch units are ready, things can occasionally lock up or give unpredictable results. Hence why I'd like to find a way to confirm that the connection is complete before my Max app gets busy doing its stuff.
That seems very annoying.
I only once used behringer mixer while helping someone set up stage monitoring
system and was really dissapointed with X-air 18 I believe, it took ages
to initialise the network, which then failed again and again even within few meters.
External router with fixed IP adresses was the only remedy at the end,
even that this also took quite long till system was ready to use.
--------
So your problem are not the Midi ports but that X-Touch units.
Yes, The XR-18 (and XR-12/XR-16) can be a bit of a pain via a wireless connection, especially if there are lots of other Wi-Fi devices in the area. Lots of people have had problems in public settings because of mobile phones constantly polling for access points. The answer seems to be, as you say, to fix the IP addresses but also to turn off all the SSID broadcasts. The Wi-Fi connectivity issues have been improved a lot with recent firmware updates.
I agree, it's the X-Touch units that cause the problem - but having said that, they do work really well once they are connected. Across my 4 units, there are nearly 500 controllable parameters and my Max app effectively doubles that by interfacing them to two different software packages simultaneously. It's a lot going on but I rarely have problems once it's all initialised correctly.
To add to that - I don't use apple bonjour midi networking,
it is pain to setup and does create problems similar to what you describe.
I use ipMidi instead - freeware for Mac since many years,
which really performs much better.
Did not have a try on apple network midi ever again.
I've had a look at ipMIDI - it's available for Windows too. I costs $79 now though. It only connects PC's across the network using UDP (requires the same package installed at both ends) and it doesn't have any configuration options that would allow me to connect the X-Touch units.
I'll try dropping an email to Tobias and see if he can let me know of some way that I might interrogate rtpMIDI to check that the connection to the X-Touch is active.