Difference between revisions of "LlSetSoundQueueing"

From Second Life Wiki
Jump to navigation Jump to search
m (Replaced old <LSL> block with <source lang="lsl2">)
(Added links to the llLoopSoundMaster and slave functions which are also affected by the use of this function. Changed caveat warning to be more precise.)
Line 9: Line 9:
|spec
|spec
|caveats=
|caveats=
*It appears that only two sounds can be queued per prim. [[#SVC-4260|SVC-4260]]
*The sound queue is only 1 level deep - this means that beside the sound that is currently playing, there can only be 1 sound in reserve. The sound queue is first-come, first-serve.* [[#SVC-4260|SVC-4260]]
*Sound queuing is a property of the prim, not the script. It can be activated and deactivated by any script in the prim and survives script reset, rerez and script removal.
*Further to the above, the queue order is reversed when using [[llPlaySoundSlave]] - using the below example, the default behaviour would be to play SoundName1 and SoundName2, however when using the aforementioned function the order would be to play SoundName2 and SoundName3.
*Sound queuing is a property of the prim, not the script. It can be activated and deactivated by any script in the prim and survives script reset, re-rez and script removal.
*If used to make smooth transitions using slave/master sounds the sounds tend to go out of sync.
*If used to make smooth transitions using slave/master sounds the sounds tend to go out of sync.
*There is a very small (but audible) gap of silence between sounds due to network latency and processing time.
*There is a very small (but audible) gap of silence between sounds due to network latency and processing time.
Line 24: Line 25:
         llPreloadSound("SoundName1");//This loads the sounds into all in range viewers and cuts delay between sounds.
         llPreloadSound("SoundName1");//This loads the sounds into all in range viewers and cuts delay between sounds.
         llPreloadSound("SoundName2");//All sound parameters can be the name of a sound in the prim's inventory or a UUID of a sound");
         llPreloadSound("SoundName2");//All sound parameters can be the name of a sound in the prim's inventory or a UUID of a sound");
        llPreloadSound("SoundName3"); //This sound will be skipped, as the queue is only 1 level deep.
     }
     }
     touch_start(integer detected)
     touch_start(integer detected)
     {
     {
         llSetSoundQueueing(TRUE);//Set to TRUE for queueing and SoundName2 plays after the SoundName1 has ended.
         llSetSoundQueueing(TRUE);//Set to TRUE for queueing and SoundName2 plays after the SoundName1 has ended.
         //Set to FALSE only the second will be played since the prim has only one sound emmiter and the second was called last.
         //Set to FALSE only the second will be played since the prim has only one sound emitter and the second was called last.
         //Can be set anywhere withing the script (if within an event it will activate when the event is triggered.
         //Can be set anywhere within the script (if within an event it will activate when the event is triggered.
         llPlaySound("SoundName1", 1.0);
         llPlaySound("SoundName1", 1.0);
         llPlaySound("SoundName2", 1.0);
         llPlaySound("SoundName2", 1.0);
        llPlaySound("SoundName3", 1.0); //This sound isn't played as the queue is already full, so this is discarded.
     }
     }
}
}
Line 37: Line 40:
|helpers
|helpers
|also_functions={{LSL DefineRow||[[llLoopSound]]}}
|also_functions={{LSL DefineRow||[[llLoopSound]]}}
{{LSL DefineRow||[[llLoopSoundSlave]]|3=Plays a sound {{HoverText|attached|The sound moves with the prim}}.}}
{{LSL DefineRow||[[llLoopSoundSlave]]|3=Plays a looped sound {{HoverText|attached|The sound moves with the prim}}, synced with the master.}}
{{LSL DefineRow||[[llPlaySoundSlave]]|3=Plays a sound once {{HoverText|attached|The sound moves with the prim}}, synced with the master.}}
|also_tests
|also_tests
|also_events
|also_events

Revision as of 14:54, 22 April 2022

Summary

Function: llSetSoundQueueing( integer queue );

Set whether attached sounds wait for the current sound to finish. If queue is TRUE, queuing is enabled, if FALSE queuing is disabled. Sound queuing is disabled by default.

• integer queue boolean, sound queuing: TRUE enables, FALSE (default) disables

Caveats

  • The sound queue is only 1 level deep - this means that beside the sound that is currently playing, there can only be 1 sound in reserve. The sound queue is first-come, first-serve.* SVC-4260
  • Further to the above, the queue order is reversed when using llPlaySoundSlave - using the below example, the default behaviour would be to play SoundName1 and SoundName2, however when using the aforementioned function the order would be to play SoundName2 and SoundName3.
  • Sound queuing is a property of the prim, not the script. It can be activated and deactivated by any script in the prim and survives script reset, re-rez and script removal.
  • If used to make smooth transitions using slave/master sounds the sounds tend to go out of sync.
  • There is a very small (but audible) gap of silence between sounds due to network latency and processing time.
  • The queued sound must be fully loaded in the viewer, or else it will not play. llPreloadSound is not always reliable in doing its job.
  • Queueing a sound that is identical to the one currently playing will fail. Use llLoopSound instead.
All Issues ~ Search JIRA for related Bugs

Examples

default
{
    state_entry()
    {
        llPreloadSound("SoundName1");//This loads the sounds into all in range viewers and cuts delay between sounds.
        llPreloadSound("SoundName2");//All sound parameters can be the name of a sound in the prim's inventory or a UUID of a sound");
        llPreloadSound("SoundName3"); //This sound will be skipped, as the queue is only 1 level deep.
    }
    touch_start(integer detected)
    {
        llSetSoundQueueing(TRUE);//Set to TRUE for queueing and SoundName2 plays after the SoundName1 has ended.
        //Set to FALSE only the second will be played since the prim has only one sound emitter and the second was called last.
        //Can be set anywhere within the script (if within an event it will activate when the event is triggered.
        llPlaySound("SoundName1", 1.0);
        llPlaySound("SoundName2", 1.0);
        llPlaySound("SoundName3", 1.0); //This sound isn't played as the queue is already full, so this is discarded.
    }
}

See Also

Functions

•  llLoopSound
•  llLoopSoundSlave Plays a looped sound attached, synced with the master.
•  llPlaySoundSlave Plays a sound once attached, synced with the master.

Deep Notes

History

All Issues

~ Search JIRA for related Issues
   Since llSetSoundQueueing only allows two sounds to be played in queue can it be changed to allow more?

Footnotes

  1. ^ Early release notes were not very accurate or thorough, they sometimes included information about features added in previous releases or failed to include information about features added in that release.

Signature

function void llSetSoundQueueing( integer queue );