[pulseaudio-discuss] Java and pulseaudio

John Stanley johnstops at verizon.net
Wed Aug 13 13:58:42 PDT 2008


Hi,
Thanks for the response. Backend is alsa. I'm using alsa-1.0.17, 
mplayer-1.0rc2, VLC-0.8.6i, pulseaudio-0.9.11, and audacity-1.3.5.

Originally I had those lines in asound.conf, but then mplayer failed to 
play at all, giving:

 >-------------
AO: [alsa] 22050Hz 2ch s16le (2 bytes per sample)
Video: no video
[AO_ALSA] Unable to find simple control 'PCM',0.
Starting playback...
mpg123: Can't rewind stream by 695 bits!
mpg123: Can't rewind stream by 166 bits!
gmplayer: pcm_pulse.c:275: pulse_write: Assertion `pcm->last_size >= 
(size * pcm->frame_size)' failed.


MPlayer interrupted by signal 6 in module: play_audio
- MPlayer crashed. This shouldn't happen.
It can be a bug in the MPlayer code _or_ in your drivers _or_ in your
gcc version. If you think it's MPlayer's fault, please read
DOCS/HTML/en/bugreports.html and follow the instructions there. We can't and
won't help unless you provide this information when reporting a possible 
bug.
<----------------

I also tried a current svn version of mplayer, setting the sound device 
to "pulse," and then to alsa "default," in both cases, the same result 
as above. When I removed the default lines from asound.conf, mplayer 
then worked.

I think I'll look into kde/arts a bit to try 'n discover how 
javax.sound.sampled is dealt with.

Also, I've found that if I set mplayer, vlc, and audacity all to use the 
alsa "default" device, then they all work together (individually and 
concurrently), without using pulseaudio at all.

For this case, I remove the /etc/asound.conf file, and make sure that 
pulseaudio is not running. Nevertheless, if any app is using sound 
output, a Java app crashes with "output/target line unavailable, and if 
I run the Java app first, then all other sound apps do the same. So with 
or without pulseaudio, the result is the same: Java grabs exclusive use 
of the sound card. I was hoping that by using pulseaudio, the pulseaudio 
daemon would intercede, thus preventing Java from doing this, but it 
looks like Java is simply unable to use alsa "default," and simply 
connects directly to the audio device.

This is really really annoying as I love Java and use it a lot. I can't 
believe they're doing this in javax.sound.sampled!



Michal Sawicz wrote:
> Dnia 2008-08-13, śro o godzinie 06:35 -0400, John Stanley pisze:
>   
>> However, I simply 
>> cannot get it to work with Java.  Java (jdk6u7) appears to hold
>> output 
>> audio devices exclusively so that no other apps can be run
>> concurrently.
>>     
>
> What audio backend does Java use? If it's OSS, run the app with 'padsp
> java...', if it's alsa, add:
>
> pcm.!default {
> 	type pulse
> }
>
> ctl.!default {
> 	type pulse
> }
>
> to your .asoundrc and you should be fine.
>
>   
> ------------------------------------------------------------------------
>
> _______________________________________________
> pulseaudio-discuss mailing list
> pulseaudio-discuss at mail.0pointer.de
> https://tango.0pointer.de/mailman/listinfo/pulseaudio-discuss
>   



More information about the pulseaudio-discuss mailing list