Esempio n. 1
0
        private static void InputDevice_SysEx(SysExMessage msg)
        {
            Application.Current.Dispatcher.Invoke(new Action(() =>
            {
                MscCommand mscCommand = MscCommand.getMscCommand(msg.Data);

                if (mscCommand != null)
                {
                    if (!mscMute)
                    {
                        for (int i = 0; i < CuelistCtrl.cues.Count; ++i)
                        {
                            Cue cue = CuelistCtrl.cues[i];

                            if (cue.trigger != null && cue.trigger.type == TriggerType.MSC && MscCommand.Compare(mscCommand, cue.trigger.mscCmd))
                            {
                                if (Core.win.saveTriggerCheckbox.IsChecked && Core.win.cueTable.SelectedIndex != i)
                                {
                                    LogCtrl.Error("In: " + mscCommand.message);
                                }
                                else
                                {
                                    LogCtrl.Success("In: " + mscCommand.message);
                                    GoCtrl.Go(i);
                                }
                                return;
                            }
                        }
                        LogCtrl.Status("In: " + mscCommand.message);
                    }
                    else
                    {
                        LogCtrl.Warning("In: " + mscCommand.message);
                    }
                }
            }));
        }
Esempio n. 2
0
        private static void OscWorker_DoWork(object sender, DoWorkEventArgs e)
        {
            try
            {
                while (receiver.State != OscSocketState.Closed)
                {
                    if (oscWorker.CancellationPending)
                    {
                        return;
                    }

                    if (receiver.State == OscSocketState.Connected)
                    {
                        string command = receiver.Receive().ToString();

                        Application.Current.Dispatcher.Invoke(new Action(() =>
                        {
                            if (!oscMute)
                            {
                                if ((command.StartsWith("/video") || command.StartsWith("/eos/out")))
                                {
                                    Match match = Regex.Match(command, @".*/(\d+)/fire.*$");
                                    if (match.Success)
                                    {
                                        Debug.WriteLine(match.Groups[1].Value);
                                        if (int.TryParse(match.Groups[1].Value, out int cueNr))
                                        {
                                            for (int i = 0; i < CuelistCtrl.cues.Count; ++i)
                                            {
                                                Cue cue = CuelistCtrl.cues[i];
                                                if (cue.trigger != null && cue.trigger.type == TriggerType.OSC && cue.trigger.oscCmd.intVal == cueNr)
                                                {
                                                    if (Core.win.saveTriggerCheckbox.IsChecked && Core.win.cueTable.SelectedIndex != i)
                                                    {
                                                        LogCtrl.Error("In: " + command);
                                                    }
                                                    else
                                                    {
                                                        LogCtrl.Success("In: " + command);
                                                        GoCtrl.Go(i);
                                                    }
                                                    return;
                                                }
                                            }
                                        }
                                    }
                                    LogCtrl.Status("In: " + command);
                                }
                                else
                                {
                                    LogCtrl.Status("In: " + command);
                                }
                            }
                            else
                            {
                                LogCtrl.Warning("In: " + command);
                            }
                        }));
                    }
                }
            }
            catch (Exception ex)
            {
                Application.Current.Dispatcher.Invoke(new Action(() =>
                {
                    LogCtrl.Error(ex.Message);
                }));
            }
        }
Esempio n. 3
0
        private static void InputDevice_NoteOn(NoteOnMessage msg)
        {
            Application.Current.Dispatcher.Invoke(new Action(() =>
            {
                if (msg.Velocity > 0)
                {
                    int pitch     = (int)msg.Pitch;
                    MidiNote note = MidiNote.getMidiNote(pitch);

                    if (note != null)
                    {
                        if (!noteMute)
                        {
                            if (pitch < 108)
                            {
                                for (int i = 0; i < CuelistCtrl.cues.Count; ++i)
                                {
                                    Cue cue = CuelistCtrl.cues[i];
                                    if (cue.trigger != null && cue.trigger.type == TriggerType.NOTE && cue.trigger.note.pitch == pitch)
                                    {
                                        if (Core.win.saveTriggerCheckbox.IsChecked && Core.win.cueTable.SelectedIndex != i)
                                        {
                                            LogCtrl.Error("In: " + note.note + " (" + note.pitch + ")");
                                        }
                                        else
                                        {
                                            LogCtrl.Success("In: " + note.note + " (" + note.pitch + ")");
                                            GoCtrl.Go(i);
                                        }
                                        return;
                                    }
                                }
                                LogCtrl.Status("In: " + note.note + " (" + note.pitch + ")");
                            }
                            else
                            {
                                LogCtrl.Status("In: " + note.note + " (" + note.pitch + ")");
                                if (pitch == 108)
                                {
                                    GoCtrl.GoNextCue();
                                }
                                else if (pitch == 109)
                                {
                                    GoCtrl.GoBack();
                                }
                                else if (pitch == 110)
                                {
                                    CuelistCtrl.SelectPrevCue();
                                }
                                else if (pitch == 111)
                                {
                                    CuelistCtrl.SelectNextCue();
                                }
                                else if (pitch >= 112 && pitch <= 121)
                                {
                                    ScriptlistCtrl.ExecuteScript(note.pitch - 111);
                                }
                            }
                        }
                        else
                        {
                            LogCtrl.Warning("In: " + note.note + " (" + note.pitch + ")");
                        }
                    }
                }
            }));
        }