libpg2sdr
Host library for the ProStick Gen 2 SDR
Loading...
Searching...
No Matches
pg2sdr_sample_buffer Struct Reference

Sample buffer passed to pg2sdr_stream_callback. More...

#include <pg2sdr.h>

Data Fields

pg2sdr_conversion_mode_t mode
 Conversion mode applied to these samples.
 
int16_t * samples
 Sample data.
 
unsigned count
 Number of user samples available in samples.
 
uint64_t timestamp
 Sample timestamp at the start of this buffer.
 

Detailed Description

Sample buffer passed to pg2sdr_stream_callback.

Contains metadata and actual received samples to be processed by the library user.

libpg2sdr guarantees that (to the best of the ability of the hardware to detect it), within a single pg2sdr_sample_buffer, there are no gaps in the received data. That is, if sample data is dropped and there is a detectable gap in the sample stream, then the library will ensure that the gap appears at a boundary between buffers, not within a buffer.

Field Documentation

◆ count

unsigned pg2sdr_sample_buffer::count

Number of user samples available in samples.

This counts user samples, not int16_t values. The number of int16_t values per sample depends on the value of mode.

pg2sdr_set_buffer_size() controls the maximum number of user samples provided per sample buffer, i.e. the maximum potential value of "count".

◆ mode

pg2sdr_conversion_mode_t pg2sdr_sample_buffer::mode

Conversion mode applied to these samples.

This determines the number of int16_t values per user sample.

In PG2SDR_MODE_LOWIF_REAL mode, each sample is a single 16-bit value.

In PG2SDR_MODE_BASEBAND mode, each sample is two 16-bit values representing the I and Q channels respectively.

◆ samples

int16_t* pg2sdr_sample_buffer::samples

Sample data.

Each user sample is one or two int16_t values, depending on the conversion mode (see mode)

◆ timestamp

uint64_t pg2sdr_sample_buffer::timestamp

Sample timestamp at the start of this buffer.

The sample timestamp is the cumulative number of received user samples, incrementing at the configured sampling rate.

This counter may not initially start at zero, and may be discontinuous between buffers if an overrun causes data to be dropped. To detect discontinuities, look for callbacks where current_buffer->timestamp > last_buffer->timestamp + last_buffer->count.


The documentation for this struct was generated from the following file: