com.webos.service.audiooutput

API Summary

This service connects the audio source to the audio output device and also controls the volume on the audio device. It provides HAL abstraction for the back-end, which means that the 'audiooutput' service works with HAL or ALSA or other hardware abstraction layer.

The 'audiooutput' service is a context-less (stateless) implementation of audio handling. Since the 'audio' service manages audio policies, the 'audiooutput' service will not hold any context information.

Note:

  • This service must only be used by the 'audio' service.
  • Application developers must not use this service directly.
  • [For webOS OSE Developers] Any modifications to this 'audiooutput' service can adversely effect the working of the 'audio' service.

Overview of the API

NA

    Methods

    audio/connect

    Description

    Connects audio source to the audio sink.

    Parameters

    Name

    Required

    Type

    Description

    sourceRequiredString

    Audio source. Possible values are: 

    • AMIXER
    sinkRequiredString

    Audio sink. Possible values are:

    • ALSA

    Call Returns

    Name

    Required

    Type

    Description

    returnValueRequiredBoolean

    Indicates the status of operation. Possible values are:

    • true - Indicates that the operation was successful.
    • false - Indicates that the operation failed. Check the "errorCode" and "errorText" fields for details.
    errorCodeOptionalNumber (int8_t)

    The error code for the failed operation.

    errorTextOptionalString

    Indicates the reason for the failure of the operation. See the "API Error Codes Reference" section for details.

    sourceOptionalString

    Audio source.

    sinkOptionalString

    Audio sink.

    Example

    luna-send -n 1 luna://com.webos.service.audiooutput/audio/connect '{ "source": "AMIXER", "sink" : "ALSA"}'

    audio/disconnect

    Description

    Disconnect from audio sink.

    Note: No changes if there is no connection.

    Parameters

    Name

    Required

    Type

    Description

    sourceRequiredString

    Audio source. Possible values are: 

    • AMIXER
    sinkRequiredString

    Audio sink. Possible values are:

    • ALSA

    Call Returns

    Name

    Required

    Type

    Description

    returnValueRequiredBoolean

    Indicates the status of operation. Possible values are:

    • true - Indicates that the operation was successful.
    • false - Indicates that the operation failed. Check the "errorCode" and "errorText" fields for details.
    errorCodeOptionalNumber (int8_t)

    The error code for the failed operation.

    errorTextOptionalString

    Indicates the reason for the failure of the operation. See the "API Error Codes Reference" section for details.

    sourceOptionalString

    Audio source.

    sinkOptionalString

    Audio sink.

    Example

    luna-send -n 1 luna://com.webos.service.audiooutput/audio/disconnect '{ "source": "AMIXER", "sink" : "ALSA"}'

    audio/getStatus

    Description

    Lists information of all connected audio source and sinks.

    Parameters

    None

    Call Returns

    Name

    Required

    Type

    Description

    returnValueRequiredBoolean

    Indicates the status of operation. Possible values are:

    • true - Indicates that the operation was successful.
    • false - Indicates that the operation failed. Check the "errorCode" and "errorText" fields for details.
    errorCodeOptionalNumber (int8_t)

    The error code for the failed operation.

    errorTextOptionalString

    Indicates the reason for the failure of the operation. See the "API Error Codes Reference" section for details.

    audioRequiredObject array: audio

    Contains the connections between source and sink.

    Note: For definition of the object, click the link from the "Type" column.

    Example

    luna-send -n 1 -f luna://com.webos.service.audiooutput/audio/getStatus '{}'


    Scenario 1: Return when no source and sink is connected:

    {

        "audio": [ ],

        "returnValue": true

    }

     

    Scenario 2: Return when only source and sink are connected:

    {

        "audio":

        [

            {

                "source": "ADEC0",

                "sink": "MAIN",

                "muted": false,

                "outputMode": "null"

            }

        ],

        "returnValue": true

    }


    Scenario 3: Return when source, sink, and soundOut are connected:

    {

        "audio":

        [

            {

                "source": "AMIXER",

                "sink": "ALSA",

                "muted": false,

                "outputMode": "alsa"

            }

        ],

        "returnValue": true

    }

    audio/mute

    Description

    Mute or unmute the connected audio source.

    Parameters

    Name

    Required

    Type

    Description

    sourceRequiredString

    Audio source. Possible values are:

    • AMIXER
    sinkRequiredString

    Audio sink. Possible values are:

    • ALSA
    muteRequiredBoolean

    Indicate if the audio source is to be muted. Possible values are:

    • true: audio source is muted.
    • false: audio source is not muted.

    Call Returns

    Name

    Required

    Type

    Description

    returnValueRequiredBoolean

     Indicates the status of operation. Possible values are:

    • true - Indicates that the operation was successful.
    • false - Indicates that the operation failed. Check the "errorCode" and "errorText" fields for details.
    errorCodeOptionalNumber (int8_t)

     The error code for the failed operation.

    errorTextOptionalString

     Indicates the reason for the failure of the operation. See the "API Error Codes Reference" section for details.

    sourceOptionalString

    Audio source.

    sinkOptionalString

    Audio sink.

    muteOptionalBoolean

    Indicates if the audio source is muted. Possible values are:

    • true: audio source is muted.
    • false: audio source is not muted.

    Example

    luna-send -n 1 -f luna://com.webos.service.audiooutput/audio/mute '{"sink": "ALSA", "source": "AMIXER", "mute": true}'

    audio/setSoundOut

    Description

    Sets the audio output device to which the audio must be routed.

    Parameters

    Name

    Required

    Type

    Description

    soundOutRequiredString

    Audio output device. Possible values are:

    • alsa

    Call Returns

    Name

    Required

    Type

    Description

    returnValueRequiredString

     Indicates the status of operation. Possible values are:

    • true - Indicates that the operation was successful.
    • false - Indicates that the operation failed. Check the "errorCode" and "errorText" fields for details.
    errorCodeOptionalNumber (int8_t)

     The error code for the failed operation.

    errorTextOptionalString

     Indicates the reason for the failure of the operation. See the "API Error Codes Reference" section for details.

    soundOutOptionalString

    Audio output device.

    Example

    luna-send -n 1 luna://com.webos.service.audiooutput/audio/setSoundOut '{"soundOut": "alsa"}'

    audio/volume/up

    Description

    Increase linearly, the master volume of the audio output device.

    Parameters

    Name

    Required

    Type

    Description

    soundOutputRequiredString

    Audio output device. Possible values are:

    • alsa

    Call Returns

    Name

    Required

    Type

    Description

    returnValueRequiredBoolean

     Indicates the status of operation. Possible values are:

    • true - Indicates that the operation was successful.
    • false - Indicates that the operation failed. Check the "errorCode" and "errorText" fields for details.
    errorCodeOptionalNumber (int8_t)

     The error code for the failed operation.

    errorTextOptionalString

     Indicates the reason for the failure of the operation. See the "API Error Codes Reference" section for details.

    soundOutputOptionalString

    Audio output device.

    volumeOptionalNumber (int8_t)

    The volume level after it is increased. Supported range is 0 to 100.

    Example

    luna-send -n 1 luna://com.webos.service.audiooutput/audio/volume/up '{"soundOutput": "alsa"}'

    audio/volume/down

    Description

    Decrease linearly, the master volume of the audio output device.

    Parameters

    Name

    Required

    Type

    Description

    soundOutputRequiredString

    Audio output device. Possible values are:

    • alsa

    Call Returns

    Name

    Required

    Type

    Description

    returnValueRequiredBoolean

     Indicates the status of operation. Possible values are:

    • true - Indicates that the operation was successful.
    • false - Indicates that the operation failed. Check the "errorCode" and "errorText" fields for details.
    errorCodeOptionalNumber (int8_t)

     The error code for the failed operation.

    errorTextOptionalString

     Indicates the reason for the failure of the operation. See the "API Error Codes Reference" section for details.

    soundOutputOptionalString

    Audio output device.

    volumeOptionalNumber (int8_t)

    The volume level after it is decreased. Supported range is 0 to 100.

    Example

    luna-send -n 1 luna://com.webos.service.audiooutput/audio/volume/down '{"soundOutput": "alsa"}'

    audio/volume/set

    Description

    Set volume of the audio output device, to a specific numerical value.

    Parameters

    Name

    Required

    Type

    Description

    soundOutputRequiredString

    Audio output device. Possible values are:

    • alsa
    volumeRequiredNumber (int8_t)

    Volume level to be set. Supported range is 0 to 100.

    Call Returns

    Name

    Required

    Type

    Description

    returnValueRequiredBoolean

     Indicates the status of operation. Possible values are:

    • true - Indicates that the operation was successful.
    • false - Indicates that the operation failed. Check the "errorCode" and "errorText" fields for details.
    errorCodeOptionalNumber (int8_t)

     The error code for the failed operation.

    errorTextOptionalString

     Indicates the reason for the failure of the operation. See the "API Error Codes Reference" section for details.

    soundOutputOptionalString

    Audio output device.

    volumeOptionalNumber (int8_t)

    Volume level that is set. Supported range is 0 to 100.

    Example

    luna-send -n 1 luna://com.webos.service.audiooutput/audio/volume/set '{"soundOutput":"alsa","volume":10}'

    audio/volume/getStatus

    Description

    Lists information of all available audio output devices.

    Parameters

    None

    Call Returns

    Name

    Required

    Type

    Description

    returnValueRequiredBoolean

     Indicates the status of operation. Possible values are: \

    • true - Indicates that the operation was successful.
    • false - Indicates that the operation failed. Check the "errorCode" and "errorText" fields for details.
    errorCodeOptionalNumber (int8_t)

     The error code for the failed operation.

    errorTextOptionalString

    Indicates the reason for the failure of the operation. See the "API Error Codes Reference" section for details.

    volumeStatusOptionalObject array: volumeStatus

    Information of audio output devices.

    Note: For definition of the object, click the link from the "Type" column.

      Example

      luna-send -n 1 luna://com.webos.service.audiooutput/audio/volume/getStatus '{}'

      audio/volume/muteSoundOut

      Description

      Mute the audio output device.

      Parameters

      Name

      Required

      Type

      Description

      soundOutputRequiredString

      Audio output device. Possible values are:

      • alsa
      muteRequiredBoolean

      Indicate if the audio output device is to be muted. Possible values are:

      • true: mute.
      • false: not muted.

      Call Returns

      Name

      Required

      Type

      Description

      returnValueRequiredBoolean

       Indicates the status of operation. Possible values are:

      • true - Indicates that the operation was successful.
      • false - Indicates that the operation failed. Check the "errorCode" and "errorText" fields for details.
      errorCodeOptionalNumber (int8_t)

       The error code for the failed operation

      errorTextOptionalString

       Indicates the reason for the failure of the operation. See the "API Error Codes Reference" section for details.

      soundOutputOptionalString

      Audio output device.

      muteOptionalBoolean

      Indicates if the audio output device is muted. Possible values are:

      • true: muted.
      • false: not muted.

      Example

      luna-send -n 1 luna://com.webos.service.audiooutput/audio/volume/muteSoundout '{"soundOutput": "alsa", "mute": false}'

      Objects

      audio

      Contains information of the connections between source and sink.

      Note: If no Source/Sink are connected, it returns an empty array.

      Name

      Required

      Type

      Description

      sourceOptionalString

      Audio source. Possible values are:

      • AMIXER

      Note: Returns empty string is no source and sink are connected.

      sinkOptionalString

      Audio sink. Possible values are:

      • ALSA

      Note: Returns empty string is no source and sink are connected.

      mutedOptionalBoolean

      Indicates if the audio is muted. Possible values are:

      • true: audio is muted.
      • false: audio is not muted.
      outputModeOptionalString

      Audio output device. Possible values are:

      • alsa

      Note: Returns "null" string if no output device is set.

      volumeStatus

      Contains information of the audio output devices.

      Name

      Required

      Type

      Description

      mutedRequiredBoolean

      Indicates if the audio output device is muted. Possible values are:

      • true: muted.
      • false: not muted.
      volumeRequiredNumber (int8_t)

      Volume level of the audio output device. Values can be from 0 to 100.

      soundOutputRequiredString

      Audio output device. Possible values are:

      • alsa

      API Error Codes Reference

      Error Code

      Error Text

      Error Description

      1Unknown error

       General Service error: API_ERROR_UNKNOWN 1 "Unknown error"

      3Failed to validate against schema

       General Service error: API_ERROR_SCHEMA_VALIDATION 3 "Failed to validate against schema"

      4Invalid Parameters

       General Service error: API_ERROR_INVALID_PARAMETERS 4 "invalid input Parameters"

      10Not implemented

       General Service error: API_ERROR_NOT_IMPLEMENTED 10 "Functionality not implemented

      20Driver error while executing the command

       Driver error: API_ERROR_HAL_ERROR 20 "Driver error while executing the command"

      200Audio not connected

       Audio error: API_ERROR_AUDIO_NOT_CONNECTED 200 "Audio not connected"

      201soundOutput not implemented

       Audio error: API_ERROR_INVALID_SPKTYPE 201, "soundOutput not implemented”

      202Volume already at max/min/Volume out of range

       Audio error: API_ERROR_VOLUME_LIMIT 202, “Volume already at max/min”/"Volume out of range"

      203Connection not possible

       Audio error: API_ERROR_CONNECTION_NOT_POSSIBLE 203 "Connection not possible"

      204Volume control is not supported

       Volume control error: API_ERROR_INVALID_VOLUME_CONTROL 204," Volume control is not supported"

      Contents