Closed davidrenne closed 3 years ago
Hi David,
sorry for the late response, I tend to not see github notifications timely.
Oca (e.g. OcaGain or OcaMute) have properties which you can get/set using the corresponding methods. If you have the device tree, you need to first find the objects that you care about. The way I would recommend for doing that is to use get_role_map() http://docs.deuso.de/AES70.js/api/controller.html#RemoteDevice.get_role_map, instead, and look up the objects you want using their path names.
For OcaGain you can then use the GetGain() to fetch the current value, SetGain(value) to change values and .OnGainChaned.subscribe(...) to subscribe to changes to that property.
Arne
Thanks for the response @arneg. I only wish you had more code snippets using GetGain/SetGain and Subscribe I am too much of a noob.
For anyone needing a set or get example here is one:
const OCA = require('aes70');
async function run() {
const connection = await OCA.controller.TCP.connect({
host: '10.20.20.41',
port: 33499,
// port: 34397,
});
const device = new OCA.RemoteDevice(connection);
device.set_keepalive_interval(5);
console.log("Device name:", await device.DeviceManager.GetModelDescription());
console.log("Searching for all objects by role. This might take a while...");
const tree = await device.get_role_map();
console.log(`Found ${tree.size} objects...`);
const input_level_0 = tree.get("dsp/overlay/input_level/channel/0/level");
const input_level_1 = tree.get("dsp/overlay/input_level/channel/1/level");
// Example for getting a value
const val = await input_level_0.GetGain();
console.log(val); // Val is an array of [value,minVal,maxVal]
// Now subscribe to input level 0 and if it changes, mirror it to level 1
input_level_0.OnGainChanged.subscribe((val) => {
console.log(val);
input_level_1.SetGain(val);
});
console.log(val);
}
run().then(() => console.log("Done."));
Closing this issue.
I am very new to AES70. I have your get_device_tree example working and connected to a Bosch MXE5 Dynacord and I see a bunch of properties on several OcaGain and OcaMute Roles.
I was wondering if you could help me setup an example where I get/set/subscribe to an OcaGain or OcaMute channel. I looked at your tests and couldnt find anything that would cover those to show me how to take some actions or subscribe on a Gain/Mute.
Thanks in advanced for your time helping a noob!