From: Carsten W. <ca...@us...> - 2005-04-27 12:21:58
|
Update of /cvsroot/jake2/jake2/src/jake2/sound/lwjgl In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10584/src/jake2/sound/lwjgl Modified Files: LWJGLSoundImpl.java Channel.java Log Message: change the master volume (listener) only on Update not per source Index: Channel.java =================================================================== RCS file: /cvsroot/jake2/jake2/src/jake2/sound/lwjgl/Channel.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Channel.java 25 Apr 2005 22:50:25 -0000 1.3 --- Channel.java 27 Apr 2005 12:21:24 -0000 1.4 *************** *** 38,42 **** import java.nio.FloatBuffer; import java.nio.IntBuffer; ! import java.util.*; import org.lwjgl.openal.AL10; --- 38,44 ---- import java.nio.FloatBuffer; import java.nio.IntBuffer; ! import java.util.Hashtable; ! import java.util.Iterator; ! import java.util.Map; import org.lwjgl.openal.AL10; *************** *** 97,101 **** private static IntBuffer tmp = Lib.newIntBuffer(1); ! static int init(IntBuffer buffers, float masterVolume) { Channel.buffers = buffers; // create channels --- 99,103 ---- private static IntBuffer tmp = Lib.newIntBuffer(1); ! static int init(IntBuffer buffers) { Channel.buffers = buffers; // create channels *************** *** 115,119 **** // set default values for AL sources ! AL10.alSourcef (sourceId, AL10.AL_GAIN, masterVolume); AL10.alSourcef (sourceId, AL10.AL_PITCH, 1.0f); AL10.alSourcei (sourceId, AL10.AL_SOURCE_ABSOLUTE, AL10.AL_TRUE); --- 117,121 ---- // set default values for AL sources ! AL10.alSourcef (sourceId, AL10.AL_GAIN, 1.0f); AL10.alSourcef (sourceId, AL10.AL_PITCH, 1.0f); AL10.alSourcei (sourceId, AL10.AL_SOURCE_ABSOLUTE, AL10.AL_TRUE); *************** *** 209,214 **** private static FloatBuffer sourceOriginBuffer = Lib.newFloatBuffer(3); ! static void playAllSounds(FloatBuffer listenerOrigin, float masterVolume) { ! float[] entityOrigin = {0, 0, 0}; FloatBuffer sourceOrigin = sourceOriginBuffer; Channel ch; --- 211,218 ---- private static FloatBuffer sourceOriginBuffer = Lib.newFloatBuffer(3); ! //stack variable ! private static float[] entityOrigin = {0, 0, 0}; ! ! static void playAllSounds(FloatBuffer listenerOrigin) { FloatBuffer sourceOrigin = sourceOriginBuffer; Channel ch; *************** *** 239,244 **** AL10.alSourcei(sourceId, AL10.AL_BUFFER, ch.bufferId); } ! // AL10.alSourcef (sourceId, AL10.AL_GAIN, masterVolume * ch.volume); ! AL10.alSourcef (sourceId, AL10.AL_GAIN, masterVolume); AL10.alSourcef (sourceId, AL10.AL_ROLLOFF_FACTOR, ch.rolloff); AL10.nalSourcefv(sourceId, AL10.AL_POSITION, sourceOrigin, 0); --- 243,247 ---- AL10.alSourcei(sourceId, AL10.AL_BUFFER, ch.bufferId); } ! // AL10.alSourcef (sourceId, AL10.AL_GAIN, ch.volume); AL10.alSourcef (sourceId, AL10.AL_ROLLOFF_FACTOR, ch.rolloff); AL10.nalSourcefv(sourceId, AL10.AL_POSITION, sourceOrigin, 0); Index: LWJGLSoundImpl.java =================================================================== RCS file: /cvsroot/jake2/jake2/src/jake2/sound/lwjgl/LWJGLSoundImpl.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** LWJGLSoundImpl.java 26 Apr 2005 22:34:17 -0000 1.6 --- LWJGLSoundImpl.java 27 Apr 2005 12:21:24 -0000 1.7 *************** *** 15,23 **** import jake2.util.Vargs; ! import java.nio.*; import org.lwjgl.LWJGLException; import org.lwjgl.openal.*; ! import org.lwjgl.openal.eax.*; /** --- 15,27 ---- import jake2.util.Vargs; ! import java.nio.ByteBuffer; ! import java.nio.FloatBuffer; ! import java.nio.IntBuffer; import org.lwjgl.LWJGLException; import org.lwjgl.openal.*; ! import org.lwjgl.openal.eax.EAX; ! import org.lwjgl.openal.eax.EAX20; ! import org.lwjgl.openal.eax.EAXListenerProperties; /** *************** *** 61,67 **** } ! AL10.alGenBuffers(buffers); s_volume = Cvar.Get("s_volume", "0.7", Defines.CVAR_ARCHIVE); ! int count = Channel.init(buffers, s_volume.value); Com.Printf("... using " + count + " channels\n"); AL10.alDistanceModel(AL10.AL_INVERSE_DISTANCE_CLAMPED); --- 65,72 ---- } ! // set the listerner (master) volume s_volume = Cvar.Get("s_volume", "0.7", Defines.CVAR_ARCHIVE); ! AL10.alGenBuffers(buffers); ! int count = Channel.init(buffers); Com.Printf("... using " + count + " channels\n"); AL10.alDistanceModel(AL10.AL_INVERSE_DISTANCE_CLAMPED); *************** *** 240,243 **** --- 245,251 ---- AL10.nalListenerfv(AL10.AL_ORIENTATION, listenerOrientation, 0); + // set the master volume + AL10.alListenerf(AL10.AL_GAIN, s_volume.value); + if (hasEAX){ if ((GameBase.gi.pointcontents.pointcontents(origin)& Defines.MASK_WATER)!= 0) { *************** *** 250,254 **** Channel.addLoopSounds(); Channel.addPlaySounds(); ! Channel.playAllSounds(listenerOrigin, s_volume.value); } --- 258,262 ---- Channel.addLoopSounds(); Channel.addPlaySounds(); ! Channel.playAllSounds(listenerOrigin); } *************** *** 267,270 **** --- 275,280 ---- */ public void StopAllSounds() { + // mute the listener (master) + AL10.alListenerf(AL10.AL_GAIN, 0); PlaySound.reset(); Channel.reset(); |