Error: Error: Variable does not contain a valid scalar value

Post Reply
steffendasenbrock
Site Admin
Posts: 12
Joined: Thu May 02, 2019 1:08 pm

Error: Error: Variable does not contain a valid scalar value

Post by steffendasenbrock » Fri Sep 10, 2021 1:28 pm

Hi,

my aim is to use an AC variable I created using my own plugin as an input of another plugin, e.g. the gain plugin. I have two question:

1. I want to set the value of the gain.gains variable to the value of my AC variable, gains needs to be of kind vector<float>, but I can not find an function which inserts an AC variable as a vector. But the only functions I can find are insert_var, insert_var_int, insert_var_float and insert_var_double - what would be the correct way to register a variable such that it can be used as gains for the gain plugin?

2. I tried to set the value of gain.max, since it is a float value. For this I used something like this:

Code: Select all

    ac.insert_var_float(ac.handle, "db_EEG_steered_AC", &db_EEG_steered );
with db_EEG_steered being are float variable. But when setting

Code: Select all

mha.gain.max = db_EEG_steered_AC
I get the error:

Code: Select all

Error: (mha_parser) (mha_parser) "db_EEG_steered_AC" does not contain a valid scalar value (db_EEG_steered_AC)
(while parsing "config.cfg" line 13)
What could be wrong in this case?

tobiasherzke
Posts: 109
Joined: Mon Jun 24, 2019 12:51 pm

Re: Error: Error: Variable does not contain a valid scalar value

Post by tobiasherzke » Fri Sep 10, 2021 3:46 pm

AC variables can only be read by MHA plugins while they execute either their prepare() or process() callback. You cannot read them in the MHA configuration language.

steffendasenbrock
Site Admin
Posts: 12
Joined: Thu May 02, 2019 1:08 pm

Re: Error: Error: Variable does not contain a valid scalar value

Post by steffendasenbrock » Fri Sep 17, 2021 11:15 am

Thanks for your answer. I though it would be possible to pass content of AC variables between plugins using the configuration language. Is there a way to pass an AC variable created by my own plugin to e.g. the gain plugin?

tobiasherzke
Posts: 109
Joined: Mon Jun 24, 2019 12:51 pm

Re: Error: Error: Variable does not contain a valid scalar value

Post by tobiasherzke » Fri Sep 17, 2021 2:10 pm

Yes: you can change the source code of the gain plugin to make use of an AC variable and recompile the gain plugin.

It's open source after all.

Post Reply