Document toolboxDocument toolbox

(8.D.2.2) UpdateSampleRate

Overview

Updates the sample rate of each module wire in the system

Discussion

The module is designed to update the sample rate of all the wires in the system.

Attach the input pin of this module to the HW input pin of the AWD.

At build time, the module will build an array containing the sample rate information for each wire in the system. The .sampleRate parameter can be updated while in either design mode or in tuning mode.

This module's set function will recalculate the sample rate for each wire in the system using the formula [new wire SR] = [wire SR] * (.sampleRate / [HW pin SR]) After the wires have been updated, the module then calls the set function for each module. This will cause each module to recompute its derived variables.

Because the .sampleRate variable can be updated either manually or from the firmware using control I/O an output pin is provided to indicate when updating all the wire sample rates is complete When the .sampleRate variable is changed the output is set to 1. When all wire sample rates are changed and each module's set function is called (i.e. the change is complete) the output is set to 0. This can be used to mute the output of the system using a MuteUnmute module.

Note that this module does not change the target sample rate

In the typical use case, when the sample rate of the running target changes it causes the target firmware to use Control I/O to change the .sampleRate variable thus allowing the running layout to match processing to the new sample rate running on the target

Type Definition

typedef struct _ModuleUpdateSampleRate { ModuleInstanceDescriptor instance; // Common Audio Weaver module instance structure FLOAT32 sampleRate; // Desired sample rate FLOAT32 initialSampleRate; // Default sample rate of the system. Updated during the construction time. INT32 updateActive; // Flag to control the state of the boolean output pin. FLOAT32* wireSR; // Array of all modules wire sample rate info } ModuleUpdateSampleRateClass;

Properties

Name

Type

Usage

isHidden

Default value

Range

Units

sampleRate

float

parameter

0

48000

Unrestricted

 

initialSampleRate

float

state

1

48000

Unrestricted

 

updateActive

int

state

1

0

0:1:1

 

wireSR

float*

state

1

[1 x 1]

Unrestricted

 

Pins

Input Pins

Name: dummy

Description: Attach to system input pin

Data type: {float, int, fract32}

Channel range: Unrestricted

Block size range: Unrestricted

Sample rate range: Unrestricted

Complex support: Real

Output Pins

Name: updateActive

Description: Boolean indicating that sample rates are being updated

Data type: int

MATLAB Usage

File Name: update_sample_rate_module.m

M=update_sample_rate_module(NAME) This module updates the sample rate information within wires and then then calls the set function for each module. It can be used to implement real-time sample rate changes. Arguments: NAME - name of the module.

Â