public void setMidiData(MidiEventCollection m, MidiSelection e) { // Get a temporary filename for the MIDI file. // We do this because we don't want to save to the // user's folders unless they request it. String temp = getTemporaryMidiFileName(); if (e == MidiSelection.HARMONY_ONLY) { // Store the incoming MIDI data, but strip out // track 0 m.RemoveTrack(0); midiData[(int)e] = m; } else { // Store the incoming MIDI data midiData[(int)e] = m; } // Export the temp copy... // NOTE: this is how we save MIDI files... m.PrepareForExport(); MidiFile.Export(temp, m); // And update the filename so we remember where the // MIDI temp file is... fileNames[(int)e] = temp; return; }
public BitHoven() { InitializeComponent(); m_midiControl = new MidiControl(); selIndex = MidiSelection.SOURCE; Harmonizer h = new Harmonizer(); System.Console.WriteLine(h.testAngle()); }
public bool play(MidiSelection e) { if (m_mediaPlayer != null) { // Setup and load the file into the media player m_mediaPlayer.FileName = fileNames[(int)e]; m_mediaPlayer.Open(fileNames[(int)e]); // Play it m_mediaPlayer.Play(); } return(true); }
public bool save(MidiSelection e) { SaveFileDialog sfd = new SaveFileDialog(); sfd.InitialDirectory = Convert.ToString(Environment.SpecialFolder.MyDocuments); sfd.Filter = "MIDI Files|*.mid"; sfd.FilterIndex = 1; if (sfd.ShowDialog() == DialogResult.OK) { File.Copy(fileNames[(int)e], sfd.FileName, true); } return(true); }
public bool open(MidiSelection e, string fileName) { // Should we verify if something is already open? // Load the midi file. MidiFile m = new MidiFile(fileName, true); if (m != null) { // Set the filename and Midi slots... midiData[(int)e] = m.Events; fileNames[(int)e] = fileName; return(true); } return(false); }
public MidiEventCollection getMidiData(MidiSelection e) { // Return the MidiEventCollection at position e return(midiData[(int)e]); }
private void selHarmony_CheckedChanged(object sender, EventArgs e) { selIndex = MidiSelection.HARMONY_ONLY; }
private void selFull_CheckedChanged(object sender, EventArgs e) { selIndex = MidiSelection.RESULT; }
private void selOriginal_CheckedChanged(object sender, EventArgs e) { selIndex = MidiSelection.SOURCE; }