de en es fr
Let the machine help
Light teasing, exhibition, BDSM, sissyfication, watersports... with sounds and pictures


Post new topic Reply to topic  [ 4 posts ] 
Author Message
 High lag when playing sound
PostPosted: Fri Jun 19, 2020 11:22 pm 
Offline
Regular
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.


Top
 Profile Send private message 
 
 Re: High lag when playing sound
PostPosted: Sun Jun 28, 2020 8:23 pm 
Offline
Site Admin
User avatar
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


Top
 Profile Send private message 
 
 Re: High lag when playing sound
PostPosted: Mon Jun 29, 2020 8:48 pm 
Offline
Regular
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.


Top
 Profile Send private message 
 
 Re: High lag when playing sound
PostPosted: Wed Jul 08, 2020 12:04 pm 
Offline
Site Admin
User avatar
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.


Top
 Profile Send private message 
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC + 1 hour [ DST ]


Who is online

Users browsing this forum: No registered users and 4 guests


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:  


Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
Maroon Fusion theme created by Oxydo
Software, theme modifications, phpBB modification by Doti 2010, 2015
This website uses session cookies only.