Implementations/fsoaudiod/RoutingUsecases

From freesmartphone.org
Jump to: navigation, search

Most devices has a very different way to do audio routing. This page will collect most of them so we can create a general approach to handle all of them in a common way.

Contents

Palm Pre

Audio routing on the Palm Pre is done with little scripts which are loaded into the kernel by passing them to a sysfs node. The scripts contains settings for the registers of the audio chip in the device. There are two relevant script domains: media and phone. The media domain is responsible for all audio played when no telephony call is active. The media audio can be routed to the frontspeaker, backspeaker, headset or via bluetooth. For each destination there is a separate script.

When a telephony call is active the audio codec needs to be switched with a extra script called "call_started" and restored after the call has finished by a script called "call_ended".

For more implementation details, please see the implementation of the fsoaudiod router plugin for the Palm Pre device.

N900

That is implemented in an fsoaudiod plugin named gsmvoice_alsa_cmtspeechdata

Openmoko GTA02

Normal playback/recording

see :

Bluetooth

The bluetooth has 2 modes:

A2DP is stereo and doesn't permit recording the sound from the microphone, while SCO is mono but permit the recording from the microphone.

SCO

SCO is PCM in the case of the freerunner(that can't be changed because the mode is written in the bluetooth chip's eeprom), and works the following way:

A2DP

To make A2DP you use that:

opkg install libasound-module-bluez
# cat .asoundrc 
pcm.!default {
  type bluetooth
  device XX:XX:XX:XX:XX:XX
  profile "auto"
}

However this has some issues: while plug works with bluetooth, dmix doesn't. That makes ringing and playing music at the same time on A2DP impossible until another solution than pulseaudio is found

htcdream

The htc dream has 3 switches:

It also has a main volume control. Note that switching from back speaker to front speaker result in a different volume Bluetooth headset was not tested and I guess it should fail to work.

Nexusone

Kernel driver

A new kernelspace driver was written by Cotulla and uses standard alsamixer controls, it's a plain alsa driver(not sound/soc/)

Userspace driver

The nexusone didn't have a decent enough alsa driver yet, so it had an userspace workarround instead in .asoundrc(in combinaison with the dummy kernel sound card):

pcm.qsd8k {
        type plug
        slave {
                pcm "file:/dev/msm_pcm_out,raw"
                format S16_LE
                rate 44100
                channels 2
        }
} 

# Device for playing media audio
pcm.softvol {
    type softvol
    slave.pcm "qsd8k"
    control.name "PCM"
    control.card 0
} 
  

pcm.!default {
        type plug
        slave.pcm "softvol"
}

routing could be done in fsoaudiod(it's currently a separate program).

Or we could implement it as alsa userspace libraries,

Or we could make the kenrel driver better

Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox