pub struct SdrFileReader { /* private fields */ }
Expand description
Create a new SdrFileReader
using the builder pattern.
Then call read_next_chunk_complexf32
or read_next_chunk_complexf64
to read the samples.
§Example
use sdr_iq_file_reader::{SdrFileReader, SampleType};
let mut reader = SdrFileReader::builder()
.file_path("gqrx_20240929_015218_580206500_2400000_fc.raw")
.samples_per_chunk(1024)
.sample_type(SampleType::F32)
.build()
.expect("Failed to create SdrFileReader");
let samples = reader.read_next_chunk_complexf32().unwrap();
Implementations§
Source§impl SdrFileReader
impl SdrFileReader
Sourcepub fn read_next_chunk_complexf32(
&mut self,
) -> Result<Option<Vec<Complex<f32>>>, Error>
pub fn read_next_chunk_complexf32( &mut self, ) -> Result<Option<Vec<Complex<f32>>>, Error>
Read the next chunk of samples as Complex
§Warning
If you have set the sample type to SampleType::F64
, you should use read_next_chunk_complexf64
instead. Otherwise, the values will be truncated and you will lose accuracy.
§Returns
Ok(Some(samples))
if there are samples in the chunkOk(None)
if the end of the file is reached
§Errors
std::io::Error
if there was an error reading the file other than reaching the end
pub fn builder<__0>() -> SdrFileReaderBuilder<__0>
Auto Trait Implementations§
impl Freeze for SdrFileReader
impl RefUnwindSafe for SdrFileReader
impl Send for SdrFileReader
impl Sync for SdrFileReader
impl Unpin for SdrFileReader
impl UnwindSafe for SdrFileReader
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more