Exemplo n.º 1
0
 public ListViewItem EventListItem(vMixEvent vmixevent)
 {
     string[] caption = {
                            vmixevent.Title,
                            vmixevent.EventStart.ToString("MM-dd  HH:mm:ss"),
                            vmixevent.EventDuration.ToString(@"hh\:mm\:ss"),
                            vmixevent.EventTypeString()
                        };
     ListViewItem lvi = new ListViewItem(caption);
     return lvi;
 }
Exemplo n.º 2
0
 public void RemoveMicroEvents(vMixEvent evnt)
 {
     LocalListLock.WaitOne();
     for (int n = LocalList.Count - 1; n >= 0; n--)
     {
         if (LocalList[n].with == evnt)
         {
             LocalList.RemoveAt(n);
         }
     }
     LocalListLock.Release();
 }
Exemplo n.º 3
0
 public bool IsLike(vMixEvent other)
 {
     if (EventStart != other.EventStart)
     {
         return(false);
     }
     if (EventPath != other.EventPath)
     {
         return(false);
     }
     return(true);
 }
Exemplo n.º 4
0
        public ListViewItem EventListItem(vMixEvent vmixevent)
        {
            string[] caption =
            {
                vmixevent.Title,
                vmixevent.EventStart.ToString("MM-dd  HH:mm:ss"),
                vmixevent.EventDuration.ToString(@"hh\:mm\:ss"),
                vmixevent.EventTypeString()
            };
            ListViewItem lvi = new ListViewItem(caption);

            return(lvi);
        }
Exemplo n.º 5
0
        public void RevokeMicroEvents(vMixEvent evnt, DateTime when)
        {
            LocalListLock.WaitOne();
            for (int n = LocalList.Count - 1; n >= 0; n--)
            {
                if (LocalList[n].with == evnt)
                {
                    LocalList.RemoveAt(n);
                }
            }

            LocalList.Add(new vMixMicroEvent(when + new TimeSpan(0, 0, MediaLinger), vmMicroEventType.remove, evnt));
            LocalList.Sort(delegate(vMixMicroEvent e1, vMixMicroEvent e2) { return(e1.when.CompareTo(e2.when)); });
            LocalListLock.Release();
        }
Exemplo n.º 6
0
        public bool AddMicroEvents(vMixEvent evnt)
        {
            DateTime now = DateTime.Now;

            if (evnt.EventEnd < now + new TimeSpan(0, 0, MediaPreload + 1))
            {
                return(false);     // too late to add!
            }
            List <vMixMicroEvent> vmes = new List <vMixMicroEvent>();

            // prepare, transition, remove
            if (!evnt.HasDuration)
            {
                vmes.Add(new vMixMicroEvent(evnt.EventStart - new TimeSpan(0, 0, MediaPreload), vmMicroEventType.prepare, evnt));
                if (evnt.EventType == vmEventType.photos)
                {
                    vmes.Add(new vMixMicroEvent(evnt.EventStart - new TimeSpan(0, 0, 2), vmMicroEventType.setup, evnt));
                }
                vmes.Add(new vMixMicroEvent(evnt.EventStart, vmMicroEventType.transition, evnt));
            }
            else if (evnt.EventStart >= now + new TimeSpan(0, 0, MediaPreload))
            {
                vmes.Add(new vMixMicroEvent(evnt.EventStart - new TimeSpan(0, 0, MediaPreload), vmMicroEventType.prepare, evnt));
                if (evnt.EventInPoint >= new TimeSpan(0))
                {
                    vmes.Add(new vMixMicroEvent(evnt.EventStart - new TimeSpan(0, 0, 2), vmMicroEventType.fastforward, evnt));
                }
                vmes.Add(new vMixMicroEvent(evnt.EventStart, vmMicroEventType.transition, evnt));
            }
            else // has already started!!
            {
                evnt.EventTransition     = vmTransitionType.fade;
                evnt.EventTransitionTime = 300;
                vmes.Add(new vMixMicroEvent(now, vmMicroEventType.prepare, evnt));
                vmes.Add(new vMixMicroEvent(now + new TimeSpan(0, 0, 0, 1, 0), vmMicroEventType.fastforward, evnt));
                vmes.Add(new vMixMicroEvent(now + new TimeSpan(0, 0, 0, 2, 0), vmMicroEventType.transition, evnt));
            }

            vmes.Add(new vMixMicroEvent(evnt.EventEnd + new TimeSpan(0, 0, MediaLinger), vmMicroEventType.remove, evnt));

            LocalListLock.WaitOne();
            LocalList.AddRange(vmes);
            LocalList.Sort(delegate(vMixMicroEvent e1, vMixMicroEvent e2) { return(e1.when.CompareTo(e2.when)); });
            LocalListLock.Release();
            return(true);
        }
Exemplo n.º 7
0
 private void RemoveEvent(vMixEvent evnt)
 {
     try
     {
         if (this.InvokeRequired)
         {
             this.Invoke(new MethodInvoker(delegate { RemoveEvent(evnt); }));
         }
         else
         {
             EventListLock.WaitOne();
             EventList.Remove(evnt);
             EventListLock.Release();
             lvEventList.VirtualListSize = EventList.Count;
         }
     }
     catch (Exception e)
     {
         Console.Write(e.StackTrace);
     }
 }
Exemplo n.º 8
0
        public bool AddMicroEvents(vMixEvent evnt)
        {
            DateTime now = DateTime.Now;
            if (evnt.EventEnd < now + new TimeSpan(0, 0, MediaPreload+1))
                return false;     // too late to add!

            List<vMixMicroEvent> vmes = new List<vMixMicroEvent>();

            // prepare, transition, remove
            if (!evnt.HasDuration)
            {
                vmes.Add(new vMixMicroEvent(evnt.EventStart - new TimeSpan(0, 0, MediaPreload), vmMicroEventType.prepare, evnt));
                if (evnt.EventType ==  vmEventType.photos )
                    vmes.Add(new vMixMicroEvent(evnt.EventStart - new TimeSpan(0, 0, 2), vmMicroEventType.setup, evnt));
                vmes.Add(new vMixMicroEvent(evnt.EventStart, vmMicroEventType.transition, evnt));
            }
            else if (evnt.EventStart >= now + new TimeSpan(0,0,MediaPreload))
            {
                vmes.Add(new vMixMicroEvent(evnt.EventStart - new TimeSpan(0, 0, MediaPreload), vmMicroEventType.prepare, evnt));
                if (evnt.EventInPoint >= new TimeSpan(0) )
                    vmes.Add(new vMixMicroEvent(evnt.EventStart - new TimeSpan(0, 0, 2), vmMicroEventType.fastforward, evnt));
                vmes.Add(new vMixMicroEvent(evnt.EventStart, vmMicroEventType.transition, evnt));
            }
            else // has already started!!
            {
                evnt.EventTransition = vmTransitionType.fade;
                evnt.EventTransitionTime = 300;
                vmes.Add(new vMixMicroEvent(now, vmMicroEventType.prepare, evnt));
                vmes.Add(new vMixMicroEvent(now + new TimeSpan(0, 0, 0, 1, 0), vmMicroEventType.fastforward, evnt));
                vmes.Add(new vMixMicroEvent(now + new TimeSpan(0, 0, 0, 2, 0), vmMicroEventType.transition, evnt));
            }

            vmes.Add(new vMixMicroEvent(evnt.EventEnd + new TimeSpan (0, 0, MediaLinger), vmMicroEventType.remove, evnt));

            LocalListLock.WaitOne();
            LocalList.AddRange(vmes);
            LocalList.Sort(delegate(vMixMicroEvent e1, vMixMicroEvent e2) { return e1.when.CompareTo(e2.when); });
            LocalListLock.Release();
            return true;
        }
Exemplo n.º 9
0
 private void RemoveEvent(vMixEvent evnt)
 {
     try
     {
         if (this.InvokeRequired)
             this.Invoke(new MethodInvoker(delegate { RemoveEvent(evnt); }));
         else
         {
             EventListLock.WaitOne();
             EventList.Remove(evnt);
             EventListLock.Release();
             lvEventList.VirtualListSize = EventList.Count;
         }
     }
     catch (Exception e)
     {
         Console.Write(e.StackTrace);
     }
 }
