Document toolboxDocument toolbox

(8.D.2.7) LogicCompareConstReplaceInt32

Overview

Compares input with a user definable value with option to replace the output

Discussion

This module implements a general purpose logical compare module against stored user defined integer values that is capable of realizing many different logic operations. The behavior of the logic compare is controlled by the compareType parameter. compareType is an integer in the range from 0 to 5 inclusive.

The following table discusses the various compare oprations types and which variables are active in each case:

compareType = 0, performs logic equal operation.

compareType = 1, performs logic not equal operation.

compareType = 2, performs logic less than operation.

compareType = 3, performs logic less than equal operation.

compareType = 4, performs logic greater than operation.

compareType = 5, performs logic greater than equal operation.

If logic condition is true: replace output by user definable value (replacementValue).

If logic condition is false: copy value from input to output.

Module works on multichannel control signals, with individual parameters for each channel. No smoothing is applied when switching the output to or from the replacementValue.

Type Definition

typedef struct _ModuleLogicCompareConstReplaceInt32 { ModuleInstanceDescriptor instance; // Common Audio Weaver module instance structure INT32 numChan; // Number of channels. INT32* compareType; // Selects the type of comparison that is implemented by the module: Equal=0 NotEqual=1 LessThan=2 LessOrEqual=3 GreaterThan=4 GreaterOrEqual=5. One row per comparison. INT32* constValue; // Selects value against to compare against. INT32* replaceValue; // Selects value for replacement. } ModuleLogicCompareConstReplaceInt32Class;

 

Variables

Properties

Name

Type

Usage

isHidden

Default value

Range

Units

numChan

int

const

1

1

Unrestricted

 

compareType

int*

parameter

0

[1 x 1]

0:5

 

constValue

int*

parameter

0

[1 x 1]

Unrestricted

 

replaceValue

int*

parameter

0

[1 x 1]

Unrestricted

 

Pins

Input Pins

Name: in

Description: Control In

Data type: int

Channel range: Unrestricted

Block size range: 1

Sample rate range: Unrestricted

Complex support: Real

Output Pins

Name: out

Description: Control Out

Data type: int

MATLAB Usage

File Name: logic_compare_const_replace_module.m

M=logic_compare_const_replace_int_module(NAME) Compares input with a user definable value (constValue) If condition is true: replace output by user definable value (replacementValue) If condition is false: copy value on input to output Arguments: NAME - name of the module. Copyright 2023. DSP Concepts, Inc. All Rights Reserved.