The initialisation of the EarObject data structures is stage (iii) in the standard program format. The section of code which initialises the EarObjects used in the example program are shown in figure .
stimulus = Init_EarObject(stModuleName);
pEFilter = Init_EarObject(pEModuleName);
bMFilter = Init_EarObject(bMModuleName);
recptPotn = Init_EarObject(rPModuleName);
hairCell = Init_EarObject(hCModuleName);
Figure : AudPerGen.c - Initialising the EarObject Data Structures
The Init_EarObject(...) dynamically allocates the memory required for each EarObject. The string argument passed to the routine is the name of the module to be associated with the EarObject, as in figure .
Figure : Initialising EarObjects.
As this example program follows the generic programming coding convention, the module name is a variable string - it might also have been a constant. The variable ("stModuleName" in this case) is read in from the main parameter file. How this is done is explained in a subsection below. This means that the module associated with an EarObject can be assigned just by changing the module name used in the parameter file. The modules used in the example can be seen in the parameter file for the example program (see Appendix D).
Note that the "recptPotn" EarObject has the "null" module associated with it. This means that there is no process currently associated with this EarObject. When an attempt is made to use the DoProcess(...) command on "recpPotn" (see the Main Simulation Process subsection) the EarObject's input signal is passed on as its output signal without any intervening processing: the "recptPotn" process is "short-circuited". Structuring the program in this way allows it to have the ability to use the new inner hair cell model, which requires the "recptPotn" (inner hair cell receptor potential) process as an input. Thus the program can be used with both the new or old inner hair cell models.
A list of the modules available is given in the reference chapter of the manual.