From a6abfd2da66bb04739dcddf13d9dc382c1d1b831 Mon Sep 17 00:00:00 2001
From: athomas
Maurais
Hope you found the last tutorial of some use. I know I did. This will be a +
Hope you found the last tutorial of some use. I know I did. This will be a real quick and easy tutorial. It won't get too much more complicated at this point.
@@ -58,8 +58,9 @@ point. static float[] listenerOri = { 0.0f, 0.0f, -1.0f, 0.0f, 1.0f, 0.0f }; static AL al; static ALC alc;-
There is only one change in the code since the last tutorial in this fist -section. It is that we altered the sources velocity. It's 'z' field is now 0.1.
+There is only one change in the code since the last tutorial + in this fist section. It is that we altered the sources velocity. It's 'z' field + is now 0.1.
static int loadALData() { if (al.alGetError() != AL.AL_NO_ERROR) { @@ -99,10 +100,11 @@ section. It is that we altered the sources velocity. It's 'z' field is now 0.1.< } return AL.AL_TRUE; }-
Two changes in this section. First we are loading the file "Footsteps.wav". - We are also explicitly setting the sources 'AL_LOOPING' value to 'AL_TRUE'. - What this means is that when the source is prompted to play it will continue - to play until stopped. It will play over again after the sound clip has ended.
+Two changes in this section. First we are loading the file + "Footsteps.wav". We are also explicitly setting the sources 'AL_LOOPING' + value to 'AL_TRUE'. What this means is that when the source is prompted to play + it will continue to play until stopped. It will play over again after the sound + clip has ended.
static void setListenerValues() {
al.alListenerfv(AL.AL_POSITION, listenerPos);
@@ -149,12 +151,13 @@ section. It is that we altered the sources velocity. It's 'z' field is now 0.1.<
ALut.alutExit();
}
}
-The only thing that has changed in this code is the loop. Instead of playing -and stopping the audio sample it will slowly get quieter as the sources position -grows more distant. We do this by slowly incrementing the position by it's -velocity over time. The time is sampled by checking the system clock which gives -us a tick count. It shouldn't be necessary to change this, but if the audio clip -fades too fast you might want to change 100 to some higher number.
+The only thing that has changed in this code is the loop. Instead + of playing and stopping the audio sample it will slowly get quieter as the sources + position grows more distant. We do this by slowly incrementing the position + by it's velocity over time. The time is sampled by checking the system clock + which gives us a tick count. It shouldn't be necessary to change this, but if + the audio clip fades too fast you might want to change 100 to some higher number. +
Download the Java Source and Ant Build file.