Exemplo n.º 1
0
        void AdjustOutputsPanel()
        {
            int maxcount = 0;

            foreach (TBasePin pin in FPluginHost.Outputs)
            {
                if (pin.Visibility != TPinVisibility.False)
                {
                    maxcount = Math.Max(maxcount, pin.SliceCount * pin.Dimension);
                }
            }

            OutputsPanel.Height = Math.Min(200, (maxcount + 1) * FSliceHeight + 2);
            OutputsPanel.Invalidate();
        }
Exemplo n.º 2
0
        void AfterEvaluateCB()
        {
            if (EnableOSCCheckBox.Checked)
            {
                //double time;
                //GetCurrentTime(out time);
                OSCBundle bundle = new OSCBundle();

                //send outputs as OSC
                for (int i = 0; i < FPluginHost.Outputs.Count; i++)
                {
                    string pinname = FPluginHost.Outputs[i].Name;
                    // pinname = pinname.Replace(" ", "_");
                    OSCMessage message = new OSCMessage(FOSCAddress + "/" + pinname);

                    if (FPluginHost.Outputs[i] is TValuePin)
                    {
                        double val;
                        for (int j = 0; j < (FPluginHost.Outputs[i] as TValuePin).SliceCount; j++)
                        {
                            (FPluginHost.Outputs[i] as TValuePin).GetValue(j, out val);
                            message.Append((float)val);
                        }
                    }
                    else if (FPluginHost.Outputs[i] is TStringPin)
                    {
                        string str;
                        for (int j = 0; j < (FPluginHost.Outputs[i] as TStringPin).SliceCount; j++)
                        {
                            (FPluginHost.Outputs[i] as TStringPin).GetString(j, out str);
                            message.Append(str);
                        }
                    }
                    else if (FPluginHost.Outputs[i] is TColorPin)
                    {
                        RGBAColor col;
                        for (int j = 0; j < (FPluginHost.Outputs[i] as TColorPin).SliceCount; j++)
                        {
                            (FPluginHost.Outputs[i] as TColorPin).GetColor(j, out col);
                            message.Append(col.ToString());
                        }
                    }

                    bundle.Append(message);
                }

                try
                {
                    if (FOSCTransmitter != null)
                    {
                        FOSCTransmitter.Send(bundle);
                    }
                }
                catch (Exception ex)
                {
                    DebugLog.Items.Add("UDP: " + ex.Message);
                }
            }

            bool redraw = false;

            for (int i = 0; i < FPluginHost.Inputs.Count; i++)
            {
                redraw       |= (FPluginHost.Inputs[i] as TBasePin).PinIsChanged;
                FPinsChanged |= (FPluginHost.Inputs[i] as TBasePin).SliceCountIsChanged;
                (FPluginHost.Inputs[i] as TBasePin).Invalidate();
            }
            if (redraw)
            {
                InputsPanel.Invalidate();
            }

            redraw = false;
            for (int i = 0; i < FPluginHost.Outputs.Count; i++)
            {
                redraw       |= (FPluginHost.Outputs[i] as TBasePin).PinIsChanged;
                FPinsChanged |= (FPluginHost.Outputs[i] as TBasePin).SliceCountIsChanged;
                (FPluginHost.Outputs[i] as TBasePin).Invalidate();
            }
            if (redraw)
            {
                OutputsPanel.Invalidate();
            }
        }