Skip to content

Mixer

The built-in Mixer extension enables DAC volume control and mute/unmute functionality, automatically using on-chip hardware volume control when available or falling back to software control.

https://github.com/berry-audio/berryaudio/tree/master/mixer

Methods

get_volume

get_volume

Gets the current volume status.

Request

json
{
  "jsonrpc": "2.0",
  "method": "mixer.get_volume",
  "id": 3
}

Response

json
{
  "jsonrpc": "2.0",
  "id": 5,
  "result": 66
}
PropertyTypeDescription
resultnumberCurrent volume

set_volume

set_volume

Sets the current mixer volume.

Request

json
{
  "jsonrpc": "2.0",
  "method": "mixer.set_volume",
  "params": {
    "volume": 60
  },
  "id": 5
}
ParamTypeRequiredValueDescription
volumenumberYes0-100Mixer volume

Response

json
{
  "jsonrpc": "2.0",
  "id": 5,
  "result": true
}

Returns true if set else false if there was a problem

get_mute

get_mute

Gets the current mute status.

Request

json
{
  "jsonrpc": "2.0",
  "method": "mixer.get_mute",
  "id": 5
}

Response

json
{
  "jsonrpc": "2.0",
  "id": 5,
  "result": false
}
PropertyTypeDescription
resultbooleanMute status

set_mute

set_mute

Sets the current mixer mute.

Request

json
{
  "jsonrpc": "2.0",
  "method": "mixer.set_mute",
  "params": {
    "mute": true
  },
  "id": 5
}
ParamTypeRequiredValueDescription
mutebooleanYestrueSets Mute
falseSets Un-Mute

Response

json
{
  "jsonrpc": "2.0",
  "id": 5,
  "result": true
}

Returns true if set else false if there was a problem

Events

volume_changed

volume_changed

Event triggered when a volume changes

json
{
    "event": "volume_changed",
    "volume": 64
}
PropertyTypeDescription
eventstringEvent name
volumenumberVolume state

mixer_mute

mixer_mute

Event triggered when a mixer is muted or un-muted

json
{
    "event": "mixer_mute",
    "mute": true
}
PropertyTypeDescription
eventstringEvent name
mutebooleanMute Status