OsAdjustSoundVolume

From OpenSimulator

(Difference between revisions)
Jump to: navigation, search
(Created)
 
m (Add See Also)
 
(3 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 
{{osslfunc
 
{{osslfunc
|function_syntax=osAdjustSoundVolume(LSL_Integer linknum, LSL_Float volume)
+
|function_syntax=osAdjustSoundVolume(integer linknum, float volume)
 
|threat_level=ignored
 
|threat_level=ignored
 
|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 use of osAdjustSoundVolume
+
//
 
+
// osAdjustSoundVolume Script Example
integer which_prim = 2;
+
// 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()
 
     {
 
     {
         llListen(10, "", llGetOwner(), "");
+
         if (osIsUUID(sound))
 +
        {
 +
            llSay(PUBLIC_CHANNEL, "Touch to hear osAdjustSoundVolume running.");
 +
        }
 +
 +
        else
 +
        {
 +
            llSay(PUBLIC_CHANNEL, "Invalid uuid detected ...");
 +
        }
 
     }
 
     }
 
   
 
   
     listen(integer channel, string name, key id, string msg)
+
     touch_start(integer number)
 
     {
 
     {
         float volume = (float)msg;
+
         float volume = llFrand(1.0);
         llAdjustSoundVolume(volume);
+
         osAdjustSoundVolume(1, volume);
         llOwnerSay("Volume in prim " + (string)which_prim + " was set to " + (string)volume);
+
         osPlaySound(1, sound, volume);
 +
        llSay(PUBLIC_CHANNEL, "The volume of the primitive (link 1) has been adjusted to " + (string)volume);
 
     }
 
     }
}</source>
+
}
|description=Adjust the volume of attached sound for a prim in a linkset.
+
</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 15: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:

Personal tools
General
About This Wiki