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.

Registering Sound Input Devices

Sound input device drivers must call the SPBSignInDevice function to register with the Sound Input Manager before they can use its sound input services. You might call this routine at system startup time from within an extension to install a sound input device driver. Your application can generate a list of registered sound input devices by using the SPBGetIndexedDevice function. You can cancel the registration of your driver, thus removing it from the Sound control panel and making it inaccessible, by calling the SPBSignOutDevice function.

SPBSignInDevice

You can register a sound input device by calling the SPBSignInDevice function.

FUNCTION SPBSignInDevice (deviceRefNum: Integer;
                                                              deviceName: Str255): OSErr;

deviceRefNum

The device driver reference number of the sound input device to register with the Sound Input Manager.

deviceName

The device's name as it is to appear to the user in the Sound In control panel (which is not the name of the driver used by the Device Manager).

DESCRIPTION

The SPBSignInDevice function registers with the Sound Input Manager the device whose driver reference number is deviceRefNum .

The deviceName parameter specifies this device's name as it is to appear to the user in the Sound In control panel (which is not the name of the driver itself). Accordingly, the name should be as descriptive as possible. You should call SPBSignInDevice after you have already opened your driver by calling normal Device Manager routines.

SPECIAL CONSIDERATIONS

Because the SPBSignInDevice function moves or purges memory, you should not call it at interrupt time. You can, however, call it at system startup time.

ASSEMBLY-LANGUAGE INFORMATION

The trap macro and routine selector for the SPBSignInDevice function are

Trap macro

Selector

_SoundDispatch

$030C0014

RESULT CODES

noErr

0

No error

siBadSoundInDevice

-221

Invalid sound input device

SPBGetIndexedDevice

You can use the SPBGetIndexedDevice function to help generate a list of sound input devices.

FUNCTION SPBGetIndexedDevice (count: Integer;
                                                              VAR deviceName: Str255;
                                                              VAR deviceIconHandle: Handle):
                                                              OSErr;

count

The index number of the sound input device you wish to obtain information about.

deviceName

On exit, the name of the sound input device specified by the count parameter.

deviceIconHandle

On exit, a handle to the icon of the sound input device specified by the count parameter. The memory for this icon is allocated automatically, but your application must dispose of it.

DESCRIPTION

The SPBGetIndexedDevice function returns the name and icon of the device whose index is specified in the count parameter. Your application can create a list of sound input devices by calling this function with a count starting at 1 and incrementing it by 1 until the function returns siBadSoundInDevice .

Because the Sound In control panel allows the user to select a sound input device, most applications should not use this function. Your application might need to use this function if it allows the user to record from more than one sound input device at once.

SPECIAL CONSIDERATIONS

Because the SPBGetIndexedDevice function allocates memory, you should not call it at interrupt time.

ASSEMBLY-LANGUAGE INFORMATION

The trap macro and routine selector for the SPBGetIndexedDevice function are

Trap macro

Selector

_SoundDispatch

$05140014

RESULT CODES

noErr

0

No error

siBadSoundInDevice

-221

Invalid sound input device

SPBSignOutDevice

You can use the SPBSignOutDevice function to cancel the registration of a device you have previously registered with the SPBSignInDevice function.

FUNCTION SPBSignOutDevice (deviceRefNum: Integer): OSErr;

deviceRefNum

The driver reference number of the device you wish to sign out.

DESCRIPTION

The SPBSignOutDevice function cancels the registration of the device whose driver reference number is deviceRefNum ; the device is unregistered from the Sound Input Manager's list of available sound input devices and no longer appears in the Sound In control panel.

Ordinarily, you should not need to use the SPBSignOutDevice function. You might use it if your device driver detects that a sound input device is not functioning correctly or has been disconnected.

SPECIAL CONSIDERATIONS

Because the SPBSignOutDevice function moves or purges memory, you should not call it at interrupt time.

ASSEMBLY-LANGUAGE INFORMATION

The trap macro and routine selector for the SPBSignOutDevice function are

Trap macro

Selector

_SoundDispatch

$01100014

RESULT CODES

noErr

0

No error

siBadSoundInDevice

-221

Invalid sound input device

siDeviceBusyErr

-227

Sound input device is busy


© 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.