3D Sound System

Thanks for explanations so far… I'll try you library more as I'll incorporate it in my project, but right now I see no obstacle to do everything I'll need (except that listener which I'll try as soon as possible:))

gouessej said:
I had forgotten to put the .ogg files into the JAR. But your sound system did not complain, it is strange  :|


I'm having a little trouble tracking this bug down.  Which Library and Codec plug-ins were you using at the time?

--EDIT--
Never mind, I found it and it's now fixed.

I'm having some odd behavior with the new Doppler Effect feature in LibraryJavaSound plug-in.  As soon as I can get this problem figured out, I'll upload the next release.

Great, I was just waiting all the time that you said something like that  :slight_smile:

Having completed all the planned updates, I released the library to my alpha testers yesterday.  Unfortunately, there is a major problem in 64-bit Java in the MIDI source and in the library switching (possibly something to do with reloading from saved FilenameURL instances, but not sure yet).  The SoundSystem is currently unusable on these systems.  I am looking into the problem, and I'll post an update when I get this thing figured out.

PaulLamb said:

Having completed all the planned updates, I released the library to my alpha testers yesterday.  Unfortunately, there is a major problem in 64-bit Java in the MIDI source and in the library switching (possibly something to do with reloading from saved FilenameURL instances, but not sure yet).  The SoundSystem is currently unusable on these systems.  I am looking into the problem, and I'll post an update when I get this thing figured out.

Can I still read ogg files on 64-bit Java machines? I was planning to switch to a more recent version of your library, I don't want any regression :s

Yes, no problem reading ogg files.  Sorry for the delay on getting the update out - I have had almost no time to do any programming lately.  Babies sure seem to take up a lot of time…



All Together, "Awwwwww:slight_smile:



On Topic:  Any difference in read speeds for WAV vs. Ogg these days?

sbook said:

On Topic:  Any difference in read speeds for WAV vs. Ogg these days?


Depends on which codec plug-in you use for .ogg.  JOrbis is very compatible and stable, but it is quite slow at decoding the data compared to reading uncompressed data from .wav (not to mention that it uses the somewhat restrictive LGPL license).  JOgg is way faster (and has a very liberal license), but it has compatibility issues with many .ogg formats and with simultaneous decoding of more than one .ogg file at a time.  But it is fast (about the same as reading from .wav on my computer).  It would be nice if Tor-Einar Jarnbjo maintained his library.. he must be as busy as me..  XD

How can JOgg have issues decoding more than one file at a time? Does it use static variables?

No idea.  It is one of those strange "sometimes happens" bugs.  JOgg can not decode certain .ogg files simultaneously, but others it can.  The code is too complicated for me to try and figure out myself, and the developer hasn't posted an update in at least a couple of years.

PaulLamb said:

No idea.  It is one of those strange "sometimes happens" bugs.  JOgg can not decode certain .ogg files simultaneously, but others it can.  The code is too complicated for me to try and figure out myself, and the developer hasn't posted an update in at least a couple of years.


Sounds like the Java Media Framework team at it again!

The thing is, I am using JOgg in jME3 and so far it has been reliable. I edited some parts of it so it works better with jME3's Asset management system. It is able to read files encoded with AoTuV (best/highest quality ogg encoder) and that's all that matters to me.

Just depends on the ogg file.  Also, running an incompatible ogg through a converter can sometimes make it compatible.  It seems to have the most problem with short-duration oggs.  JOrbis and JOgg each have their advantages and disadvantages.  That's why I made a plug-in for each so the developer can decide.

PaulLamb said:

Yes, no problem reading ogg files.  Sorry for the delay on getting the update out - I have had almost no time to do any programming lately.  Babies sure seem to take up a lot of time..



Ok I don't have yet such "problems"  :lol:

You do your best, good job, keep it up.

I'm having an issue with playing ogg files. It seems my application will hang in SoundSystem.CommandQueue in the first step of waiting for synchronization forever.



