Esempio n. 1
0
        static void CreateOneToN(Model.Node router, int nodeNumber, Dispatcher dispatcher)
        {
            var oneToN = new Model.Node(nodeNumber, router, "oneToN")
            {
                Description = "Linear 1:N",
            };

            var labels = new Model.Node(1, oneToN, "labels")
            {
                SchemaIdentifier = "de.l-s-b.emberplus.matrix.labels"
            };

            var targetLabels = new Model.Node(1, labels, "targets");
            var sourceLabels = new Model.Node(2, labels, "sources");

            var targets = new List <Model.Signal>();
            var sources = new List <Model.Signal>();

            for (int number = 0; number < 200; number++)
            {
                var targetParameter = new Model.StringParameter(number, targetLabels, IdentOf("t", number), dispatcher, isWriteable: true)
                {
                    Value = IdentOf("SDI-T", number),
                };

                targets.Add(new Model.Signal(number, targetParameter));

                var sourceParameter = new Model.StringParameter(number, sourceLabels, IdentOf("s", number), dispatcher, isWriteable: true)
                {
                    Value = IdentOf("SDI-S", number),
                };

                sources.Add(new Model.Signal(number, sourceParameter));
            }

            var matrix = new Model.OneToNMatrix(
                2,
                oneToN,
                "matrix",
                dispatcher,
                targets,
                sources,
                labels)
            {
                SchemaIdentifier = "de.l-s-b.emberplus.samples.oneToN"
            };

            foreach (var target in matrix.Targets)
            {
                matrix.Connect(target, new[] { matrix.GetSource(target.Number) }, null);
            }
        }
Esempio n. 2
0
        static void CreateSparse(Model.Node router, int nodeNumber, Dispatcher dispatcher)
        {
            var sparse = new Model.Node(nodeNumber, router, "sparse")
            {
                Description = "Linear 1:N with Sparse Signals",
            };

            var labels       = new Model.Node(1, sparse, "labels");
            var targetLabels = new Model.Node(1, labels, "targets");
            var sourceLabels = new Model.Node(2, labels, "sources");

            var targets = new List <Model.Signal>();
            var sources = new List <Model.Signal>();

            for (int number = 3; number < 200; number += 2)
            {
                var targetParameter = new Model.StringParameter(number, targetLabels, IdentOf("t", number), dispatcher, isWriteable: true)
                {
                    Value = IdentOf("Sparse-T", number),
                };

                targets.Add(new Model.Signal(number, targetParameter));

                var sourceParameter = new Model.StringParameter(number, sourceLabels, IdentOf("s", number), dispatcher, isWriteable: true)
                {
                    Value = IdentOf("Sparse-S", number),
                };

                sources.Add(new Model.Signal(number, sourceParameter));
            }

            var matrix = new Model.OneToNMatrix(
                2,
                sparse,
                "matrix",
                dispatcher,
                targets,
                sources,
                labels,
                targetCount: 1000,
                sourceCount: 1000);

            foreach (var target in matrix.Targets)
            {
                matrix.Connect(target, new[] { matrix.GetSource(target.Number) }, null);
            }
        }
Esempio n. 3
0
        static void CreateOneToOne(Model.Node router, int nodeNumber, Dispatcher dispatcher)
        {
            var oneToOne = new Model.Node(nodeNumber, router, "oneToOne")
            {
                Description = "Linear 1:1",
            };

            var labels       = new Model.Node(1, oneToOne, "labels");
            var targetLabels = new Model.Node(1, labels, "targets");
            var sourceLabels = new Model.Node(2, labels, "sources");

            var targets = new List <Model.Signal>();
            var sources = new List <Model.Signal>();

            for (int number = 0; number < 16; number++)
            {
                var targetParameter = new Model.StringParameter(number, targetLabels, IdentOf("t", number), dispatcher, isWriteable: true)
                {
                    Value = IdentOf("OneToOne-T", number),
                };

                targets.Add(new Model.Signal(number, targetParameter));

                var sourceParameter = new Model.StringParameter(number, sourceLabels, IdentOf("s", number), dispatcher, isWriteable: true)
                {
                    Value = IdentOf("OneToOne-S", number),
                };

                sources.Add(new Model.Signal(number, sourceParameter));
            }

            var matrix = new Model.OneToOneMatrix(
                2,
                oneToOne,
                "matrix",
                dispatcher,
                targets,
                sources,
                labels);

            foreach (var target in matrix.Targets)
            {
                matrix.Connect(target, new[] { matrix.GetSource(target.Number) }, null);
            }
        }
