changeset 4:f6cffd6abce3

copies the generated jar to the correct lib folder.
author luisf <luis.figueira@eecs.qmul.ac.uk>
date Wed, 27 Nov 2013 17:24:31 +0000
parents 747ae11a8af8
children ac4aa1922f32
files build.xml webapp/WEB-INF/src/TestEchoClass.java
diffstat 2 files changed, 35 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- a/build.xml	Wed Nov 27 17:07:39 2013 +0000
+++ b/build.xml	Wed Nov 27 17:24:31 2013 +0000
@@ -4,24 +4,29 @@
     </description>
 
   <!-- set global properties for this build -->
-  <property name="matlab_src" location="webapp/WEB-INF/mcode/"/>
-  <property name="build" location="scratch"/>
+  <property name="matlab-src" location="webapp/WEB-INF/mcode"/>
+  <property name="matlab-build" location="scratch"/>
+  <property name="lib" location="webapp/WEB-INF/lib"/>
   <property name="dist"  location="dist"/>
 
   <target name="init">
     <!-- Create the time stamp -->
     <tstamp/>
     <!-- Create the build directory structure used by compile -->
-    <mkdir dir="${build}"/>
+    <mkdir dir="${matlab-build}"/>
   </target>
 
-
   <target name="compile-matlab" depends="init"
     description="compile the MATLAB source" >
+
     <exec executable="/Applications/MATLAB_R2013b.app/bin/mcc">
       <!-- Will create the java package with the HumanEcho class -->
-      <arg line='-W "java:uk.ac.soton.isvr,HumanEcho" -d ${build} -T "link:lib" -v "class{HumanEcho:./webapp/WEB-INF/mcode/simulateBinauralSignals.m}"'/>
+      <arg line='-W "java:uk.ac.soton.isvr,HumanEcho" -d ${matlab-build} -T "link:lib" -v "class{HumanEcho:${matlab-src}/simulateBinauralSignals.m}"'/>
     </exec>
+
+    <!-- Copy the generated jar to the lib folder -->
+    <copy file="${matlab-build}/isvr.jar" tofile="${lib}/isvr.jar" overwrite="true" />
+
   </target>
 
   <target name="dist" depends="compile-matlab"
--- a/webapp/WEB-INF/src/TestEchoClass.java	Wed Nov 27 17:07:39 2013 +0000
+++ b/webapp/WEB-INF/src/TestEchoClass.java	Wed Nov 27 17:24:31 2013 +0000
@@ -1,32 +1,46 @@
 import com.mathworks.toolbox.javabuilder.MWJavaObjectRef;
 import com.mathworks.toolbox.javabuilder.MWNumericArray;
+import com.mathworks.toolbox.javabuilder.MWStructArray;
 import com.mathworks.toolbox.javabuilder.MWException;
 
 import uk.ac.soton.isvr.*;
 
 public class TestEchoClass {
-
     int test = 4;
-
-   double[][] square = new double[0][];
-
+    double[][] square = new double[0][];
 
     public static void main(String[] args) {
         System.out.println("YOOOOOO, Bs");
 
+        //Instantiate Objects to null
+        MWStructArray Input = null;
+
         HumanEcho echo;
 
+
         try {
             echo = new HumanEcho();
-             Object[] result = echo.gen_echo(1);
 
-             MWNumericArray array = (MWNumericArray)result[0];
-             //square = (double[][])array.toArray();
+            // Matlab function:
+            // a = struct('dist', 0.9, 'azim', 0, 'orient', 'horz', 'dirweight', 0.2)
 
-         }
-         catch(MWException e) {
-             e.printStackTrace();
-          }
+            // package input into MW Structure Array
+            String[] InputStructFields = {"dist", "azim", "orient", "dirweight"};
+            Input = new MWStructArray(1, 1, InputStructFields);
+            Input.set("dist", 1, 0.9);
+            Input.set("azim", 1, "azim");
+            Input.set("orient", 1, "horz");
+            Input.set("dirweight", 1, 0.2);
+
+            Object[] result = echo.simulateBinauralSignals(Input);
+
+            MWNumericArray array = (MWNumericArray)result[0];
+            //square = (double[][])array.toArray();
+
+        }
+        catch(MWException e) {
+            e.printStackTrace();
+        }
 
     }