From 6f39df6a7becc4f6c247f6892088e7a1b4624439 Mon Sep 17 00:00:00 2001 From: Josh Bailey Date: Wed, 3 Apr 2024 00:09:06 +0000 Subject: [PATCH] add gain. --- lib/sample_pipeline.cpp | 4 ++-- lib/sample_pipeline.h | 2 +- lib/sample_pipeline_test.cpp | 4 ++-- lib/uhd_sample_recorder.cpp | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/sample_pipeline.cpp b/lib/sample_pipeline.cpp index 16d3103..8d0d864 100644 --- a/lib/sample_pipeline.cpp +++ b/lib/sample_pipeline.cpp @@ -261,12 +261,12 @@ void sample_pipeline_start(const std::string &file, const std::string &fft_file, } void sample_pipeline_stop(size_t overflows, const std::string &file, - size_t rate, size_t freq, double timestamp) { + size_t rate, size_t freq, double timestamp, double gain) { samples_input_done = true; writer_threads->join_all(); sample_writer->close(overflows); fft_sample_writer->close(overflows); - sample_writer->write_sigmf(file + ".sigmf-meta", timestamp, "s16", rate, freq, 0); + sample_writer->write_sigmf(file + ".sigmf-meta", timestamp, "s16", rate, freq, gain); if (useVkFFT) { free_vkfft(); } diff --git a/lib/sample_pipeline.h b/lib/sample_pipeline.h index 7a9fb18..643d249 100644 --- a/lib/sample_pipeline.h +++ b/lib/sample_pipeline.h @@ -11,6 +11,6 @@ void sample_pipeline_start(const std::string &file, const std::string &fft_file, size_t sample_id); size_t get_samp_size(); void sample_pipeline_stop(size_t overflows, const std::string &file, - size_t rate, size_t freq, double timestamp); + size_t rate, size_t freq, double timestamp, double gain); void set_sample_pipeline_types(const std::string &type, std::string &cpu_format); diff --git a/lib/sample_pipeline_test.cpp b/lib/sample_pipeline_test.cpp index 0c8c5fb..7cfbaf5 100644 --- a/lib/sample_pipeline_test.cpp +++ b/lib/sample_pipeline_test.cpp @@ -10,7 +10,7 @@ BOOST_AUTO_TEST_CASE(SmokeTest) { set_sample_pipeline_types("short", cpu_format); BOOST_TEST(cpu_format == "sc16"); sample_pipeline_start("", "", 1e6, 1, false, 0, 0, 1, 1, 1e6, 0, 0); - sample_pipeline_stop(0, "", 1e6, 1e6, 1.1); + sample_pipeline_stop(0, "", 1e6, 1e6, 1.1, -1); } BOOST_AUTO_TEST_CASE(RandomFFTTest) { @@ -33,7 +33,7 @@ BOOST_AUTO_TEST_CASE(RandomFFTTest) { memcpy(buffer_p, samples.memptr(), samples.size() * sizeof(std::complex)); enqueue_samples(write_ptr); - sample_pipeline_stop(0, file, 1e3 * 1024, 100e6, 1.1); + sample_pipeline_stop(0, file, 1e3 * 1024, 100e6, 1.1, -1); arma::Col> disk_samples; disk_samples.copy_size(samples); FILE *samples_fp = fopen(file.c_str(), "rb"); diff --git a/lib/uhd_sample_recorder.cpp b/lib/uhd_sample_recorder.cpp index d6fd270..9a303a2 100644 --- a/lib/uhd_sample_recorder.cpp +++ b/lib/uhd_sample_recorder.cpp @@ -205,7 +205,7 @@ void sample_record(uhd::usrp::multi_usrp::sptr usrp, const std::string &type, stream_cmd.stream_mode = uhd::stream_cmd_t::STREAM_MODE_STOP_CONTINUOUS; rx_stream->issue_stream_cmd(stream_cmd); std::cerr << "stream stopped" << std::endl; - sample_pipeline_stop(overflows, file, rate, freq, timestamp); + sample_pipeline_stop(overflows, file, rate, freq, timestamp, gain); std::cerr << "pipeline stopped" << std::endl; }