Additionally, interrupt code should
avoid accessing a low-memory global
or calling a trap that would access one. While MultiFinder is running, the applications' low-memory
globals are being swapped in and out. Because of this, the interrupt code cannot rely on which
application's globals are currently available. Even if CurApName
is correct, the interrupt routine
may be called while MultiFinder is in the process of swapping the applications' globals. This
restriction is difficult
to deal with because there is no documention as to which low-memory globals are swapped by
MultiFinder, nor which globals are accessed by traps.
A typical example of this problem is interrupt routines that attempt to restore A5 by examining
CurrentA5. This low-memory global is valid only while the current application is running at non-interrupt time.
Thus, the Macintosh Programmer's Workshop (MPW) routine SetCurrentA5
(or the obsoleteSetupA5
) cannot be used at interrupt level. It is necessary to place the application's A5 value
somewhere it can be located while in the interrupt routine. This is documented in Technical Notes
#180 and #208. In fact, the exact code you need is in #180.
Also, there are interrupt limitations while System 7 is running under Virtual Memory. Therefore, it
is best to avoid interrupt code if at all possible. Move the functionality of the interrupt code into the
application. For example, if you do require a VBL, limit the code to an absolute minimum. Also, set
a global flag for the application to check in its event loop.
The problem is, we overflowed our PACK SysErr range. The Color Picker is PACK 12. If the
Package Manager couldn't load in PACK 12, it adds 12 to 17 and calls SysErr with a code of ... 29.
And there you have it.
PACKs are loaded into the system heap. If there's not enough room in the system heap for a PACK,
the system heap is expanded and the PACK is loaded in. If you set your application to take over the
entire application memory space, the system heap can't grow anymore. The
GetResource('PACK',12) call that the Package Manager makes fails: It adds 12 to 17, and calls
SysErr with a code of 29. This could be what's causing the crashes in your case.
4 | run-length encoding, all of one component at the time, one scan line at a time (24-bit pixels only)
Scheme 4 will store the alpha channel also if cmpCount is set to to four. PackSize is not used and
should be set to zero for compatibility reasons.
See Inside Macintosh, Volume 6, for complete details.
QIs there any way to stop the Dialog Manager from playing with the txSize and txFace fields of a dialog's grafPort so that I can draw Geneva 9-point text from
within a userItem proc?
AUnfortunately, because the Dialog Manager forgets about your previous calls to TextFont and
TextSize when you put up your dialog again, you will need to call TextFont and TextSize every time
your userItem proc is called.
QWhen should the Color Manager be used and when should the Palette Manager be used?
AThe Palette Manager is by far the friendlier and more versatile of the two. It provides all the
functionality you need to customize and animate the colors in your application. You shouldn't ever
need to use the Color Manager unless you require custom color search and complement functions.
Unless you really understand the Color Manager in detail, you are likely to have problems getting
the Color Manager to work in a clean fashion.
When using the Palette Manager, applications following the rules will maintain their respective
color environments safely as windows move back and forth from foreground to background, and
from one screen to another. Accomplishing this with the Color Manager calls is not worth the effort.
For additional information, see the Palette Manager article in this issue.
QI would like to make my fills print better. Currently, they come out as 72 dpi patterns. Is
there a way that
I can make them print at a higher resolution, but have my patterns still print as patterns?
ATo make your patterns print at the printer's resolution, you need to use Printing Manager
PrGeneral's GetRslData and SetRsl opcodes to get and set the resolution, and you must
scale the pattern to match. Let
me explain.
If we do not scale our patterns up to the printer's resolution before print time, we would get "big
chunky" patterns because the printer driver would need to scale the patterns on the fly from 72 dpi
to its resolution. Therefore, we use the "cookie cutter" approach to "place" the pattern into the
object that is being filled. The size of the "cookie cutter" (the destination Rect) depends on the
"scaleFactor." For example, a "scaleFactor" of 2 will have a destination rect of 16 x 16. We will then
CopyBits the pattern one square at a time into the object that is being filled.
You might find the article "Meet PrGeneral" from the July 1990 issue
of develop useful for describing the functionality of PrGeneral in greater detail.
QWhat versions of Apple Color Printer software work with what system software versions?
Can Apple Color Printer software distributed with System 6.0.7 work with System 6.0.5
and earlier versions? I am distributing LaserWriter ® drivers with modified pgsz resources. I
would like to cut back on the number of files I need to distribute.
AThe software sent with version 6.0.7 will work with all other 6.0.x systems. This should be the rule
with most other LaserWriter printer software as well. Color has been supported since LaserWriter
driver 6.0, for color depths of 8 bits or less. Depths greater than 8 bits must be converted before
printing.
There really isn't any simple way to match up the version of released printer software with what
version of the system it is compatible. LaserWriter 7.x is compatible with both System 7 and System
6. It's still prerelease software, however. Do not ship the preliminary LaserWriter 7.x driver with
your application. You'll be able to ship the final LaserWriter 7 driver with your product as soon as
System 7 is final.
QHow can I use SndPlay to function asynchronously? It seems to ignore the async parameter.
ATo use SndPlay asynchronously, you must have allocated a sound channel without passing NIL as
the chan parameter. There is one thing to be aware of in doing this, which often confuses
developers. If the 'snd' resource being used with SndPlay specifies a 'snth' resource, then you cannot
create the sound channel with a synth. Because of a Sound Manager bug that has been present in all
releases through System 6.0.7, SndPlay has not worked correctly for a 'snd' resource specifying a
'snth', with a user channel initialized with a 'snth'. For example, the following code will fail:
SndNewChannel(myChan, sampledSound, init, @myCallBack);
SndPlay(myChan, sndHdl, async);
{sndHdle is a sampled sound}
The Sound Manager attempts to link this 'snth' to the channel with every call to SndPlay. If the
synthesizer has already been installed, the Sound Manager attempts to install it again, only this time
as a modifier. The same 'snth' code ends up being installed more than once in the channel. If the
'snd' contains 'snth' information, then SndPlay can be used once and only once on a channel. A
format 2 'snd' resource is assumed to be a sampled sound. For format 1, check the number of snths
specified in the 'snd' and then check each one. The latest version of SoundApp has source code that
does these tests.
This limitation has been fixed in System 7. In System 7, SndPlay can be called any number of times
on a channel. For older system releases you need to create and dispose of the channel each time after
calling SndPlay, as in the following code:
#include <Resources.h>
#include <Sound.h>
#define TRUE 0xFF
#define FALSE 0
main()
{
Handle Sound;
SndChannelPtr chan;
int i;
OSErr err;
Sound = GetResource('snd', 100);
if (ResError() != noErr || Sound == nil)
Debugger();
for (i = 0; i < 3; ++i)
{
chan = nil;
err = SndNewChannel(
&chan, 0, 0, nil);
if (err != noErr)
Debugger();
err = SndPlay (chan,
Sound, FALSE);
if (err != noErr)
Debugger();
}
}
A good method for playing sampled sound asynchronously on any Macintosh is to create a sound channel
and use the bufferCmd. Find the sound header from the 'snd ' resource and pass the pointer to
this in the bufferCmd. Use this with SndDoCommand or SndDoImmediate. To determine when the sound has completed so that you can know when
to dispose of the channel, send a bufferCmd with SndDoCommand (in order to queue it)
after the bufferCmd. Once your callback procedure is called, set a global signalling that
the sound has finished. The new Sound Manager (System 6.0.7 and beyond) supports a new call, SndChannelStatus, which
will tell you if the channel is playing a sound or not. Instead of the callback procedure,
you can poll the channel’s status to determine when to dispose of the channel.
Example code using the callback procedure can be found in the DTS sample code SoundApp.
Q What is the difference between North and West?
A
North is an absolute direction on the globe. Once you are on the North Pole it is impossible to go any
"further North." West, on the other hand,
is a relative position. No matter where you are on the surface of the Earth, it’s always possible to go further West.
Q
I have found that sounds recorded at good or better quality will not play with system software prior to 6.0.7.
That’s expected, but the fact that SndPlay does not return an error message is not.
How can I check to see if a sound is compressed when running older system software?
A
There is a byte in the SoundHeader
data structure (and thus in a 'snd' resource), called "encode." If the sound is compressed,
the value of this byte will be $FE, which is defined as the constant cmpSH in the headers for the Sound Manager.
Q
Why do golf balls have pocks?
A
As counter intuitive as it may seem
at first, the pocks on golf balls actually make them fly farther. A golf ball builds turbulence in front of it as it flies through the air. If the ball is pocked, the turbulence “fills” the pockets as the ball spins, resulting in less resistance and more flight. 747s have pocks on their wings for the same reason. Dolphins presumably have these pocks on their fins for this purpose as well, but to date none of them have come out publicly and said so.
Q
We generate sounds using the Sound Driver’s four-tone synthesizer. Our application must run on all Macintosh computers and all system software versions starting with System 6.0.
According to an early version of Inside Macintosh, Volume VI, the new Sound Manager's
wave-table synthesizer, which replaces the Sound Driver's four-tone synthesizer, does not
perform as expected on some Macintosh systems. When should we use the Sound Manager and
when should we use the Sound Driver?
AThe Sound Driver is no longer supported, as of System 6.0.7. The wave-form synthesizer in the Sound
Manager released with 6.0.7 does not work correctly for non-Apple Sound Chip machines (Macintosh
Plus, SE, Classic, and LC), but this will be fixed in System 7. If you need to use the wave-form
synthesizer for non-ASC machines running 6.0.7, you could try the Sound Driver with 6.0.7 on the
chance it'll work for your purpose. Use the Sound Driver for non-ASC machines running System 6.0.5
and earlier.
QDoes stereo work? I was hoping to init the left and right channels separately
(using initChanLeft and initChanRight ) and send different sampled sounds out both
channels. But the Sound Manager documentation says stereo is not supported. I figured this
would be a "cheap" way of playing two sounds at the same time, sending them out the left
and right channels and letting the Macintosh mix them together (or telling the user to flip
the MONO switch on their stereo).
AStereo and mixing multiple channels
are new features of the Sound Manager released with System 6.0.7. If you create a mono channel, the
sounds come out both speakers. If you create a left channel, it is a mono sound coming from only the
left channel. Alternatively, creating a right channel will only come from the right.
If you create a stereo channel, then
the sound's left or right position is determined by the sound header you
use (with the bufferCmd). A stereo sound is only supported by a compressed or extended sound header.
You cannot control the left or right panning of a stereo sound. This is only determined by the sound
header and its interleaved data. The left or right init params will have no affect on a stereo channel.
True stereo sounds can only occur by using a stereo sound header. Two mono channels, one for the
left speaker and one for the right, could be opened for the affect that most developers want.
Only the Macintosh SE/30 and the Macintosh IIsi have both the left and right sources mixed to the
internal speaker. A stereo sound on all other Macintosh systems have the left source only sent to the
internal speaker. The right source is only sent to the external port, and it isn't possible to determine
if the external port is in use or not.
QIs it necessary to lock a 'snd' resource that is to be played asynchronously with SndPlay?
AYes, if you are playing a sound resource asynchronously with SndPlay, then you have to lock the
sound. SndPlay will restore the handle's state as soon as the trap returns to the caller. If the call is
asynchronous, the handle's state is restored immediately after calling SndPlay, before the sound
finishes playing.
QWhen converting stacks from HyperCard 1.2.5 to 2.0, the default "fixed line height" setting
for text fields sometimes enlarges the space required by text and destroys the layout of the
screen. For example,text tends to disappear outside the edges of the field, or be misaligned. Deselecting "fixed line
height" corrects the problem in most instances, but there can still be a slight discrepancy in the
amount of space taken up by identical fonts in identical fields between 1.2.5 and 2.0, such that
layouts are disrupted even if "fixed line height" is not selected.
AInherent in the design of HyperCard 2.0, the way a field is displayed may
be different in HyperCard 2.0 than
in HyperCard 1.2.5. Converting a
stack to HyperCard 2.0 from HyperCard 1.2.5 may require that
fields be tweaked to appear properly. Therefore, developers may want to provide special versions of
their stacks for use with HyperCard 2.0, regardless of whether features specific to HyperCard 2.0 are
incorporated.
QSince I have received HyperCard 2.0 I have converted several stacks for 1.x to 2.0 and have
experienced several problems with scripts that worked fine in 1.x. I have recently learned
that HyperCard 1.x will NOT run on System 6.0.7 and later versions. For HyperCard 1.x
users this results in stacks that cannot be used in HyperCard 2.0. For HyperCard stack
developers this presents a nightmare in converting old 1.x stacks for users into 2.0 stacks.
Since encountering these problems I have changed my scripts in 1.x so that when converted
they work. What is Apple's position on "seamless conversion" of HyperCard 1.x stacks to
HyperCard 2.0?
AMost functioning 1.x scripts will work without modification under HyperCard 2.0. However,
HyperCard 2.0 is a bit more strict in enforcing some of the grammar of HyperTalk. For example,
keywords can no longer be used as variable names under 2.0. Under 1.x, keywords could be used as
variable names, but the documentation specifically warned against doing this.
Kudos to our readers who care enough to ask us terrific and well-thought-out questions. The answers to these puzzles have
been supplied courtesy of our teams of technical gurus; our thanks to all. Special thanks to Pete "Luke Skywalker"
Alexander, Mark Baumwell, Jeremy Bornstein, Rich Collyer, Dennis Hescox, Jim Luther, Guillermo Ortiz, Jim Reekes, Bryan
Stearns, Robert Stobel,Forrest Tanaka,Vince Tapia, Jon Zap, and Scott "Zz" Zimmerman for the material in this Q & A
column. *
Have more questions? Need more answers? Take a look at the new developer technical library on AppleLink (updated
weekly) or the Q & A stack on each Developer CD Series disc. *
Software Updates via MacUpdate
The Legend of Heroes: Trails of Cold Ste...
I adore game series that have connecting lore and stories, which of course means the Legend of Heroes is very dear to me, Trails lore has been building for two decades. Excitedly, the next stage is upon us as Userjoy has announced the upcoming... | Read more »
Go from lowly lizard to wicked Wyvern in...
Do you like questing, and do you like dragons? If not then boy is this not the announcement for you, as Loongcheer Game has unveiled Quest Dragon: Idle Mobile Game. Yes, it is amazing Square Enix hasn’t sued them for copyright infringement, but... | Read more »
Aether Gazer unveils Chapter 16 of its m...
After a bit of maintenance, Aether Gazer has released Chapter 16 of its main storyline, titled Night Parade of the Beasts. This big update brings a new character, a special outfit, some special limited-time events, and, of course, an engaging... | Read more »
Challenge those pesky wyverns to a dance...
After recently having you do battle against your foes by wildly flailing Hello Kitty and friends at them, GungHo Online has whipped out another surprising collaboration for Puzzle & Dragons. It is now time to beat your opponents by cha-cha... | Read more »
Pack a magnifying glass and practice you...
Somehow it has already been a year since Torchlight: Infinite launched, and XD Games is celebrating by blending in what sounds like a truly fantastic new update. Fans of Cthulhu rejoice, as Whispering Mist brings some horror elements, and tests... | Read more »
Summon your guild and prepare for war in...
Netmarble is making some pretty big moves with their latest update for Seven Knights Idle Adventure, with a bunch of interesting additions. Two new heroes enter the battle, there are events and bosses abound, and perhaps most interesting, a huge... | Read more »
Make the passage of time your plaything...
While some of us are still waiting for a chance to get our hands on Ash Prime - yes, don’t remind me I could currently buy him this month I’m barely hanging on - Digital Extremes has announced its next anticipated Prime Form for Warframe. Starting... | Read more »
If you can find it and fit through the d...
The holy trinity of amazing company names have come together, to release their equally amazing and adorable mobile game, Hamster Inn. Published by HyperBeard Games, and co-developed by Mum Not Proud and Little Sasquatch Studios, it's time to... | Read more »
Amikin Survival opens for pre-orders on...
Join me on the wonderful trip down the inspiration rabbit hole; much as Palworld seemingly “borrowed” many aspects from the hit Pokemon franchise, it is time for the heavily armed animal survival to also spawn some illegitimate children as Helio... | Read more »
PUBG Mobile teams up with global phenome...
Since launching in 2019, SpyxFamily has exploded to damn near catastrophic popularity, so it was only a matter of time before a mobile game snapped up a collaboration. Enter PUBG Mobile. Until May 12th, players will be able to collect a host of... | Read more »
Price Scanner via MacPrices.net
Apple is offering significant discounts on 16...
Apple has a full line of 16″ M3 Pro and M3 Max MacBook Pros available, Certified Refurbished, starting at $2119 and ranging up to $600 off MSRP. Each model features a new outer case, shipping is free... Read more
Apple HomePods on sale for $30-$50 off MSRP t...
Best Buy is offering a $30-$50 discount on Apple HomePods this weekend on their online store. The HomePod mini is on sale for $69.99, $30 off MSRP, while Best Buy has the full-size HomePod on sale... Read more
Limited-time sale: 13-inch M3 MacBook Airs fo...
Amazon has the base 13″ M3 MacBook Air (8GB/256GB) in stock and on sale for a limited time for $989 shipped. That’s $110 off MSRP, and it’s the lowest price we’ve seen so far for an M3-powered... Read more
13-inch M2 MacBook Airs in stock today at App...
Apple has 13″ M2 MacBook Airs available for only $849 today in their Certified Refurbished store. These are the cheapest M2-powered MacBooks for sale at Apple. Apple’s one-year warranty is included,... Read more
New today at Apple: Series 9 Watches availabl...
Apple is now offering Certified Refurbished Apple Watch Series 9 models on their online store for up to $80 off MSRP, starting at $339. Each Watch includes Apple’s standard one-year warranty, a new... Read more
The latest Apple iPhone deals from wireless c...
We’ve updated our iPhone Price Tracker with the latest carrier deals on Apple’s iPhone 15 family of smartphones as well as previous models including the iPhone 14, 13, 12, 11, and SE.
Use our price... Read more
Boost Mobile will sell you an iPhone 11 for $...
Boost Mobile, an MVNO using AT&T and T-Mobile’s networks, is offering an iPhone 11 for $149.99 when purchased with their $40 Unlimited service plan (12GB of premium data). No trade-in is required... Read more
Free iPhone 15 plus Unlimited service for $60...
Boost Infinite, part of MVNO Boost Mobile using AT&T and T-Mobile’s networks, is offering a free 128GB iPhone 15 for $60 per month including their Unlimited service plan (30GB of premium data).... Read more
$300 off any new iPhone with service at Red P...
Red Pocket Mobile has new Apple iPhones on sale for $300 off MSRP when you switch and open up a new line of service. Red Pocket Mobile is a nationwide MVNO using all the major wireless carrier... Read more
Clearance 13-inch M1 MacBook Airs available a...
Apple has clearance 13″ M1 MacBook Airs, Certified Refurbished, available for $759 for 8-Core CPU/7-Core GPU/256GB models and $929 for 8-Core CPU/8-Core GPU/512GB models. Apple’s one-year warranty is... Read more
Jobs Board
DMR Technician - *Apple* /iOS Systems - Haml...
…relevant point-of-need technology self-help aids are available as appropriate. ** Apple Systems Administration** **:** Develops solutions for supporting, deploying,
Read more
Operating Room Assistant - *Apple* Hill Sur...
Operating Room Assistant - Apple Hill Surgical Center - Day Location: WellSpan Health, York, PA Schedule: Full Time Sign-On Bonus Eligible Remote/Hybrid Regular
Read more
Solutions Engineer - *Apple* - SHI (United...
**Job Summary** An Apple Solution Engineer's primary role is tosupport SHI customers in their efforts to select, deploy, and manage Apple operating systems and
Read more
DMR Technician - *Apple* /iOS Systems - Haml...
…relevant point-of-need technology self-help aids are available as appropriate. ** Apple Systems Administration** **:** Develops solutions for supporting, deploying,
Read more
Omnichannel Associate - *Apple* Blossom Mal...
Omnichannel Associate - Apple Blossom Mall Location:Winchester, VA, United States (https://jobs.jcp.com/jobs/location/191170/winchester-va-united-states) - Apple
Read more
All contents are Copyright 1984-2011 by Xplain Corporation. All rights reserved. Theme designed by Icreon.
|