changeset 32:01926bcd6016

Add debug command line option
author Jeremy Gow <jeremy.gow@gmail.com>
date Tue, 13 Nov 2012 18:00:31 +0000
parents ec628e1d70d1
children b083ddc5c546
files Experiment.class Experiment.java
diffstat 2 files changed, 9 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
Binary file Experiment.class has changed
--- a/Experiment.java	Tue Nov 13 17:36:19 2012 +0000
+++ b/Experiment.java	Tue Nov 13 18:00:31 2012 +0000
@@ -73,7 +73,7 @@
     private int midiDevice;
 
     /* debugging */ 
-    private boolean debug = false;
+    private boolean debug;
 
     /* accessors */ 
     public boolean getDebug() { return debug; }
@@ -104,12 +104,10 @@
     }
 
     /* Constructor */ 
-    public Experiment (int sc, int cu, int nu, int sl, int md, String la, String ha, String mfd, String inf, String rdr, int fam, int lik, int quest) { 
+    public Experiment (int sc, int cu, int nu, int sl, int md, String la, String ha, String mfd, String inf, String rdr, int fam, int lik, int quest, int de) { 
         
-	if (debug)
-	    displayMIDIDevices();
-
         // Setup variables 
+	debug = (de != 0);
         results = new SubjectResults(this); 
         if (sc == 0) 
             showClock = false;
@@ -142,6 +140,9 @@
         else 
             finalQuestionnaire = true; 
 
+	if (debug)
+	    displayMIDIDevices();
+
         // Initialise the experiment 
         Block practice = new Block(this, gui, PRACTICE_MIDIFILELIST_FILE, 
                                    "Practice", false); 
@@ -197,7 +198,7 @@
                                "<midi device> " + 
                                "<scale length> <low anchor> <high anchor> " +
                                "<midi file directory> <instructions file> <results directory>" + 
-                               "<familiarity>" + "<pleasantness>" + "<questionnaire>");
+                               "<familiarity>" + "<pleasantness>" + "<questionnaire>" + "<debug>");
             System.exit(1);
         }
         
@@ -216,9 +217,10 @@
         int fam = Integer.parseInt(args[n++]);
         int lik = Integer.parseInt(args[n++]);
         int quest = Integer.parseInt(args[n++]);
+        int de = Integer.parseInt(args[n++]);
 
         // Create experiment 
-        Experiment exp = new Experiment(sc, cu, nu, sl, md, la, ha, mfd, inf, rdr, fam, lik, quest);
+        Experiment exp = new Experiment(sc, cu, nu, sl, md, la, ha, mfd, inf, rdr, fam, lik, quest, de);
         
         // Show the GUI 
         int width=(int)Toolkit.getDefaultToolkit().getScreenSize().getWidth();