Exemplo n.º 10
0
        private void ReloadSchedule()
        {
            if (this.InvokeRequired)
                this.Invoke(new MethodInvoker(ReloadSchedule));
            else
            {
                this.Enabled = false;

                string schedulename = ScheduleFolder + "\\vMixSchedule.xml";
                if (File.Exists(schedulename))
                {
                    List<vMixEvent> vmes = new List<vMixEvent>();
                    XmlDocument d = new XmlDocument();
                    try
                    {
                        d.Load(schedulename);
                        lvEventList.SelectedIndices.Clear();
                        vmes.Sort(delegate(vMixEvent e1, vMixEvent e2) { return e1.EventStart.CompareTo(e2.EventStart); });
                        for (int n = EventList.Count - 1; n >= 0; n--)
                        {
                            if (!EventList[n].IsLoaded)
                            {
                                MasterClock.RemoveMicroEvents(EventList[n]);
                                EventList.RemoveAt(n);
                            }
                        }

                        foreach (XmlNode n in d.SelectNodes("//vMixManager//Events//Event"))
                        {
                            vMixEvent ne = new vMixEvent (n);
                            if (ne.EventEnd > DateTime.Now )
                            {
                                bool found = false;
                                foreach (vMixEvent ve in EventList)
                                    if (ve.IsLike (ne))
                                        found = true;
                                if (!found)
                                    vmes.Add(new vMixEvent (n));
                            }
                        }

                        if (vmes.Count > 0)
                        {
                            DateTime revoke = vmes[0].EventStart > DateTime.Now ? vmes[0].EventStart : DateTime.Now;
                            foreach (vMixEvent ve in EventList)
                                MasterClock.RevokeMicroEvents (ve,revoke);
                            foreach (vMixEvent vme in vmes)
                                if (MasterClock.AddMicroEvents(vme))
                                    EventList.Add(vme);
                            EventList.Sort(delegate(vMixEvent e1, vMixEvent e2) { return e1.EventStart.CompareTo(e2.EventStart); });
                            lvEventList.VirtualListSize = EventList.Count;
                            lvEventList.RedrawItems(0, EventList.Count - 1, false);
                        }
                    }
                    catch {}
                }
                this.Enabled = true;
            }
        }
Exemplo n.º 11
0
 public vMixMicroEvent(vmMicroEventType type)
 {
     when = new DateTime();
     what = type;
     with = null;
 }
Exemplo n.º 12
0
 public vMixMicroEvent(DateTime time, vmMicroEventType type, vMixEvent vmevent)
 {
     when = time;
     what = type;
     with = vmevent;
 }
Exemplo n.º 13
0
 public vMixMicroEvent(vmMicroEventType type)
 {
     when = new DateTime();
     what = type;
     with = null;
 }
Exemplo n.º 14
0
 public vMixMicroEvent(DateTime time, vmMicroEventType type, vMixEvent vmevent)
 {
     when = time;
     what = type;
     with = vmevent;
 }
Exemplo n.º 15
0
        public void RevokeMicroEvents(vMixEvent evnt, DateTime when)
        {
            LocalListLock.WaitOne();
            for (int n = LocalList.Count - 1; n >= 0; n--)
                if (LocalList[n].with == evnt)
                    LocalList.RemoveAt(n);

            LocalList.Add (new vMixMicroEvent(when + new TimeSpan(0,0,MediaLinger), vmMicroEventType.remove, evnt));
            LocalList.Sort(delegate(vMixMicroEvent e1, vMixMicroEvent e2) { return e1.when.CompareTo(e2.when); });
            LocalListLock.Release();
        }
Exemplo n.º 16
0
        private void ReloadSchedule()
        {
            if (this.InvokeRequired)
            {
                this.Invoke(new MethodInvoker(ReloadSchedule));
            }
            else
            {
                this.Enabled = false;

                string schedulename = ScheduleFolder + "\\vMixSchedule.xml";
                if (File.Exists(schedulename))
                {
                    List <vMixEvent> vmes = new List <vMixEvent>();
                    XmlDocument      d    = new XmlDocument();
                    try
                    {
                        d.Load(schedulename);
                        lvEventList.SelectedIndices.Clear();
                        vmes.Sort(delegate(vMixEvent e1, vMixEvent e2) { return(e1.EventStart.CompareTo(e2.EventStart)); });
                        for (int n = EventList.Count - 1; n >= 0; n--)
                        {
                            if (!EventList[n].IsLoaded)
                            {
                                MasterClock.RemoveMicroEvents(EventList[n]);
                                EventList.RemoveAt(n);
                            }
                        }

                        foreach (XmlNode n in d.SelectNodes("//vMixManager//Events//Event"))
                        {
                            vMixEvent ne = new vMixEvent(n);
                            if (ne.EventEnd > DateTime.Now)
                            {
                                bool found = false;
                                foreach (vMixEvent ve in EventList)
                                {
                                    if (ve.IsLike(ne))
                                    {
                                        found = true;
                                    }
                                }
                                if (!found)
                                {
                                    vmes.Add(new vMixEvent(n));
                                }
                            }
                        }

                        if (vmes.Count > 0)
                        {
                            DateTime revoke = vmes[0].EventStart > DateTime.Now ? vmes[0].EventStart : DateTime.Now;
                            foreach (vMixEvent ve in EventList)
                            {
                                MasterClock.RevokeMicroEvents(ve, revoke);
                            }
                            foreach (vMixEvent vme in vmes)
                            {
                                if (MasterClock.AddMicroEvents(vme))
                                {
                                    EventList.Add(vme);
                                }
                            }
                            EventList.Sort(delegate(vMixEvent e1, vMixEvent e2) { return(e1.EventStart.CompareTo(e2.EventStart)); });
                            lvEventList.VirtualListSize = EventList.Count;
                            lvEventList.RedrawItems(0, EventList.Count - 1, false);
                        }
                    }
                    catch {}
                }
                this.Enabled = true;
            }
        }
Exemplo n.º 17
0
        private void WorkloadFunc()
        {
            vMixMicroEvent vme;

            while (!exitApp)
            {
                PaintTime();
                if (Workload.TryTake(out vme, 1000))
                {
                    vMixEvent evnt = vme.with;

                    if (vme.what.Equals(vmMicroEventType.exit))
                    {
                        break;
                    }

                    switch (vme.what)
                    {
                    case vmMicroEventType.prepare:
                        evnt.state = 1;
                        if (evnt.EventType == vmEventType.input)
                        {
                            WebClient.GetGUID(evnt.Title, out evnt.GUID);
                        }
                        else if (evnt.EventType == vmEventType.black)
                        {
                            WebClient.AddInput("Colour", "black", evnt.GUID);
                        }
                        else if (evnt.HasMedia)
                        {
                            WebClient.AddInput(evnt.EventTypeString(), evnt.EventPath, evnt.GUID);
                        }
                        break;

                    case vmMicroEventType.setup:
                        if (evnt.EventType == vmEventType.photos)
                        {
                            WebClient.SetupSlideshow(evnt.SlideshowInterval, evnt.SlideshowTypeString(), evnt.SlideshowTransitionTime, evnt.GUID);
                        }
                        break;

                    case  vmMicroEventType.fastforward:
                        if (evnt.HasDuration)
                        {
                            int position = (int)(DateTime.Now - evnt.EventStart + evnt.EventInPoint).TotalMilliseconds;
                            WebClient.ForwardTo(evnt.GUID, position);
                        }
                        break;

                    case vmMicroEventType.transition:
                        evnt.state = 2;
                        if (evnt.EventType == vmEventType.input)
                        {
                            string type     = evnt.TransitionTypeString();
                            int    duration = evnt.EventTransitionTime;
                            WebClient.Transition(evnt.GUID, type, duration);
                        }
                        else if (evnt.HasMedia)
                        {
                            string type     = evnt.TransitionTypeString();
                            int    duration = evnt.EventTransitionTime;
                            WebClient.Transition(evnt.GUID, type, duration);
                        }
                        break;

                    case vmMicroEventType.remove:
                        if (evnt.EventType != vmEventType.input)
                        {
                            WebClient.CloseInput(evnt.GUID);
                        }
                        RemoveEvent(evnt);
                        break;
                    }
                }
            }
            CloseWindow();
        }
Exemplo n.º 18
0
 public bool IsLike(vMixEvent other)
 {
     if (EventStart != other.EventStart) return false;
     if (EventPath != other.EventPath) return false;
     return true;
 }
Exemplo n.º 19
0
 public void RemoveMicroEvents(vMixEvent evnt)
 {
     LocalListLock.WaitOne();
     for (int n = LocalList.Count - 1; n >= 0; n--)
         if (LocalList[n].with == evnt)
             LocalList.RemoveAt(n);
     LocalListLock.Release();
 }