[comp.sys.mac.programmer] Complex sound manager question

vrm@blackwater.cerc.wvu.wvnet.edu (Vasile R. Montan) (04/12/91)

I am attempting to figure out how the Sound Manager works, and
want to start by simply playing a single asynchronous sound.
I have a resource file containing the Harpsichord sound from
HyperCard, and the following code:

program SndTest;
  uses
    Sound;
  var
    Harpsichord: Handle;
    result : OSErr;
begin
  Harpsichord := GetResource('snd ', 190);  {Load in the sound}
  Result := SndPlay(nil, Harpsichord, FALSE);  {Play it}
  DisposHandle(Harpsichord);  {Do not litter}
end.

Result ends up being 0, indicating that nothing went wrong, but there
is no sound to be heard.  What's wrong?

--Kurisuto
un020070@vaxa.wvnet.edu

REEKES@applelink.apple.com (Jim Reekes) (04/15/91)

In article <1584@babcock.cerc.wvu.wvnet.edu>, vrm@blackwater.cerc.wvu.wvnet.edu (Vasile R. Montan) writes:
> program SndTest;
>   uses
>     Sound;
>   var
>     Harpsichord: Handle;
>     result : OSErr;
> begin
>   Harpsichord := GetResource('snd ', 190);  {Load in the sound}
>   Result := SndPlay(nil, Harpsichord, FALSE);  {Play it}
>   DisposHandle(Harpsichord);  {Do not litter}
> end.
> 
> Result ends up being 0, indicating that nothing went wrong, but there
> is no sound to be heard.  What's wrong?


I don't see anything wrong with this code.  I suspect you have a bad snd resource.
Try other snds.  And you should mention the System version you're running, and the
version of HyperCard you took the sound from.  There's a Tech Note about HyperCard's
sounds being incorrect.

Jim Reekes
Sound Manager Engineer