Skip to main content
Skip table of contents

ConsecutiveCountInt

Overview

Counts repeated input values

Discussion

This module checks for repeated input samples from a single channel. The instance variable .value is set to the last input sample value. The instance variable .count is set to the number of consecutive times that the input signal was equal to .value. If the last two input samples are not equal, then .count equals 1.

The argument OUTPUTVALUE to the instantiation function specifies whether the module has any output pins. By default, OUTPUTVALUE=0 and the results of the computation are only stored to the instance variables. If OUTPUTVALUE=1, then the module has two output pins, named .value and .count, containing the respective values of the instance variables.

When bypassed and OUTPUTVALUE=1, the module always outputs the last input sample on pin .value and sets pin .count to 1. When muted and OUTPUTVALUE=1, the module always outputs zero on pin .value and sets pin .count to 0.

Type Definition

CODE
typedef struct _ModuleConsecutiveCountInt
{
    ModuleInstanceDescriptor instance;            // Common Audio Weaver module instance structure
    INT32 value;                                  // Equals the last input sample
    UINT32 count;                                 // Number of consecutive times that the last input sample was seen
} ModuleConsecutiveCountIntClass;

Variables

Properties

Name

Type

Usage

isHidden

Default value

Range

Units

value

int

state

0

0

Unrestricted

count

uint

state

0

0

Unrestricted

Pins

Input Pins

Name: in

Description: Integer inputs

Data type: int

Channel range: 1

Block size range: Unrestricted

Sample rate range: Unrestricted

Complex support: Real

Output Pins

Name: value

Description: Contains the instance variable .value

Data type: int

Name: count

Description: Contains the instance variable .count

Data type: int

MATLAB Usage

File Name: consecutive_count_int_module.m

CODE
 M=consecutive_count_int_module(NAME, OUTPUTVALUE)
 Audio Weaver module that the number of consecutive input values
 that are of the same value.  The module has two internal variables
 that are of note:
    .value - last input value to the module
    .count - number of consecutive times that the input was equal to
             .value.  If the input has just changed, then .count=1.
    OUTPUTVALUE - specifies whether the module has an output pin.
                  By default, OUTPUTVALUE=0 and the result of the
                  computation is only stored to the instance variables
                  If OUTPUTVALUE=1, then the module has two output pins
                  named .value and .count
 The module's input pin can only contain a single channel.

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.