Most devices which based on BeBoB chipset utilize FUNCTION BLOCK commands to control the volume and routing on its device.

Status

This document is based on the specification of "AV/C Audio Subunit Specification 1.0 (TA Document 1999008)". This specification is "Audio Subunit" version of "AV/C Digital Interface Command Set General Specification, version 3 (TA Document April 1999)". This document refers to this specification as "AV/C Audio".

Audio Subunit FUNCTION_BLOCK command

"AV/C Audio" defined "Audio Subunit FUNCTION_BLOCK command" in its clause 10, This command is used to modify or retrieve the values of controls related to audio.

Command structure

The basic structure of this command:

Opcode:         FUNCTION BLOCK command (0xB8)
Operand[0]:     function block type
Operand[1]:     function block ID
Operand[2]:     control attribute
Operand[3]:     the length of selector, including this field
Operand[3+1]:   audio selector data [1]
...
Operand[3+n]:   audio selector data [n]
Operand[3+n+1]: control selector
Operand[4+n+1]: control data (x)
...
Operand[4+n+x]: ...

function block type

"AV/C Audio" defined the type of function block in its clause 10.1.

  • 0x80 Selector function block
  • 0x81 Feature function block
  • 0x82 Processing function block
  • 0x83 CODEC function block
  • 0x84 reserved

"AV/C Audio" defined the value of control attribute. But it's usually 0x10 as long as I experienced.

Selector function block

"AV/C Audio" defined "Selector function block" in its clause 10.2.

Operand[3]: 2 (fixed value, this means the length of selector, including this field)
Operand[4]: input function block plug number
Operand[5]: 1 (fixed value, SELECTOR_CONTROL)

This command is used like "to select sources to sink".

Feature function block

"AV/C Audio" defined "Feature function block" in its clause 10.3.

Operand[3    ]: 2 (fixed value, this means the length of selector, including this field)
Operand[4    ]: the number of audio channel (0x01, 0x02...)
Operand[5    ]: control selector
Operand[5 + 1]: control parameters
Operand[5 + n]: 

This command is used like "to change volue" or "to mute a jack", "to control panning".

Mute Control

Operand[5]: 0x01 (fixed value, MUTE_CONTROL)
Operand[6]: 0x01 (fixed value, this means the length of control data)
Operand[7]: 0x70 (on), 0x60 (off)

But most devices seem to use Volume Control command instread of this.

Volume Control

Operand[5]: 0x02 (fixed value, VOLUME_CONTROL)
Operand[6]: 2 (fixed value, this means the length of control data)
Operand[7]: higher byte for volume
Operand[8]: lower byte for volume

bytes for volume (when CURRENT):

0x7FFF: invalid
0x7FFE:  127.9922dB
...
0x0001:    0.0039dB
0x0000:    0.0000dB
0xFFFF:   -0.0039dB
...
0x8001: -127.9961dB
0x8000:  -finite dB

(There are more combinations of these values according to "control attribute" but here I omit them.)

LR Balance Control

Operand[5]: 0x03 (fixed value, LR_BALANCE_CONTROL)
Operand[6]: 2 (fixed value, this means the length of control data)
Operand[7]: higher byte for balance
Operand[8]: lower byte for balance

bytes for balance (when CURRENT):

0x7FFF: invalid
0x7FFE:  -finite dB [Right]
0x7FFD: -127.9883dB [Right]
...
0x0100:   -1.0000dB [Right]
...
0x0001:   -0.0039dB [Right]
0x0000:    0.0000dB [Center]
0xFFFF:   -0.0039dB [Left]
...
0x8001: -127.9961dB [Left]
0x8000:  -finite dB [Left]

Processing function block

"AV/C Audio" define this function in its clause 10.04.

Operand[3    ]: 4 (fixed value, this means the length of selector, including this field)
Operand[4    ]: the number of function block input plug
Operand[5    ]: the number of input audio channel
Operand[6    ]: the numebr of output audio channel
Operand[7    ]: control selector
Operand[7 + 1]: parameters depended on the type of processing function block
Operand[7 + n]: ...

This command is used like "to mix sources for a sink and control its degree".

Mixer Control

Operand[ 7]: 0x03 (fixed value, MIXER_CONTROL)
Operand[ 8]: 2 (the length of data for control)
Operand[ 9]: higher byte for mixer control
Operand[10]: lower byte for mixer control

bytes for volume (when CURRENT):

0x7FFF: invalid
0x7FFE:  127.9922dB
...
0x0001:    0.0039dB
0x0000:    0.0000dB
0xFFFF:   -0.0039dB
...
0x8001: -127.9961dB
0x8000:  -finite dB

(There are more combinations of these values according to "control attribute" but here I omit them.)

Practice

The "ffado-test" tool can generate the list of parameters needed for these commands. The fields of "FunctionBlockType", "FunctionBlockId" and "Id", "Names" are useful to understand its implementation for your device. Additionally generated ps file show their connection visually.

For example, M-Audio Firewire Solo has:

Nr | AddressType     | Direction | SubUnitType | SubUnitId | FunctionBlockType | FunctionBlockId | Id   | Type         |Name
---+-----------------+-----------+-------------+-----------+-------------------+-----------------+------+--------------+------
...
 6 |   functionblock |     Input |       Audio |      0x00 |              0x80 |            0x01 | 0x00 |    IsoStream | FB Audio In 1394 Spdif
 7 |   functionblock |     Input |       Audio |      0x00 |              0x80 |            0x01 | 0x01 |    IsoStream | FB Audio In Spdif Mix
 8 |   functionblock |    Output |       Audio |      0x00 |              0x80 |            0x01 | 0x00 |    IsoStream | FB Audio Out Ext Spdif
...

These are for Selector function block command (0x80). It's ID is 0x01. The option to selecting source is 0x00 and 0x01. The former is for software playback for SPDIF and the latter is for mixer output for SPDIF. The sink is hardware output for SPDIF.

Then you can command to route software playback for SPDIF to hardware output for SPDIF:

0x00 (the type of command is for CONTROL)
0x08 (the type of subunit is Audio and its ID is for 0)
0xb8 (FUNCTION BLOCK command)
0x80 (for selector function block)
0x01 (function block ID is 0x01)
0x10 (control attribute is CURRENT)
0x02 (the length of selector is 2)
0x01 (input function block plug is 0x01)
0x01 (fixed value, SELECTOR_CONTROL)
0x00 (padding to be quadlets)
0x00 (padding to be quadlets)
0x00 (padding to be quadlets)

In "AV/C Audio", to get the value of function block, the value of STATUS is used in the first field. But the driver and mixer software on Windows don't use this. They always set mixer value when initializing the device. Additionally, as long as I executed this command, the device always return 0x08 (NOT IMPLEMENTED). So BeBoB don't give us to refer to the current value.