OsAdjustSoundVolume
From OpenSimulator
(Difference between revisions)
m (Fixed some cut and paste errors) |
m (Add See Also) |
||
| (2 intermediate revisions by one user not shown) | |||
| Line 4: | Line 4: | ||
|permissions=true | |permissions=true | ||
|delay=0.1 | |delay=0.1 | ||
| + | |description=Adjust the volume of attached sound for a prim in a linkset. | ||
|ossl_example=<source lang="lsl"> | |ossl_example=<source lang="lsl"> | ||
| − | // Example | + | // |
| − | + | // osAdjustSoundVolume Script Example | |
| − | integer | + | // Author: djphil |
| + | // | ||
| + | |||
| + | string sound; | ||
| + | |||
| + | default | ||
| + | { | ||
| + | state_entry() | ||
| + | { | ||
| + | sound = llGetInventoryName(INVENTORY_SOUND, 0); | ||
| + | |||
| + | if (sound == "") | ||
| + | { | ||
| + | llSay(PUBLIC_CHANNEL, "Inventory sound missing ..."); | ||
| + | } | ||
| + | |||
| + | else | ||
| + | { | ||
| + | llSay(PUBLIC_CHANNEL, "Touch to hear osAdjustSoundVolume running."); | ||
| + | } | ||
| + | } | ||
| + | |||
| + | touch_start(integer number) | ||
| + | { | ||
| + | float volume = llFrand(1.0); | ||
| + | osAdjustSoundVolume(1, volume); | ||
| + | osPlaySound(1, sound, volume); | ||
| + | llSay(PUBLIC_CHANNEL, "The volume of the primitive (link 1) has been adjusted to " + (string)volume); | ||
| + | } | ||
| + | } | ||
| + | </source> | ||
| + | '''And with uuid:''' | ||
| + | <source lang="lsl"> | ||
| + | // | ||
| + | // osAdjustSoundVolume Script Example | ||
| + | // Author: djphil | ||
| + | // | ||
| + | |||
| + | string sound = "ed124764-705d-d497-167a-182cd9fa2e6c"; | ||
default | default | ||
| Line 13: | Line 52: | ||
state_entry() | state_entry() | ||
{ | { | ||
| − | + | if (osIsUUID(sound)) | |
| + | { | ||
| + | llSay(PUBLIC_CHANNEL, "Touch to hear osAdjustSoundVolume running."); | ||
| + | } | ||
| + | |||
| + | else | ||
| + | { | ||
| + | llSay(PUBLIC_CHANNEL, "Invalid uuid detected ..."); | ||
| + | } | ||
} | } | ||
| − | + | touch_start(integer number) | |
{ | { | ||
| − | float volume = ( | + | float volume = llFrand(1.0); |
| − | osAdjustSoundVolume( | + | osAdjustSoundVolume(1, volume); |
| − | + | osPlaySound(1, sound, volume); | |
| + | llSay(PUBLIC_CHANNEL, "The volume of the primitive (link 1) has been adjusted to " + (string)volume); | ||
} | } | ||
| − | }</source> | + | } |
| − | + | </source> | |
|additional_info=This function was added in 0.9.0.1 | |additional_info=This function was added in 0.9.0.1 | ||
}} | }} | ||
| + | '''See Also:''' | ||
| + | * [[osSetSoundRadius]] | ||
| + | * [[osAdjustSoundVolume]] | ||
Latest revision as of 14:04, 3 December 2020
osAdjustSoundVolume(integer linknum, float volume)
| |
| Adjust the volume of attached sound for a prim in a linkset. | |
| Threat Level | This function does not do a threat level check |
| Permissions | Use of this function is always allowed by default |
| Extra Delay | 0.1 seconds |
| Example(s) | |
// // osAdjustSoundVolume Script Example // Author: djphil // string sound; default { state_entry() { sound = llGetInventoryName(INVENTORY_SOUND, 0); if (sound == "") { llSay(PUBLIC_CHANNEL, "Inventory sound missing ..."); } else { llSay(PUBLIC_CHANNEL, "Touch to hear osAdjustSoundVolume running."); } } touch_start(integer number) { float volume = llFrand(1.0); osAdjustSoundVolume(1, volume); osPlaySound(1, sound, volume); llSay(PUBLIC_CHANNEL, "The volume of the primitive (link 1) has been adjusted to " + (string)volume); } } And with uuid: // // osAdjustSoundVolume Script Example // Author: djphil // string sound = "ed124764-705d-d497-167a-182cd9fa2e6c"; default { state_entry() { if (osIsUUID(sound)) { llSay(PUBLIC_CHANNEL, "Touch to hear osAdjustSoundVolume running."); } else { llSay(PUBLIC_CHANNEL, "Invalid uuid detected ..."); } } touch_start(integer number) { float volume = llFrand(1.0); osAdjustSoundVolume(1, volume); osPlaySound(1, sound, volume); llSay(PUBLIC_CHANNEL, "The volume of the primitive (link 1) has been adjusted to " + (string)volume); } } | |
| Notes | |
| This function was added in 0.9.0.1 | |
See Also:
- osSetSoundRadius
- osAdjustSoundVolume