asb / spindle

http://asbradbury.org/projects/spindle/
Other
185 stars 43 forks source link

Add asound.conf to make plug ALSA plugin work. #118

Closed kadamski closed 12 years ago

kadamski commented 12 years ago

By default, "default" ALSA device is using plughw (that is a plug plugin wrapper) to play sound. The plugin seems to need mmap support from device driver to work properly and currently snd-bcm2835 lacks that support. This makes plug plugin fail when an application tries to some PCM format that is not supported by hardware. Plug plugin is supposed to be able to get any PCM configuration and convert it to something that hardware can actually play. Many alsa applications depend on this feature. What it worst, plug plugin reports that it can handle formats not supported by hardware (sine it should do that) but then fails when you actually do so. This makes programs like mplayer/VLC (and probably many others) unhappy, especially when playing MP3 as their codecs produces float PCM which is not supported by hardware. There is quite simple solution for this and it involves creating .asoundrc or /etc/asound.conf. I don't think this is suitable to put this to upstream so I believe it could be tweaked by your scripts. Here's the configuration:

pcm.mmap0 {
    type mmap_emul;
    slave {
      pcm "hw:0,0";
    }
}

pcm.!default {
  type plug;
  slave {
    pcm mmap0;
  }
}

It enables mmap_emul plugin which emulates mmap support. The drawback is worst latency but I think it's worth sound working out of the box for much more people. This config can be disabled when ALSA driver got proper MMAP support done.