com.palserv.XMidi
Class MX

java.lang.Object
  |
  +--com.palserv.XMidi.MX

public class MX
extends java.lang.Object

Convert a midi file to an XMidi (XML) file.

This class can be used in two ways:

  1. From the command line.
  2. From another java class:
    1. Create an array of Strings which will correspond to the command line arguments.
    2. Pass the array to the constructor:
       MX mx = new MX(args);
       
    3. Invoke the conversion method:
       mx.midiToXMidi();
       
      or invoke one of the "inner" conversion methods:
       Document doc = mx.midiToDoc("blah.mid");
       
      or
       mx.docToXMidi(doc, "blah.xmi");
       

Author:
Peter Arthur Loeb

Constructor Summary
MX(java.lang.String[] args)
          public constructor Takes "command line" arguments.
 
Method Summary
 ByteLen deltaToInt(byte[] b, int offset)
          convert delta time to byte array a delta time is expressed as a byte array, length unknown (4 or less)
 void docToXMidi(org.w3c.dom.Document xDoc, java.lang.String outFile)
          Convert a DOM structure to an XMidi file.
static void main(java.lang.String[] args)
          main routine, executed from command line.
 org.w3c.dom.Document midiToDoc(java.lang.String inFile)
          Convert a MIDI file to a DOM structure.
 void midiToXMidi()
          convert a midi file to an XMidi (XML) file
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MX

public MX(java.lang.String[] args)
public constructor Takes "command line" arguments. see the Util.getCmdLine method for details. Also, see the main package description for details about external parsers.
Parameters:
String[] - args - command line arguments (as in main)
Method Detail

midiToXMidi

public void midiToXMidi()
convert a midi file to an XMidi (XML) file

midiToDoc

public org.w3c.dom.Document midiToDoc(java.lang.String inFile)
Convert a MIDI file to a DOM structure.
Returns:
Document

docToXMidi

public void docToXMidi(org.w3c.dom.Document xDoc,
                       java.lang.String outFile)
Convert a DOM structure to an XMidi file. This ought to be part of the DOM interface, but isn't, so I have to implement it here.
Parameters:
Document - xDoc - the "base" of the DOM structure
String - outFile - the file name of the file to write

main

public static void main(java.lang.String[] args)
main routine, executed from command line. See the Util.getCmdLine method for details of the command line arguments

deltaToInt

public ByteLen deltaToInt(byte[] b,
                          int offset)
convert delta time to byte array a delta time is expressed as a byte array, length unknown (4 or less)