diff MidiPlayer.java @ 4:5080b65e6963

Close MIDI sequencer and synthesizer properly and allow user to pass MIDI file directory as a command line argument Ignore-this: dbf86cc9008fba00379b67dd541adb38
author Marcus Pearce <m.pearce@gold.ac.uk>
date Thu, 18 Nov 2010 11:47:32 +0000
parents 93ed757b9871
children 15f3b6d84c81
line wrap: on
line diff
--- a/MidiPlayer.java	Mon Jun 21 17:37:24 2010 +0100
+++ b/MidiPlayer.java	Thu Nov 18 11:47:32 2010 +0000
@@ -2,7 +2,7 @@
  * File:       MidiPlayer.java
  * Author:     Marcus Pearce <m.pearce@gold.ac.uk>
  * Created:    <2007-02-14 12:13:56 marcusp>
- * Time-stamp: <2010-06-08 16:12:05 marcusp>
+ * Time-stamp: <2010-11-18 11:01:56 marcusp>
  *=============================================================================
  */
 
@@ -300,6 +300,13 @@
     } 
 
     public void stop() { 
-        sequencer.close(); 
-    } 
+        if (synthesizer != null) {
+            synthesizer.close();
+        }
+        if (sequencer != null) {
+            sequencer.close();
+        }
+        sequencer = null;
+        synthesizer = null;
+    }
 }