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
}| Property | Type | Description |
|---|---|---|
| result | number | Current volume |
set_volume
set_volume
Sets the current mixer volume.
Request
json
{
"jsonrpc": "2.0",
"method": "mixer.set_volume",
"params": {
"volume": 60
},
"id": 5
}| Param | Type | Required | Value | Description |
|---|---|---|---|---|
| volume | number | Yes | 0-100 | Mixer 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
}| Property | Type | Description |
|---|---|---|
| result | boolean | Mute status |
set_mute
set_mute
Sets the current mixer mute.
Request
json
{
"jsonrpc": "2.0",
"method": "mixer.set_mute",
"params": {
"mute": true
},
"id": 5
}| Param | Type | Required | Value | Description |
|---|---|---|---|---|
| mute | boolean | Yes | true | Sets Mute |
false | Sets 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
}| Property | Type | Description |
|---|---|---|
| event | string | Event name |
| volume | number | Volume state |
mixer_mute
mixer_mute
Event triggered when a mixer is muted or un-muted
json
{
"event": "mixer_mute",
"mute": true
}| Property | Type | Description |
|---|---|---|
| event | string | Event name |
| mute | boolean | Mute Status |