Proper way to receive an AC variable from a plugin in a chain (especially lsl2ac)?
Posted: Thu Aug 12, 2021 9:35 am
Hi :)
I've been playing around a bit with example6.cpp from the Developer manual to get to know how to work with AC variables. I've managed to create an AC variable by declaring it as member of the class example6_t:
And setting up data_type, num_entries, stride and data as well as register it in the constructor.
The float variable test is filled in the process function.
Now I was wondering how to get an AC variable from an other plugin. For this I've put the original plugin example6 before my own plugin:
The plugin example6 creates an AC variable called "example6_rmslev" which I tried to catch in my own plugin steffencov using
and register it as a new AC variable to test if it worked:
And it did. The AC variable example6_rmslev had the same value as test3. Then I wanted to try the same thing, but instead of having example6 switched before my own plugin, I've used lsl2ac to catch e.g. the clock corrections of a test stream e.g.
and
But this did not work - in this case test3 is just an empty 0x1 variable:
Do you know why this could be?
I will attach my (rather messy) C++ code and the configuration I've used for testing this.
Best regards,
Steffen
I've been playing around a bit with example6.cpp from the Developer manual to get to know how to work with AC variables. I've managed to create an AC variable by declaring it as member of the class example6_t:
Code: Select all
comm_var_t test_ac;
Code: Select all
test_ac.data_type = MHA_AC_FLOAT;
test_ac.num_entries = 2;
test_ac.stride = 1;
test_ac.data = test;
ac.insert_var( ac.handle, "testac", test_ac );
Now I was wondering how to get an AC variable from an other plugin. For this I've put the original plugin example6 before my own plugin:
Code: Select all
mha.algos=[ example6 steffencov acmon ]
Code: Select all
ac.get_var(ac.handle, "example6_rmslev",&new_ac_var);
Code: Select all
ac.insert_var( ac.handle, "test3", new_ac_var );
Code: Select all
ac.get_var(ac.handle, "SimpleStream_tc",&new_ac_var);
Code: Select all
ac.insert_var( ac.handle, "test3", new_ac_var );
Code: Select all
# complete list of variables
# vector<string> (monitor)
mha.acmon.varlist = [SimpleStream SimpleStream_new SimpleStream_tc SimpleStream_ts test3]
# variable dimensions in AC space
# vector<string> (monitor)
mha.acmon.dimensions = [1x480 1x1 1x1 1x1 0x1]
I will attach my (rather messy) C++ code and the configuration I've used for testing this.
Best regards,
Steffen