Move with sound delay

LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
xfratboy
Posts: 97
Joined: Fri Mar 05, 2010 9:09 pm

Move with sound delay

Post by xfratboy » Tue Dec 14, 2010 6:11 am

I'm wondering if there are any suggestions on a minor yet slightly annoying issue I'm having. I'm playing around with moves and sounds. In this stack (see attached) I want to play a sound when a graphic reaches a specific point on a polygon. One thing I'm seeing is that when the sound is started there's a slight but noticeable pause in the movement of the graphic. Does anyone have an idea that could reduce or eliminate this minor pause?
moveWithSound.zip
(74.82 KiB) Downloaded 278 times

jmburnod
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2729
Joined: Sat Dec 22, 2007 5:35 pm
Contact:

Re: Move with sound delay

Post by jmburnod » Tue Dec 14, 2010 9:52 am

Hi xfratboy,

For me the pause happen when the img "alien.png" move over the btns at the top
of cd.
No pause for me if the img "alien.png" don't move over them

Best

Jean-Marc
https://alternatic.ch

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 4172
Joined: Sun Jan 07, 2007 9:12 pm

Re: Move with sound delay

Post by bn » Tue Dec 14, 2010 10:44 am

Hi Xfratboy,

I notice the delay only for the first time the sound is played. You could 'initialize' the sound in an opencard handler like this. It apparently loads the sounds into memory.

Code: Select all

on opencard
   put the playLoudness into tLoud
   set the playLoudness to 0
   play SciFi3_L.wav
   play SciFi3_R.wav
   play stop
   set the playLoudness to tLoud
end opencard
in the script of the card. You will not really notice it since both sounds are not really played, the first one is immediately stopped by starting the second one, the second one is immediately stopped by the play stop command and on top you set the playloudness to 0 and restore it afterwards.

Is that what you had in mind?

Kind regards

Bernd

xfratboy
Posts: 97
Joined: Fri Mar 05, 2010 9:09 pm

Re: Move with sound delay

Post by xfratboy » Tue Dec 14, 2010 5:31 pm

Thanks for the help. Klaus, I tried that. It's REALLY a small delay, but it is still there. It's transient though; it kind of comes and goes. I've tried with variations of move and/or setting the loc vs. using the move command. I experience the same result. It's just enough of a delay to cause the movement to appear to be interrupted. Oh well.
Attachments
moveWithSound.zip
(36.66 KiB) Downloaded 277 times

Klaus
Posts: 14198
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Move with sound delay

Post by Klaus » Tue Dec 14, 2010 5:58 pm

Hi xfratboy,

I know that we all look alike for you non-germans, but it was Bernd who provided the above script! :D


Best

Klaus (not Bernd!) 8)

xfratboy
Posts: 97
Joined: Fri Mar 05, 2010 9:09 pm

Re: Move with sound delay

Post by xfratboy » Tue Dec 14, 2010 6:06 pm

Oh my gosh that's funny Klaus. OOps!! So sorry Bernd! Thanks BERND!

Klaus
Posts: 14198
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Move with sound delay

Post by Klaus » Tue Dec 14, 2010 6:18 pm

OK, "thou shalt be forgiven"! 8)


Best

Bernd :P

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 4172
Joined: Sun Jan 07, 2007 9:12 pm

Re: Move with sound delay

Post by bn » Tue Dec 14, 2010 9:07 pm

Hi Xfratboy,

When exactly do you see the interruption of the movement. I only see it when the sound is playing. Other than that you have to bear in mind that Livecode is not the fastest program for animation. You have to use some tricks to get it halfway smooth. I turned off the default button. If you are on a Mac that takes an amazing amount of processor to have the buttons pulsating in blue. That is what the button does if you set it to default.
Then you can tweak the movement a bit by setting the syncrate lower. Contrary to what the dictionary says reducing the syncrate increases the fluency of the movement.
Then it also depends on what processor you have.

I upload a version that has some changes. Tell us what it does. When and What.

regards

Bernd (or Klaus or I don't know who...) :)
Attachments
Move With Sounds 0.0.1.livecode.zip
(37.38 KiB) Downloaded 245 times

Post Reply