void textBox1_Enter(object sender, KeyEventArgs e) { if (e.KeyValue != 13) { return; } try { ((FunctionBlockHandler)functionBlocks[AnalysisType.FBHandler]).PauseSound(); ((FunctionBlockHandler)functionBlocks[AnalysisType.FBHandler]).PausePlay(); Thread.Sleep(100); M = int.Parse(textBox1.Text); if (M < 2) { M = 2; } FftAdapterSetup setup1 = functionBlocks[AnalysisType.FFTAdapter].Settings as FftAdapterSetup; setup1.length = 1 << M; functionBlocks[AnalysisType.FFTAdapter].Settings = setup1; FftSetup setup2 = functionBlocks[AnalysisType.FFTAnalysis].Settings as FftSetup; setup2.M = M; functionBlocks[AnalysisType.FFTAnalysis].Settings = setup2; ((FunctionBlockHandler)functionBlocks[AnalysisType.FBHandler]).ContinueSound(); ((FunctionBlockHandler)functionBlocks[AnalysisType.FBHandler]).ContinuePlay(); } catch { } }
public object Clone() { FftSetup s = new FftSetup(); s.Copy(this); return(s); }
public void Copy(FftSetup setup) { M = setup.M; averagingType = setup.averagingType; numberOfAverages = setup.numberOfAverages; type = setup.type; }
public FftAnalysis() { setup = new FftSetup(); calculations = new Calculations(); output = new DataObject(); outputData = new DataObjectElement[5]; outputData[0] = new DataObjectElement("Time", 0); outputData[1] = new DataObjectElement("Inst", 1); outputData[2] = new DataObjectElement("Autospectrum", 2); outputData[3] = new DataObjectElement("Autocorrelation", 3); outputData[4] = new DataObjectElement("Count", 4); output.dataElements = outputData; }
void textBox2_Enter(object sender, KeyEventArgs e) { if (e.KeyValue != 13) { return; } try { FftSetup setup = functionBlocks[AnalysisType.FFTAnalysis].Settings as FftSetup; setup.numberOfAverages = int.Parse(textBox2.Text); functionBlocks[AnalysisType.FFTAnalysis].Settings = setup; } catch { } }
public Machine() { SoundCardDelegate soundCardCallback = SoundCardCallBack; InitializeComponent(); textBox1.KeyDown += new KeyEventHandler(textBox1_Enter); textBox2.KeyDown += new KeyEventHandler(textBox2_Enter); textBox3.KeyDown += new KeyEventHandler(textBox3_Enter); textBox4.KeyDown += new KeyEventHandler(textBox4_Enter); textBox5.KeyDown += new KeyEventHandler(textBox5_Enter); textBox6.KeyDown += new KeyEventHandler(textBox6_Enter); textBox7.KeyDown += new KeyEventHandler(textBox7_Enter); textBox8.KeyDown += new KeyEventHandler(textBox8_Enter); displayComponent = new DisplayComponent(); displayComponent.PreviewKeyDown += new PreviewKeyDownEventHandler(display_previewKey); displayComponent.KeyDown += new KeyEventHandler(display_keyDown); Controls.Add(displayComponent); KeyPreview = true; InitDisplay(); fileDialog = new OpenFileDialog(); functionBlocks = new FunctionBlocks(); functionBlocks.Add(new FunctionBlockHandler(), AnalysisType.FBHandler); functionBlocks.Add(new SoundCard(soundCardCallback), AnalysisType.Soundcard); functionBlocks.Add(new PlayBack(), AnalysisType.Playback); functionBlocks.Add(new Generator(), AnalysisType.Generator); functionBlocks.Add(new Afilter(), AnalysisType.AWeighting); functionBlocks.Add(new Upsampling(), AnalysisType.Upsampling); functionBlocks.Add(new FftAdapter(), AnalysisType.FFTAdapter); functionBlocks.Add(new FftAnalysis(), AnalysisType.FFTAnalysis); functionBlocks.Add(new CpbAnalysis(), AnalysisType.OctaveAnalysis); functionBlocks.Add(new DetectorBank(), AnalysisType.OctaveDetectorBank); functionBlocks.Add(new CpbAnalysis(), AnalysisType.ThirdOctaveAnalysis); functionBlocks.Add(new DetectorBank(), AnalysisType.ThirdOctaveDetectorBank); functionBlocks.Add(new BBDetector(), AnalysisType.BroadbandDetector); functionBlocks.Add(new GraphAdapter(), AnalysisType.GraphAdapter); functionBlocks.Add(new GraphHandler(), AnalysisType.Graph); functionBlocks.Add(new GraphAdapter(), AnalysisType.ValueAdapter); functionBlocks.Add(new ValueHandler(), AnalysisType.Value); functionBlocks.Add(new CursorHandler(), AnalysisType.ValueCursor); soundCardSetup = new SoundCardSetup(); playBackSetup = new SoundCardSetup(); generatorSetup = new GeneratorSetup(); fftAdaptorSetup = new FftAdapterSetup(); upsamplingSetup = new UpsamplingSetup(); fftSetup = new FftSetup(); aFilterSetup = new AfilterSetup(); cpbSetup1 = new CpbSetup(); cpbSetup3 = new CpbSetup(); detectorsSetup1 = new DetectorBankSetup(); detectorsSetup3 = new DetectorBankSetup(); bbDetectorSetup = new BBDetectorSetup(); graphAdapterSetup = new DefaultSetup(); valueAdapterSetup = new DefaultSetup(); graphSetup = new DisplaySetup(); valueSetup = new DisplaySetup(); UpdateSettings(dataGridView); Setup(); Reset(); }