Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Familiar sound troubles.

InuYasha Meiji
Half Demon
Join date: 14 Mar 2005
Posts: 127
05-31-2005 09:24
I read somewhere that since version 1.4 that there seems to be problems with playing sound in scripts. I maybe running into one of those problems. Maybe someone could help me with this.

I have a clock I'm working on. I have all the code working but one part. It currently plays one sound file at each quarter. Meaning for those who don't know. It chimes at every quarter hour. But the clock I am modeling it after, also chimes out the hour. I am having trouble playing the same sound file, over and over in a dowhile loop.

I have a integer variable holding the current hour. I called it count. When the minute hits 0, top of the hour, it starts this do while loop using the count variable I created.

The first thing I noticed was at 5 SL time it only chimed twice. I thought somehow I didn't make the variable correctly and the floating point hour wasn't being changed into an integer properly. So, to test that aspect out I added a llSay to say "CHIME" each time the chime should ring. Guess what! The loop was working properly. I forced the chime to ring out the 5 O'clock hour at several mins past 5. In other words, it was 10 past 5, but I had it ring out the 5th hour for me. It did write "CHIME" into the chat window 5 times.

I used llPlaysound in the loop in the same place I used the llSay command to say "CHIME" five times. I used llPlaySound in conjunction with a llSleep command and it helped a little, but didn't fix it. I also try setting the sound queue on, but it seemed to make no difference.

I would put my code in here, but the SL grid is down at the moment, and I was hoping for help so I could fix this as soon as it came back up.

Here in the North East part of the US, SL is down during my part of the day. I'm home from Dialysis today, and with the time difference, SL is down between 9 am and 3 pm. God I'm board right now.

-Inu-
Keknehv Psaltery
Hacker
Join date: 11 Apr 2005
Posts: 1,185
05-31-2005 10:02
I think I know what probably happened...

You called many sound calls without a break in between them, so, in effect, you had all 5 of them play, but 3 of them only played the first moment of silence that they had.

To fix this, you need to add a pause in between your llPlaySound() calls. This would allow the sounds to finish playing before the next one began.

My guess is that you were using llSetSoundQueuing(), correct?
InuYasha Meiji
Half Demon
Join date: 14 Mar 2005
Posts: 127
I'll give it a try.
05-31-2005 16:46
From: Keknehv Psaltery
I think I know what probably happened...

You called many sound calls without a break in between them, so, in effect, you had all 5 of them play, but 3 of them only played the first moment of silence that they had.

To fix this, you need to add a pause in between your llPlaySound() calls. This would allow the sounds to finish playing before the next one began.

My guess is that you were using llSetSoundQueuing(), correct?


Yes, I have the queuing turned on. I left it it, but never noticed a difference with or without it.

-Inu
Christopher Omega
Oxymoron
Join date: 28 Mar 2003
Posts: 1,828
05-31-2005 17:21
What's probably happening here is that subsequent llPlaySounds are called too fast after your initial llPlaySound. Ideally, your clock would call llPlaySound once, wait the length of the sound using a timer or llSleep, call llPlaySound again, wait the length of the sound, then call llPlaySound again, etc, until you are done looping. The sound engine only lets a script play one sound at a time when using llPlaySound, and queues the first call occuring during the sound currently playing if llSetSoundQueueing is TRUE.

==Chris