genode/repos/os/src/server/mixer
Norman Feske 4d442bca30 Streamline exception types
This patch reduces the number of exception types by facilitating
globally defined exceptions for common usage patterns shared by most
services. In particular, RPC functions that demand a session-resource
upgrade not longer reflect this condition via a session-specific
exception but via the 'Out_of_ram' or 'Out_of_caps' types.

Furthermore, the 'Parent::Service_denied', 'Parent::Unavailable',
'Root::Invalid_args', 'Root::Unavailable', 'Service::Invalid_args',
'Service::Unavailable', and 'Local_service::Factory::Denied' types have
been replaced by the single 'Service_denied' exception type defined in
'session/session.h'.

This consolidation eases the error handling (there are fewer exceptions
to handle), alleviates the need to convert exceptions along the
session-creation call chain, and avoids possible aliasing problems
(catching the wrong type with the same name but living in a different
scope).
2017-05-31 13:16:07 +02:00
..
mixer.cc Streamline exception types 2017-05-31 13:16:07 +02:00
README mixer: add reporting and config handling 2015-11-18 12:22:07 +01:00
target.mk server/mixer: transition to new base API 2016-11-08 15:26:33 +01:00

The mixer component implements a simple Audio_out session mixer. Input
packets from multiple sources are mixed together into one output packet.


The mixer can be tested by executing the 'repos/os/run/mixer.run' run
script.


Configuration
=============

The mixer gets its configuration via a ROM module called 'mixer.config'.
The following configuration snippet illustrates its structure:

! <config>
!   <default out_volume="75" volume="25" muted="0"/>
!   <channel_list>
!     <channel type="input"  label="client" number="0" volume="75"  muted="1"/>
!     <channel type="input"  label="client" number="1" volume="15"  muted="1"/>
!     <channel type="output" label="master" number="0" volume="100" muted="0"/>
!     <channel type="output" label="master" number="1" volume="100" muted="0"/>
!   </channel_list>
! </config>

The '<default>' node is used to set up the initial settings for new clients.
According to this configuration every new client will start with a volume
level set to 25 and is not muted. The initial output volume level is set
to 75 (the volume level ranges from 0 to 100). The '<channel_list>' node
contains all (pre-)configured channels. Each '<channel>' node has several
mandatory attributes: 'type' specifies its type and is either 'input'
or 'output', the 'label' attribute contains the label of a client for an input
node and the label 'master' for an output node, 'number' specifies the channel
number (0 for left and 1 for right), the 'volume' attribute sets the volume
level and 'muted' marks the channel as muted. In addition, there are optional
read-only channel attributes which are mainly used by the channel list report.


Channel list report
===================

The mixer reports all available channels in its 'channel_list' report.
The report contains a `<channel_list>' node that is similar to the one
used in the 'mixer.config':

! <channel_list>
!   <channel type="input" label="client0" name="left"  number="0" active="1" volume="100" muted="0"/>
!   <channel type="input" label="client0" name="right" number="1" active="1" volume="100" muted="0"/>
!   <channel type="input" label="client1" name="left"  number="0" active="0" volume="25"  muted="0"/>
!   <channel type="input" label="client1" name="right" number="1" active="0" volume="25"  muted="0"/>
!   <channel type="output" label="master" name="left"  number="0" active="1" volume="100" muted="0"/>
!   <channel type="output" label="master" name="right" number="1" active="1" volume="100" muted="0"/>
! </channel_list>

Each channel node features all mandatory attributes as well as a few optional
ones. The 'name' attribute contains the name of the channel. It is the
alphanumeric description of the numeric 'number' attribute. The 'active'
attribute indicates whether a channel is currently playing or not.

A 'channel_list' report may by used to create a new configuration for the
mixer. Every time the available channels change, e.g. when a new client
appears, a new report is generated by the mixer. In return this report can
then be used to configure the volume level of the new client. A new report
is also generated after a new configuration has been applied by the mixer.