The SoundLoader cleanup is now complete. Now you load sounds this way:
SceneGraph sg = new Xith3DEnvironment( ... );
sg.setSoundDriver( new org.xith3d.sound.drivers.joal.SoundDriverImpl() );
SoundContainer sc = SoundLoader.getInstance().loadSound( resLoc.getResource( "sounds/jog_on_grass.ogg" ) );
PointSound pointSound = new PointSound( sc, 1.0f );
You don't necessarily need to set a SoundDriver, if Java Sound is sufficient (no spacial sound). JOAL supports spatial sound, which will be needed in most games.
SoundLoader.getInstance() returns the singleton instance of ExtensionSoundLoader, which will utilize the singleton instances of OggLoader, WaveLoader or MidiLoader depending on the resource's extension. If you want to load explicitly from an InputStream, then you have to directly use the appropriate loader implementation, since it cannot be determined from the InputStream.
While the OggSoundContainer and WaveSoundContainer can be reused for an arbitrary number of PointSound objects, MidiSound cannot. Simply attach MidiSound to exactly one BackgroundSound instance.
The soundLoaders are fully integrated into the ResourceLoader system. So you can load your SoundContainers the following way:
ResourceLoader resLoader = new ResourceLoader( ResourceLocator.create( ... ) );
resLoader.addRequest( new SoundRequest( "bla/blub.ogg", "MY_BLA_SOUND" ) );
ResourceBag resBag = resLoader.loadResources( myLoadingScreenUpdater );
...
SoundContainer sc = resBag.getSound( "MY_BLA_SOUND" );
PointSound pointSound = new PointSound( sc );
A shortcut for ResourceBag handling is this:
ResourceBag.setSingletonInstance( resBag );
...
// now you can utilize the static methods of "ResBag" to access the singleton instance of ResourceBag.
SoundContainer sc = ResBag.getSound( "MY_BLA_SOUND" );
This can also be seen in DigiBots source, though not for Sounds, but for Textures and Models, but it works absolutely the same way.
Marvin