Binding sounds to item values or states
- Last UpdatedDec 04, 2023
- 1 minute read
A running engine should make noise. The noise volume should change depending on engine revolutions per minute (RPM).
Code example
In this example, the sound was created and positioned in the graphic context, but requires an automatic start at the beginning. The definition must be patched. Then the volume is linked to a gauge value scaling on its max.
<patch name="SOUND_P802" start="true" />
<route from="gauge_P802.value" to="SOUND_P802.volume" value="#@gauge_P802.value@/@gauge_P802.needleScale.y@#" />