Inside Macintosh: Sound Manager
| Previous | Chapter contents | Chapter top | Section top | Next |
Important: Sound Input Manager is deprecated as of Mac OS X v10.5. For new audio development in Mac OS X, use Core Audio. See the Audio page in the ADC Reference Library.
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 routine or a sound input interrupt routine, your routine receives a pointer to a sound input parameter block. If you are using only the Sound Input Manager's 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.
TYPE SPB =
RECORD
inRefNum: LongInt; {reference number of input device}
count: LongInt; {number of bytes to record}
milliseconds: LongInt; {number of milliseconds to record}
bufferLength: LongInt; {length of buffer to record into}
bufferPtr: Ptr; {pointer to buffer to record into}
completionRoutine: ProcPtr; {pointer to a completion routine}
interruptRoutine: ProcPtr; {pointer to an interrupt routine}
userLong: LongInt; {for application's use}
error: OSErr; {error returned after recording}
unused1: LongInt; {reserved}
END;
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 NIL , 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 NIL is useful only if you want to do something in a sound input interrupt routine but do not want to save the recorded sound.
A pointer to a completion routine 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 routine executes only if SPBRecord is called asynchronously and therefore is called at interrupt time.
A pointer to a routine that is called by asynchronous recording devices when their internal buffers are full. You can define a sound input interrupt routine to modify uncompressed sound samples before they are placed into the buffer specified in the bufferPtr parameter. The interrupt routine executes only if SPBRecord is called asynchronously and therefore is called at interrupt time.
A long integer available for the application's own use. You can use this field, for instance, to pass a handle to an application-defined structure to the completion routine or to the interrupt routine.
On exit, 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.
Inside Macintosh: Sound Manager
| Previous | Chapter contents | Chapter top | Section top | Next |
Important: Sound Input Manager is deprecated as of Mac OS X v10.5. For new audio development in Mac OS X, use Core Audio. See the Audio page in the ADC Reference Library.