changeset 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 7d2163eeacc3
children b31c64b316c5
files WebContent/index.jsp src/HumanEchoServlet.java
diffstat 2 files changed, 33 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/WebContent/index.jsp	Thu Dec 12 16:38:57 2013 +0000
+++ b/WebContent/index.jsp	Thu Dec 12 16:39:26 2013 +0000
@@ -6,6 +6,7 @@
         <link rel="Stylesheet" type="text/css" media=all href="./StyleSheet.css" />
         <link href="StyleSheet.css" rel="stylesheet" type="text/css" />
 
+        <!-- no default value for distance -->
         <c:choose>
             <c:when test="${not empty param.dist}">
                 <c:set var="dist" value="${param.dist}" />
@@ -16,9 +17,20 @@
             </c:otherwise>
         </c:choose>
 
-        <c:set var="azim" value="${param.azim}" />
-        <c:set var="dirweight" value="${param.dirweight}" />
-        <c:set var="orient" value="${param.orient}" />
+        <!-- Default values for remaining parameters -->
+        <c:set var="azim" value="0" />
+        <c:set var="dirweight" value="0.2" />
+        <c:set var="orient" value="horz" />
+
+        <c:if test="${not empty param.azim}">
+            <c:set var="azim" value="${param.azim}" />
+        </c:if>
+        <c:if test="${not empty param.dirweight}">
+            <c:set var="dirweight" value="${param.dirweight}" />
+        </c:if>
+        <c:if test="${not empty param.orient}">
+            <c:set var="orient" value="${param.orient}" />
+        </c:if>
 
     </head>
 
@@ -37,16 +49,16 @@
                 Input parameters:
                 <br />
                 Distance (typical value: 0.9):
-                <input type="text" name="dist" size="8">
+                <input type="text" name="dist" size="8" value="${dist}">
                 <br />
                 Azimuth (-17 to +17):
-                <input type="text" name="azim" size="8">
+                <input type="text" name="azim" size="8" value="${azim}" >
                 <br />
                 Orientation (angled / horiz):
-                <input type="text" name="orient" size="8">
+                <input type="text" name="orient" size="8" value="${orient}">
                 <br />
                 Dirweight (angled / horiz):
-                <input type="text" name="dirweight" size="8">
+                <input type="text" name="dirweight" size="8" value="${dirweight}">
                 <br />
                 <p class="description">Controls how easy it is to distinguish whether the reflector is to the left or the right (the lower .dirweight is, the easier).</p>
 
@@ -64,9 +76,11 @@
                     <p class="debug">
                         Generating echo with the following parameters:
                         <br/>Distance <c:out value="${dist}"/>
-                        <br/>Distset <c:out value="${distSet}"/>
+                        <br/>Azim <c:out value="${azim}"/>
+                        <br/>Dirweight <c:out value="${dirweight}"/>
+                        <br/>Orient <c:out value="${orient}"/>
                     </p>
-                    <embed src="/echoapp/HumanEcho?dist=<c:out value="${dist}"/>" type="audio/x-wav"/>
+                    <embed src="/echoapp/HumanEcho?dist=<c:out value="${dist}"/>&amp;azim=<c:out value="${azim}"/>&amp;dirweight=<c:out value="${dirweight}"/>&amp;orient=<c:out value="${orient}"/>" type="audio/x-wav"/>
                 </c:when>
                 <c:otherwise>
                     <c:out value="Cowardly refusing to generate a player without distance parameter..."/>
--- a/src/HumanEchoServlet.java	Thu Dec 12 16:38:57 2013 +0000
+++ b/src/HumanEchoServlet.java	Thu Dec 12 16:39:26 2013 +0000
@@ -71,6 +71,13 @@
 
         // todo: validate/normalise distance
         int dist = Integer.parseInt(request.getParameter("dist"));
+
+        logger.info("String azim is: " + request.getParameter("azim"));
+        Float azim = Float.parseFloat(request.getParameter("azim"));
+
+
+
+
         MWStructArray Input = null;
         HumanEcho echo;
 
@@ -89,7 +96,7 @@
             String[] InputStructFields = {"dist", "azim", "orient", "dirweight", "outputfname"};
             Input = new MWStructArray(1, 1, InputStructFields);
             Input.set("dist", 1, Double.valueOf(dist));
-            Input.set("azim", 1, Double.valueOf(0));
+            Input.set("azim", 1, Double.valueOf(azim));
             Input.set("orient", 1, "horz");
             Input.set("dirweight", 1, Double.valueOf(0.2));
 
@@ -97,6 +104,8 @@
             StringBuilder sb = new StringBuilder();
             sb.append("e_d");
             sb.append(dist);
+            sb.append("_a");
+            sb.append(azim);
             sb.append(".wav");
             outputfname = sb.toString();