![]() |
SPB |
Header: Sound.h |
struct SPB { SInt32 inRefNum; UInt32 count; UInt32 milliseconds; UInt32 bufferLength; Ptr bufferPtr; SICompletionUPP completionRoutine; SIInterruptUPP interruptRoutine; SInt32 userLong; OSErr error; SInt32 unused1; }; typedef SPB SPBPtr;
The reference number of the sound input device (as received from the SPBOpenDevice function) from which the recording is to occur.
On input, the number of bytes to record. On output, the number of bytes actually recorded. If this field specifies a longer recording time than the milliseconds field, then the milliseconds field is ignored on input.
On input, the number of milliseconds to record. On output, the number of milliseconds actually recorded. If this field specifies a longer recording time than the count field, then the count field is ignored on input.
The length of the buffer into which recorded sound data is placed. The recording time specified by the count or milliseconds field is truncated to fit into this length, if necessary.
A pointer to the buffer into which recorded data is placed. If this field is NULL, then the count, milliseconds, and bufferLength fields are ignored and the recording will continue indefinitely until the SPBStopRecording function is called. However, the data is not stored anywhere, so setting this field to NULL is useful only if you want to do something in a sound input interrupt function but do not want to save the recorded sound.
A pointer to a completion function that is called when the recording terminates as a result of your calling the SPBStopRecording function or when the limit specified by the count or milliseconds field is reached. The completion function executes only if SPBRecord is called asynchronously and therefore is called at interrupt time.
A pointer to a function that is called by asynchronous recording devices when their internal buffers are full. You can define a sound input interrupt function to modify uncompressed sound samples before they are placed into the buffer specified in the bufferPtr parameter. The interrupt function executes only if SPBRecord is called asynchronously and therefore is called at interrupt time.
A long integer available for the applications own use. You can use this field, for instance, to pass a handle to an application-defined structure to the completion function or to the interrupt function.
On return, the error that occurred during recording. This field contains a value greater than 0 while recording unless an error occurs, in which case it contains a value less than 0 that indicates an operating system error. Your application can poll this field to check on the status of an asynchronous recording. If recording terminates without an error, this field contains 0.
Reserved for use by Apple. You should always initialize this field to 0.
The SPBRecord and SPBRecordToFile functions require a pointer to a sound input parameter block that defines characteristics of the recording. If you define a sound input completion function or a sound input interrupt function, your function receives a pointer to a sound input parameter block. If you are using only the Sound Input Managers high-level SndRecord and SndRecordToFile functions, the operation of sound input parameter blocks is transparent to your application. A sound input parameter block is defined by the SPB data type.
© 2000 Apple Computer, Inc. (Last Updated 6/30/2000)