示例#1
0
        public object Clone()
        {
            SoundCardSetup s = new SoundCardSetup();

            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 ContinueSound()
        {
            SoundCardSetup setup = soundCard.Settings as SoundCardSetup;

            setup.paused       = false;
            soundCard.Settings = setup;
        }
        public void ContinuePlay()
        {
            SoundCardSetup setup = playBack.Settings as SoundCardSetup;

            setup.paused      = false;
            playBack.Settings = setup;
        }
        public void PausePlay()
        {
            SoundCardSetup setup = playBack.Settings as SoundCardSetup;

            setup.paused      = true;
            playBack.Settings = setup;
        }
        public void PauseSound()
        {
            SoundCardSetup setup = soundCard.Settings as SoundCardSetup;

            setup.paused       = true;
            soundCard.Settings = setup;
        }
示例#7
0
 public PlayBack()
 {
     output = new DataObject();
     output.dataElements    = new DataObjectElement[1];
     output.dataElements[0] = new DataObjectElement("", 0);
     waveIO = new WaveIO();
     setup  = new SoundCardSetup();
 }
        public void StopPlay()
        {
            SoundCardSetup setup = playBack.Settings as SoundCardSetup;

            setup.running     = false;
            playBack.Settings = setup;
            threadPlayBack    = null;
        }
        public void StopSound()
        {
            SoundCardSetup setup = soundCard.Settings as SoundCardSetup;

            setup.running      = false;
            soundCard.Settings = setup;
            threadSoundCard    = null;
        }
示例#10
0
 public SoundCard(SoundCardDelegate callBack)
 {
     output = new DataObject();
     output.dataElements    = new DataObjectElement[1];
     output.dataElements[0] = new DataObjectElement("", 0);
     setup         = new SoundCardSetup();
     this.callBack = callBack;
 }
示例#11
0
 public void Copy(SoundCardSetup setup)
 {
     length            = setup.length;
     path              = setup.path;
     delay             = setup.delay;
     running           = setup.running;
     paused            = setup.paused;
     samplingFrequency = setup.samplingFrequency;
     sesitivity        = setup.sesitivity;
 }
示例#12
0
        void button7_Click(object sender, EventArgs e)
        {
            DialogResult result = fileDialog.ShowDialog();

            if (result == DialogResult.OK)
            {
                string path = fileDialog.FileName;

                ((FunctionBlockHandler)functionBlocks[AnalysisType.FBHandler]).StopPlay();

                SoundCardSetup setup = functionBlocks[AnalysisType.Playback].Settings as SoundCardSetup;
                setup.path = path;
                functionBlocks[AnalysisType.Playback].Settings = setup;

                functionBlocks[AnalysisType.FFTAnalysis].Reset();
                ((FunctionBlockHandler)functionBlocks[AnalysisType.FBHandler]).StartPlay();
            }
        }
示例#13
0
        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
            {
            }
        }
示例#14
0
        public void StartPlay()
        {
            if (threadPlayBack != null)
            {
                return;
            }

            playIndicator.BackColor = Color.FromArgb(192, 0, 0);
            SetIterator(playBack.CreateIterator());
            iteratorPlay = iterator;
            playBack.Subscribe(this);

            SoundCardSetup setup = playBack.Settings as SoundCardSetup;

            setup.running     = true;
            playBack.Settings = setup;

            threadPlayBack      = new Thread(new ThreadStart(playBack.Compute));
            threadPlayBack.Name = "PlayBack";
            threadPlayBack.Start();
        }
示例#15
0
        public void StartSound()
        {
            if (threadSoundCard != null)
            {
                return;
            }

            soundIndicator.BackColor = Color.FromArgb(192, 0, 0);
            SetIterator(soundCard.CreateIterator());
            iteratorSound = iterator;
            soundCard.Subscribe(this);

            SoundCardSetup setup = soundCard.Settings as SoundCardSetup;

            setup.running      = true;
            soundCard.Settings = setup;

            threadSoundCard      = new Thread(new ThreadStart(soundCard.Compute));
            threadSoundCard.Name = "SoundCard";
            threadSoundCard.Start();
        }
示例#16
0
        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();
        }