Exemplo n.º 1
0
    public void ProcessInput()
    {
        string fileName = fileNameField.GetComponent<InputField> ().text;
        int BPM = System.Int32.Parse(BPMfield.GetComponent<InputField> ().text);

        if (BPM <= 0) {
            outputField.GetComponent<Text>().text = "BPM error";
        } else if (fileName.EndsWith (".mid")) {
            fileName = "/Resources/" + fileName;
            if (File.Exists (Application.dataPath + fileName)) {
                MIDIEventParser midiEventParser = new MIDIEventParser (BPM);
                midiEventParser.ParseMIDIFile (fileName, false);
                outputField.GetComponent<Text>().text = "MIDI file processed";
            } else {
                outputField.GetComponent<Text>().text = "There's no file by this name in the resources folder";
            }

            fileName = fileName.Remove (fileName.IndexOf (".mid"));

            if (File.Exists(Application.dataPath + fileName + "_Camera.mid")) {
                MIDIEventParser midiEventParser = new MIDIEventParser (BPM);
                midiEventParser.ParseMIDIFile (fileName + "_Camera.mid", false);
            }

            if (File.Exists(Application.dataPath + fileName + "_Acts.mid")) {
                MIDIEventParser midiEventParser = new MIDIEventParser (BPM);
                midiEventParser.ParseMIDIFile (fileName + "_Acts.mid", false);
            }

            if (File.Exists(Application.dataPath + fileName + "_Blocker.mid")) {
                MIDIEventParser midiEventParser = new MIDIEventParser (BPM);
                midiEventParser.ParseMIDIFile (fileName + "_Blocker.mid", false);
            }
        } else {
            outputField.GetComponent<Text>().text = "Not a MIDI file name";
        }
    }
Exemplo n.º 2
0
 // Use this for initialization
 void Start()
 {
     MIDIEventParser midiEventParser = new MIDIEventParser ();
     midiEventParser.ParseMIDIFile (filePath, true);
 }