[futurebasic] Re: sounds and memory

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : September 1998 : Group Archive : Group : All Groups

From: BMichael@...
Date: Mon, 28 Sep 1998 02:15:39 EDT
>But these are still bandaid fixes. Can anyone give any insight into what the
>_real_ problem is?

I suspect that somewhere in your sound-playing routine you're changing 
memory that shouldn't be changed... perhaps the sound handles aren't 
locked, and they 'move' on you? Regardless, I can pretty much guarantee 
that your sound routine is branching off into "left field" and 
overwriting memory - particularly the memory right after your handle 
variable, but also including the menu-click handler. (Which is patched by 
Apple Menu Options to provide those heirarchical menus.)

Here's what I use to play sounds from the resource fork; I use the sound 
_name_ rather than a resource id because I had trouble with the SOUND 
command any way other than this; however, if you're dealing with 
channels, your routine is obviously more complex; you may need to post 
parts of your sound play function...

LOCAL FN playSound(soundName$)
  IF gSndH& THEN CALL RELEASERESOURCE (gSndH&) : gSndH& = 0
  SOUND END
  gSndH& = FN GET1NAMEDRESOURCE (_"snd ", soundName$)
  LONG IF gSndH&
    soundName$ = "&" + MKI$(gSndH&)
    SOUND soundName$
  END IF
END FN

Bill