Unofficial LSL Reference

[[functions:llpreloadsound]]


Unofficial LSL reference

User Tools

Login

You are currently not logged in! Enter your authentication credentials below to log in. You need to have cookies enabled to log in.

Login

Forgotten your password? Get a new one: Set new password

This is an old revision of the document!


Function: llPreloadSound

llPreloadSound(string sound)

Preloads a sound. The idea of preloading a sound is to transmit the sound in advance, so that when the time to play it comes, it is already cached by the surrounding avatars' viewers, and plays without delay.

Sleeps the script for 1.0 seconds.

Parameters

sound

Sound name or UUID of the sound clip to preload.

Notes

  • If used in a HUD, the preload is only effective for the owner.
  • Sounds are usually deleted from the cache when relogging.
  • If sound is a UUID, and an item with that name does not exist in the prim's inventory, the sound with that UUID will be preloaded.
  • If sound is a UUID and it matches a sound item that exists in the prim's inventory, the sound item takes precedence.
  • If sound is a UUID and it matches an item other than a sound in the prim's inventory, an error will be privately said (20m range) to the owner in DEBUG_CHANNEL.
  • If sound is not a UUID, and an item with that name does not exist, or is not a sound, an error will be privately said (20m range) to the owner in DEBUG_CHANNEL.

Short examples

llPreloadSound("My Sound"); // Preloads the sound "My Sound" (the clip must exist in the prim)

Complete examples

llPreloadSound-example.lsl
default
{
    on_rez(integer param)
    {
        // Preload a bubbling sound when this object is rezzed.
        llPreloadSound("00000000-0000-0000-0000-000000000115");
    }

    touch_start(integer count)
    {
        // When touched, the sound will immediately be ready to play if the avatar
        // was present when the object was rezzed.
        llPlaySound("00000000-0000-0000-0000-000000000115", 1.0);
    }
}

See also