As I guess it's based on the issues described above, I'd like to know how to switch from Jogg to Jorbis?



In addition I had problems with cleanup()as it played the background song on and on (also an ogg file).

I mitigated this by issuing stop and calling interruptCommandThread before calling cleanup. Perhaps the two things are based on the same problem? (lock being held by jogg ?)

ghoust said:
I'd like to know how to switch from Jogg to Jorbis?

Just replace CodecJOgg with CodecJOrbis.  Since SoundSystem uses a common interface for codecs, there's no need to change anything else.  Just note that JOrbis is licensed by the LGPL which is not so much of a "do anything you like" license as the one for JOgg, so make sure you familiarize yourself with the terms of that license if you haven't already.

ghoust said:
In addition I had problems with cleanup()as it played the background song on and on (also an ogg file).  I mitigated this by issuing stop and calling interruptCommandThread before calling cleanup.

I'll look into this - sounds like a potential bug in the Command Thread infrastructure to me.  This part of SoundSystem has had a whole lot of bugs in the past that I've fixed over time, so it can't hurt to take a look at it again to see if I can improve it some more.  At the very least, this indicates a problem with the code I added to prevent cleanup() from waiting indefinitely if there is a delay shutting down.

Any chance you can upload and post a link to the ogg file that causes the cleanup() problem, or email it to me?

I was hoping to solve the 64-bit Sun Java problems on Linux, before I post the next big release.  However, if I can't get these fixed in the next few days, I'll go ahead and upload what I have now and post another update later.

PaulLamb said:


ghoust said:
In addition I had problems with cleanup()as it played the background song on and on (also an ogg file).  I mitigated this by issuing stop and calling interruptCommandThread before calling cleanup.

I'll look into this - sounds like a potential bug in the Command Thread infrastructure to me.  This part of SoundSystem has had a whole lot of bugs in the past that I've fixed over time, so it can't hurt to take a look at it again to see if I can improve it some more.  At the very least, this indicates a problem with the code I added to prevent cleanup() from waiting indefinitely if there is a delay shutting down.

Any chance you can upload and post a link to the ogg file that causes the cleanup() problem, or email it to me?

The ogg file is the one uesed in jcrpg: https://javacrpg.svn.sourceforge.net/svnroot/javacrpg/trunk/jcrpg/data/audio/music/fantasy/fantasy_menu.ogg

The code I use is the following:

package com.l2client.controller;

import paulscode.sound.Library;
import paulscode.sound.SoundSystem;
import paulscode.sound.SoundSystemConfig;
import paulscode.sound.SoundSystemException;
import paulscode.sound.codecs.CodecJOgg;
import paulscode.sound.codecs.CodecWav;
import paulscode.sound.libraries.LibraryJavaSound;
import paulscode.sound.libraries.LibraryLWJGLOpenAL;

import com.jme.math.Vector3f;

public class SoundController {

   private static SoundController instance = null;

   private SoundSystem soundSystem;
   private String currentBgSound = "";
   
   private SoundController(){
      
   }
   
   private void initialize(){
      Class libraryType;
      
      if (SoundSystem.libraryCompatible(LibraryJavaSound.class))
         libraryType = LibraryJavaSound.class; // Java Sound
      else if (SoundSystem.libraryCompatible(LibraryLWJGLOpenAL.class))
         libraryType = LibraryLWJGLOpenAL.class; // OpenAL
      else
         libraryType = Library.class; // "No Sound, Silent Mode"
      try {
         soundSystem = new SoundSystem(libraryType);
         SoundSystemConfig.setCodec("wav", CodecWav.class);
         SoundSystemConfig.setCodec("ogg", CodecJOgg.class);
      } catch (SoundSystemException sse) {
         // Shouldn

Interesting, I'll try and reproduce this.  BTW, is the call to interruptCommandThread() necessary after the call to stop()?  This should already be done internally by the SoundSystem when you call stop().  For that matter, though, I'm not sure why stop() is necessary in the first place… very strange.