SoundSystem doesn't play

I installed and configured eclipse to work in linux with jme and openal.



However all works fine , i don't hear anything coming out from speakers when i try the playStream over an audio (ogg) file.



The log is void, and the program does not interrupt, so i'm driven to think that it is playing something.



That's the code :


   URL rootUrl = (new File("score.ogg")).toURL();
   int background = SoundSystem.createStream(rootUrl);
   System.out.println("Inizio...");
   if(SoundSystem.isStreamOpened(background)) {
      int lgth = (int) SoundSystem.getStreamLength(background);
      System.out.println("Stream background loaded! Music length:" + lgth);
      SoundSystem.playStream(background);
   }
   else {
      System.out.println("Failed to open stream!");
   }
   
   
    LoggingSystem.getLogger().setLevel(java.util.logging.Level.OFF);



When using VLC i'm hearing correctly ogg audio files and all the other types. So what is the problem ?

Hi,



You say the log is void.

You appear to be switching it off on the last line of that sample code.



Hmm  :stuck_out_tongue:



I know nothing about sound, sorry I can't be any help there.  But try taking out the last line (that might not be turning logging off, I know little about logging too!) and see if you get any kind of output.




  • Chris

Sorry, i wrote wrong. The log was set to ALL when i tested it.



At this moment i have done two tests :

1 wave file : the duration is detected correctly.

2 ogg file : the duration is detected as -1000



In every case i don't hear any sound from speakers. And the program doesn't stop.



The log show this for the ogg file :



24/10/2006 21:42:52 com.jmex.sound.openAL.SoundSystem <clinit>

INFO: DETECT OPERATING SYSTEM

24/10/2006 21:42:53 com.jmex.sound.openAL.SoundSystem <clinit>

INFO: CREATE OPENAL

24/10/2006 21:42:53 com.jmex.sound.openAL.SoundSystem initializeOpenAL

INFO: OpenAL initalized!

24/10/2006 21:42:53 com.jmex.sound.openAL.SoundSystem <clinit>

INFO: CREATE LISTENER

Inizio…

Stream background loaded! Music length:-1000

I used the above code to test if my sound files got loaded (as they never seemed to play…)



Here's the complete test code:

import com.jme.app.SimpleGame;

import java.net.URL;

import com.jmex.sound.openAL.SoundSystem;
public class TestSound extends SimpleGame {

   public static void main(String[] args) {
      TestSound app = new TestSound();
      app.setDialogBehaviour(SimpleGame.NEVER_SHOW_PROPS_DIALOG);
      app.start();
   }

   protected void simpleInitGame() {
      SoundSystem.init(display.getRenderer().getCamera(), SoundSystem.OUTPUT_DEFAULT);
      URL rootUrl = TestSound.class.getClassLoader().getResource("./data/sounds/explosion.wav");
      int background = SoundSystem.createStream(rootUrl);
      System.out.println("Inizio...");
      if(SoundSystem.isStreamOpened(background)) {
         int lgth = (int) SoundSystem.getStreamLength(background);
         System.out.println("Stream background loaded! Music length:" + lgth);
         SoundSystem.playStream(background);
      }
      else {
         System.out.println("Failed to open stream!");
      }
   }
}



And its output:
29.07.2007 07:48:21 com.jme.app.BaseGame start
INFO: Application started.
29.07.2007 07:48:21 com.jme.system.PropertiesIO <init>
INFO: PropertiesIO created
29.07.2007 07:48:21 com.jme.system.PropertiesIO load
INFO: Read properties
29.07.2007 07:48:21 com.jme.app.BaseSimpleGame initSystem
INFO: jME version 1.0 alpha
29.07.2007 07:48:21 com.jme.input.joystick.DummyJoystickInput <init>
INFO: Joystick support is disabled
29.07.2007 07:48:21 com.jme.system.lwjgl.LWJGLDisplaySystem <init>
INFO: LWJGL Display System created.
29.07.2007 07:48:22 com.jme.renderer.lwjgl.LWJGLRenderer <init>
INFO: LWJGLRenderer created. W:

Hi there, I also use Ubuntu 7.04. I ran your test class and it played .ogg file no problem. It may be in your sound preferences, I have everything set to ALSA and the ESD sound server turned off. I still get some random exceptions from audio but its mostly stable. good luck

You need a a lot of luck for completing the set of Sound-Quests for Linux…  :roll:



Turned of ESD, set everything to ALSA, still no sound…  :’(