예제 #1
0
        public void PopulateLocalProcesses(List <MultiboxProcess> processes)
        {
            PerformerLayout.Controls.Clear();

            List <BmpLocalPerformer> performers = new List <BmpLocalPerformer>();
            int track = 0;

            foreach (MultiboxProcess mp in processes)
            {
                BmpLocalPerformer perf = new BmpLocalPerformer(mp);
                perf.onUpdate += delegate(object o, EventArgs e) {
                    this.Invoke(t => t.UpdatePerformer(perf));
                };

                if (mp.hostProcess == true)
                {
                    perf.hostProcess = true;
                    performers.Insert(0, perf);
                }
                else
                {
                    performers.Add(perf);
                }
                track++;
            }
            for (int i = 0; i < performers.Count; i++)
            {
                BmpLocalPerformer perf = performers[i];
                perf.TrackNum = i;
                PerformerLayout.Controls.Add(perf);
            }

            BmpLocalOrchestra_Resize(this, EventArgs.Empty);
        }
        public void PopulateLocalProcesses(List <MultiboxProcess> processes)
        {
            PerformerPanel.Controls.Clear();

            List <BmpLocalPerformer> performers = new List <BmpLocalPerformer>();
            int track = 0;

            foreach (MultiboxProcess mp in processes)
            {
                BmpLocalPerformer perf = new BmpLocalPerformer(mp);
                perf.Dock = DockStyle.Top;

                if (mp.hostProcess == true)
                {
                    perf.hostProcess = true;
                    performers.Insert(0, perf);
                }
                else
                {
                    performers.Add(perf);
                }
                track++;
            }
            for (int i = 0; i < performers.Count; i++)
            {
                BmpLocalPerformer perf = performers[i];
                perf.TrackNum = i + 1;
                PerformerPanel.Controls.Add(perf);
            }
        }
예제 #3
0
 private void muteAll_Click(object sender, EventArgs e)
 {
     foreach (Control ctl in PerformerLayout.Controls)
     {
         BmpLocalPerformer performer = (ctl as BmpLocalPerformer);
         if (performer != null && performer.PerformerEnabled)
         {
             performer.ToggleMute();
         }
     }
 }
예제 #4
0
 private void closeInstruments_Click(object sender, EventArgs e)
 {
     foreach (Control ctl in PerformerLayout.Controls)
     {
         BmpLocalPerformer performer = (ctl as BmpLocalPerformer);
         if (performer != null && performer.PerformerEnabled)
         {
             performer.CloseInstrument();
         }
     }
 }
 public void PerformersInvoke(Action <BmpLocalPerformer> action)
 {
     foreach (Control ctl in PerformerPanel.Controls)
     {
         BmpLocalPerformer performer = (ctl as BmpLocalPerformer);
         if (performer != null)
         {
             action.Invoke(performer);
         }
     }
 }
예제 #6
0
 public void PerformerStop()
 {
     foreach (Control ctl in PerformerPanel.Controls)
     {
         BmpLocalPerformer performer = (ctl as BmpLocalPerformer);
         if (performer != null)
         {
             performer.Stop();
         }
     }
 }
예제 #7
0
 public void PerformerProgress(int prog)
 {
     foreach (Control ctl in PerformerPanel.Controls)
     {
         BmpLocalPerformer performer = (ctl as BmpLocalPerformer);
         if (performer != null)
         {
             performer.SetProgress(prog);
         }
     }
 }
예제 #8
0
 public void PerformerPlay(bool play)
 {
     foreach (Control ctl in PerformerPanel.Controls)
     {
         BmpLocalPerformer performer = (ctl as BmpLocalPerformer);
         if (performer != null)
         {
             performer.Play(play);
         }
     }
 }
예제 #9
0
 private void testC_Click(object sender, EventArgs e)
 {
     foreach (Control ctl in PerformerLayout.Controls)
     {
         BmpLocalPerformer performer = (ctl as BmpLocalPerformer);
         if (performer != null && performer.PerformerEnabled)
         {
             performer.NoteKey("C");
         }
     }
 }
예제 #10
0
 public void UpdatePerformer(BmpLocalPerformer performer)
 {
     if (sequencerRef == null)
     {
         return;
     }
     if (performer != null)
     {
         performer.Update(sequencerRef);
     }
 }
예제 #11
0
 public BmpLocalPerformer FindPerformer(string name)
 {
     foreach (Control ctl in PerformerLayout.Controls)
     {
         BmpLocalPerformer performer = (ctl as BmpLocalPerformer);
         if (performer != null && performer.PerformerName == name)
         {
             return(performer);
         }
     }
     return(null);
 }
