Inside Macintosh: Sound Manager

| Previous | Chapter contents | Chapter top | Section top | Next |

Legacy Documentclose button

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.

Manipulating Device Settings

You can use the two functions SPBGetDeviceInfo and SPBSetDeviceInfo to read and change the settings of a sound input device.

SPBGetDeviceInfo

You can use the SPBGetDeviceInfo function to get information about the settings of a sound input device.

FUNCTION SPBGetDeviceInfo (inRefNum: LongInt; infoType: OSType;
                                                              infoData: Ptr): OSErr;

inRefNum

The device reference number of the sound input device, as obtained from the SPBOpenDevice function.

infoType

A sound input device information selector that specifies the type of information you need.

infoData

A pointer to a buffer in which information should be returned. This buffer must be large enough for the type of information specified in the infoType parameter.

DESCRIPTION

The SPBGetDeviceInfo function returns information about the sound input device specified by the inRefNum parameter. The type of information you want is specified in the infoType parameter. The available sound input device information selectors are listed in "Sound Input Device Information Selectors" . The information is copied into the buffer specified by the infoData parameter.

SPECIAL CONSIDERATIONS

Because the SPBGetDeviceInfo function might move memory, you should not call it at interrupt time. Check the selector description of the selector you want to use to see if it moves memory before calling the SPBGetDeviceInfo function. Most of the selectors do not move memory and are therefore safe to use at interrupt time.

ASSEMBLY-LANGUAGE INFORMATION

The trap macro and routine selector for the SPBGetDeviceInfo function are

Trap macro

Selector

_SoundDispatch

$06380014

RESULT CODES

noErr

0

No error

siBadSoundInDevice

-221

Invalid sound input device

siUnknownInfoType

-231

Unknown type of information

SEE ALSO

Listing 43 shows an example that uses the SPBGetDeviceInfo function to get the name of a sound input device driver.

SPBSetDeviceInfo

You can use the SPBSetDeviceInfo function to set information in a sound input device.

FUNCTION SPBSetDeviceInfo (inRefNum: LongInt; infoType: OSType;
                                                               infoData: Ptr): OSErr;

inRefNum

The device reference number of the sound input device, as obtained from the SPBOpenDevice function.

infoType

A sound input device information selector that specifies the type of information you need.

infoData

A pointer to a buffer. This buffer can contain information on entry, and information might be returned on exit. This buffer must be large enough for the type of information specified in the infoType parameter, and the data in the buffer must be set to appropriate values if information needs to be passed in to the SPBSetDeviceInfo function.

DESCRIPTION

The SPBSetDeviceInfo function sets information about the sound input device specified by the inRefNum parameter, based on the data in the buffer specified by the infoData parameter.

The type of setting you wish to change is specified in the infoType parameter. The sound input device information selectors are listed in "Sound Input Device Information Selectors" .

SPECIAL CONSIDERATIONS

Because the SPBSetDeviceInfo function might move memory, you should not call it at interrupt time. Check the selector description of the selector you want to use to see if it moves memory before calling the SPBGetDeviceInfo function. Most of the selectors do not move memory and are therefore safe to use at interrupt time.

ASSEMBLY-LANGUAGE INFORMATION

The trap macro and routine selector for the SPBSetDeviceInfo function are

Trap macro

Selector

_SoundDispatch

$063C0014

RESULT CODES

noErr

0

No error

permErr

-54

Attempt to open locked file for writing

siBadSoundInDevice

-221

Invalid sound input device

siDeviceBusyErr

-227

Sound input device is busy

siUnknownInfoType

-231

Unknown type of information


© 1999 Apple Computer, Inc.

Inside Macintosh: Sound Manager

| Previous | Chapter contents | Chapter top | Section top | Next |

Legacy Documentclose button

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.