You are currently not logged in! Enter your authentication credentials below to log in. You need to have cookies enabled to log in.
This shows you the differences between two versions of the page.
functions:lladjustsoundvolume [2014-12-06 20:39 SLT] sei Be a bit more specific with llSetSoundRadius |
functions:lladjustsoundvolume [2015-09-22 18:41 SLT] (current) sei style |
||
---|---|---|---|
Line 1: | Line 1: | ||
+ | $nav | ||
===== Function: llAdjustSoundVolume ===== | ===== Function: llAdjustSoundVolume ===== | ||
Line 5: | Line 6: | ||
</code> | </code> | ||
- | Change the volume of the sound of a prim when it is already playing. | + | Change the volume of the $lart[sound] of the prim the script is in when it is already playing. |
$delay[0.1] | $delay[0.1] | ||
Line 12: | Line 13: | ||
=== volume === | === volume === | ||
- | A [[types/float]] value indicating the new volume to set, between 0.0 and 1.0. | + | A $lty[float] value indicating the new volume to set, between 0.0 and 1.0. |
===== Notes ===== | ===== Notes ===== | ||
- | * Works only for [[llPlaySound]], [[llLoopSound]], and similar. Does not work for [[llTriggerSound]] or [[llTriggerSoundLimited]]. | + | * Works only for $lfn[llPlaySound], $lfn[llLoopSound], and similar. Does not work for $lfn[llTriggerSound] or $lfn[llTriggerSoundLimited]. |
===== Short examples ===== | ===== Short examples ===== | ||
Line 26: | Line 27: | ||
===== Complete examples ===== | ===== Complete examples ===== | ||
- | The following script will lower the volume of the looping sound every time it's touched. When it gets to zero, it wraps around to maximum volume. | + | The following script will start a looped $lart[sound] in the prim, then lower its volume every time it's clicked. When it gets to zero, it wraps around to maximum volume. |
<file lsl2 llAdjustSoundVolume-example.lsl> | <file lsl2 llAdjustSoundVolume-example.lsl> | ||
float vol = 1; | float vol = 1; | ||
Line 34: | Line 35: | ||
state_entry() | state_entry() | ||
{ | { | ||
- | llLoopSound("Crackling fire", vol); | + | // Start the Jetpack looped sound |
+ | llLoopSound("67f5e4f0-0534-4d97-bc01-f297648d20e0", vol); | ||
} | } | ||
touch_start(integer n) | touch_start(integer n) | ||
{ | { | ||
- | // Lowers the volume of the sound, wrapping around to full volume | + | // Lower the volume of the sound, or go to full volume if already zero |
vol -= 0.125; | vol -= 0.125; | ||
if (vol < 0) | if (vol < 0) | ||
Line 50: | Line 52: | ||
===== See also ===== | ===== See also ===== | ||
- | * [[llStopSound]] stops a sound playing in this prim. | + | * $lfn[llStopSound] stops a sound playing in this prim. |
- | * [[llPlaySound]] plays a sound in this prim. | + | * $lfn[llPlaySound] plays a sound in this prim. |
- | * [[llLoopSound]] plays a looped sound in this prim. | + | * $lfn[llLoopSound] plays a looped sound in this prim. |
- | * [[llLoopSoundMaster]] plays a looped sound letting others synchronize with it. | + | * $lfn[llLoopSoundMaster] plays a looped sound letting others synchronize with it. |
- | * [[llLoopSoundSlave]] plays a looped sound synchronized with a master. | + | * $lfn[llLoopSoundSlave] plays a looped sound synchronized with a master. |
- | * [[llPlaySoundSlave]] plays a sound synchronized with a master. | + | * $lfn[llPlaySoundSlave] plays a sound synchronized with a master. |
- | * [[llSetSoundRadius]] adjusts how far the prim sounds can be heard. | + | * <wrap important>$lfn[llSetSoundRadius]</wrap> adjusts how far the prim sounds can be heard. |
- | * [[llSetSoundQueueing]] adjusts whether sounds are enqueued in this prim. | + | * $lfn[llSetSoundQueueing] adjusts whether sounds are enqueued in this prim. |
- | * [[llTriggerSound]] "drops" a sound where the prim is. | + | * $lfn[llTriggerSound] "drops" a sound where the prim is. |
- | * [[llTriggerSoundLimited]] "drops" a sound where the prim is, with limited reach. | + | * $lfn[llTriggerSoundLimited] "drops" a sound where the prim is, with limited reach. |
- | * [[llPreloadSound]] causes a sound to be preloaded, for faster playing. | + | * $lfn[llPreloadSound] causes a sound to be preloaded, for faster playing. |
+ | * <wrap important>$lfn[llSound]</wrap> plays a sound in this prim (deprecated - use $lfn[llPlaySound] instead). | ||
+ | * <wrap important>$lfn[llSoundPreload]</wrap> causes a sound to be preloaded (deprecated - use $lfn[llPreloadSound] instead). | ||
+ | * $lart[Sound] (general information) | ||