Skip to content

Event

Discussion

This module enables triggering event callbacks to the target system (BSP). When a trigger is detected, the event trigger callback is called by the module. The payload included in the event trigger callback is whatever is on the module input pin when the trigger is detected. The module also calls an event register callback at construction time, and an event deregister callback when the module is destroyed. See awe_registerEventCallbacks in the AWE Core API documentation for more information.

eventType (module argument) - Event type integer. The meaning of this value is fully defined by the module user and the target system

isCallbackRegistered - Determines if the event trigger callback function is registered by the target system or not: 0=not registered, 1=registered. If an event trigger callback is not registered, no function calls can be made into the target system when event triggers are detected.

triggerBehavior - Determines when the event trigger callback occurs. If set to Instant, then the event trigger callback occurs in the processing function. If set to Deferred (the default), the event trigger callback occurs in the deferred processing thread. Deferred processing is safer than Instant, as the trigger callback does not happen in the audio processing thread and will not interrupt audio processing. However, it is possible that high frequency event triggers can be missed with deferred event triggering. When this occurs the previous, unprocessed event payload will be lost, and the failedTriggerCnt will increment.

triggerType - Determines the trigger detection logic. Can be RISING_EDGE, FALLING_EDGE, HIGH, LOW, NONE. NONE can be used to effectively disable the module.

triggerCnt - Counter for the number of detected and successfully processed triggers

failedTriggerCnt - Counter for the number of detected but unsuccessfully processed triggers. This will increment if there is a trigger but no callback is registered, or if the event trigger callback returns a failure. This counter can also increment if the triggerBehavior is set to deferred and a previously detected event has not yet been handled by the deferred processing thread.

resetTriggerCnts - Resets the triggerCnt and failedTriggerCnt parameters to 0

Module Pack

Advanced

ClassID

classID = 1446

Type Definition

typedef struct _ModuleEvent
{
ModuleInstanceDescriptor instance;            // Common Audio Weaver module instance structure
INT32 eventType;                              // Event type, defined by this module instance
INT32 triggerType;                            // Trigger Type
INT32 resetTriggerCnts;                       // Used to reset the triggerCnt and failedTriggerCnt.
INT32 triggerBehavior;                        // Controls whether the event is triggered immediately, or in deferred processing
INT32 prevTriggerValue;                       // Internal variable to store old trigger value
INT32 isCallbackRegistered;                   // Tracks whether there is an event callback registered on the target system
UINT32 triggerCnt;                            // Counts the number of times the module has successfully triggered the event callback
UINT32 failedTriggerCnt;                      // Counts the number of times the event callback has failed to process the trigger
INT32 deferredProcessingActive;               // State of deferred processing
INT32 deferredTriggerRequired;                // Internal flag used to handle deferred processing
INT32 moduleObjId;                            // Custom objectID of this module. -1 if not in custom objectID range
INT32* deferredBuffer;                        // Captured payload for deferred processing
AWEInstance* pAWE;                            // Pointer to hold AWEInstance pointer
void* userHandle;                             // Pointer to hold the user managed handle
} ModuleEventClass;

Variables

Properties

Name Type Usage isHidden Default Value Range Units
eventType int const 0 0 Unrestricted
triggerType int parameter 0 0 0:4
resetTriggerCnts int state 0 0 Unrestricted
triggerBehavior int parameter 0 1 0:1
prevTriggerValue int parameter 1 0 Unrestricted
isCallbackRegistered int state 1 0 0:1
triggerCnt uint state 1 0 Unrestricted
failedTriggerCnt uint state 1 0 Unrestricted
deferredProcessingActive int state 1 0 Unrestricted
deferredTriggerRequired int state 1 0 Unrestricted
moduleObjId int const 1 -1 Unrestricted
deferredBuffer int* state 0 [0 x 0] Unrestricted
pAWE AWEInstance* state 1 Unrestricted
userHandle void* state 1 Unrestricted

Pins

Input Pins

Name Trigger
Description Event
Data type int
Channel range 1
Block size range 1
Sample rate range Unrestricted
Complex support Real
Name Payload
Description Event
Data type {float, int, fract32}
Channel range Unrestricted
Block size range Unrestricted
Sample rate range Unrestricted
Complex support Real

Matlab Usage

File Name: event_module.m 
 M = event_module(NAME, EVENTTYPE) 
 Audio Weaver event module. Triggers callbacks if defined in the BSP 
 Arguments: 
   NAME        - Name of the module. 
   EVENTTYPE   - The event type. This is an integer that will be communicated 
               to the system via the event callbacks. It is up to the system 
               to respond to individual event types as needed 

 Copyright (c) 2024 DSP Concepts, Inc.  All Rights Reserved. 

Copyright (c) 2026 DSP Concepts, Inc.