Пример #1
0
        public void RefreshViewablePoints()
        {
            if (worker == null)
            {
                if (this.Equals(Panel.TimeChannel1))
                {
                    worker = new Workers.ChartRenderWorker(Panel, 0, false);
                }
                else
                {
                    worker = new Workers.ChartRenderWorker(Panel, 1, false);
                }
            }
            else if (worker.IsBusy)
            {
                try {
                    worker.CancelAsync();
                } catch { /* Race condition */ };
            }

            try {
                worker.RunWorkerAsync();
            } catch { /* Race condition */ };
        }
Пример #2
0
        public void Record_Click(object sender, EventArgs e)
        {
            if (Service.DLLWrapper.Safe)
            {
                if (panel.PanelData.RIFFData.SubChunkSize == 0)
                {
                    recording = !recording;
                    if (recording)
                    {
                        play.Enabled = false;
                        record.Text  = "Stop";
                        WavPackager packager = new WavPackager(null);
                        RIFFData    riff     = packager.GenerateRIFFData(panel);
                        panel.PanelData.RIFFData = riff;
                        Service.DLLWrapper.Record(riff);
                    }
                    else
                    {
                        play.Enabled = true;
                        Enable_Record(false);
                        RIFFData riff = panel.PanelData.RIFFData;
                        riff.Data                = Service.DLLWrapper.RecordStop();
                        riff.SubChunkSize        = riff.Data.Length;
                        panel.PanelData.RIFFData = riff;

                        panel.PanelData.SplitWavData();
                        panel.ClearAllCharts();

                        panel.PanelData.RawChartData.Add(panel.PanelData.GetReadableChannel(0));

                        Workers.ChartRenderWorker worker = new Workers.ChartRenderWorker(panel, 0, true);
                        worker.RunWorkerAsync();

                        if (panel.PanelData.RawChannelData.Count > 1)
                        {
                            panel.Menu.manager.Stereo_Click();
                            panel.Menu.manager.Mono.Enabled = false;

                            panel.PanelData.RawChartData.Add(panel.PanelData.GetReadableChannel(1));

                            Workers.ChartRenderWorker worker2 = new Workers.ChartRenderWorker(panel, 1, true);
                            worker2.RunWorkerAsync();
                        }
                        else
                        {
                            panel.Menu.manager.Mono_Click();
                            panel.Menu.manager.Stereo.Enabled = false;
                        }
                    }

                    panel.Menu.manager.Open_Click();
                }
                else
                {
                    ScrollPanel scroll = (ScrollPanel)panel.ParentRef;
                    scroll.Click_AddChannel(null, EventArgs.Empty);
                    scroll.audioPanels.Last.Value.PlayBar.Record_Click(null, EventArgs.Empty);
                }
            }
            else
            {
                Console.WriteLine("Unsafe Record action attempted and ignored.");
            }
        }