MCPcopy Create free account
hub / github.com/demoth/jake2 / S

Class S

client/src/main/java/jake2/client/sound/S.java:39–237  ·  view source on GitHub ↗

S

Source from the content-addressed store, hash-verified

37 * S
38 */
39public class S {
40
41 static Sound impl;
42 static cvar_t s_impl;
43
44 static Vector drivers = new Vector(3);
45
46 /**
47 * Searches for and initializes all known sound drivers.
48 */
49 static {
50 // dummy driver (no sound)
51 try {
52 Class.forName("jake2.client.sound.DummyDriver");
53 // initialize impl with the default value
54 // this is necessary for dedicated mode
55 useDriver("dummy");
56 } catch (Throwable e) {
57 Com.DPrintf("could not init dummy sound driver class.");
58 }
59
60 try {
61 Class.forName("org.lwjgl.openal.AL");
62 Class.forName("jake2.client.sound.lwjgl.LWJGLSoundImpl");
63 } catch (Throwable e) {
64 // ignore the lwjgl driver if runtime not in classpath
65 Com.DPrintf("could not init lwjgl sound driver class.");
66 }
67
68 // prefered driver
69 try {
70 Class.forName("com.jogamp.openal.AL");
71 Class.forName("jake2.client.sound.joal.JOALSoundImpl");
72 } catch (Throwable e) {
73 // ignore the joal driver if runtime not in classpath
74 Com.DPrintf("could not init joal sound driver class.");
75 }
76
77 };
78
79 /**
80 * Registers a new Sound Implementor.
81 */
82 public static void register(Sound driver) {
83 if (driver == null) {
84 throw new IllegalArgumentException("Sound implementation can't be null");
85 }
86 if (!drivers.contains(driver)) {
87 drivers.add(driver);
88 }
89 }
90
91 /**
92 * Switches to the specific sound driver.
93 */
94 public static void useDriver(String driverName) {
95 Sound driver = null;
96 int count = drivers.size();

Callers

nothing calls this directly

Calls 2

useDriverMethod · 0.95
DPrintfMethod · 0.95

Tested by

no test coverage detected