# HG changeset patch # User Marcus Pearce # Date 1276014607 -3600 # Node ID 93ed757b9871a9f60b011baa0c28de775b240f76 # Parent 4031cbb02f08d2db6dfb2db23f50214bc554d7c9 Add midi device as a command line parameter. Ignore-this: a6c745a4b262ed92195abba61880f758 diff -r 4031cbb02f08 -r 93ed757b9871 Block.java --- a/Block.java Tue May 18 11:37:10 2010 +0100 +++ b/Block.java Tue Jun 08 17:30:07 2010 +0100 @@ -2,7 +2,7 @@ * File: Block.java * Author: Marcus Pearce * Created: <2008-01-07 10:38:45 marcusp> - * Time-stamp: <2010-05-17 11:42:23 marcusp> + * Time-stamp: <2010-06-08 16:13:27 marcusp> *============================================================================= */ @@ -82,7 +82,7 @@ /* initialise the block */ public void initialiseBlock() { // Initialise the Midiplayer - mp = new MidiPlayer(exp.getMidiDirectory().concat(filename)); + mp = new MidiPlayer(exp.getMidiDirectory().concat(filename), exp.getMidiDeviceNumber()); // Set up the melody structure and the probe positions setupSong(); setupProbes(); @@ -216,7 +216,7 @@ File outputFile = new File(outFile); MidiPlayer midip = - new MidiPlayer(exp.getMidiDirectory().concat(midiFile)); + new MidiPlayer(exp.getMidiDirectory().concat(midiFile), exp.getMidiDeviceNumber()); // Setup the probes ArrayList probePos = filelist.currentProbes(); diff -r 4031cbb02f08 -r 93ed757b9871 Experiment.java --- a/Experiment.java Tue May 18 11:37:10 2010 +0100 +++ b/Experiment.java Tue Jun 08 17:30:07 2010 +0100 @@ -2,7 +2,7 @@ * File: Experiment.java * Author: Marcus Pearce * Created: <2007-02-14 11:28:27 marcusp> - * Time-stamp: <2010-05-18 11:13:42 marcusp> + * Time-stamp: <2010-06-08 16:18:32 marcusp> *============================================================================= */ @@ -58,7 +58,11 @@ private String lowAnchor; private String highAnchor; + /* the midi device */ + private int midiDevice; + /* accessors */ + public int getMidiDeviceNumber() { return midiDevice; } public int getScaleLength() { return scaleLength; } public String getLowAnchor() { return lowAnchor; } public String getHighAnchor() { return highAnchor; } @@ -79,13 +83,14 @@ } /* Constructor */ - public Experiment (int cu, int nu, int sl, String la, String ha) { + public Experiment (int cu, int nu, int sl, int md, String la, String ha) { // Setup variables results = new SubjectResults(this); clockUnits = cu; numUnits = nu; scaleLength = sl; + midiDevice = md; lowAnchor = la; highAnchor = ha; @@ -133,8 +138,8 @@ public static void main(String[] args) { if (args.length == 0) { System.out.println("Usage: " + "\t" + "java Experiment " + - " " + - " "); + " " + + " "); System.exit(1); } @@ -142,12 +147,13 @@ int n = 0; int cu = Integer.parseInt(args[n++]); int nu = Integer.parseInt(args[n++]); + int md = Integer.parseInt(args[n++]); int sl = Integer.parseInt(args[n++]); String la = args[n++]; String ha = args[n++]; // Create experiment - Experiment exp = new Experiment(cu, nu, sl, la, ha); + Experiment exp = new Experiment(cu, nu, sl, md, la, ha); // Show the GUI int width=(int)Toolkit.getDefaultToolkit().getScreenSize().getWidth(); diff -r 4031cbb02f08 -r 93ed757b9871 MidiPlayer.java --- a/MidiPlayer.java Tue May 18 11:37:10 2010 +0100 +++ b/MidiPlayer.java Tue Jun 08 17:30:07 2010 +0100 @@ -2,7 +2,7 @@ * File: MidiPlayer.java * Author: Marcus Pearce * Created: <2007-02-14 12:13:56 marcusp> - * Time-stamp: <2008-10-20 16:52:05 marcusp> + * Time-stamp: <2010-06-08 16:12:05 marcusp> *============================================================================= */ @@ -48,8 +48,9 @@ public Sequencer getSequencer() { return sequencer; } /* Constructor */ - public MidiPlayer(String path) { + public MidiPlayer(String path, int deviceNumber) { File midiFile = new File(path); + midiDevice = deviceNumber; // Get sequence try { sequence = MidiSystem.getSequence(midiFile); } diff -r 4031cbb02f08 -r 93ed757b9871 README --- a/README Tue May 18 11:37:10 2010 +0100 +++ b/README Tue Jun 08 17:30:07 2010 +0100 @@ -5,14 +5,20 @@ USAGE - java Experiment + java Experiment where and are integers: the clock runs for time units before a probed event where the time unit is a multiple of the -tatum as specified by . is the number of -levels of the rating scale and and are its -high and low anchors respectively (e.g., "highly unexpected", "highly -expected" with a scale length of 7). See runExperiment.bat for an example. +tatum as specified by . + + is an integer specifying the midi device to use (usually 0). + + is the number of levels of the rating scale and and are its high and low anchors respectively +(e.g., "highly unexpected", "highly expected" with a scale length of +7). + +See runExperiment.bat for an example. To use in a study: diff -r 4031cbb02f08 -r 93ed757b9871 runExperiment.bat --- a/runExperiment.bat Tue May 18 11:37:10 2010 +0100 +++ b/runExperiment.bat Tue Jun 08 17:30:07 2010 +0100 @@ -1,1 +1,1 @@ -java Experiment 1 4 7 "Highly unexpected" "Highly expected" +java Experiment 1 4 0 7 "Highly unexpected" "Highly expected"