Exemplo n.º 1
0
        private static void PersistInput(StringBuilder sb, AbstractTodoInput input)
        {
            sb.Append("<TodoInput Type=\"");


            if (input is TodoOscInput)
            {
                TodoOscInput osc = input as TodoOscInput;
                sb.AppendLine("OSC\">");
                sb.AppendLine("<Message>" + osc.Message + "</Message>");
            }

            if (input is TodoMidiInput)
            {
                TodoMidiInput midi = input as TodoMidiInput;
                sb.AppendLine("Midi\">");
                sb.AppendLine("<Channel>" + midi.MidiChannel + "</Channel>");
                sb.AppendLine("<ControlType>" + midi.ControlType + "</ControlType>");
                sb.AppendLine("<ControlValue>" + midi.ControlValue + "</ControlValue>");
                sb.AppendLine("<Device>" + midi.Device + "</Device>");
            }
            sb.AppendLine("<TakeOverMode>" + input.TakeOverMode.ToString() + "</TakeOverMode>");
            sb.AppendLine("<FeedbackMode>" + input.FeedBackMode.ToString() + "</FeedbackMode>");


            sb.AppendLine("</TodoInput>");
        }
Exemplo n.º 2
0
        public void Evaluate(int SpreadMax)
        {
            if (this.FInEngine.PluginIO.IsConnected)
            {
                this.FOutIsFound.SliceCount = SpreadMax;
                for (int i = 0; i < SpreadMax; i++)
                {
                    TodoVariable var = this.FInEngine[i].GetVariableByName(this.FInName[i]);
                    if (var != null)
                    {
                        if (this.FInDoCreate[i])
                        {
                            bool         found = true;
                            TodoOscInput item  = null;
                            foreach (AbstractTodoInput input in var.Inputs)
                            {
                                if (input is TodoOscInput)
                                {
                                    TodoOscInput osc = (TodoOscInput)input;
                                    if (osc.Message == this.FInMessage[i])
                                    {
                                        item = osc; found = true;
                                    }
                                }
                            }
                            if (item == null)
                            {
                                item         = new TodoOscInput(var);
                                item.Message = this.FInMessage[i];
                            }
                            item.FeedBackMode = this.FInFeedBack[i];
                            item.TakeOverMode = this.FinTakeOver[i];

                            this.FOutIsFound[i] = !found;
                        }
                        else
                        {
                            this.FOutIsFound[i] = false;
                        }
                    }
                    else
                    {
                        this.FOutIsFound[i] = false;
                    }
                }
            }
            else
            {
                this.FOutIsFound[0] = false;
            }
        }
Exemplo n.º 3
0
        private static void LoadInputs(TodoEngine engine, XmlNode node, TodoVariable var)
        {
            string type = node.Attributes["Type"].Value;


            if (type == "OSC")
            {
                TodoOscInput osc = new TodoOscInput(var);

                foreach (XmlNode child in node.ChildNodes)
                {
                    if (child.Name == "Message")
                    {
                        osc.Message = child.InnerText;
                    }
                    if (child.Name == "TakeOverMode")
                    {
                        osc.TakeOverMode = (eTodoLocalTakeOverMode)Enum.Parse(typeof(eTodoLocalTakeOverMode), child.InnerText);
                    }
                    if (child.Name == "FeedbackMode")
                    {
                        osc.FeedBackMode = (eTodoLocalFeedBackMode)Enum.Parse(typeof(eTodoLocalFeedBackMode), child.InnerText);
                    }
                }
                engine.Osc.RegisterInput(osc);
            }

            if (type == "Midi")
            {
                TodoMidiInput midi = new TodoMidiInput(var);
                midi.Device = "Any";
                foreach (XmlNode child in node.ChildNodes)
                {
                    if (child.Name == "ControlType")
                    {
                        midi.ControlType = (eTodoMidiType)Enum.Parse(typeof(eTodoMidiType), child.InnerText);
                    }
                    if (child.Name == "ControlValue")
                    {
                        midi.ControlValue = Convert.ToInt32(child.InnerText);
                    }
                    if (child.Name == "Channel")
                    {
                        midi.MidiChannel = Convert.ToInt32(child.InnerText);
                    }
                    if (child.Name == "Device")
                    {
                        midi.Device = child.InnerText;
                    }
                    if (child.Name == "TakeOverMode")
                    {
                        midi.TakeOverMode = (eTodoLocalTakeOverMode)Enum.Parse(typeof(eTodoLocalTakeOverMode), child.InnerText);
                    }
                    if (child.Name == "FeedbackMode")
                    {
                        midi.FeedBackMode = (eTodoLocalFeedBackMode)Enum.Parse(typeof(eTodoLocalFeedBackMode), child.InnerText);
                    }
                }
                engine.Midi.RegisterInput(midi);
            }
        }