The audio control protocol configures sound sources and sinks, for instance for call audio control on a mobile phone. This protocol is still experimental, as configuration of audio stacks is complex and I have only a few simple examples to work from thus far. As Synit is ported to new systems (e.g. new mobile handsets, to desktop machines, and so on), this protocol will be refined.
Implementation. The protocol is (as of October 2022) implemented entirely within the
SqueakPhone Smalltalk image, in class
AudioProfileDaemon. The audio profile daemon has three
tasks: first, to track Linux input
MICROPHONE_INSERT events and state,
HeadsetMicrophonePresent assertions in response;
second, to track application state such as whether a call is in progress or not; and third, to
respond to changes in device and application state, along with changes in sink/source mapping
configuration, by using the external
amixer program to enable and disable audio sinks and
sources. The schema definition file contains a few
that give some of the flavour of the logic involved.
Each different kind of device asserts
Mapping records to connect abstract
Endpoint names to
concrete ALSA device names.
Mapping = <alsa-mapping @abstract Endpoint @concrete string> . Endpoint = <source @value Source> / <sink @value Sink> . Sink = =speaker / =headset / =earpiece . Source = =speakerphone / =headset / =handset .
Example. When the Smalltalk code detects that it is running on a PinePhone, it asserts
<alsa-mapping <sink speaker> "Line Out">
<alsa-mapping <sink headset> "Headphone">
<alsa-mapping <sink earpiece> "Earpiece">
<alsa-mapping <source speakerphone> "Mic1">
<alsa-mapping <source handset> "Mic1">
The current daemon interprets low-level Linux input subsystem events, asserting
HeadsetMicrophonePresent when the relevant hardware is physically
attached to the system. These assertions are in turn used when selecting an audio profile to
HeadsetSpeakerPresent = <headset-speaker-present> . HeadsetMicrophonePresent = <headset-microphone-present> .