MCPcopy Create free account
hub / github.com/OpenEndedGroup/Field2 / Spatialization

Class Spatialization

src/main/java/trace/sound/Spatialization.kt:11–55  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

9
10class Spatialization
11{
12 val BOOT = "/boot"
13
14 var s: Server
15
16 var id = 0;
17
18 var hostname: String
19
20 init {
21 this.s = Server(8092, 8093)
22
23 s.addDocumentRoot(fieldagent.Main.app + "/modules/fieldbox/resources/")
24 s.addDocumentRoot(fieldagent.Main.app + "/modules/fielded/resources/")
25 s.addDocumentRoot(fieldagent.Main.app + "/modules/fieldcore/resources/")
26 s.addDocumentRoot(fieldagent.Main.app + "/lib/web/")
27 s.addDocumentRoot(fieldagent.Main.app + "/win/lib/web/")
28
29 s.addDocumentRoot(fieldagent.Main.app + "/win/lib/web/")
30
31 val addr = InetAddress.getLocalHost().address
32 val addrs = "${addr[0].toInt() and 255}.${addr[1].toInt() and 255}.${addr[2].toInt()and 255}.${addr[3].toInt()and 255}"
33 hostname = "http://"+addrs+":8090/boot"
34
35 s.addURIHandler { uri, method, headers, params, files ->
36 if (uri.startsWith(BOOT)) {
37
38 println(" booting up... ")
39
40 var text = Files.toString(File(Main.app + "lib/web/init_remote.html"), Charset.defaultCharset())
41
42 System.out.println(" canonical host name is :"+ InetAddress.getLocalHost().getCanonicalHostName())
43
44
45 text = text.replace("///IP///", addrs) //!!
46 text = text.replace("///ID///", ""+(id++))
47 text = text.replace("///WSPORT///", "8091")
48
49 return@addURIHandler NanoHTTPD.Response(NanoHTTPD.Response.Status.OK, "text/html", text)
50 }
51 null
52 }
53 }
54}

Callers

nothing calls this directly

Calls 8

ServerClass · 0.85
FileFunction · 0.85
addURIHandlerMethod · 0.80
replaceMethod · 0.80
ResponseMethod · 0.80
addDocumentRootMethod · 0.45
toStringMethod · 0.45
printlnMethod · 0.45

Tested by

no test coverage detected