Page 1 of 1

edit openMHA code and get private variables

Posted: Wed Apr 14, 2021 11:12 am
by fam
Thank you for the package, it is great. I can connect openMHA to MATLAB and run the desired plugin on my data.
The problem is that I want to monitor the openMHA variables during runtime.
The "mha_get(mha,'');" just return the value that had been set in the .cfg file.
Would you please help me to know how I can do that?

Re: edit openMHA code and get private variables

Posted: Wed Apr 14, 2021 4:34 pm
by tobiasherzke
Please clarify what you want to achieve, e.g. by giving an example of the desired outcome.

Re: edit openMHA code and get private variables

Posted: Thu Apr 15, 2021 10:26 am
by fam
Thank you for your reply.

I am using the adaptive differential microphone array, 'adm'. In this case, e.g. there is a private variable named, "m_beta" which is updated for every frame of data. How can I access the value of this variable during the run time?

Re: edit openMHA code and get private variables

Posted: Thu Apr 15, 2021 7:26 pm
by tobiasherzke
Not every C++ variable that you find in the source code of the plugins is exported to the configuration tree, and therefore not every C++ variable is accessible from Matlab. You can find the accessible configuration variables for each plugin in the plugin manual, http://www.openmha.org/docs/openMHA_plugins.pdf

Re: edit openMHA code and get private variables

Posted: Fri Apr 16, 2021 8:34 am
by fam
Thank you for your clarification.
So is there a way, not necessarily from MATLAB, to access all the C++ variables?

Re: edit openMHA code and get private variables

Posted: Fri Apr 16, 2021 11:28 am
by tobiasherzke
Two possibilities:

1. Use a debugger, set breakpoints, display the variables you are interested in.

2. Hack the source code to export the data that you are interested in in some suitable form, recompile.

It's all open source after all.

Re: edit openMHA code and get private variables

Posted: Fri Apr 16, 2021 6:59 pm
by fam
Thank you again for your reply.
For the first possibility, I have to write a test_code to call the desired function and monitor the variable. I didn't find any available test_code, and recompile the code. Is there any step-by-step guide file for compiling the openMHA package?

Re: edit openMHA code and get private variables

Posted: Fri Apr 16, 2021 7:33 pm
by tobiasherzke

Re: edit openMHA code and get private variables

Posted: Mon Apr 19, 2021 12:03 pm
by fam
Thank you so much for your help.
Now I can edit and compile the code. :)