VJ Master API

Developer API

I have done my best to document all classes, structs, enums and interfaces. I used the help of an A.I. but manually corrected those that were blatantly incorrect. I am updating ambiguous briefs as I go along.

I have not documented the editor module as it only provides some cool editor tricks that should not affect your project. For example, add a ShaderTech details panel category.

As I continue to work inside of VJ Master, class names and functions may change in the future. This can be due to bug fixes, new features or updating to new engine versions.

Audio IO Buffer

This section applies to custom shader code only: compute shaders, Custom material nodes and Niagara HLSL. The audio material expressions, the Niagara data interface and the Blueprint audio events read the buffer for you.

Overview

Each audio source (an IO) is analysed separately. The results are uploaded to the GPU as four flat arrays: frequency bands, amplitudes, pitches and beats. All active IOs share these arrays, with the values of each IO stored one after another.

The Audio IO Buffer is the index into those arrays. For every IO it stores whether the IO is active, how many values it has, and the offset at which its values start in each array.

Layout

The buffer holds one row of 12 unsigned integers per IO. The row is fixed by the IO type.

RowIO
0Playback Waveform
1Playback Noise
2Playback Player
3Playback Engine Player
4Capture Loopback
5Capture Microphone
6Capture Engine Submix
7Reserved
8 – 15Additional capture instances created at runtime (1.6)

The buffer always holds 16 rows, 192 values in total. In Blueprint, the X component of Get IO Id is the row.

Row Fields

OffsetDefineDescription
0AudioIO_Items_Active1 while the IO is running, otherwise 0. The other fields are only valid while this is 1.
1AudioIO_Items_OrderActivation order, starting at 1. Used internally to pack the arrays.
2AudioIO_Items_NumChannelsNumber of channels analysed.
3AudioIO_Items_NumFrequencyBandsNumber of frequency bands per channel.
4AudioIO_Items_FrequencyBandHistorySizeNumber of frames of band history kept. 1 keeps the latest frame only.
5AudioIO_Items_FrequencyBandsStartIndexOffset of this IO in the frequency bands array.
6AudioIO_Items_AmpltitudeHistorySizeNumber of amplitude values kept per channel.
7AudioIO_Items_AmplitudesStartIndexOffset of this IO in the amplitudes array.
8AudioIO_Items_PitchHistorySizeNumber of pitch values kept per channel.
9AudioIO_Items_PitchesStartIndexOffset of this IO in the pitches array.
10AudioIO_Items_BeatHistorySizeNumber of beat values kept per channel.
11AudioIO_Items_BeatsStartIndexOffset of this IO in the beats array.

Indexing

index = row × 12 + offset

The number of frequency bands of Capture Loopback (row 4, offset 3) is at index 4 × 12 + 3 = 51.
The active flag of Capture Microphone (row 5, offset 0) is at index 5 × 12 + 0 = 60.

Reading Values

Frequency bands are stored per channel, then per history frame:

index = start + band + (bands × frame) + (history size × bands × channel)

Example: an IO with 32 bands, a history size of 1 and a start index of 32. Band 5 of the latest frame (frame 0) is at 32 + 5 = 37 for channel 0, and at 32 + 5 + (1 × 32 × 1) = 69 for channel 1.

Amplitudes, pitches and beats hold one value per channel and frame:

index = start + frame + (history size × channel)

Shader Helpers

The plugin provides accessor functions that perform these lookups and validate the IO:

#include "/ST_AudioVisualisation/Shared/Libs/AudioIOBuffersLib.ush"

bool IsValid; float Value;
GetFrequencyBandValue(IO, BandIndex, HistoryIndex, ChannelIndex, IsValid, Value);

Also available: GetAmplitudeValue, GetPitchValue, GetBeatValue, GetNumFrequencyBands, GetNumChannels and IsIOValid. IO is the row.

The offsets are defined in Shaders/Shared/Libs/AudioIOLib.ush and mirrored in ST_AudioIOLib.h.