...
The entire schema file for the example module library is shown in Section 2.9.7. The portion corresponding to the ScalerSmoothedExample module is shown below.
Code Block |
---|
ModuleScalerSmoothedExample 0x0xBEEF8800, BaseModule |
...
{ |
...
gain float // Target gain
smoothingTime float // Time constant ...
currentGain float // Instantaneous gain ...
smoothingCoeff float // Smoothing coefficient
gain float // Target gain smoothingTime float // Time constant ... currentGain float // Instantaneous gain ... smoothingCoeff float // Smoothing coefficient } |
Note the one-to-one correspondence between the schema description and the C type definition shown above. Furthermore, the C substructure ModuleInstanceDescriptor maps to the BaseModule descriptor in the schema file.
...
awe_generate_module(M, DIR);
The following files will be created in the directories specified by DIR:
Include/ModScalerSmoothedExample.h
Source/ModScalerSmoothedExample.c
will be created in the directories specified by DIR.
You can also specify that the C code should be formatted using the ident.exe utility (supplied) via a third argument:
...
When you run the MATLAB script ‘make_examples’ you'll see something the MATLAB output window will show an output similar to the following written to your MATLAB output window:
Code Block |
---|
Generating code for module: DownsamplerExample |
...
Unchanged output file: |
...
<DIR >\Source\Modules\Examples\include\ModDownsamplerExample.h |
...
Unchanged output file: |
...
<DIR >\Source\Modules\Examples\Source\ModDownsamplerExample.c |
...
Generating code for module: FaderExampleFract32 |
...
Unchanged output file: |
...
<DIR>\Source\Modules\Examples\include\ModFaderExampleFract32.h |
...
Unchanged output file: |
...
<DIR >\Source\Modules\Examples\Source\ModFaderExampleFract32.c |
...
... |
...
Generated a total of 8 modules |
You'll note that all source files are marked as "Unchanged". Audio Weaver only overwrites generated files if there has been an actual change. This minimizes file changes and makes it easier to work with source code control systems.
...
Audio Weaver uses template substitution to generate audio module source and header files. The template files are shown as item 2 in Figure 1 the Audio Weaver module design environment image, and two files are used:
<AWE>\matlab\module_generation\templates\awe_module_template.c
<AWE>\matlab\module_generation\templates\awe_module_template.h
The template files contain boiler plate text together with string substitution variables and special preprocessor directives. Consider a portion of the file awe_module_template.h:
...