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
Recruit two powerful-sounding students t...
I am a fan of anime, and I hear about a lot that comes through, but one that escaped my attention until now is A Certain Scientific Railgun T, and that name is very enticing. If it's new to you too, then players of Blue Archive can get a hands-on... | Read more »
Top Hat Studios unveils a new gameplay t...
There are a lot of big games coming that you might be excited about, but one of those I am most interested in is Athenian Rhapsody because it looks delightfully silly. The developers behind this project, the rather fancy-sounding Top Hat Studios,... | Read more »
Bound through time on the hunt for sneak...
Have you ever sat down and wondered what would happen if Dr Who and Sherlock Holmes went on an adventure? Well, besides probably being the best mash-up of English fiction, you'd get the Hidden Through Time series, and now Rogueside has announced... | Read more »
The secrets of Penacony might soon come...
Version 2.2 of Honkai: Star Rail is on the horizon and brings the culmination of the Penacony adventure after quite the escalation in the latest story quests. To help you through this new expansion is the introduction of two powerful new... | Read more »
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 »
Price Scanner via MacPrices.net
May 2024 Apple Education discounts on MacBook...
If you’re a student, teacher, or staff member at any educational institution, you can use your .edu email address when ordering at Apple Education to take up to $300 off the purchase of a new MacBook... Read more
Clearance 16-inch M2 Pro MacBook Pros in stoc...
Apple has clearance 16″ M2 Pro MacBook Pros available in their Certified Refurbished store starting at $2049 and ranging up to $450 off original MSRP. Each model features a new outer case, shipping... Read more
Save $300 at Apple on 14-inch M3 MacBook Pros...
Apple has 14″ M3 MacBook Pros with 16GB of RAM, Certified Refurbished, available for $270-$300 off MSRP. Each model features a new outer case, shipping is free, and an Apple 1-year warranty is... Read more
Apple continues to offer 14-inch M3 MacBook P...
Apple has 14″ M3 MacBook Pros, Certified Refurbished, available starting at only $1359 and ranging up to $270 off MSRP. Each model features a new outer case, shipping is free, and an Apple 1-year... Read more
Apple AirPods Pro with USB-C return to all-ti...
Amazon has Apple’s AirPods Pro with USB-C in stock and on sale for $179.99 including free shipping. Their price is $70 (28%) off MSRP, and it’s currently the lowest price available for new AirPods... Read more
Apple Magic Keyboards for iPads are on sale f...
Amazon has Apple Magic Keyboards for iPads on sale today for up to $70 off MSRP, shipping included:
– Magic Keyboard for 10th-generation Apple iPad: $199, save $50
– Magic Keyboard for 11″ iPad Pro/... Read more
Apple’s 13-inch M2 MacBook Airs return to rec...
Apple retailers have 13″ MacBook Airs with M2 CPUs in stock and on sale this weekend starting at only $849 in Space Gray, Silver, Starlight, and Midnight colors. These are the lowest prices currently... Read more
Best Buy is clearing out iPad Airs for up to...
In advance of next week’s probably release of new and updated iPad Airs, Best Buy has 10.9″ M1 WiFi iPad Airs on record-low sale prices for up to $200 off Apple’s MSRP, starting at $399. Sale prices... Read more
Every version of Apple Pencil is on sale toda...
Best Buy has all Apple Pencils on sale today for $79, ranging up to 39% off MSRP for some models. Sale prices for online orders only, in-store prices may vary. Order online and choose free shipping... Read more
Sunday Sale: Apple Studio Display with Standa...
Amazon has the standard-glass Apple Studio Display on sale for $300 off MSRP for a limited time. Shipping is free:
– Studio Display (Standard glass): $1299.97 $300 off MSRP
For the latest prices and... Read more
Jobs Board
Liquor Stock Clerk - S. *Apple* St. - Idaho...
Liquor Stock Clerk - S. Apple St. Boise Posting Begin Date: 2023/10/10 Posting End Date: 2024/10/14 Category: Retail Sub Category: Customer Service Work Type: Part
Read more
*Apple* App Developer - Datrose (United Stat...
…year experiencein programming and have computer knowledge with SWIFT. Job Responsibilites: Apple App Developer is expected to support essential tasks for the RxASL
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
Operations Associate - *Apple* Blossom Mall...
Operations Associate - Apple Blossom Mall Location:Winchester, VA, United States (https://jobs.jcp.com/jobs/location/191170/winchester-va-united-states) - Apple
Read more
Cashier - *Apple* Blossom Mall - JCPenney (...
Cashier - Apple Blossom Mall Location:Winchester, VA, United States (https://jobs.jcp.com/jobs/location/191170/winchester-va-united-states) - Apple Blossom Mall
Read more
All contents are Copyright 1984-2011 by Xplain Corporation. All rights reserved. Theme designed by Icreon.
|