SoundGetName

Retrieves the name of a sound device or component.

Name := SoundGetName(Component, Device)

Parameters

Component

Type: String or Integer

If blank or omitted, the name of the device itself will be retrieved. Otherwise, specify the component's display name and/or index, e.g. 1, "Line in" or "Line in:2".

For further details, see Component (Sound Functions).

Device

Type: String or Integer

If blank or omitted, it defaults to the system's default device for playback (which is not necessarily device 1). Otherwise, specify the device's display name and/or index, e.g. 1, "Speakers", "Speakers:2" or "Speakers (Example HD Audio)".

For further details, see Device (Sound Functions).

Return Value

Type: String

This function returns the name of the device or component, which can be empty.

Error Handling

A TargetError is thrown if the device or component could not be found. Otherwise, an OSError is thrown on failure.

Sound Functions

Examples

Retrieves and reports the name of the default playback device.

default_device := SoundGetName()
MsgBox "The default playback device is " default_device

Retrieves and reports the name of the first device.

device1 := SoundGetName( , 1)
MsgBox "Device 1 is " device1

Retrieves and reports the name of the first component.

component1 := SoundGetName(1)
MsgBox "Component 1 is " component1

For a more complex example, see the soundcard analysis script.