예제 #1
0
        private void StartRecording()
        {
            if (recording)
                return;
            Guid guid = ((DeviceItem)deviceCombo.SelectedItem).DeviceInformation.DriverGuid;

            const int Fs = 44100;

            powerMeter = new PowerMeter(Util.CalcBufferSize(0.1f, Fs));
            powerMeter.PowerUpdated += new PowerMeter.PowerUpdatedHandler(powerMeter_PowerUpdated);

            waveCap = new WaveCapture(guid, Fs, 32 * 1024, 50);
            frontEnd = new FrontEnd(Fs, 1022.76);
            UnitOffset<float> offset = new UnitOffset<float>();
            BitCombiner combiner1 = new BitCombiner();
            BitCombiner combiner2 = new BitCombiner();
            decider1 = new Decider(1);
            decider2 = new Decider(2);
            FirstOneWins<bool> firstOneWins = new FirstOneWins<bool>();
            ConvertToBytes convertToBytes = new ConvertToBytes();
            Progress progress = new Progress();

            // set up capture outputs
            waveCap.Output.Connect(frontEnd.Input);
            waveCap.Output.Connect(powerMeter.Input);

            // set up front-end outputs
            InputPin<float> phasePin = new InputPin<float>();
            frontEnd.PhaseOutput.Connect(phasePin);
            phasePin.BufferFilled += new InputPin<float>.BufferFilledHandler(PhaseOutputBuffer_BufferFilled);
            frontEnd.EyeOutput.Connect(eyePlot1.Input);
            frontEnd.Output.Connect(combiner1.Input);
            frontEnd.Output.Connect(offset.Input);
            offset.Output.Connect(combiner2.Input);

            // Set up combiner outputs
            combiner1.Output.Connect(decider1.Input);
            combiner2.Output.Connect(decider2.Input);

            // Set up decider outputs
            decider1.Output.Connect(firstOneWins.Input1);
            decider2.Output.Connect(firstOneWins.Input2);

            firstOneWins.Output.Connect(convertToBytes.Input);

            convertToBytes.Output.Connect(progress.Input);

            // TODO: Look into reset signal crap...

            phasePlot2.Clear();
            phasePlot2.Reset();
            eyePlot1.Clear();

            waveCap.Start();
            deviceCombo.Enabled = false;

            recording = true;
        }
예제 #2
0
 public Receiver(ReceiverSettings settings)
 {
     if (settings == null)
         throw new ArgumentNullException("settings");
     if (settings.SamplingFrequency <= 0.0f)
         throw new ArgumentOutOfRangeException("settings", "Settings request an invalid sampling frequency. Sampling frequency must be positive.");
     if (settings.CarrierFrequency <= 0.0f)
         throw new ArgumentOutOfRangeException("settings", "Settings request an invalid carrier frequency. Carrier frequency must be positive.");
     this.settings = settings;
     this.frontEnd = new FrontEnd(settings.SamplingFrequency, settings.CarrierFrequency);
 }