Change font size
It is currently Tue Dec 18, 2018 12:13 pm

Forum rules


{L_IMAGE}



Post a new topicPost a reply Page 1 of 1   [ 5 posts ]
Author Message
 Post subject: Play Sound
PostPosted: Mon Feb 04, 2008 3:11 pm 
Site Admin
User avatar

Joined: Sat Feb 02, 2008 5:27 pm
Posts: 843
{L_CODE}:
default
{
    state_entry()
    {
        llSetTimerEvent(9.9);
        llSay(0,"reset.");
    }
   
    timer()
    {
        llPlaySound("00000000-0000-0000-0000-000000000000",0.5);
    }
   
   
}


Last edited by Nebadon Izumi on Wed Feb 06, 2008 3:33 pm, edited 1 time in total.

Top
 Profile  
 
 Post subject: Re: Play Sound
PostPosted: Mon Feb 04, 2008 4:30 pm 
Site Admin
User avatar

Joined: Sat Feb 02, 2008 6:15 pm
Posts: 4
Location: The Woods Of Oregon
llLoopSound() doesnt seem to be implemented yet. We can use timers to loop sound, but loopsound would be kewl! Great work, everyone!

Neb, should I post comments like this to a new topic or thread? Are we trying to keep these threads just as a script library?


Top
 Profile  
 
 Post subject: Re: Play Sound
PostPosted: Mon Feb 04, 2008 5:37 pm 
Site Admin
User avatar

Joined: Sat Feb 02, 2008 5:27 pm
Posts: 843
yea i hope that people have dialogue here about these scripts. :ugeek:


Top
 Profile  
 
 Post subject: Re: Play Sound
PostPosted: Mon Feb 11, 2008 1:02 pm 
Furious Typer
User avatar

Joined: Sat Feb 02, 2008 10:02 pm
Posts: 104
Location: Romania, Bucharest
As a note if it may be of any help... I managed to get llLoopSound almost half-working. I did this in LSL_BuiltIn_Commands.cs:

If this is the normal working llPlaySound,

public void llPlaySound(string sound, double volume)
{
m_host.AddScriptLPS(1);
m_host.SendSound(sound, volume, false);
}


I tried to experiment making llLoopSound like this:

public void llLoopSound(string sound, double volume)
{
m_host.AddScriptLPS(1);
while (0==0)
{
m_host.SendSound(sound, volume, false);
System.Threading.Thread.Sleep(5000);
}
}


It basically worked, with the only problem that using Thread.Sleep causes a "Thread was being aborted." error (same as if you try making a do{...}while(...) script), and the loop only lives one time. If it would have worked like that, the only thing that would have been needed was for the timer to be the length of the sound file, and the implementation would have been complete.

Because of the thread aborting error, it dies after the first 2 loops. During these 2 loops however, llLoopSound looped the sound file correctly over my timer, without causing any additional lag nor stopping any other active scripts.

So if anyone can figure these last 2 things from here (fixing the abort error and getting the timer to be the sounds length), its implemented and working, at least temporarily if there's is a better way then that.


Top
 Profile  
 
 Post subject: Re: Play Sound
PostPosted: Mon Feb 11, 2008 8:16 pm 
User avatar

Joined: Tue Feb 05, 2008 12:13 am
Posts: 24
Location: Central California
{L_QUOTE}:
Because of the thread aborting error, it dies after the first 2 loops.


I remember reading somewhere in opensim.org that script loops are not working yet. Maybe that is why this script doesn't work.

_________________
"...a book with no readers is not a fully effective work of art." Rudy Rucker


Top
 Profile  
 
Display posts from previous:  Sort by  
Post a new topicPost a reply Page 1 of 1   [ 5 posts ]


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron


Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
610nm Style by Daniel St. Jules of Gamexe.net