Ejemplo n.º 1
0
 public void ReadChunk(string id, long length, DarkInStream stream)
 {
     handler(id, length, stream);
 }
Ejemplo n.º 2
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);
                }
            }
        }
Ejemplo n.º 3
0
 public void ReadChunk(string id, long length, DarkInStream s)
 {
     if (id.Equals("CHAN"))
     {
         int index;
         s.Read(out index);
         Channels[index] = new Channel(index);
         s.ReadAllChunks(Channels[index]);
     }
 }
Ejemplo n.º 4
0
 public NoteEvent(DarkInStream s)
 {
     s.Read(out StartTime);
     s.Read(out Note);
     s.Read(out Velocity);
     s.Read(out Length);
 }
Ejemplo n.º 5
0
 public Patch(DarkInStream s)
     : this()
 {
     s.Read(out Time);
     s.ReadByteArray(controllers);
 }
Ejemplo n.º 6
0
 public Event(DarkInStream s)
 {
     s.Read(out Time);
     Message = new MidiMessage(s.ReadUInt());
 }
Ejemplo n.º 7
0
        public void ReadChunk(string id, long length, DarkInStream s)
        {
            if (id.Equals("NOTE"))
            {
                int numNoteEvents = s.ReadInt();
                for (int i = 0; i < numNoteEvents; i++)
                {
                    NoteEvents.Add(new NoteEvent(s));
                }
            }

            if (id.Equals("CTRL"))
            {
                int numControllerEvents = s.ReadInt();
                for (int i = 0; i < numControllerEvents; i++)
                {
                    ControllerEvents.Add(new Event(s));
                }
            }
        }
Ejemplo n.º 8
0
 public void Read(DarkInStream s)
 {
     s.Read(out StartTime);
     s.Read(out Length);
     s.ReadAllChunks(this);
 }
Ejemplo n.º 9
0
 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);
     }
 }
Ejemplo n.º 10
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();
 }