edit openMHA code and get private variables

Post Reply
fam
Posts: 15
Joined: Wed Apr 14, 2021 1:24 am

edit openMHA code and get private variables

Post by fam » Wed Apr 14, 2021 11:12 am

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?

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

Re: edit openMHA code and get private variables

Post by tobiasherzke » Wed Apr 14, 2021 4:34 pm

Please clarify what you want to achieve, e.g. by giving an example of the desired outcome.

fam
Posts: 15
Joined: Wed Apr 14, 2021 1:24 am

Re: edit openMHA code and get private variables

Post by fam » Thu Apr 15, 2021 10:26 am

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?

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

Re: edit openMHA code and get private variables

Post by tobiasherzke » Thu Apr 15, 2021 7:26 pm

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

fam
Posts: 15
Joined: Wed Apr 14, 2021 1:24 am

Re: edit openMHA code and get private variables

Post by fam » Fri Apr 16, 2021 8:34 am

Thank you for your clarification.
So is there a way, not necessarily from MATLAB, to access all the C++ variables?

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

Re: edit openMHA code and get private variables

Post by tobiasherzke » Fri Apr 16, 2021 11:28 am

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.

fam
Posts: 15
Joined: Wed Apr 14, 2021 1:24 am

Re: edit openMHA code and get private variables

Post by fam » Fri Apr 16, 2021 6:59 pm

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?


fam
Posts: 15
Joined: Wed Apr 14, 2021 1:24 am

Re: edit openMHA code and get private variables

Post by fam » Mon Apr 19, 2021 12:03 pm

Thank you so much for your help.
Now I can edit and compile the code. :)

Post Reply