Table of Contents

Start Functions Events Constants Types Language Articles

Function: llAdjustSoundVolume

llAdjustSoundVolume(float volume)

Change the volume of the sound of the prim the script is in when it is already playing.

Sleeps the script for 0.1 seconds.

Parameters

volume

A float value indicating the new volume to set, between 0.0 and 1.0.

Notes

Short examples

llAdjustSoundVolume(0.2); // Sets the volume of a playing sound to 20% of the max.

Complete examples

The following script will start a looped sound in the prim, then lower its volume every time it's clicked. When it gets to zero, it wraps around to maximum volume.

llAdjustSoundVolume-example.lsl
float vol = 1;

default
{
    state_entry()
    {
        // Start the Jetpack looped sound
        llLoopSound("67f5e4f0-0534-4d97-bc01-f297648d20e0", vol);
    }

    touch_start(integer n)
    {
        // Lower the volume of the sound, or go to full volume if already zero
        vol -= 0.125;
        if (vol < 0)
            vol = 1;
        llAdjustSoundVolume(vol);
    }
}

See also