[comp.sys.mac.programmer] Gestalt Bug?

darth@athena.mit.edu (Darren T Garnier) (01/22/91)

I've been playing around with system 6.07 and I think I've found a bug
with one of the Gestalt routines.  Namely, when I register my sound input
driver (which works but still has a few bugs to work out before I release it)
the Gestalt 'snd' selector does not indicate that the driver is available
(bit 4 does not get set).  Is there something else I need to do to register
my driver with Gestalt or is this a bug?  (Maybe someone with an IIsi or LC
can tell me if this bit is set on there machines).  Any idle speculation will
be appreciated.

darren.
--
                        Darren Garnier                
darth@athena.mit.edu                     | Some rise, some fall,
garnier@alcvax.pfc.mit.edu               | some try to get to Terrapin.

ldo@waikato.ac.nz (Lawrence D'Oliveiro, Waikato University) (01/23/91)

I've got Farallon's MacRecorder Driver installed on my vintage II
running 6.0.7, and the Gestalt "snd " selector still only returns a
value of 9. This indicates that the sound I/O manager is present and
that my hardware can do stereo output, but that there is *no* sound
input hardware present. My MacRecorder isn't connected (it's
sitting at home at the moment), but that shouldn't matter as long
as I'm not actually using the driver.

I seem to recall that the "sound input hardware present" bit
*was* set on an LC, but I'll have to go home and check.

Sounds like that bit doesn't quite mean what we thought it means...

Lawrence D'Oliveiro                       fone: +64-71-562-889
Computer Services Dept                     fax: +64-71-384-066
University of Waikato            electric mail: ldo@waikato.ac.nz
Hamilton, New Zealand    37^ 47' 26" S, 175^ 19' 7" E, GMT+13:00

ldo@waikato.ac.nz (Lawrence D'Oliveiro, Waikato University) (01/24/91)

I checked the Gestalt "snd " selector on my LC, and it returns a value
of 25 decimal (hex 19). The bits set are: sound input hardware present,
new sound I/O manager present, and sound hardware has stereo capability.

Well, that's two out of three: the LC can't in fact do stereo output.

Lawrence D'Oliveiro                       fone: +64-71-562-889
Computer Services Dept                     fax: +64-71-384-066
University of Waikato            electric mail: ldo@waikato.ac.nz
Hamilton, New Zealand    37^ 47' 26" S, 175^ 19' 7" E, GMT+13:00

Greg@AppleLink.Apple.Com (Greg Marriott) (01/24/91)

In article <1991Jan23.170829.2793@waikato.ac.nz>, ldo@waikato.ac.nz
 (Lawrence D'Oliveiro, Waikato University) wonders about the
"sound input hardware present" bit:

Okay, I talked to a sound engineer, and here's what he told me:

NOBODY is suppose to change any of the SoundMgr Gestalt selectors!
If a developer wants to determine if a Sound Input driver is available,
then call the SPBGetIndexedDevice call (as shown below).
The Gestalt selectors for sound will only report if the machine has
"built-in sound input hardware". 

In System 7, we've added a new bit in the sound selector and changed
a previous one to a name that is more descriptive.  The new selector,
gestaltHasSoundInputDevice, will call SPBGetIndexedDevice for you, but
this only happens in System 7.  If you are running under System 6.0.7,
then you have to call SPBGetIndexedDevice directly.  Also, if you are
running under older Systems then you'll have to test if _SoundDispatch
is implemented before calling SPBGetIndexedDevice.  Here's some code that
developers should be using.  This issue is documented in the
new Sound Manager chapter of Inside Mac 6.

{is the new Sound Manager running?}

IF NGetTrapAddress(_Unimplemented, ToolTrap)
<> NGetTrapAddress(_SoundDispatch, ToolTrap) THEN
   gNewSndMgr:= SndSoundManagerVersion > 0
ELSE
   gNewSndMgr:= FALSE;

{is the Sound Input Manager available?}

gHasSndInput:= FALSE;
IF gNewSndMgr THEN BEGIN
   IF SPBVersion > 0 THEN BEGIN
      IF SPBGetIndexedDevice(1, devName, devIconHandle) = noErr THEN BEGIN
         DisposHandle(devIconHandle);
         gHasSndInput:= TRUE;
      END;
   END;
END;


Here are the latest versions of the Gestalt bit for sound.
"gestaltHasSoundInputDevice" only will be valid for System 7.

gestaltSoundAttr = 'snd ';         { sound attributes }
gestaltStereoCapability = 0;       { sound hardware has stereo capability }
gestaltStereoMixing = 1;           { stereo mixing on external speaker }
gestaltSoundIOMgrPresent = 3;      { The Sound I/O Manager is present  }
gestaltBuiltInSoundInput = 4;      { built-in Sound Input hardware is present }
gestaltHasSoundInputDevice = 5;    { Sound Input device available }

Jim Reekes E.O., Macintosh Toolbox Engineering
---------------------
So, there you have it.

Greg Marriott
Blue Meanie
Apple Computer, Inc.