Viz Engine Administrator Guide
Version 5.0 | Published December 20, 2022 ©
Shared Memory Integration of Channel Volume Levels
The volume level of Live Input Channels like SDI, IP or NDI as well as clip channels can be exposed to a Shared Memory Variable. This could be used, for example, to visualize a level meter of an input source.
Any change to the input level is written into a shared memory variable in the System.Map. The naming convention is the following:
-
AudioLevel.LiveIn0_0 for the first Live Input and the first channel.
-
AudioLevel.LiveIn0_1 for the first Live Input and the second channel.
-
AudioLevel.LiveIn1_0 for the second Live Input and the first channel.
-
AudioLevel.LiveIn1_1 for the second Live Input and the second channel.
-
AudioLevel.LiveIn5_63 for the sixth Live Input and the sixty fourth channel.
-
AudioLevel.ClipIn0_0 for the first Clip and the first channel.
-
etc....
To specify how often these values are updated, you can either specify a fixed value in the Viz configuration file:
############################SECTION AUDIO_CONFIG############################## 0: No calculation of VU meter values at all (default), > 0: frequency of frames when calculation happens (every X frame(s)).AudioLevelMeterUpdateInterval = 2or you can send a command to change it during runtime:
MAIN*CONFIGURATION*AUDIO*LEVEL_METER_UPDATE_INTERVAL GET / SETInformation: A setting of 0 means to not send values anymore.
Note: That the value you receive is in decibel, which is a logarithmic value between -0 and -120.
A sample script to generate a volume meter:
dim mySrc as stringSub OnSharedMemoryVariableChanged(map As SharedMemory, mapKey As String) dim tmp as array[string] dim normal_val as double If mapKey.StartsWith("AudioLevel") Then dim val = Cdbl(map[mapKey]) normal_val = calculate(val) mapKey.Split("_",tmp) dim idx = cInt(tmp[-1]) if ChildContainerCount >= idx then GetChildContainerByIndex(idx).scaling.y = normal_val end If End IfEnd Subfunction calculate(db as double) as double dim myval as double calculate = 10 ^(db/20.00)end functionsub OnInitParameters() RegisterParameterString("source","Source","LIVE1",20,20,"")end subSub OnParameterChanged(parameterName As String) if parameterName = "source" Then if mySrc<>"" Then system.map.UnregisterChangedCallback("AudioLevel."&mySrc&"_0") system.map.UnregisterChangedCallback("AudioLevel."&mySrc&"_1") end If mySrc = GetParameterString("source") system.map.RegisterChangedCallback("AudioLevel."&mySrc&"_0") system.map.RegisterChangedCallback("AudioLevel."&mySrc&"_1") end Ifend SubThis script generates an input field, that specifies the source (for example, ClipIn0). Any change in the shared memory map for AudioLevel.Clip0_0 or AudioLevel.Clip0_1 (Stereo) is applied to y-scaling of two subcontainers: