Exemplo n.º 1
0
        public static void Load(string path)
        {
            DarkInStream dis = new DarkInStream(File.OpenRead(path));
            Song = new Song();
            dis.ReadChunk(delegate(string id, long length, DarkInStream s)
            {
                if (id.Equals("VSEQ"))
                {
                    s.Read(out FramesPerTick);

                    s.ReadChunk(delegate(string id2, long length2, DarkInStream s2)
                    {
                        if (id2.Equals("SONG"))
                        {
                            s2.ReadAllChunks(Song);
                        }
                    });
                }
            });
            dis.Close();

            foreach (Channel c in Song.Channels)
            {
                foreach (MidiMessage m in c.Patches[0].Get())
                {
                    PlayMidiEvent(m, false);
                }
            }
        }
Exemplo n.º 2
0
 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();
 }