From: Carsten W. <ca...@us...> - 2006-12-07 22:45:13
|
Update of /cvsroot/jake2/jake2/src/jake2/sound/joal In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv28457/src/jake2/sound/joal Modified Files: JOALSoundImpl.java Log Message: update to new joal builds 2006-12-07 ALut.alutExit() Index: JOALSoundImpl.java =================================================================== RCS file: /cvsroot/jake2/jake2/src/jake2/sound/joal/JOALSoundImpl.java,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** JOALSoundImpl.java 29 Nov 2006 15:28:52 -0000 1.20 --- JOALSoundImpl.java 7 Dec 2006 22:45:08 -0000 1.21 *************** *** 3,7 **** * Copyright (C) 2004 * - * $Id$ */ package jake2.sound.joal; --- 3,6 ---- *************** *** 33,37 **** static AL al; static ALC alc; - static ALCcontext currentContext; static EAX eax; --- 32,35 ---- *************** *** 48,100 **** */ public boolean Init() { ! ! try { ! initOpenAL(); ! al = ALFactory.getAL(); ! alc = ALFactory.getALC(); ! checkError(); ! initOpenALExtensions(); ! } catch (ALException e) { ! Com.Printf(e.getMessage() + '\n'); ! return false; ! } catch (Throwable e) { ! Com.Printf(e.toString() + '\n'); ! return false; ! } ! // set the master volume ! s_volume = Cvar.Get("s_volume", "0.7", Defines.CVAR_ARCHIVE); ! ! al.alGenBuffers(buffers.length, buffers, 0); ! int count = Channel.init(al, buffers); ! Com.Printf("... using " + count + " channels\n"); ! al.alDistanceModel(AL.AL_INVERSE_DISTANCE_CLAMPED); ! Cmd.AddCommand("play", new xcommand_t() { ! public void execute() { ! Play(); ! } ! }); ! Cmd.AddCommand("stopsound", new xcommand_t() { ! public void execute() { ! StopAllSounds(); ! } ! }); ! Cmd.AddCommand("soundlist", new xcommand_t() { ! public void execute() { ! SoundList(); ! } ! }); ! Cmd.AddCommand("soundinfo", new xcommand_t() { ! public void execute() { ! SoundInfo_f(); } ! }); ! num_sfx = 0; ! Com.Printf("sound sampling rate: 44100Hz\n"); ! StopAllSounds(); ! Com.Printf("------------------------------------\n"); ! return true; } --- 46,98 ---- */ public boolean Init() { ! ! try { ! ALut.alutInit(); ! al = ALFactory.getAL(); ! alc = ALFactory.getALC(); ! checkError(); ! initOpenALExtensions(); ! } catch (ALException e) { ! Com.Printf(e.getMessage() + '\n'); ! return false; ! } catch (Throwable e) { ! Com.Printf(e.toString() + '\n'); ! return false; } ! // set the master volume ! s_volume = Cvar.Get("s_volume", "0.7", Defines.CVAR_ARCHIVE); ! al.alGenBuffers(buffers.length, buffers, 0); ! int count = Channel.init(al, buffers); ! Com.Printf("... using " + count + " channels\n"); ! al.alDistanceModel(AL.AL_INVERSE_DISTANCE_CLAMPED); ! Cmd.AddCommand("play", new xcommand_t() { ! public void execute() { ! Play(); ! } ! }); ! Cmd.AddCommand("stopsound", new xcommand_t() { ! public void execute() { ! StopAllSounds(); ! } ! }); ! Cmd.AddCommand("soundlist", new xcommand_t() { ! public void execute() { ! SoundList(); ! } ! }); ! Cmd.AddCommand("soundinfo", new xcommand_t() { ! public void execute() { ! SoundInfo_f(); ! } ! }); ! num_sfx = 0; ! Com.Printf("sound sampling rate: 44100Hz\n"); ! ! StopAllSounds(); ! Com.Printf("------------------------------------\n"); ! return true; } *************** *** 105,109 **** Com.Printf("... using EAX2.0\n"); } catch (Throwable e) { ! Com.Printf("... EAX2.0 not found\n"); eax = null; } --- 103,107 ---- Com.Printf("... using EAX2.0\n"); } catch (Throwable e) { ! Com.Printf("... EAX2.0 not initialized\n"); eax = null; } *************** *** 114,150 **** } - void initOpenAL() throws ALException { - alc = ALFactory.getALC(); - String deviceName = null; - ALCcontext context; - ALCdevice device; - device = alc.alcOpenDevice(deviceName); - if (device == null) { - throw new ALException("Error opening default OpenAL device"); - } - context = alc.alcCreateContext(device, null); - if (context == null) { - throw new ALException("Error creating OpenAL context"); - } - alc.alcMakeContextCurrent(context); - if (alc.alcGetError(device) != 0) { - throw new ALException("Error making OpenAL context current"); - } - currentContext = context; - } - - void exitOpenAL() { - alc.alcMakeContextCurrent(null); - // Get the current context. - //ALCcontext curContext = alc.alcGetCurrentContext(); - // Get the device used by that context. - ALCdevice curDevice = alc.alcGetContextsDevice(currentContext); - // Reset the current context to NULL. - // Release the context and the device. - alc.alcDestroyContext(currentContext); - if (!alc.alcCloseDevice(curDevice)) { - System.err.println("DEBUG: Can't close AL device"); - } - } // TODO check the sfx direct buffer size --- 112,115 ---- *************** *** 188,192 **** Channel.shutdown(); al.alDeleteBuffers(buffers.length, buffers, 0); ! exitOpenAL(); Cmd.RemoveCommand("play"); --- 153,157 ---- Channel.shutdown(); al.alDeleteBuffers(buffers.length, buffers, 0); ! ALut.alutExit(); Cmd.RemoveCommand("play"); |