예제 #12
0
        private void testC_Click(object sender, EventArgs e)
        {
            //StartSyncWorker();

            foreach (Control ctl in PerformerPanel.Controls)
            {
                BmpLocalPerformer performer = (ctl as BmpLocalPerformer);
                if (performer != null && performer.PerformerEnabled)
                {
                    performer.NoteKey("C");
                }
            }
        }
예제 #13
0
 public void UpdatePerformers()
 {
     if (sequencerRef == null)
     {
         return;
     }
     foreach (Control ctl in PerformerLayout.Controls)
     {
         BmpLocalPerformer performer = (ctl as BmpLocalPerformer);
         if (performer != null)
         {
             this.UpdatePerformer(performer);
         }
     }
 }
예제 #14
0
 public void UpdatePerformers(BmpSequencer seq)
 {
     if (seq == null)
     {
         return;
     }
     foreach (Control ctl in PerformerPanel.Controls)
     {
         BmpLocalPerformer performer = (ctl as BmpLocalPerformer);
         if (performer != null)
         {
             performer.Sequencer = seq;
         }
     }
 }
예제 #15
0
 public void ProcessOnNote(NoteEvent note)
 {
     foreach (Control ctl in PerformerLayout.Controls)
     {
         BmpLocalPerformer performer = (ctl as BmpLocalPerformer);
         if (performer != null && performer.UiEnabled && performer.PerformerEnabled)
         {
             if (note.trackNum == performer.TrackNum)
             {
                 int po = SequencerReference.GetTrackPreferredOctaveShift(note.track);
                 note.note = NoteHelper.ApplyOctaveShift(note.origNote, performer.OctaveNum + po);
                 performer.ProcessOnNote(note);
             }
         }
     }
 }
예제 #16
0
        private void ensembleCheck_Click(object sender, EventArgs e)
        {
            Timer openTimer = new Timer {
                Interval = 500
            };

            openTimer.Elapsed += delegate(object o, ElapsedEventArgs ev) {
                openTimer.Stop();
                openTimer = null;

                foreach (Control ctl in PerformerLayout.Controls)
                {
                    BmpLocalPerformer performer = (ctl as BmpLocalPerformer);
                    if (performer != null && performer.PerformerEnabled && !performer.hostProcess)
                    {
                        performer.EnsembleAccept();
                    }
                }
            };
            openTimer.Start();
        }
예제 #17
0
        public void UpdateMemory()
        {
            if (Sharlayan.MemoryHandler.Instance.IsAttached)
            {
                if (Sharlayan.Reader.CanGetActors() && Sharlayan.Reader.CanGetPerformance())
                {
                    List <string> performerNames = GetPerformerNames();

                    int pid = -1;
                    PerformanceResult perfs = Sharlayan.Reader.GetPerformance();
                    ActorResult       ares  = Sharlayan.Reader.GetActors();
                    if (ares != null)
                    {
                        foreach (ActorItem actor in ares.CurrentPCs.Values.ToList())
                        {
                            if (performerNames.Contains(actor.Name))
                            {
                                uint perfId = actor.PerformanceID / 2;
                                if (perfId >= 0 && perfId < 99 && perfs.Performances.ContainsKey(perfId))
                                {
                                    PerformanceItem item = perfs.Performances[perfId];

                                    BmpLocalPerformer perf = this.FindPerformer(actor.Name);
                                    if (perf != null)
                                    {
                                        perf.PerformanceUp = item.IsReady();
                                        perf.performanceId = perfId;
                                        perf.actorId       = actor.ID;
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
예제 #18
0
        private void StartSyncWorker()
        {
            BackgroundWorker syncWorker = new BackgroundWorker();

            syncWorker.WorkerSupportsCancellation = true;
            syncWorker.DoWork             += SyncWorker_DoWork;
            syncWorker.RunWorkerCompleted += SyncWorker_RunWorkerCompleted;

            this.UpdateMemory();

            List <uint> actorIds = new List <uint>();

            foreach (Control ctl in PerformerPanel.Controls)
            {
                BmpLocalPerformer performer = (ctl as BmpLocalPerformer);
                if (performer != null && performer.PerformerEnabled && performer.PerformanceUp)
                {
                    actorIds.Add(performer.actorId);
                }
            }
            syncWorker.RunWorkerAsync(actorIds);

            onMemoryCheck.Invoke(this, true);
        }