Home  |  Linux  | Mysql  | PHP  | XML
From:Chris Nandor Date:Fri Dec 27 11:11:31 2002
Subject:Re: [MacPerl-Toolbox] Sound Manager and "file reference numbers"
At 11:01 -0500 2002.12.27, Elliott Moreton wrote:
>I'm running 5.6.1b3 on an iBook.

FWIW, MacPerl 5.6.1r2 is the most recent release.  r1 was released in March.


>I'm trying to get a MacPerl script to
>play AIFF files, using the SndStartFilePlay function:
>
>	use Mac::Sound;
>
>	$sounddir = "Macintosh HD:Moreton:exp14:SW:testsounds";
>
>	$infile = "$sounddir:000.aiff";
>	open (IN, $infile) || die "Couldn't open $infile";
>
>	$kBufferSize = 20000;
>
>	$err = SndStartFilePlay (0, IN, 0, $kBufferSize, 0, 0, 0, 0);
>
>	print "Error:  $err\n";
>
>
>When I run this, I get the message:
>
>
>	#Usage:  Mac::Sound::SndStartFilePlay(chan, fRefNum, resNum,
>bufferSize, theSelection, theCompletion=0, async==false).
>	File 'Dev:Pseudo'; Line 10
>
>There isn't any MacPerl documentation on SndStartFilePlay (not even in
>Sound.pm), but Inside Macintosh documents it for C (Sound Reference,
>Chapter 1, pp. 37f), and the only thing I can see that I might be doing
>wrong is that SndStartFilePlay might want the file to be identified with a
>"file reference number" rather than the filehandle I'm using right now.
>What is a "file reference number", and how do I set one up?

I don't really know the answer, but would guess fileno(IN), perhaps.

At 12:36 -0500 2002.12.27, Elliott Moreton wrote:
>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.

Again, I am not sure; I can look later when I get some spare time.

-- 
Chris Nandor                      pudge@pobox.com    http://pudge.net/
Open Source Development Network    pudge@osdn.com     http://osdn.com/
Navigate in group perl.macperl.toolbox at sever nntp.perl.org
Previous Next




  
© No Copyright
You are free to use Anything
Site Maintained by PHP Developer
Powered By PHP Consultants