SndStartFilePlay
bufferSize, theBuffer, theSelection, theCompletion,
async);
SndChannelPtr chan; a pointer to a sound channel
short fRefNum; is the file reference number
short resNum; is the resource ID number
long bufferSize; is the number of bytes of memory
void * theBuffer; is a pointer to a nonrelocatable block
AudioSelectionPtr theSelection; points to an audio selection record
ProcPtr theCompletion; is a pointer to a completion routine Boolean async; TRUE= the call is made asynchronously on a sound channel
chan is a pointer to a sound channel.
fRefNumr the file reference number of the file to be played,
resNum the resource ID number (not the file reference number) of the
resource to play
bufferSize contains the number of bytes of memory that the
sound data.
theBuffer should be a pointer to a nonrelocatable block of size bufferSize.
theSelection should point to an audio selection record.
theCompletion is a pointer to a routine that is called when the sound is finished
playing
async TRUE= the call is made asynchronously; otherwise, the call is
synchronous
noErr (0) No error
notEnoughHardwareErr (-201) Insufficient hardware available
queueFull (-203) No room in the queue
badChannel (-205) Channel is corrupt or unusable
badFormat (-206) Resource is corrupt or unusable
notEnoughBufferSpace (-207) Insufficient memory available
badFileFormat (-208) File is corrupt or unusable
channelBusy (-209) Channel is busy
buffersTooSmall (-210) Buffer is too small
siIn validCompression (-223) Invalid compression type
level.
If chan is not NULL, it is used as a valid channel. If chan is NULL, an
internally allocated sound channel is used for play from disk. This
internally allocated sound channel is not passed back to you. Since the other
two play-from-disk routines require a sound-channel pointer, you must
allocate your own channel if you wish to use those routines.
The sounds you wish to play can be stored either in a file or in an 'snd '
resource. If you are playing a file, then fRefNum should be the file
reference number of the file to be played, and the parameter resNum should
be set to 0.
If you are playing an 'snd ' resource, then fRefNum should be set to 0, and
resNum should be the resource ID number (not the file reference number)
of the resource to play. Both format 1 and format 2 'snd ' resources are
supported.
The bufferSize parameter contains the number of bytes of memory that the Sound Manager is to use for input buffering while reading in sound data. If theBuffer is a NULL pointer, then the Sound Manager internally allocates two relocatable blocks, each of which is half the size of bufferSize;
otherwise, theBuffer should be a pointer to a nonrelocatable block of size
bufferSize.
If theSelection is a NULL pointer, then the entire sound is played;
otherwise, theSelection should point to an audio selection record. You use
that record to specify the segment of the sound to be played.
The theCompletion parameter is a pointer to a routine that is called when the sound is finished playing. Set theCompletion to NULL if you do not wish
to specify a completion routine. The completion routine should be declared
like this:
pascal void MyFilePlayCompletionRoutine (SndChannelPtr chan);
This routine is called at interrupt time and must preserve all registers
other than D0-D2 and A0-A1. In addition, it must not make any calls to the
routine needs to access your application's global variables, you must ensure
that register A5 contains your application's A5. (You can use the userInfo
field of the sound channel pointed to by the chan parameter to pass that
value to your completion routine.)
If the async parameter is TRUE, then the call is made asynchronously;
otherwise, the call is synchronous.