Hi,

Off-list help has partially solved the problem; however, another lurks 
beyond it.  

Inside Macintosh says that in order to have the whole file played, you
should pass SndStartFilePlay a NIL for a parameter called theSelection,
which is of type AudioSelection (Ch. 2, "Using the Sound Manager", p.
2-53).  MacPerl won't accept 0, '', (), [], or {} as a null value for this 
parameter:

        use Mac::Sound;
        
        $sounddir = "Macintosh HD:Moreton:exp14:SW:testsounds";

        $infile = "$sounddir:000.aiff";
        open (IN, $infile) || die "Couldn't open $infile";

        $Chan = SndNewChannel (sampledSynth (), initMono (), 0);
        $kBufferSize = 20000;

        $err = SndStartFilePlay ($Chan, IN, 0, $kBufferSize, '', 0, 0);
                                                             ^
                                                             |
                                                        theSelection

The error I get is 

        # theSelection is not of type AudioSelection

The Sound.pm code section on SndStartFilePlay has the following variable 
declarations:

        SndChannel      chan
        short           fRefNum  (filehandle seems to work)
        short           resNum   (0, since this is a file, not a resource)
        long            bufferSize
        AudioSelection  &theSelection
        SV              *theCompletion
        Boolean         async

Can anyone see what the problem is?  I'm sure this is extremely basic, but 
I'm baffled.

Thanks,
Elliott Moreton


Reply via email to