Bravia.Audio (Bravia v0.1.0)

Copy Markdown View Source

Volume, muting, and sound settings.

{:ok, [%{"volume" => 12, "maxVolume" => 100}]} = Bravia.Audio.get_volume_information(tv)
:ok = Bravia.Audio.set_volume(tv, 20)
:ok = Bravia.Audio.set_volume(tv, "+1")

Televisions routing sound to an external amplifier over eARC may report a volume they do not actually control. Check get_volume_information/1 before assuming a write will be audible.

Summary

Functions

Reads sound settings such as the output terminal or sound mode.

Reads speaker settings, such as the front speaker configuration.

Reads each output's volume, mute state, and range.

Mutes or unmutes the television.

Writes speaker settings.

Functions

get_sound_settings(client, target \\ "")

@spec get_sound_settings(Bravia.Client.t(), String.t()) ::
  {:ok, [map()]} | {:error, Bravia.Error.t()}

Reads sound settings such as the output terminal or sound mode.

get_speaker_settings(client, target \\ "")

@spec get_speaker_settings(Bravia.Client.t(), String.t()) ::
  {:ok, [map()]} | {:error, Bravia.Error.t()}

Reads speaker settings, such as the front speaker configuration.

get_volume_information(client)

@spec get_volume_information(Bravia.Client.t()) ::
  {:ok, [map()]} | {:error, Bravia.Error.t()}

Reads each output's volume, mute state, and range.

[%{"target" => "speaker", "volume" => 12, "mute" => false,
   "minVolume" => 0, "maxVolume" => 100}]

set_mute(client, status)

@spec set_mute(Bravia.Client.t(), boolean()) :: :ok | {:error, Bravia.Error.t()}

Mutes or unmutes the television.

set_sound_settings(client, settings)

@spec set_sound_settings(Bravia.Client.t(), [map()]) ::
  :ok | {:error, Bravia.Error.t()}

Writes sound settings, in the same shape as Bravia.Video.set_picture_quality_settings/2.

set_speaker_settings(client, settings)

@spec set_speaker_settings(Bravia.Client.t(), [map()]) ::
  :ok | {:error, Bravia.Error.t()}

Writes speaker settings.

set_volume(client, volume, options \\ [])

@spec set_volume(Bravia.Client.t(), non_neg_integer() | String.t(), keyword()) ::
  :ok | {:error, Bravia.Error.t()}

Sets the volume.

Accepts an absolute level as a non-negative integer, or a relative adjustment as a string such as "+1" or "-1".

Options

  • :target — which output to change. Defaults to "speaker". An empty string means whichever output is currently active.