...
Let DIR be the base directory for the audio module library and let 'Examples' be the name of the library. awe_generate_library.m
creates the following files and folders:
<DIR>\Examples.h — Header file containing extern definitions for each module class object. It also has macros defining the entire list of modules and all dependencies.
<DIR>\Examples.sch — Overall schema file for the library.
<DIR>\ExamplesSchema.cpp — Compiled schema file.
📁 <DIR>\Doc — Location of generated documentation
📁 <DIR>\Include — Location of generated module include files
📁 <DIR>\matlab — Location of the module m-files. This also contains the master library make script.
📁 <DIR>\matlab\code — Suggested location for the inner code pieces.
📁 <DIR>\matlab\process — Suggested location of the MATLAB versions of the processing functions.
📁 <DIR>\matlab\test — Suggested location of MATLAB test scripts which validate the operation of the modules.
📁 <DIR>\Source – Location of the generated module source files.
📁 <DIR>\xml – Module XML file for AWE Designer, explained in section 3.12.
...
The command adds the directory
📁 <DIR>\matlab
to the MATLAB search path; this directory has to exist. It then optionally adds
📁 <DIR>\matlab\test
📁 <DIR>\matlab\process
if these directories exist. In addition, the function modifies the global variable
...
In many cases, the SUBSTITUTION string contains many lines and it is unwieldy to represent in MATLAB. Instead, it is easier to copy the SUBSTITUTION text from another file. If the SUBSTITUTION string has the form "Insert:filename.txt" then the text will be copied from filename.txt. filename.txt is referenced relative to the location of the module's m-file. You can specify subdirectories as well. For example:
Code Block |
---|
awe_addcodemarker(M, 'processFunction', ... |
...
'Insert:InnerPeakHold_Process.c'); |
inserts the file InnerPeakHold_Process.c located in the subdirectory "Inner".
awe_lookupcodemarker.m
The MATLAB function
STR=awe_lookupcodemarker(M, IDENTIFIER)
returns the contents of a code marker. If IDENTIFIER
is not defined, then the function returns an empty string. The returned value STR
is either a string, for simple replacements, or a cell array in the case of multi-line replacements.
awe_deletecodemarker.m
M=awe_deletecodemarker(M, IDENTIFIER)
Deletes the code marker named IDENTIFIER
.
M=awe_deletecodemarker(M)
Deletes all code markers associated with a module or subsystem.
...
The template files also contain their own preprocessor directives. These directives are similar to those used by the C preprocessor but are handled by the template substitution function. The directives are identified by ##
and only a few variations are supported.
Code Block |
---|
##if 1 |
...
… This code will appear in the output file … |
...
##endif
##if 0
… This code will NOT appear in the output file …
##endif ##if 0 … This code will NOT appear in the output file … ##endif |
When the argument to ##if
is 1, then the text between the ##if ##i
f and ##endif
will appear in the generated file. Otherwise, the text will not appear. You can also use an identifier with an ##if
statement as in
Code Block |
---|
##if $myVariable$ |
...
Optional text |
...
##endif |
If you set
awe_addcodemarker(M, 'myVariable', '1')
then the optional text will appear in the generated file. Note that $myVariable$
is being set to the string '1' not to the numeric value 1. The template preprocessor directive also supports an else clause
Code Block |
---|
##if $combineSourceFiles$ |
...
#include "$combinedIncludeName$" |
...
##else |
...
#include "$baseHFileName$" |
...
##endif |
Frequently Defined Code Markers
...
The following logic defines the bypass function.
If
$bypassFunction$
is defined, then the code is placed into the generated .c file and$bypassFunctionName$
is set toawe_modClassNameBypass
,If
$bypassFunctionName$
is defined, then this function is used for bypass behavior. No additional code is placed into the generated .c file.Otherwise, the default bypass function
IOMatchUpModule_Bypass()
is used. No additional code is placed into the generated .c file.
...
Specifies the inner portion of a custom constructor function. The function must follow the calling convention outlined in Section 4.4.1. Constructor Function.
Simple audio modules without indirect arrays
...
: No need to define the constructor function. The
BaseClassModule_Constructor()
usually does everything needed.Audio modules with direct arrays
...
: Set the
.arrayHeap
and.arraySizeConstructor
fields of the array variables in MATLAB. Audio Weaver will then auto generate a suitable constructor function.Complex modules requiring further initialization
...
: Write a custom
$constructorFunction$
or use the$postConstructorFunction$
shown below.Modules created out of subsystems
...
: Audio Weaver automatically generates code for these systems. If you need further initialization, use the
...
$postConstructorFunction$
shown below.
$postConstructorFunction$
This code marker follows immediately after the $constructorFunction$
code marker in awe_module_template.c. This marker allows you to add your own code in cases where Audio Weaver generates the memory allocation and instantiation code but further initialization is needed. It is particularly useful for subsystems.
...
Defines the discussion section of the help documentation. This has been grandfathered for backwards compatibility. When writing new modules, set the M.docInfo.discussion
field of the audio module instead.
...
Specifies the inner portion of a module's Get function. Follows the calling convention outlined in Section 4.4.4 Get Function .
$setFunction$
Specifies the inner portion of a module's Set function. Follows the calling convention outlined in Section 4.4.3 Set Function.
$hFileDefine$
Located near the top of the template file awe_module_template.h. Allows you to add additional preprocessor directives (or anything else) at the start of the header file. Example,
...