In the previews article we talked about how to generate .h and .cpp files by using Skeleton Generator for OpenViBE. Here we want to learn how to add this new module to designer and make it visible. There are some few steps which should be done and some points that you have to check them to not having further errors in time of compilation.
Step 1: Including the module to ovp_main.cpp
Open the OpenViBE folder in your system >> “openvibe-plugins”, in this folder there are 15 folders, which each of them contains codes for different categories of plugins. If you open any of them and check the folder “trunk” >> “src”, you will see that, there are two files “ovp_defines.h” and “ovp_main.cpp” with the same name in all of plugin categories. These two file contains the information about modules header file and class ID specifically for correspond plugin and its modules. In our case we don’t need to add any code in “ovp_defines.h”, because if you check the “ovpCBoxAlgorithmMomentaryFrequency.h” file, you will see that, in the lines 12 and 13 the class ID already defined for our module. In the other hand, we should include two lines to “ovp_main.cpp”. Open the “ovp_main.cpp” file and add #include “ovpCBoxAlgorithmMomentaryFrequency.h” in the line 12 and also add OVP_Declare_New(OpenViBEPlugins::SignalProcessingGpl::CBoxAlgorithmMomentaryFrequencyDesc); to the line 75. Save the file and exit.
Note: In the files “ovpCBoxAlgorithmMomentaryFrequency.h” and “ovpCBoxAlgorithmMomentaryFrequency.h”, our module defined as sub class of “SignalProcessing” namespace, but actually we located the .h and .cpp files of module in “Signal-processing-gpl” plugin, that’s why, in these two files, instead of “SignalProcessing” add “SignalProcessing Gpl”.
Step 2: Make module visible
In the previews step we add necessary information to make our recognizable and the module be compile with other modules in time of compilation, but still we cannot see the Momentary Frequency module in the designer. For this purpose we have to change the parameter of “Designer_ShowUnstable” to “true” in the “openvibe.conf” file in the “dist” >> “share” folder.
At this point come back to “OpenViBE” folder >> “scripts” and build the source code again. After finishing the compilation, open the OpenViBE designer from “dist” folder and you can see the Momentary Frequency module under “Signal processing” >> “Filtering”. Drag and drop the Momentary Frequency to the left side and double click on it, the “Configure Momentary Frequency setting” window will show up and in that window, you can see the two setting values for “AdapTime_FreqEstimation” and “AdapTime_MeanEstimation”.