Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

By default, the input and output pins are mono and the system ends up using 3 scratch wires:

Code Block
>> SYS=lah_limiter_example_module('LAH');

...


>> SYS=prebuild(SYS);

...


>> SYS.scratchPin

...

 



ans

...

 

...

 = 

    [1x1 struct]

...

    [1x1 struct]

...

    [1x1 struct]

This subsystem is designed to operate on an arbitrary number of channels.  However, the wire allocation shown above is only applicable when the input is mono.  (To see this, consider the MaxAbs module.  This module always has a mono output and is assigned to wire #3.  The signal path through DelayMsec can be N-channel and is also assigned to wire #3).  If this system is run with stereo inputs, then the wire allocation is incorrect and the audio processing will fail.

To fix this problem, force the system input pin to have 2 channels by default. 

Code Block
pinType=SYS.max_abs.inputPin{1}.type;

...


add_pin(SYS, 'input', 'in', 'Audio Input', pinType);

...


SYS.inputPin{1}.type.numChannels=2;

The pin still holds an arbitrary number of channels, but its default value is 2.  When the subsystem is now routed, the wires will be allocated as:

...

The system now requires a total of 4 scratch wires, with a new scratch wire, #6 assigned to the output of DelayMsec.  Furthermore, the buffer allocation is now general purpose and will work with any number of input channels.

The last portion of the file is module browser information as explained in scaler module example above.

Code Block
SYS.moduleBrowser.path = 'Examples';

...


SYS.moduleBrowser.image = '../images/E.bmp';

...


SYS.moduleBrowser.name = 'Look Ahead Limiter';

...


SYS.moduleBrowser.searchTags = 'lah Limiter';

...


SYS.shapeInfo.legend = 'Look Ahead Limiter';

...


SYS.shapeInfo.size = [10 6];