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

Method Init

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

Initializes the sound module.

()

Source from the content-addressed store, hash-verified

109 * Initializes the sound module.
110 */
111 public static void Init() {
112
113 Com.Printf("\n------- sound initialization -------\n");
114
115 cvar_t cv = Cvar.getInstance().Get("s_initsound", "1", 0);
116 if (cv.value == 0.0f) {
117 Com.Printf("not initializing.\n");
118 useDriver("dummy");
119 return;
120 }
121
122 // set the last registered driver as default
123 String defaultDriver = "dummy";
124 if (drivers.size() > 1){
125 defaultDriver = ((Sound)drivers.lastElement()).getName();
126 }
127
128 s_impl = Cvar.getInstance().Get("s_impl", defaultDriver, Defines.CVAR_ARCHIVE);
129 useDriver(s_impl.string);
130
131 if (impl.Init()) {
132 // driver ok
133 Cvar.getInstance().Set("s_impl", impl.getName());
134 } else {
135 // fallback
136 useDriver("dummy");
137 }
138
139 Com.Printf("\n------- use sound driver \"" + impl.getName() + "\" -------\n");
140 StopAllSounds();
141 }
142
143 public static void Shutdown() {
144 impl.Shutdown();

Callers 2

CLClass · 0.95
InitMethod · 0.95

Calls 9

PrintfMethod · 0.95
getInstanceMethod · 0.95
useDriverMethod · 0.95
StopAllSoundsMethod · 0.95
GetMethod · 0.80
sizeMethod · 0.80
SetMethod · 0.80
getNameMethod · 0.65
InitMethod · 0.65

Tested by

no test coverage detected