public object Clone() { GeneratorSetup s = new GeneratorSetup(); s.Copy(this); return(s); }
public void OnCompleted() { SoundCardSetup setupCard = soundCard.Settings as SoundCardSetup; if (!setupCard.running) { soundIndicator.BackColor = Color.FromArgb(0, 192, 0); threadSoundCard = null; } SoundCardSetup setupPlay = playBack.Settings as SoundCardSetup; if (!setupPlay.running) { playIndicator.BackColor = Color.FromArgb(0, 192, 0); threadPlayBack = null; } GeneratorSetup setupGenerator = generator.Settings as GeneratorSetup; if (!setupGenerator.running) { generatorIndicator.BackColor = Color.FromArgb(0, 192, 0); threadGenerator = null; } //foreach (DictionaryEntry functionBlock in functionBlocks) // ((FunctionBlock)functionBlock.Value).Reset(); }
public void ContinueGenerator() { GeneratorSetup setup = generator.Settings as GeneratorSetup; setup.paused = false; generator.Settings = setup; }
public void PauseGenerator() { GeneratorSetup setup = generator.Settings as GeneratorSetup; setup.paused = true; generator.Settings = setup; }
public void StopGenerator() { GeneratorSetup setup = generator.Settings as GeneratorSetup; setup.running = false; generator.Settings = setup; threadGenerator = null; }
public Generator() { output = new DataObject(); output.dataElements = new DataObjectElement[1]; output.dataElements[0] = new DataObjectElement("", 0); abstraction = new GeneratorAbstraction(); sine = new Sine(); whiteNoise = new WhiteNoise(); launchpad = new Launchpad(); setup = new GeneratorSetup(); }
public void Copy(GeneratorSetup setup) { generatorType = setup.generatorType; samplingFrequency = setup.samplingFrequency; frequency = setup.frequency; level = setup.level; length = setup.length; running = setup.running; paused = setup.paused; delay = setup.delay; }
void button11_Click(object sender, EventArgs e) { ((FunctionBlockHandler)functionBlocks[AnalysisType.FBHandler]).StopGenerator(); GeneratorSetup setup = functionBlocks[AnalysisType.Generator].Settings as GeneratorSetup; functionBlocks[AnalysisType.Generator].Settings = setup; functionBlocks[AnalysisType.FFTAnalysis].Reset(); ((FunctionBlockHandler)functionBlocks[AnalysisType.FBHandler]).StartGenerator(); }
void textBox3_Enter(object sender, KeyEventArgs e) { if (e.KeyValue != 13) { return; } try { SoundCardSetup setup = functionBlocks[AnalysisType.Playback].Settings as SoundCardSetup; setup.delay = int.Parse(textBox3.Text); functionBlocks[AnalysisType.Playback].Settings = setup; GeneratorSetup setupG = functionBlocks[AnalysisType.Generator].Settings as GeneratorSetup; setupG.delay = int.Parse(textBox3.Text); functionBlocks[AnalysisType.Generator].Settings = setupG; } catch { } }
public void StartGenerator() { if (threadGenerator != null) { return; } generatorIndicator.BackColor = Color.FromArgb(192, 0, 0); SetIterator(generator.CreateIterator()); iteratorGenerator = iterator; generator.Subscribe(this); GeneratorSetup setup = generator.Settings as GeneratorSetup; setup.running = true; generator.Settings = setup; threadGenerator = new Thread(new ThreadStart(generator.Compute)); threadGenerator.Name = "Generator"; threadGenerator.Start(); }
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(); }