I have the following code in the .asoundrc file in my home directory -
When I run this sample example (http://www.alsa-project.org/alsa-doc/alsa-lib/_2test_2pcm_8c-example.html) it works fine (I changed the device name to plug:lol). I can hear a sound playing in my headphones. The problem occurs when two or more processes try to output audio data at the same time. In this case, the later process cannot output its audio data properly.
For example, I ran a media player which was playing a song and then I tried running that example. I couldn't hear any sound from it, all I could hear was the music playing in the media player. Similar thing happens when I run this example first and then the media player, in which case I only listen audio output from my example.
How can I solve this problem? Is there any error with my pcm device configuration? Or do I have to provide any additional PCM configuration parameters in the example code ?
Also, it would have been really nice if I could create this logical device configuration programmatically rather than using a configuration file like this.
Pinned topic ALSA configuration to enable device sharing between multiple processes
Answered question This question has been answered.
Unanswered question This question has not been answered yet.
Updated on 2011-12-02T15:54:31Z at 2011-12-02T15:54:31Z by SystemAdmin
SystemAdmin 110000D4XK2364 Posts
Re: ALSA configuration to enable device sharing between multiple processes2011-12-02T15:54:31ZThis is the accepted answer. This is the accepted answer.Typically ALSA does a pretty good job of supporting multiple programs with the defaults. Do you know how this .asoundrc file was generated? What distribution of Linux are you running?