Exemplo n.º 1
0
        private void UpdateTimer_Tick(object sender, EventArgs e)
        {
            UpdateTimer.Enabled = false;
            /////////
            visualizerController.ParseData(soundInputHandler.GetWorkingData());

            VisualizerDisplay ledDisplay = visualizerController.ledDisplay;

            byte[] packet = ledDisplay.displayToPacket();
            Console.WriteLine(networkHandler.TransmitData(packet));
            //Console.WriteLine(networkHandler.PacketAsString(packet));

            VisualizerDisplay display        = visualizerController.getDisplay();
            Bitmap            led_projection = new Bitmap(display.width, display.height);

            DisplayPixel[,] pixels = display.getDisplay();

            for (int i = 0; i < pixels.GetLength(0); ++i)
            {
                for (int j = 0; j < pixels.GetLength(1); ++j)
                {
                    led_projection.SetPixel(pixels[i, j].COOR.Item1, pixels[i, j].COOR.Item2, Color.FromArgb(pixels[i, j].ToARGB()));
                }
            }

            LEDProjector.Image = led_projection;
            //////////
            UpdateTimer.Enabled = true;
        }
        public VisualizerController(int w, int h)
        {
            display        = new VisualizerDisplay(w, h);
            ledDisplay     = new VisualizerDisplay(300, 1); //DELETE LATER
            soundProcessor = new SoundProcessor();

            int frequencies = Dashboard.WorkingProfile.SoundProcessorProfile.frequencyRanges.Length;

            sectionColor = new RGBS[frequencies];
            for (int i = 0; i < frequencies; ++i)
            {
                sectionColor[i] = new RGBS(Dashboard.WorkingProfile.ColorProfile.ColumnColors[0].ToARGB());
            }
        }