[futurebasic] SetupAIFFHeader

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : October 1999 : Group Archive : Group : All Groups

From: Rick Brown <rbrown@...>
Date: Sun, 10 Oct 1999 16:45:08 -0500
Does anyone have experience using the Sound Input Manager function
"SetupAIFFHeader"?  I am stumped trying to get it to work right.  Here's
how I've defined it:

LOCAL FN SetupAIFFHeader(fRefNum%, numChannels%, sampleRate&,
sampleSize%, compressionType&, numBytes&, numFrames&)
  `     clr.w   -(sp)
  `     move.w  -(sp),^fRefNum%
  `     move.w  -(sp),^numChannels%
  `     move.l  -(sp),^sampleRate&
  `     move.w  -(sp),^sampleSize%
  `     move.l  -(sp),^compressionType&
  `     move.l  -(sp),^numBytes&
  `     move.l  -(sp),^numFrames&
  `     move.l  #$0B4C0014,D0
  `     dc.w    $A800
  `     move.w  (sp)+,^OSErr

Whenever I call it, it returns either error -51 ("Reference number
specifies non-existant access path"), or error -21 ("Driver reference
number does not match unit table").

These make it sound like something's wrong with the fRefNum% parameter
I'm passing it--but I know that's a valid fRefNum%, because I use it in
other places without error (when writing to the file, setting the file
mark, etc.)

I'm basically calling it like this:

  OSErr = FN FSpOpenDF(outSpec, _fsWrPerm, @gFRefNum%)
  IF OSErr FN ReportOSErr(OSErr, "FSpOpenDF")
  numChannels% = 2
  sampleRate& = &AC440000
  sampleSize% = 16
  compressionType& = _"NONE"
  OSErr = FN SetupAIFFHeader(gFRefNum%, numChannels%, sampleRate&,
sampleSize%, compressionType&, 0, 0)
  IF OSErr THEN FN ReportOSErr(OSErr, "SetupAIFFHeader")

No error is ever reported by FSpOpenDF; only by SetupAIFFHeader.
Furthermore, if I ignore the error reported by SetupAIFFHeader, I can
use gFRefNum% in other file i/o routines without any problem.

So what's going on??

Thanks in advance,
- Rick