Comment 5 for bug 457144

Revision history for this message
manolo (manuel-sales) wrote :

Francesco, thanks for the advice.

The good news is that if I follow your advice it works (just copying libpulse-java.so and pulse-java.jar is enough, even if I don't modify sound.properties it also works), I can play your web radio at the same time I play music with Rhythmbox

The bad news is that not everything works..

1) a java program not done by me, it works the first time a sound is played (but an icon that should change to pause after the sound is played never changes) and the second time it tryes to play the application gets frozen (I suppose the first sound never acknowledges that it has finished and some kind of lock occurs) and the only way out is to kill it.
The terminal shows this stack trace
PulseAudio Eventloop Thread
 at java.lang.Object.wait(Native Method)
 at java.lang.Thread.join(Thread.java:1143)
 at java.lang.Thread.join(Thread.java:1196)
 at org.classpath.icedtea.pulseaudio.PulseAudioClip.close(PulseAudioClip.java:247)
 at jsound.b.f(b.java:112)
 at jsound.b.update(b.java:69)
 at org.classpath.icedtea.pulseaudio.PulseAudioLine.fireLineEvent(PulseAudioLine.java:76)
 at org.classpath.icedtea.pulseaudio.PulseAudioDataLine$2.update(PulseAudioDataLine.java:207)
 at org.classpath.icedtea.pulseaudio.Stream.underflowCallback(Stream.java:601)
 at org.classpath.icedtea.pulseaudio.EventLoop.native_iterate(Native Method)
 at org.classpath.icedtea.pulseaudio.EventLoop.run(EventLoop.java:141)
 at java.lang.Thread.run(Thread.java:619)
2) A program done by me plays the sound the first time but the second not; in this case my application doesnt throw any error and there is no stack trace; anyway it seems similar to case 1.
In this case the code I wrote for the defining and loading the sound is...
    try {

      // especificar el sonido a tocar

      soundFile = new File(c.carpetaDatos + "CconfCV.wav");

      sound = AudioSystem.getAudioInputStream(soundFile); //throws UnsupportedAudioFileException, IOException

      // cargar el sonido en memoria (un Clip)

      clipConfCV = (Clip) AudioSystem.getLine(new DataLine.Info(Clip.class, sound.getFormat()));
      clipConfCV.open(sound);

    } catch (javax.sound.sampled.UnsupportedAudioFileException ex) {

       c.t.traza('E', "Aplicacion", "UnsupportedAudioFileException: en sonido " + soundFile, true, false);

    } catch (java.io.IOException ex) {

       c.t.traza('E', "Aplicacion", "IOException: en sonido " + soundFile, true, false);

    } catch (javax.sound.sampled.LineUnavailableException ex) {

       c.t.traza('E', "Aplicacion", "LineUnavailableException: en sonido " + soundFile, true, false);

    }

  }

And the method for playing...
  public void ReproduceSonido(int sonido) {

    clipConfCV.setFramePosition(0); clipConfCV.start();
  }