Hello, I'm a newbie to the mac toolbox but I figured I'd jump right in. I'm
trying to use Mac::Sound::SndStartFilePlay() but I get an error:# OS error -51
(Error message file not available). What does it mean, and how can I fix it?

It might be a problem with the file reference number thing (which I don't
understand) but looking through the archives I found something implying that it
should work. In case it helps the code follows.

Thanks in advance,
~wren

#!perl -w
use strict;
use Mac::Sound;
use vars qw($filename $file_ref_number $ch $chan $sel $theSelection);
my $ch  = 0; $chan         = bless \$ch,  "SndChannel";
my $sel = 0; $theSelection = bless \$sel, "AudioSelection";

$filename = shift @ARGV; # for argument's sake
&PlayAiff($filename);
print 'Test Done!';

sub PlayAiff {
        my $filename = shift;
        open (SOUND, $filename) or die "Couldn't open $filename";
        SndStartFilePlay($chan, \*SOUND, 0, 0, $theSelection, 0, 0) or die $^E;
        close SOUND;
}
__END__

Reply via email to