dkandalov / friday-mario

IntelliJ plugin to have fun 🎮🔊
https://plugins.jetbrains.com/plugin/7599
76 stars 6 forks source link

No music and sounds on OpenJDK on GNU/Linux #3

Closed robertfausk closed 9 years ago

robertfausk commented 9 years ago

Plays no music and no sound It's already actived under "Tools" -> "Start Friday Mario"

dkandalov commented 9 years ago

Thanks a lot for reporting this. Just installed PHPStorm 141.690 and the plugin works for me (jre 1.6, OSX 10.9.5). Do you run PHPStorm with jre 1.8 by any chance?

robertfausk commented 9 years ago

Here is my config:

$ java -version
java version "1.7.0_75"
OpenJDK Runtime Environment (IcedTea 2.5.4) (7u75-2.5.4-1~trusty1)
OpenJDK 64-Bit Server VM (build 24.75-b04, mixed mode)

I'm on ubuntu 14.04 LTS.

dkandalov commented 9 years ago

Apologies for the very slow response. I suspect there might be no sounds because of IcedTea JDK.

If something is wrong with sounds, it must be in this class which depends almost on jdk only https://github.com/dkandalov/friday-mario/blob/master/fridaymario/sounds/Sound.java#L15 I'll be happy to make any changes and release the plugin if you could check why it doesn't work.

Unfortunately, I don't have access to linux desktop to try it myself :(

kernc commented 9 years ago

Fails for me too in PyCharm on Debian. (Might as well rename the issue to sound more general.) IcedTea is just the browser plugin; don't think it has much to do with it.

How would one test this minimally, i.e. what to run to see if the sound, as used in Friday Mario, is working at all with OpenJDK on GNU/Linux? (I'm not a native Java speaker; please kindly give some guidance.)

dkandalov commented 9 years ago

Thank you for reporting the issue again.

Yes, blaming IcedTea probably was be a bit too much guesswork on my side. As I understand it's not just browser plugin but also some patches and different build system. The reason I mentioned it is that few years ago there were couple cases when IcedTea jdk didn't work with some apps but Sun jdk worked fine. It might be different now.

I could wrap https://github.com/dkandalov/friday-mario/blob/master/fridaymario/sounds/Sound.java into standalone program. Let me try virtual box first, I'll do it sometime this week.

kernc commented 9 years ago

FWIW, I tried this small example (adapted from here and from your code — I couldn't possibly construct it myself), and with ffmpeg -i some.mp3 test.au run beforehand, the sound works.

import java.io.*;
import javax.sound.sampled.AudioSystem;
import javax.sound.sampled.Clip;

public class JavaSound
{
  public static void main(String[] args)
  throws Exception
  {
    // open the sound file as a Java input stream
    InputStream in = new BufferedInputStream(new FileInputStream("test.au"));
    final Clip clip = AudioSystem.getClip();
    clip.open(AudioSystem.getAudioInputStream(in));
    clip.loop(3);
  }
}
kernc commented 9 years ago

Ahhh, but with the same script but one of yout WAVs as the filename, it excepts with:

Exception in thread "main" javax.sound.sampled.UnsupportedAudioFileException: could not get audio input stream from input stream
    at javax.sound.sampled.AudioSystem.getAudioInputStream(AudioSystem.java:1119)
    at JavaSound.main(JavaSound.java:13)

Do I need to wrap WAVs with something more or is this the culprit? Seems odd the WAV codecs would be missing.

kernc commented 9 years ago

Would you consider shipping samples in Sun Audio (.au) format? :smile:

dkandalov commented 9 years ago

Thanks a lot for testing this! Yes, sure.

kernc commented 9 years ago

For anyone interested, in addition to changes in #7 and #8, I had to edit my /etc/java-7-openjdk/sound.properties according to this guide, otherwise PulseAudio sound server (or something) would lock up randomly, locking up the whole of PyCharm with it.