public void AddPatch(Patch p) { patches.Add(p); p.Channel = this; }
public void ReadChunk(string id, long length, DarkInStream s) { if (id.Equals("CLIP")) { Clip c = new Clip(); c.Read(s); AddClip(c); } else if (id.Equals("PTCH")) { Patch p = new Patch(s); AddPatch(p); } }
public void RemovePatch(Patch p) { if (patches.Remove(p)) { p.Channel = null; } }
void patchItem_DropDownItemClicked(object sender, ToolStripItemClickedEventArgs e) { string file = (string)e.ClickedItem.Tag; if (file == null) { return; } DarkInStream s = new DarkInStream(File.OpenRead(file)); s.ReadChunk(delegate(string id, long length, DarkInStream s1) { if (id.Equals("PTCH")) { Patch p = new Patch(s); p.Channel = selectedChannel; foreach (MidiMessage m in p.Get()) { MidiMessage m2 = m; Sequencer.PlayMidiEvent(m2, true); } } }); s.Close(); }