New version of SoundManager is out today.JAR:http://www.paulscode.com/libs/SoundSystem/11MAR2008/SoundManager.jarSource:http://www.paulscode.com/source/SoundSystem/11MAR2008/SoundManagerSource.zip
Here's what's new about this version:1)
SoundManager now supports attenuation (how a sound "fades" with distance). Available types:
No Attenuation: The sound will play at constant volume regardless of distance
Linear Attenuation: lets you specify a distance at which a sound volume
will become completely silent.
(works for both mono and stereo sounds!)
Logrithmic Attenuation (or Rolloff): More realistic - uses a rolloff factor
Smaller values for rolloff fade at
longer distances. If rolloff is 0,
then the sound will not fade.
(only works for mono sounds)
There are also a few varriables you can change to redefine the default attenuation settings. Or you can just leave them alone and let SoundManager use the default settings:
You can now create multiple sources from the same sound file. The method for creating a source is "newSource". It is no longer necessary to call the "load" method. SoundManager will automatically call "load" before creating a source if the sound file hasn't been loaded yet. There are several ways to call "newSource", depending on how much information you want to supply. SoundManager will use default values for any value you don't specify when creating your source.
The least amount of information required to create a source is: newSource( sourcename, filename, toLoop );
sourcename: A unique identifier for this source
(two sources may not use the same sourcename)
filename: The name of the sound file to play at this source
(if the sound file has not been loaded yet,
then SoundManager will load it for you)
toLoop: Should this source loop, or play the sound only once
Optional information you can specify when creating a new source: newSource( sourcename, filename, toLoop, x, y, z, attmodel, distORroll );
(x, y, z): Location in 3D space for this source.
Default location is the origin ( 0, 0, 0 )
attmodel: Attenuation model to use. Possible values are
distORroll: Either the fading distance or rolloff factor,
depending on the value of "attmodel".3)
.ogg files are supported. They can be either streamed or played normally. There are some varriables you can change to redefine how streaming is handled. Or you can just leave them alone and let SoundManager use the default settings:
(size of each data "block")
(number of buffers to use when streaming)4)
There is also a method called "newStreamingSource". A streaming source differs from a normal source, in that it has multiple, dynamic buffers. Use newStreamingSource to create a source that will be streaming a sound. newStreamingSource takes the same parameters as newSource.
To have support for .ogg files, the above jar is compiled with the source code from the j-ogg library, located at http://www.j-ogg.de
. If you want to alter the SoundManager class, you will need need to include that library before you will be able to compile. The source files for the j-ogg library are also inside the zip file refrenced above.