com.webos.service.audiooutput

Note
This API has been available since API level 11.

API Summary

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:

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

Overview of the API

NA

    Methods

    audio/connect

    ACG: audiooutput.management
    • Added: API level 11

    Description

    Connects the audio source to the audio sink.

    Parameters

    Name

    Required

    Type

    Description

    sourceRequiredString

    Indicates the audio source. Possible values are: 

    • AMIXER
    sinkRequiredString

    Indicates the audio sink. Possible values are:

    • ALSA

    Call Returns

    Name

    Required

    Type

    Description

    returnValueRequiredBoolean

    Indicates the status of the 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

    Indicates the audio source.

    sinkOptionalString

    Indicates the audio sink.

    Example

    Example scenario

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

    Response:

    {
       "source":"AMIXER",
       "sink":"ALSA",
       "returnValue":true
    }

    audio/disconnect

    ACG: audiooutput.management
    • Added: API level 11

    Description

    Disconnects from the audio sink.

    Note: No changes if there is no connection.

    Parameters

    Name

    Required

    Type

    Description

    sourceRequiredString

    Indicates the audio source. Possible values are: 

    • AMIXER
    sinkRequiredString

    Indicates the audio sink. Possible values are:

    • ALSA

    Call Returns

    Name

    Required

    Type

    Description

    returnValueRequiredBoolean

    Indicates the status of the 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

    Indicates the audio source.

    sinkOptionalString

    Indicates the audio sink.

    Example

    Example scenario

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

    Response:

    {
       "source":"AMIXER",
       "sink":"ALSA",
       "returnValue":true
    }

    audio/getStatus

    ACG: audiooutput.management
    • Added: API level 11

    Description

    Lists the information of all the connected audio source and sinks.

    Parameters

    None

    Call Returns

    Name

    Required

    Type

    Description

    returnValueRequiredBoolean

    Indicates the status of the 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.

    audioOptionalObject array: audio

    Contains the connections between source and sink.

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

    Example

    Example: When no source and sink are connected

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

    Response:

    {

        "audio": [ ],
        "returnValue": true

    }

    Example: When only source and sink are connected

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

    Response:

    {
       "audio":[
          {
             "source":"AMIXER",
             "sink":"ALSA",
             "muted":false,
             "outputMode":"null"
          }
       ],
       "returnValue":true
    }

    Example: When source, sink, and soundOut are connected

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

    Response:

    {
       "audio":[
          {
             "source":"AMIXER",
             "sink":"ALSA",
             "muted":false,
             "outputMode":"alsa"
          }
       ],
       "returnValue":true
    }

    audio/mute

    ACG: audiooutput.management
    • Added: API level 11

    Description

    Mutes or unmutes the connected audio source.

    Parameters

    Name

    Required

    Type

    Description

    sourceRequiredString

    Indicates the audio source. Possible values are:

    • AMIXER
    sinkRequiredString

    Indicates the audio sink. Possible values are:

    • ALSA
    muteRequiredBoolean

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

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

    Call Returns

    Name

    Required

    Type

    Description

    returnValueRequiredBoolean

    Indicates the status of the 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

    Indicates the audio source.

    sinkOptionalString

    Indicates the audio sink.

    muteOptionalBoolean

    Indicates if the audio source is muted.

    Possible values are:

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

    Example

    Example scenario

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

    Response:

    {
       "source":"AMIXER",
       "sink":"ALSA",
       "mute":true,
       "returnValue":true
    }

    audio/setSoundOut

    ACG: audiooutput.management
    • Added: API level 11

    Description

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

    Parameters

    Name

    Required

    Type

    Description

    soundOutRequiredString

    Indicates the audio output device. Possible values are:

    • alsa

    Call Returns

    Name

    Required

    Type

    Description

    returnValueRequiredString

    Indicates the status of the 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

    Indicates the audio output device.

    Example

    Example scenario

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

    Response:

    {
       "soundOut":"alsa",
       "returnValue":true
    }

    audio/volume/down

    ACG: audiooutput.management
    • Added: API level 11

    Description

    Linearly decreases, the master volume of the audio output device.

    Parameters

    Name

    Required

    Type

    Description

    soundOutputRequiredString

    Indicates the audio output device. Possible values are:

    • alsa

    Call Returns

    Name

    Required

    Type

    Description

    returnValueRequiredBoolean

    Indicates the status of the 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

    Indicates the audio output device.

    volumeOptionalNumber (int8_t)

    Indicates the volume level after it is decreased.

    Possible range: 0 ~ 100

    Example

    Example scenario

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

    Response:

    {
       "soundOutput":"alsa",
       "volume":9,
       "returnValue":true
    }

    audio/volume/getStatus

    ACG: audiooutput.management
    • Added: API level 11

    Description

    Lists the information of all available audio output devices.

    Parameters

    None

    Call Returns

    Name

    Required

    Type

    Description

    returnValueRequiredBoolean

    Indicates the status of the 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

    Contains the information of the audio output devices.

      Example

      Example scenario

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

      Response:

      {
         "returnValue":true,
         "volumeStatus":[
            {
               "muted":false,
               "volume":10,
               "soundOutput":"alsa"
            }
         ]
      }

      audio/volume/muteSoundOut

      ACG: audiooutput.management
      • Added: API level 11

      Description

      Mutes the audio output device.

      Parameters

      Name

      Required

      Type

      Description

      soundOutputRequiredString

      Indicates the audio output device. Possible values are:

      • alsa
      muteRequiredBoolean

      Indicates if the audio output device is to be muted.

      Possible values are:

      • true: muted.
      • false: not muted.

      Call Returns

      Name

      Required

      Type

      Description

      returnValueRequiredBoolean

      Indicates the status of the 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

      Indicates the audio output device.

      muteOptionalBoolean

      Indicates if the audio output device is muted.

      Example

      Example scenario

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

      Response:

      {
         "returnValue":true,
         "soundOutput":"alsa",
         "mute":true
      }

      audio/volume/set

      ACG: audiooutput.management
      • Added: API level 11

      Description

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

      Parameters

      Name

      Required

      Type

      Description

      soundOutputRequiredString

      Indicates the audio output device. Possible values are:

      • alsa
      volumeRequiredNumber (int8_t)

      Indicates the volume level to be set.

      Possible range: 0 - 100

      Call Returns

      Name

      Required

      Type

      Description

      returnValueRequiredBoolean

      Indicates the status of the 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

      Indicates the audio output device.

      volumeOptionalNumber (int8_t)

      Indicates the volume level to be set.

      Possible range: 0 - 100

      Example

      Example scenario

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

      Response:

      {
         "soundOutput":"alsa",
         "volume":10,
         "returnValue":true
      }

      audio/volume/up

      ACG: audiooutput.management
      • Added: API level 11

      Description

      Linearly increases, the master volume of the audio output device.

      Parameters

      Name

      Required

      Type

      Description

      soundOutputRequiredString

      Indicates the audio output device. Possible values are:

      • ALSA

      Call Returns

      Name

      Required

      Type

      Description

      returnValueRequiredBoolean

      Indicates the status of the 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

      Indicates the audio output device.

      volumeOptionalNumber (int8_t)

      Indicates the volume level after it is increased.

      Possible range: 0 ~ 100

      Example

      Example scenario

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

      Response:

      {
         "soundOutput":"alsa",
         "volume":11,
         "returnValue":true
      }

      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

      Indicates the audio source.

      Possible values are:

      • AMIXER

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

      sinkOptionalString

      Indicates the audio sink.

      Possible values are:

      • ALSA

      Note: Returns empty string if 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

      Indicates the audio output device.

      Possible values are:

      • alsa

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

      volumeStatus

      Contains the 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)

      Indicates the volume level of the audio output device.

      Possible volume range: 0 - 100

      soundOutputRequiredString

      Indicates the 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