Esempio n. 4
0
        static void CreateDynamic(Model.Node router, int nodeNumber, Dispatcher dispatcher)
        {
            var dyna = new Model.Node(nodeNumber, router, "dynamic")
            {
                Description = "Linear N:N with Dynamic Parameters",
            };

            var labels       = new Model.Node(1, dyna, "labels");
            var targetLabels = new Model.Node(1, labels, "targets");
            var sourceLabels = new Model.Node(2, labels, "sources");

            var targets = new List <Model.Signal>();
            var sources = new List <Model.Signal>();

            for (int index = 0; index < 1000; index++)
            {
                var targetLabel = new Model.StringParameter(index, targetLabels, IdentOf("t", index), dispatcher, isWriteable: true)
                {
                    Value = IdentOf("DYN-T", index)
                };
                targets.Add(new Model.Signal(index, targetLabel));

                var sourceLabel = new Model.StringParameter(index, sourceLabels, IdentOf("s", index), dispatcher, isWriteable: true)
                {
                    Value = IdentOf("DYN-S", index)
                };
                sources.Add(new Model.Signal(index, sourceLabel));
            }

            var matrix = new Model.DynamicMatrix(
                3,
                dyna,
                "matrix",
                dispatcher,
                targets,
                sources,
                labels);

            foreach (var target in matrix.Targets)
            {
                matrix.Connect(target, new[] { matrix.GetSource(target.Number) }, null);
            }
            //matrix.Connect(target, matrix.Sources, null);
        }
Esempio n. 5
0
        GlowContainer Model.IElementVisitor <ElementToGlowOptions, GlowContainer> .Visit(Model.StringParameter element, ElementToGlowOptions state)
        {
            var glow         = new GlowQualifiedParameter(element.Path);
            var dirFieldMask = state.DirFieldMask;

            if (dirFieldMask.HasBits(GlowFieldFlags.Identifier))
            {
                glow.Identifier = element.Identifier;
            }

            if (dirFieldMask.HasBits(GlowFieldFlags.Description) &&
                String.IsNullOrEmpty(element.Description) == false)
            {
                glow.Description = element.Description;
            }

            if (dirFieldMask.HasBits(GlowFieldFlags.Value))
            {
                glow.Value = new GlowValue(element.Value);
            }

            if (dirFieldMask == GlowFieldFlags.All)
            {
                if (element.IsWriteable)
                {
                    glow.Access = GlowAccess.ReadWrite;
                }
            }

            if ((dirFieldMask == GlowFieldFlags.All) &&
                String.IsNullOrEmpty(element.SchemaIdentifier) == false)
            {
                glow.SchemaIdentifiers = element.SchemaIdentifier;
            }

            return(glow);
        }
Esempio n. 6
0
        static void CreateNToN(Model.Node router, int nodeNumber, Dispatcher dispatcher)
        {
            var nToN = new Model.Node(nodeNumber, router, "nToN")
            {
                Description = "Non-Linear N:N",
            };

            var labels       = new Model.Node(1, nToN, "labels");
            var targetLabels = new Model.Node(1, labels, "targets");
            var sourceLabels = new Model.Node(2, labels, "sources");

            var parameters   = new Model.Node(2, nToN, "parameters");
            var targetParams = new Model.Node(1, parameters, "targets");
            var sourceParams = new Model.Node(2, parameters, "sources");
            var xpointParams = new Model.Node(3, parameters, "connections");

            var targets = new List <Model.Signal>();
            var sources = new List <Model.Signal>();
            var number  = 0;

            for (int index = 0; index < 4; index++)
            {
                number += 3;

                var targetLabel = new Model.StringParameter(number, targetLabels, IdentOf("t", number), dispatcher, isWriteable: true)
                {
                    Value = IdentOf("AES-T", number)
                };
                targets.Add(new Model.Signal(number, targetLabel));
                var targetNode = new Model.Node(number, targetParams, IdentOf("t", number));
                new Model.IntegerParameter(1, targetNode, "targetGain", dispatcher, -128, 15, isWriteable: true);
                new Model.StringParameter(2, targetNode, "targetMode", dispatcher, isWriteable: true)
                {
                    Value = "something"
                };

                var sourceLabel = new Model.StringParameter(number, sourceLabels, IdentOf("s", number), dispatcher, isWriteable: true)
                {
                    Value = IdentOf("AES-S", number)
                };
                sources.Add(new Model.Signal(number, sourceLabel));
                var sourceNode = new Model.Node(number, sourceParams, IdentOf("s", number));
                new Model.IntegerParameter(1, sourceNode, "sourceGain", dispatcher, -128, 15, isWriteable: true);
            }

            foreach (var target in targets)
            {
                var targetNode = new Model.Node(target.Number, xpointParams, IdentOf("t", target.Number));

                foreach (var source in sources)
                {
                    var sourceNode = new Model.Node(source.Number, targetNode, IdentOf("s", source.Number));
                    new Model.IntegerParameter(1, sourceNode, "gain", dispatcher, -128, 15, isWriteable: true);
                }
            }

            var matrix = new Model.NToNMatrix(
                3,
                nToN,
                "matrix",
                dispatcher,
                targets,
                sources,
                labels,
                parameters);

            foreach (var target in matrix.Targets)
            {
                if (target.Number % 2 == 0)
                {
                    matrix.Connect(target, new[] { matrix.GetSource(target.Number) }, null);
                }
            }
        }
 public Signal(int number, StringParameter labelParameter)
 {
     Number         = number;
     LabelParameter = labelParameter;
 }