important: Querying input/output devices from script

It is becoming increasingly important - as we deploy systems to various locations which varying input output devices, that Derivative implements a way to query such devices from script, so that they can be either sent to a table or in any way presented to the user to pick from.

An example:
Our clients use different kinds of headsets.

in Audio Out, these headsets come up each with its own name. If we set output to a specific name, once the client plugs in a different headset, that name will not work anymore (can’t remember if it defaults to default output or else), hence the output will most likely be directed to the speakers.

if we had a way to query which output devices are available, the user could select the appropriate one to output to if needed, from a menu we display. We could then set the Audio Out appropriately by feeding the device string to the right field.

This is very important

You can use the command oppardetails to extract this information.

that’s great - but I’ll need more info I guess,

because if I oppardetails -p /videoin1 cameras I get a lot of crap before the actual name I should be setting in the opparm command…
things like menu_name_0 \?\root#media#0002#(65e8272727-eewq)\global --||-- WebCam Max Capture

should I just ignore anything before the --||-- ?

d

actually I saw I’ll have to specify the entire string with all those weird numbers. What are they? I.e. if I’m using a xbox controller, then I’ll switch to another xbox controller will those numbers change - is it the serial number of the device?

Also, another question. What can trap changes in the available devices?

I.e. if I start my show with only one camera, then I turn on my internal camera, I noticed that the list of available devices now includes the new camera as well. Is there a script/event that gets triggered to update my UI list of cameras or is it a check that’s done only when I pull down my devices menu on the operator?

tx
d

here’s a problem I’m having too… in the above example (limited to video input devices luckily) the name field is so filled with special characters that simply to try and figure out which one is the current choice just by set mychoice = chs("videoin1/cameras") and then doing a strcmp with the name_# that I find into a table I’ve created with oppardetail doesn’t seem to work. I can’t compare them…

is there an “index” that I lets me figure out which one is the current choice of a given operator without having to strcmp those crazy strings?

tx
d

That long string is the Device ID of the device. I’d expect it to change if you change devices. It’s used to differentiate between two identically named devices connected to the system. That way when the show restarts two different OPs connected to two different devices will reacquire the correct devices.

No there’s no way to trap when a new device is connected right now.