Mercurial > hg > human-echolocation-java-webapp
comparison src/HumanEchoServlet.java @ 38:91ecbdda6f4a
Adding the remaining parameters to the form;
author | luisf <luis.figueira@eecs.qmul.ac.uk> |
---|---|
date | Thu, 12 Dec 2013 16:39:26 +0000 |
parents | 0c66cff0d1cc |
children | 65a26b38bf43 |
comparison
equal
deleted
inserted
replaced
37:7d2163eeacc3 | 38:91ecbdda6f4a |
---|---|
69 | 69 |
70 protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { | 70 protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { |
71 | 71 |
72 // todo: validate/normalise distance | 72 // todo: validate/normalise distance |
73 int dist = Integer.parseInt(request.getParameter("dist")); | 73 int dist = Integer.parseInt(request.getParameter("dist")); |
74 | |
75 logger.info("String azim is: " + request.getParameter("azim")); | |
76 Float azim = Float.parseFloat(request.getParameter("azim")); | |
77 | |
78 | |
79 | |
80 | |
74 MWStructArray Input = null; | 81 MWStructArray Input = null; |
75 HumanEcho echo; | 82 HumanEcho echo; |
76 | 83 |
77 String outputfname = new String(); | 84 String outputfname = new String(); |
78 | 85 |
87 // Input = struct('dist', 0.9, 'azim', 0, 'orient', 'horz', 'dirweight', 0.2, 'outputfname', 'foo.wav') | 94 // Input = struct('dist', 0.9, 'azim', 0, 'orient', 'horz', 'dirweight', 0.2, 'outputfname', 'foo.wav') |
88 | 95 |
89 String[] InputStructFields = {"dist", "azim", "orient", "dirweight", "outputfname"}; | 96 String[] InputStructFields = {"dist", "azim", "orient", "dirweight", "outputfname"}; |
90 Input = new MWStructArray(1, 1, InputStructFields); | 97 Input = new MWStructArray(1, 1, InputStructFields); |
91 Input.set("dist", 1, Double.valueOf(dist)); | 98 Input.set("dist", 1, Double.valueOf(dist)); |
92 Input.set("azim", 1, Double.valueOf(0)); | 99 Input.set("azim", 1, Double.valueOf(azim)); |
93 Input.set("orient", 1, "horz"); | 100 Input.set("orient", 1, "horz"); |
94 Input.set("dirweight", 1, Double.valueOf(0.2)); | 101 Input.set("dirweight", 1, Double.valueOf(0.2)); |
95 | 102 |
96 // the ofname should depend on the parameters | 103 // the ofname should depend on the parameters |
97 StringBuilder sb = new StringBuilder(); | 104 StringBuilder sb = new StringBuilder(); |
98 sb.append("e_d"); | 105 sb.append("e_d"); |
99 sb.append(dist); | 106 sb.append(dist); |
107 sb.append("_a"); | |
108 sb.append(azim); | |
100 sb.append(".wav"); | 109 sb.append(".wav"); |
101 outputfname = sb.toString(); | 110 outputfname = sb.toString(); |
102 | 111 |
103 Input.set("outputfname", 1, outputfname); | 112 Input.set("outputfname", 1, outputfname); |
104 | 113 |