Example #1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="MscMessage"/> class.
 /// </summary>
 /// <param name="deviceId">The device identifier.</param>
 /// <param name="format">The format.</param>
 /// <param name="command">The command.</param>
 public MscMessage(byte deviceId, MscFormat format, MscCommand command)
     : this()
 {
     DeviceId           = deviceId;
     CommandFormat      = format;
     ShowControlCommand = command;
 }
Example #2
0
        /// <summary>
        /// Returns whether the command supports a byte array parameter format.
        /// </summary>
        /// <param name="command">The command to test.</param>
        /// <returns>Whether the parameters are supported.</returns>
        public static bool HasDataParameter(this MscCommand command)
        {
            switch (command)
            {
            case MscCommand.Set:
                return(true);
            }

            return(false);
        }
Example #3
0
        /// <summary>
        /// Returns whether the command supports a single byte number parameter.
        /// </summary>
        /// <param name="command">The command to test.</param>
        /// <returns>Whether the parameters are supported.</returns>
        public static bool HasNumberParameter(this MscCommand command)
        {
            switch (command)
            {
            case MscCommand.Go:
            case MscCommand.Stop:
            case MscCommand.Resume:
            case MscCommand.TimedGo:
            case MscCommand.Load:
            case MscCommand.GoOff:
                return(true);
            }

            return(false);
        }
Example #4
0
 public static void SendMSC(MscCommand mscCommand)
 {
     if (outputDevice != null && outputDevice.IsOpen && !MidiInputCtrl.mscMute)
     {
         try
         {
             outputDevice.SendSysEx(mscCommand.byteMessage);
             LogCtrl.Status("Send: " + mscCommand.message);
         }
         catch (Exception e)
         {
             LogCtrl.Error("Couldn't send MSC command!");
             LogCtrl.Error(e.ToString());
         }
     }
     else
     {
         LogCtrl.Warning("Send: " + mscCommand.message);
     }
 }
Example #5
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);
                    }
                }
            }));
        }