Menu

#5 Allow multiple A2DP audio streams

open
nobody
None
5
2007-12-05
2007-12-05
Anonymous
No

This patch provides basic support for multiple simultaneous audio streams to multiple A2DP headphones. It is against the current version in CVS Dec 4,2007

Multiple stream support is configured by adding multiple stanzas to the alsa .asoundrc file like:

pcm.a2dpd2 {
type a2dpd
socket "/tmp/a2dpd2"
}

pcm.a2dpd3 {
type a2dpd
socket "/tmp/a2dpd3"
}

pcm.a2dpd4 {
type a2dpd
socket "/tmp/a2dpd4"
}

This provides three streams called a2dpd2, a2dpd3 and a2dpd4 (in xmms you put these names in the audio device field for the alsa output plugin), each stream needs a unique socket name, so they are also specified.

Then multiple a2dpd daemons are started like:
`a2dpd -f ~/.a2dpdX` where each daemon has a unique configuration file.

Each configuration file then lists the headphone it uses, as always, with the `address=` line.

Two additional parameters must be added though. First is the socket and the second is the bluetooth dongle address.

They are specified like:

# the unix socket name for this daemon to communicate on.. defaults to /tmp/a2dpd if not specified.
socket=/tmp/a2dpd2
# the host address to bind this device to
hostaddress=00:15:83:C3:70:93

The socket address specified here must match the one in the .asoundrc file.

The dongle address is required because the streams will skip if played through the same BT dongle. Adding additional BT dongles, solves this problem. If there are multiple dongles though, each headphone must be bound to one of the dongles otherwise they will all default to running on a single one.

This brings up an additional problem, pairing. At a minimum the headphone must be paired with the dongle specified with the hostaddress field. This can be done by passing the -i hciX option to hcitool. I'm not sure but the headphones probably also need to be paired with the default BT dongle for the service discovery phase. You may have to experiment with this. I have some more code which updates the SDP phases to use the specified dongle, but in my case it seems to work ok without it, and this patch doesn't include it.

Finally, there is a new environment variable that may be set before loading the daemon 'A2DPD_SERVICE_NAME=a2dpd?` which sets the d-bus service name to something other than a2dpd.

Discussion

  • Nobody/Anonymous

    Allow multiple A2DP audio streams to multiple headphones

     
  • Jeremy Linton

    Jeremy Linton - 2007-12-05

    Logged In: YES
    user_id=314418
    Originator: NO

    Dope I forgot to login...

    If you have any questions they may be sent to this account.

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.