[futurebasic] SOUND question

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : August 2012 : Group Archive : Group : All Groups

From: Walter Lenk <Walter_Lenk@...>
Date: Fri, 3 Aug 2012 14:49:51 -0400
I have an application that makes a Particular sound when the user 
pushes the correct key in response to a symbol presented on the 
screen. I started out using the SOUND command, and then some years 
ago transitioned to the 'PlaySound' routine posted by Bernie Wylde in 
the 'futurebasic Digest 26 Apr 2010' - this routine uses  NSSound, 
which is deprecated.

Using either routine, there is a latency of about 3 1/2 seconds 
before the sound is produced the 1st time it is called -  I am 
guessing that this delay is caused by the operating system loading 
the routine to produce the sound. I can get around this problem by 

  let gGlassSndHandle = FN GETNAMEDRESOURCE( _"snd ", "Glass")
   ' play it and then stop it immediately
  sound &gGlassSndHandle
  sound end

when the page is originally presented. I then use

   sound &gGlassSndHandle

to play the sound any subsequent times, but after no sound has not 
been produced for about 34 seconds,  the sound routine seems to be 
purged, and the next time I call for a sound there is now again a 
delay of 3 1/2 seconds.

Any ideas on how to keep the sound routine from being purged?

And is there a more modern (non deprecated) way of playing a sound 
either from a resource, or from a.AIF file?




Walter Lenk    Cambridge Ma    617-547-7781