SexScripts : High lag when playing sound - https://ss.deviatenow.com:443/viewtopic.php?f=6&t=976 Page 1 of 1

High lag when playing sound

RustyHammer [ Fri Jun 19, 2020 11:22 pm ]

When playing a small sound file either with playSound() or playBackgroundSound(), there's approximately a one second delay before the sound plays.

SexScripts version: 04-Feb-2020
Platform: Window 10 64-bit

This is a sample script that demonstrates the problem (at least it does on my system):
Code:
setInfos(9, "play-sound-latency", "test", "RustyHammer", "v0.0", 0xFFFFFF, "en", [])

show(null)
setImage(null)

for (;;)
{
   final int selection = getSelectedValue(null, ["playSound", "playBackgroundSound"])
   if (selection == 0)
      playSound("tom.wav")
   else
      playBackgroundSound("tom.wav")
}

When pressing either button, I experience approximately a one second delay before the sound actually starts playing. The audio file in the example, tom.wav, is 22kb, and is one of the standard audio files that comes with SS.

What I was hoping to do was add a simple click sound when the user has selected an option, but with the delay it detracts from the experience.

Does anyone else experience such a delay? If I open the file from Windows Explorer, the file loads and plays in VLC within 0.1 seconds.

Re: High lag when playing sound

doti [ Sun Jun 28, 2020 8:23 pm ]

To fit with the reduction of sound cards latencies, a systematic delay that was added before playing sound will be reduced from 500ms to 200ms

Re: High lag when playing sound

RustyHammer [ Mon Jun 29, 2020 8:48 pm ]

Thanks; do you mean that there is currently a built-in delay of 500ms that will be reduced to 200ms in a future version of SS?

I'm curious, why does there need to be a delay at all? Sorry if I've misunderstood or this has already been covered in another thread, but I couldn't find any other references to delays with sound playback in the forum.

Re: High lag when playing sound

doti [ Wed Jul 08, 2020 12:04 pm ]

There's a random delay from Java involved in reading or starting sounds. When there's some loop around sounds, it make them sounds erratic. The added delay (calculated as (constant - observed delay) ) smoothens this.

Page 1 of 1 All times are UTC + 1 hour [ DST ]
https://ss.deviatenow.com:443/
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
Maroon Fusion theme created by Oxydo
Software, theme modifications, phpBB modification by Doti 2010, 2011