|
Eileen McCallister
Registered User
Join date: 13 Aug 2006
Posts: 9
|
05-30-2007 19:08
When triggering a sound I have to wait for the sound sample to finish before I can trigger it again. I tried llSetSoundQueueing but that does not seem to work. Is there a way to stop the sound and start it again in 1 touch?
I use this script ( by Storm Thunders):
---------------------------------------------------------------------------------------
// Sound Prim Script - On Touch // // Randomly picks a sound in inventory, // plays it when touched. // // Set this between 0.0 and 1.0 float LOUDNESS = 0.5; // //////////////////////////////////////////////// default {
touch_start(integer num) { integer sounds = llGetInventoryNumber(INVENTORY_SOUND);
if ( sounds <= 0 ) return;
string soundname = llGetInventoryName( INVENTORY_SOUND, llFloor(llFrand(sounds)) ); if ( soundname != "" ) { llPlaySound( soundname, LOUDNESS ); } }
}
------------------------------------------------------------------------------------
Eileen
|
|
Talarus Luan
Ancient Archaean Dragon
Join date: 18 Mar 2006
Posts: 4,831
|
05-30-2007 20:32
Well, they *said* they fixed llSetSoundQueueing() in a recent update, but I haven't tested it recently. Still, all it does is keep from interrupting the currently playing sound. The queue is only one level deep, so if you try to play a third (or subsequent to third) sound before the first is complete, it will be ignored.
Just tested it, and it does work. It won't interrupt the currently playing sound, and will play the second sound right after the first. The only way to stop it is to use llStopSound();, which is probably what you are after, or llSetSoundQueueing(FALSE);.
|
|
Eileen McCallister
Registered User
Join date: 13 Aug 2006
Posts: 9
|
05-30-2007 21:04
From: Talarus Luan It won't interrupt the currently playing sound, and will play the second sound right after the first.
Great, that will do. Where do I place llSetSoundQueueing(FALSE); in this script? Sorry, I'm not a scripter at all  Thanks in advance. Eileen
|
|
Talarus Luan
Ancient Archaean Dragon
Join date: 18 Mar 2006
Posts: 4,831
|
05-31-2007 07:44
Well, llSetSoundQueueing(TRUE); will do that (queue the sounds one right after the other without interruption). llSetSoundQueueing(FALSE); will mean playing another sound while one is playing will interrupt the first sound and play the next.
You put it in the state_entry() event. If your script changes states, you will have to put it in the state_entry() event of any other states as well (I don't think you are using states other than default, so don't worry about this).
|