[comp.sys.mac.programmer] Sound Driver & MultiFinder Fix

rs4u+@andrew.cmu.edu (Richard Siegel) (03/16/88)

        The reason that the Sound Driver glue malfunctions under MultiFinder is
because it allocates a handle (for its own globals, I s'pose), and stores this
handle in low memory. The catch comes in because when initializing itself, it
looks at this handle and tests whether the value is <= ROMBase. If it is, then
it assumes that the handle there is valid and goes ahead. Normally, this handle
is set to a greater value than ROMBase by an IAZNotify routine. This works fine
under the single-program Finder, but under MultiFinder, the IAZNotify hook
never gets called on application exit! (Didn't Apple say something about the
*Notify routines going away soon....?) So what happens is when you run an
application, the handle appears to be valid, and the Sound Driver uses it, and
havoc results.

        Anyway, it's easy enough to do yourself; in LightspeedC, just put this
at the end of your program:

        asm {move.w ROMBase, $E4}

        (I'm not entirely sure of the capitalization of ROMBase; you'll want to
check it out.) $E4 is where the sound driver glue stores its handle. The code
for Pascal is hardly more difficult, and is left as an exercise for the reader.

        (Thanks to Jon Hueras for the info here)

                --Rich

Rich Siegel