summaryrefslogtreecommitdiff
path: root/os/macosx/openttdmidi.java
diff options
context:
space:
mode:
authorbjarni <bjarni@openttd.org>2005-04-14 20:42:30 +0000
committerbjarni <bjarni@openttd.org>2005-04-14 20:42:30 +0000
commit9bd93a11480e7d972f787cb8c1aa5a3b4f40ca47 (patch)
tree92b685742435caea3a5e7e003dff99a79fc20dca /os/macosx/openttdmidi.java
parentdadec920a0b1b5071065c46302a4e49396e217e9 (diff)
downloadopenttd-9bd93a11480e7d972f787cb8c1aa5a3b4f40ca47.tar.xz
(svn r2198) renamed MacOS to MacOSX where it was written wrong. Made myself MacOSX porter as well as coder
Diffstat (limited to 'os/macosx/openttdmidi.java')
-rw-r--r--os/macosx/openttdmidi.java55
1 files changed, 55 insertions, 0 deletions
diff --git a/os/macosx/openttdmidi.java b/os/macosx/openttdmidi.java
new file mode 100644
index 000000000..fc4e0b5b8
--- /dev/null
+++ b/os/macosx/openttdmidi.java
@@ -0,0 +1,55 @@
+//
+// OpenTTDMidi.java
+// OpenTTDMidi
+//
+// Created by Joshua King on Sun Apr 25 2004.
+// Copyright (c) 2004 __MyCompanyName__. All rights reserved.
+//
+import java.io.*;
+import java.util.*;
+import javax.sound.midi.*;
+
+public class OpenTTDMidi {
+
+ public static void main (String args[]) {
+ // Currently command line is the MIDI file
+ if (args.length == 1) {
+ Sequencer s2 = null;
+
+ try {
+ s2 = MidiSystem.getSequencer();
+ s2.open();
+ } catch (MidiUnavailableException mue) {
+ System.exit(1);
+ }
+
+ Sequence s = null;
+
+ try {
+ s = MidiSystem.getSequence(new File(args[0]));
+ } catch (InvalidMidiDataException imde) {
+ System.exit(2);
+ } catch (IOException ioe) {
+ System.exit(3);
+ }
+
+ try {
+ s2.setSequence(s);
+ s2.setMicrosecondPosition(0);
+ s2.start();
+ for (long l = 0; l < (s.getMicrosecondLength() / 1000000); l++) {
+ try {
+ //System.out.print(".");
+ Thread.currentThread().sleep(1000);
+ } catch (InterruptedException ie) {}
+ }
+ System.out.println();
+ } catch (InvalidMidiDataException imde) {
+ }
+
+ s2.stop();
+ s2.close();
+ System.exit(0);
+ }
+ }
+}