|
|||||||||||||
|
jworms.openal.* Package summary OpenALListener
The listener who is listening to OpenAL soures (OpenALSource). The major property of OpenALListener is it's position.
OpenALSource
The OpenALSource plays the sound (OpenALWave).
OpenALUtils
OpenALUtils is a summary of static functions to initalize and exit OpenAL.
OpenALWave
OpenALWave is used to load .wav files that then can be played by an OpenALSource.
Basic OpenAL tutorial This tutorial shows the use of multiple OpenAL sources to play different sounds simultaneously. After compiling and starting the OpenALTutorial.java you should hear footsteps on the left side and every 2 seconds an explosion. The explosion will move from right to left (in 5 steps) and then jump to the right side again. If you get an exception starting the program please check that "tutorial/...wav" sound files are located in the working directory. Now we are going to explain the most important parts of the program. 1. Initializing OpenAL:
35 OpenALUtils.alInit();
37 // load the sounds
51 OpenALListener.setPos(0, 0, 100);
48 OpenALWave.alGenWaves();
69 // play an explosion every 2 seconds
86 OpenALUtils.alExit();
Download and installation To compile and run the tutorial you need Java Runtime Environment 1.4.2 and the LWJGL binaries for your operating system. By clicking on a download link you agree to the disclaimer and distributing terms of Vermin ExTerminator (see download section)!
Source code: Full source code of OpenALTutorial.java.
|
||||||||||||