Пример #1
0
            public void Mix(SampleValue outSample, List <SampleValue> inSamples, Style style)
            {
                if (!Exec.IsExecuting())
                {
                    throw new ExecutionEnded("");
                }
                //Gui.Log("Device: MIX " + outSample.FormatSymbol(style) + " = " + Style.FormatSequence(inSamples, ", ", x => x.FormatSymbol(style)));
                Place[,] area = FreeAreaInColumn(zone["mixing"], minRow: placement.PlaceOf(inSamples[0], style).Row(), rows: 1, cols: 2 * inSamples.Count - 1); // find free columns in "mixing" block, on the same row

                List <Place>[] routes = new List <Place> [inSamples.Count];
                for (int i = 0; i < inSamples.Count; i++)
                {
                    routes[i] = placement.PathHorFirst(placement.PlaceOf(inSamples[i], style), area[0, 2 * i]);
                }
                placement.FollowRoutes(routes, clearance: 1, style);

                for (int i = 1; i < inSamples.Count; i++)
                {
                    placement.FollowRoute(placement.PathHorFirst(placement.PlaceOf(inSamples[i], style), area[0, 1]), clearance: 0, style);
                    SampleValue accumulator = placement.SampleOf(area[0, 0]);
                    SampleValue tempSample  = new SampleValue(outSample.symbol, null, new NumberValue(accumulator.Volume() + inSamples[i].Volume()), new NumberValue(1), true);
                    placement.MixHor(tempSample, area[0, 0], area[0, 1], style);
                }
                placement.Clear(area[0, 0], style, log: false);
                placement.Place(outSample, area[0, 0], style, log: false);

                Place staging = FreePlaceInColumn(zone["staging"], minRow: 0, currentlyAt: area[0, 0], skipNo: 0);

                placement.MoveVerFirst(outSample, staging, clearance: 1, style);
            }