send command hiccups?

Dar Scott dsc at swcp.com
Thu May 17 11:57:40 EDT 2012


To get a more uniform timing, do the send at the start of the script (but after your exit test).  This can easily hog the computer if the wheel speed is high, though.  Using a minimum period (perhaps in addition testing  'done') might help, but it should be higher, say .3 seconds.   The page on "sync" in Primer on Message Machinery also describes a way to get even finer timing, but I don't think you need that.  

Hiccups can happen when you get more than one cycle running.  It seems to me that clicking the button twice while the wheel is slow can do this.  You might have more than one cycle running but don't realize it because of play collisions.  Using the flag is OK, however there are other ways to make sure to stop the send cycle--some of Sarah's commands in the mentioned primer might be overkill, but make sure the message machine is killed.  Getting multiple cycles running or not really killing a cycle are the most common errors in using send in a cycle.  

In using send, look at the message queue using the message box.  You should always see only one dingDong in the list.  if, during development, you hear the hiccup, look at the number of messages.

You might want to see how long it takes to start a play.  

Dar

On May 17, 2012, at 12:28 AM, Nicolas Cueto wrote:

> Hello All,
> 
> For a spinning wheel-of-fortune effect, I want a "ding" sound to
> repeat at even intervals. And I'd like those intervals to be as short
> as audibly possible without the sound file being too cut-off.
> 
> Using the script below, the "play 'ding'" audibly cycles at an even
> metre a few times, but, after the nth time, there's a very brief but
> clearly perceivable pause or hiccup. When that "nth" time happens
> depends on the wait time of the "send" command, but it's about every
> 6th to 11th cycle.
> 
> I've tried playing with the send time, as well as editing the original
> sound file to be as audibly brief as possible.  In fact, I've been
> attacking this "hiccup" problem on-and-off over the years. One
> "solution" I've tried is to string the dings into a new sound file and
> use a player object to play it. But, at some point, when that spinning
> wheel starts visually slowing down, I just don't see any way of
> getting around the problem that I must rely on a delaying send-in-time
> command to make the wheel also sound like it's slowing down.
> 
> Thank you in advance.  -- Nicolas Cueto
> 
> 
> THE SCRIPT...
> 
> on mouseUp
>   set the cpFlag of me to not the cpFlag of me
>   switch the cpFlag of me
>      case "true"
>         set the label of me to "S T O P"
>         send "dingDing" to me in 0 milliseconds
>         break
>      case "false"
>         set the label of me to "D I N G"
>         break
>   end switch
> end mouseUp
> 
> on dingDing
>   if the cpFlag of me is false then exit dingDing
>   play "ding" -- an au file, length of 0.089 seconds
>   put field "sendWait" into tSendWaittime_ding
>   if tSendWaittime_ding <= 0 then put 90 into tSendWaittime_ding
>   send "dingDing" to me in tSendWaittime_ding milliseconds
> end dingDing
> 
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode





More information about the use-livecode mailing list