snd_pcm_set_output_class()

Set the current audio output port information.

Synopsis:

#include <sys/asoundlib.h>

int snd_pcm_set_output_class( snd_pcm_t *pcm,
                              uint32_t outputclass);

Arguments:

pcm
The handle for the PCM device, which you must have opened by calling snd_pcm_open_name(), snd_pcm_open(), or snd_pcm_open_preferred().
outputclass
The output class to set the channel to, which can be one of the following values:
SND_OUTPUT_CLASS_UKNOWN
The output channel is for an unknown type.
SND_OUTPUT_CLASS_SPEAKER
Indicates that the output channel is for speakers that are connected to the system.
SND_OUTPUT_CLASS_HEADPHONE
Indicates that the output channel is for headphones that are connected to the system.
SND_OUTPUT_CLASS_LINEOUT
Indicates that the output channel is for the line-out channel of the system.
SND_OUTPUT_CLASS_BLUETOOTH
Indicates that the output channel is for Bluetooth.
SND_OUTPUT_CLASS_TOSLINK
Indicates the output channel is for an S-Link connector.
SND_OUTPUT_CLASS_MIRACAST
Indicates that the output channel is for Miracast.
SND_NUM_OUTPUT_CLASSES
An end-of-list identifier that indicates the total number of output types recognized by this library.

Library:

libasound.so

Use the -l asound option with qcc to link against this library.

Description:

The snd_pcm_set_output_class() function sets the output class for the PCM playback device. This call is a privileged call. Applications must be root or be part of same user group as io-audio is running as. The call is used only if the audio output routing isn't controlled by the audio driver directly (e.g., an external amplifier). External applications which control the audio output routing should use this call to notify io-audio of the change.

If the operation is successful (zero is returned), the channel's state is changed to SND_PCM_STATUS_READY.

Returns:

EOK on success, EINVAL for invalid argument values passed to this function, or a negative a negative errno upon failure. The errno values are available in the errno.h file.

Errors:

-EINVAL
The state of pcm isn't valid or an the playback channel isn't ready, or the specified output class couldn't be set.
-EPERM
An application doesn't have the appropriate privileges to call this function.

Classification:

QNX Neutrino

Safety:  
Cancellation point No
Interrupt handler No
Signal handler Yes
Thread Read the Caveats

Caveats:

This function is not thread safe if handle (snd_pcm_t) is used across multiple threads.