Skip to main content
Skip table of contents

LogicCompareConstReplace

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 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

CODE
typedef struct _ModuleLogicCompareConstReplace
{
    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.
    FLOAT32* constValue;                          // Selects value against to compare against.
    FLOAT32* replaceValue;                        // Selects value for replacement.
} ModuleLogicCompareConstReplaceClass;

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

float*

parameter

0

[1 x 1]

Unrestricted

replaceValue

float*

parameter

0

[1 x 1]

Unrestricted

Pins

Input Pins

Name: in

Description: Control In

Data type: float

Channel range: Unrestricted

Block size range: 1

Sample rate range: Unrestricted

Complex support: Real

Output Pins

Name: out

Description: Control Out

Data type: float

MATLAB Usage

File Name: logic_compare_const_replace_module.m

CODE
 M=logic_compare_const_replace_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.
JavaScript errors detected

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

If this problem persists, please contact our support.