Beispiel #1
0
        private void btnFormat_Click(object sender, EventArgs e)
        {
            DataFormatDialog dlg = new DataFormatDialog();

            dlg.SamplingRate = SamplingRate;
            dlg.SampleFormat = SampleFormat;

            if (dlg.ShowDialog() == DialogResult.OK)
            {
                SampleFormat = dlg.SampleFormat;

                _SampleSource.DataFormat = SampleFormat;
                _SampleSource.ForceInputRate(dlg.SamplingRate);
                NetShmemSink.Rate = dlg.SamplingRate * 2;
            }
        }
Beispiel #2
0
        public FileSampleSource(string fileName, int oversampling) : base(oversampling)
        {
            SourceName = fileName;

            switch (WaveFileReader.EstimateType(fileName))
            {
            case eFileType.CFile:
                /* USRP has an inverted spectrum */
                InvertedSpectrum = true;

                DataFormat = ByteUtil.eSampleFormat.Direct32BitIQFloat64k;

                /* calculate sampling rate from USRPs decimation rate */
                CFileDecimationDialog dec = new CFileDecimationDialog();
                dec.EstimateDecimation(fileName);
                dec.ShowDialog();

                if (dec.Decimation < 1)
                {
                    dec.Decimation = 1;
                }

                InputSamplingRate = (double)dec.ClockRate / dec.Decimation;
                InputStream       = new WaveFileReader(fileName, eFileType.CFile);

                break;

            case eFileType.RawIQ:
                InvertedSpectrum = false;

                DataFormatDialog dlg = new DataFormatDialog();
                dlg.SampleFormat = ByteUtil.eSampleFormat.Direct16BitIQFixedPointLE;
                dlg.EstimateDetails(fileName);
                dlg.ShowDialog();

                InputSamplingRate = dlg.SamplingRate;
                DataFormat        = dlg.SampleFormat;
                InputStream       = new WaveFileReader(fileName, eFileType.RawIQ);

                break;

            case eFileType.Rtsa:
                InvertedSpectrum = false;

                InputStream       = new RtsaFileReader(fileName);
                InputSamplingRate = InputStream.SamplingRate;
                DataFormat        = ByteUtil.eSampleFormat.Direct32BitIQFloat;

                break;

            case eFileType.WAV:
                InputStream       = new WaveFileReader(fileName, eFileType.WAV);
                InputSamplingRate = InputStream.SamplingRate;
                DataFormat        = ByteUtil.eSampleFormat.Direct16BitIQFixedPointLE;
                break;

            case eFileType.CSV:
                InputStream       = new CsvFileReader(fileName);
                InputSamplingRate = InputStream.SamplingRate;
                DataFormat        = ByteUtil.eSampleFormat.Direct32BitIQFloat;
                break;

            case eFileType.Unknown:
                return;
            }
            AllocateBuffers();
        }