Repository navigation
AudioIndicator JSON
This page describes the persisted format of the audio indicator in a project, in Mixel, and in templates. For the user guide on writing .vttp files by hand, see Audio JSON.
The indicator is saved in two modes:
-
toJSON(false)- the real Mixel state: the selected audio source, the current property values, and the size and position of the layer. -
toJSON(true)- a template: property values with no link to the project, plus the layer placement description (maket).AudioSourceProperty.toJSON(true)returns an empty object, so the selected source does not end up in the template.
{
"name": "com.velitask.plagin.official.audio",
"data": {
"properties": {}
}
}| Part | Value |
|---|---|
| plugin uid | com.velitask.plagin.official |
| indicator name | audio |
In a real Mixel, the size and position of the layer are stored next to properties. The exact shape of these State fields depends on the current runtime, so an abbreviated structure is shown; the properties are shown in full.
{
"name": "com.velitask.plagin.official.audio",
"data": {
"size": { "...": "layer size state" },
"positionInParent": { "...": "layer position state" },
"properties": {
"audioSource": {"sourceId": {"value": 5}},
"windowSeconds": {"value": 10},
"audioEnabled": {"value": true},
"volume": {"value": 100}
}
}
}sourceId is the identifier of the source inside the project; 0 or a missing key means "no source selected".
In a template, maket is written instead of size and positionInParent. When a template is exported from the application, the layer is written with a proportional maket (preset: "proportional" with the shares x, y, w, h); by hand you can set auto: the placement is taken from defineMaket(...) - bottom-left corner, a margin of 50 on the right and at the bottom, size 480x120. The source is absent from the template: audioSource is an empty object.
{
"name": "com.velitask.plagin.official.audio",
"data": {
"maket": { "preset": "auto" },
"properties": {
"audioSource": {},
"windowSeconds": {"value": 10},
"audioEnabled": {"value": true},
"volume": {"value": 100}
}
}
}The row order matches defineProperties().
| JSON key | Java property | SDK type | User meaning | Default |
|---|---|---|---|---|
audioSource |
mAudio |
AudioSourceProperty |
The selected audio source. | Not selected; {} in a template. |
windowSeconds |
mWindowSeconds |
IntegerSliderProperty |
Width of the waveform window in seconds. |
10, range 2..60
|
audioEnabled |
mAudioEnabled |
BooleanProperty |
Play the sound of the source. | true |
volume |
mVolume |
IntegerSliderProperty |
Volume in percent. |
100, range 0..100
|
| Key | Values | Meaning |
|---|---|---|
sourceId.value |
integer, 0 - not selected |
Identifier of the audio source in the project. Saved only in the real state. |
Only sources of the "audio" type are accepted. The indicator has no adaptive mode: exactly the saved sourceId is used. Sources have no sensorId key.
IntegerSliderProperty saves {"value": N}, range 2..60. If the window is longer than the source, it is shortened to the duration of the source. When the value is set from the interface, it is clamped to the range; when JSON is read, the value is not brought into the range.
BooleanProperty is saved as {"value": true|false}. With false, resolveVoice returns null and no sound is played; the waveform is still drawn.
IntegerSliderProperty saves {"value": N}; 0..100 is allowed, and the resulting volume is N / 100. The property is read in resolveVoice(TickContext) only when audioEnabled = true.
A short window (4 seconds), sound off:
{
"name": "com.velitask.plagin.official.audio",
"data": {
"maket": { "preset": "auto" },
"properties": {
"audioSource": {},
"windowSeconds": {"value": 4},
"audioEnabled": {"value": false},
"volume": {"value": 100}
}
}
}-
VelitaskPlagin.getUID()(com.velitask.plagin.official) must not be changed without migrating saved projects. -
Indicator.getName()(audio) must not be changed without a migration. - Property names (
audioSource,windowSeconds,audioEnabled,volume) must not be renamed without a migration: loading goes by name, so renaming is more dangerous than reordering. - The waveform colors are set in code and are not saved to JSON.
- The sound is controlled by
resolveVoiceonly; the obsolete sound fields ofAudioSourcePropertyitself are not used in the indicator JSON.