tim@hoptoad.uucp (Tim Maroney) (03/22/90)
Here's a solution for the play problems in HC1.2.2. It will not work in
earlier versions. Recap: If any other software uses the Sound Manager
in HyperCard's application context (e.g., SuperClock plays its chimes),
the "play" command will no longer work.
Warning: This is a quick and dirty fix.
The fix is an XCMD named "fixSound".
Here is the source in MPW C. Note that I use a precompiled header; you
will have to substitute your own, since MPW does not provide a standard
one.
#pragma load "::mpw:macos.o"
void WriteXPRam(long code, short setting);
short ReadXPRam(long code);
#define XPcode 0x0002007C
pascal void EntryPoint(XCmdPtr p)
{ short xpram;
#pragma unused (p)
if (NGetTrapAddress(0xa051, OSTrap) == NGetTrapAddress(0x8b, OSTrap))
return; /* no ReadXPRam */
if (NGetTrapAddress(0xa052, OSTrap) == NGetTrapAddress(0x8b, OSTrap))
return; /* no WriteXPRam */
xpram = ReadXPRam(XPcode); /* get beep sound resource id */
WriteXPRam(XPcode, 176); /* silence resource id in HC */
SysBeep(1); /* HC1.2.2 patch fixes up Sound Mgr */
WriteXPRam(XPcode, xpram); /* restore old beep sound */
}
Also, since MPW doesn't seem to have glue routines for ReadXPRam and
WriteXPRam:
CASE ON
STRING PASCAL
INCLUDE 'traps.a'
WriteXPRam PROC EXPORT
move.l 4(sp),d0
move.w 10(sp),-(sp)
movea.l sp,a0
_WriteXPRam
addq.w #$2,sp
rts
ENDPROC
ReadXPRam PROC EXPORT
move.l 4(sp),d0
clr.w -(sp)
movea.l sp,a0
_ReadXPRam
move.w (sp)+,d0
ext.l d0
rts
ENDPROC
END
Finally, put this script into your stack:
on play
fixSound
pass play
end play
--
Tim Maroney, Mac Software Consultant, sun!hoptoad!tim, tim@toad.com
If you vote for clowns, you have no right to complain that only clowns
make it to the ballot.