Don't click here unless you want to be banned.

LSL Wiki : llPreloadSound

HomePage :: PageIndex :: RecentChanges :: RecentlyCommented :: UserSettings :: You are crawl338.us.archive.org
llPreloadSound(string sound)

Preloads the sound clip defined by sound. If sound is in the task's inventory, then sound can be the name of the sound clip. If not, sound must be the key of the sound clip.

This function delays the script 1 second.

Note:There's still a bug that, when llPreloadSound is used in connection with llPlaySound, will cause the latter to loop the sound in some circumstances. -CorbenRadium 06/06/2010

Example:
default
{
    state_entry()
    {
        // preload "mysound" for anyone that is currently in listening range of this object.
        llPreloadSound("mysound");
    }
    
    touch_start(integer num_detected)
    {
        llPlaySound("mysound", 1.0); // play "mysound" when touched.
    }
}


This article wasn't helpful for you? Maybe the related article at the LSL Portal is able to bring enlightenment.

Functions | Sound
Comments [Hide comments/form]
I've yet to get this to work...
-- EepQuirk (2005-05-04 11:31:40)
where would be the best place for this in a script? Does it force a preload once the object becomes visible?
Anyone know?
-- MaxCase (2005-08-07 05:41:36)
As soon as it's called, the sound is loaded by everyone within hearing range. (Not quite sure what the range is, probably the max possible, though)
-- SchitsoMonkey (2006-05-19 14:18:35)
The range is relative to each user's draw distance and if the object with this function is within it.
-- EepQuirk (2006-05-21 00:49:53)
How long do you think a good sleep would be for a script that was designed to preload one sound for use with an object?

Is 20 seconds too long/short?
-- MechageoDannunzio (2006-09-07 12:11:56)
anybody have any idea about these things:

1- Do calls, like in a for loop preload each sound called, or does the preload function "overwrite" the previous one if it's not completed?
2- Any idea how to find out how big a sound file is so you can figure out how long you need to preload it for most people before playing it?
-- c-69-252-195-0.hsd1.nm.comcast.net (2007-12-12 19:10:12)
OH, and 3- if a sound is already preloaded and another preload is called for the same sound, does it just go with the one in cache or does it overwrite it?
-- c-69-252-195-0.hsd1.nm.comcast.net (2007-12-12 19:14:21)
1- Do calls, like in a for loop preload each sound called, or does the preload function "overwrite" the previous one if it's not completed?
2- Any idea how to find out how big a sound file is so you can figure out how long you need to preload it for most people before playing it?
3- if a sound is already preloaded and another preload is called for the same sound, does it just go with the one in cache or does it overwrite it?
-- RegMannoen (2007-12-12 19:41:25)