Overview
Counter module with optional wrap around
Discussion
This module counts up starting from 0 at a specified rate in milliseconds. The count value is output as an integer value on the output pin. The module has an input pin whose only purpose is to get the current sample rate and blockSize. This information is used to determine the time base for the processing. The sample rate of the output pin equals the sample rate of the input divided by the input block size.
...
When muted the module outputs all zeros. When bypassed the module continues to run.
Type Definition
Code Block |
---|
typedef struct _ModuleCounter { ModuleInstanceDescriptor instance; // Common Audio Weaver module instance structure FLOAT32 incTime; // Time in msec to wait between increments UINT32 wrap; // Counting is performed modulo this value UINT32 count; // Current counter value UINT32 sampleCounter; // Internal variable used to maintain time UINT32 sampleCounterPeriod; // Number of samples corresponding to incTime } ModuleCounterClass; |
Variables
Properties
Name | Type | Usage | isHidden | Default value | Range | Units |
incTime | float | parameter | 0 | 1000 | 0:10000 | msec |
wrap | uint | parameter | 0 | 5 | Unrestricted | |
count | uint | state | 0 | 0 | Unrestricted | |
sampleCounter | uint | state | 1 | 0 | Unrestricted | |
sampleCounterPeriod | uint | state | 1 | 48000 | Unrestricted |
Pins
Input Pins
Name: in
Description: Ignored input
...
Sample rate range: Unrestricted
Complex support: Real
Output Pins
Name: count
Description: Count value
Data type: int
MATLAB Usage
File Name: counter_module.m
...