[alsa-devel] Mono output on emu10k1 with alsa broken

Thomas Richter richter at rus.uni-stuttgart.de
Wed May 1 23:38:00 CEST 2013


Trying to configure mono (one channel) output on emu10k1 hardware using the
alsa version that comes with kernel 3.9 is broken. Instead of expecting mono
samples, the alsa callback expects twice as many stereo samples. Not getting
the required number of samples then causes a buffer underrun, and sound gets
interrupted or messed up. In fact, what the audio hardware does is that it
plays not only the buffer, but also the data "behind the buffer", causing
wierd noises.

The channel count is setup as

channels = 1;


snd_pcm_hw_params_malloc(&HWParms);

snd_pcm_open(&SoundStream,CardName,SND_PCM_STREAM_PLAYBACK,SND_PCM_NONBLOCK
| SND_PCM_ASYNC);

snd_pcm_hw_params_set_channels_min(SoundStream,HWParms,&channels);

snd_pcm_hw_params_set_channels_max(SoundStream,HWParms,&channels);

snd_pcm_hw_params_set_channels_first(SoundStream,HWParms,&channels);

plus error checking. Then, a bit later, the number of configured channels is
verified:

snd_pcm_hw_params_get_channels(HWParms,&channels);

channels is at this point still 1, i.e. the driver accepted the mono output,
but does then not play correctly.

Note that the same call sequence works for stereo, and it also works for
mono for other underlying hardware drivers, i.e. mono output works on
snd-hda-intel, for example. It does not on emu10k1.




More information about the Alsa-devel mailing list