SDRAngel  4.11.5
Developer docs for <a href="https://github.com/f4exb/sdrangel">SDRangel<\a>, an Open Source Qt5 / OpenGL 3.0+ SDR and signal analyzer frontend to various hardware.
Public Member Functions | Protected Slots | Protected Member Functions | Protected Attributes | List of all members
BasebandSampleSource Class Referenceabstract

#include <basebandsamplesource.h>

+ Inheritance diagram for BasebandSampleSource:
+ Collaboration diagram for BasebandSampleSource:

Public Member Functions

 BasebandSampleSource ()
 
virtual ~BasebandSampleSource ()
 
virtual void start ()=0
 
virtual void stop ()=0
 
virtual void pull (Sample &sample)=0
 
virtual void pullAudio (int nbSamples)
 
void feed (SampleSourceFifo *sampleFifo, int nbSamples)
 
SampleSourceFifogetSampleSourceFifo ()
 
virtual bool handleMessage (const Message &cmd)=0
 Processing of a message. Returns true if message has actually been processed. More...
 
MessageQueuegetInputMessageQueue ()
 Get the queue for asynchronous inbound communication. More...
 
virtual void setMessageQueueToGUI (MessageQueue *queue)
 
MessageQueuegetMessageQueueToGUI ()
 
void setDeviceSampleSourceFifo (SampleSourceFifo *deviceSampleFifo)
 

Protected Slots

void handleInputMessages ()
 
void handleWriteToFifo (int nbSamples)
 
void handleWriteToDeviceFifo (int nbSamples)
 

Protected Member Functions

void handleWriteToFifo (SampleSourceFifo *sampleFifo, int nbSamples)
 

Protected Attributes

MessageQueue m_inputMessageQueue
 Queue for asynchronous inbound communication. More...
 
MessageQueuem_guiMessageQueue
 Input message queue to the GUI. More...
 
SampleSourceFifo m_sampleFifo
 Internal FIFO for multi-channel processing. More...
 
SampleSourceFifom_deviceSampleFifo
 Reference to the device FIFO for single channel processing. More...
 

Detailed Description

Definition at line 30 of file basebandsamplesource.h.

Constructor & Destructor Documentation

◆ BasebandSampleSource()

BasebandSampleSource::BasebandSampleSource ( )

Definition at line 22 of file basebandsamplesource.cpp.

References handleInputMessages(), handleWriteToFifo(), m_inputMessageQueue, and m_sampleFifo.

22  :
24  m_sampleFifo(48000), // arbitrary, will be adjusted to match device sink FIFO size
26 {
27  connect(&m_inputMessageQueue, SIGNAL(messageEnqueued()), this, SLOT(handleInputMessages()));
28  connect(&m_sampleFifo, SIGNAL(dataWrite(int)), this, SLOT(handleWriteToFifo(int)));
29 }
void handleWriteToFifo(SampleSourceFifo *sampleFifo, int nbSamples)
SampleSourceFifo * m_deviceSampleFifo
Reference to the device FIFO for single channel processing.
SampleSourceFifo m_sampleFifo
Internal FIFO for multi-channel processing.
MessageQueue * m_guiMessageQueue
Input message queue to the GUI.
MessageQueue m_inputMessageQueue
Queue for asynchronous inbound communication.
+ Here is the call graph for this function:

◆ ~BasebandSampleSource()

BasebandSampleSource::~BasebandSampleSource ( )
virtual

Definition at line 31 of file basebandsamplesource.cpp.

32 {
33 }

Member Function Documentation

◆ feed()

void BasebandSampleSource::feed ( SampleSourceFifo sampleFifo,
int  nbSamples 
)
inline

direct feeding of sample source FIFO

Definition at line 42 of file basebandsamplesource.h.

References SampleSourceFifo::bumpIndex(), SampleSourceFifo::getWriteIterator(), and i.

Referenced by ThreadedBasebandSampleSource::feed().

43  {
44  SampleVector::iterator writeAt;
45  sampleFifo->getWriteIterator(writeAt);
46  pullAudio(nbSamples); // Pre-fetch input audio samples this is mandatory to keep things running smoothly
47 
48  for (int i = 0; i < nbSamples; i++)
49  {
50  pull((*writeAt));
51  sampleFifo->bumpIndex(writeAt);
52  }
53  }
virtual void pullAudio(int nbSamples)
void bumpIndex(SampleVector::iterator &writeAt)
copy current item to second buffer and bump write index - write phase 2
virtual void pull(Sample &sample)=0
int32_t i
Definition: decimators.h:244
void getWriteIterator(SampleVector::iterator &writeAt)
get iterator to current item for update - write phase 1
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getInputMessageQueue()

MessageQueue* BasebandSampleSource::getInputMessageQueue ( )
inline

Get the queue for asynchronous inbound communication.

Definition at line 59 of file basebandsamplesource.h.

Referenced by AMMod::AMMod(), LocalSourceGUI::applyChannelSettings(), FileSourceGUI::applyChannelSettings(), UpChannelizer::applyConfiguration(), UpChannelizer::applySetting(), LocalSourceGUI::applySettings(), UDPSourceGUI::applySettings(), NFMModGUI::applySettings(), AMModGUI::applySettings(), RemoteSourceGUI::applySettings(), ATVModGUI::applySettings(), WFMModGUI::applySettings(), FreeDVModGUI::applySettings(), FileSourceGUI::applySettings(), SSBModGUI::applySettings(), WFMMod::applySettings(), AMMod::applySettings(), NFMMod::applySettings(), FreeDVMod::applySettings(), SSBMod::applySettings(), FileSourceGUI::configureFileName(), AMModGUI::configureFileName(), FreeDVModGUI::configureFileName(), NFMModGUI::configureFileName(), WFMModGUI::configureFileName(), SSBModGUI::configureFileName(), ATVModGUI::configureImageFileName(), ATVModGUI::configureVideoFileName(), FreeDVMod::FreeDVMod(), UpChannelizer::handleMessage(), UDPSource::handleMessage(), LocalSource::handleMessage(), AMMod::handleMessage(), WFMMod::handleMessage(), NFMMod::handleMessage(), SSBMod::handleMessage(), FreeDVMod::handleMessage(), FileSource::handleMessage(), ATVMod::handleMessage(), NFMMod::NFMMod(), ATVModGUI::on_cameraManualFPS_valueChanged(), ATVModGUI::on_cameraManualFPSEnable_toggled(), ATVModGUI::on_camSelect_currentIndexChanged(), FileSourceGUI::on_navTime_valueChanged(), AMModGUI::on_navTimeSlider_valueChanged(), NFMModGUI::on_navTimeSlider_valueChanged(), FreeDVModGUI::on_navTimeSlider_valueChanged(), WFMModGUI::on_navTimeSlider_valueChanged(), SSBModGUI::on_navTimeSlider_valueChanged(), ATVModGUI::on_navTimeSlider_valueChanged(), FileSourceGUI::on_play_toggled(), FileSourceGUI::on_playLoop_toggled(), UDPSource::resetReadIndex(), UDPSource::setSpectrum(), SSBMod::SSBMod(), RemoteSourceGUI::tick(), FileSourceGUI::tick(), AMModGUI::tick(), FreeDVModGUI::tick(), NFMModGUI::tick(), WFMModGUI::tick(), SSBModGUI::tick(), ATVModGUI::tick(), and WFMMod::WFMMod().

+ Here is the caller graph for this function:

◆ getMessageQueueToGUI()

MessageQueue* BasebandSampleSource::getMessageQueueToGUI ( )
inline

◆ getSampleSourceFifo()

SampleSourceFifo& BasebandSampleSource::getSampleSourceFifo ( )
inline

Definition at line 55 of file basebandsamplesource.h.

55 { return m_sampleFifo; }
SampleSourceFifo m_sampleFifo
Internal FIFO for multi-channel processing.

◆ handleInputMessages

void BasebandSampleSource::handleInputMessages ( )
protectedslot

Definition at line 35 of file basebandsamplesource.cpp.

References handleMessage(), m_inputMessageQueue, and MessageQueue::pop().

Referenced by BasebandSampleSource().

36 {
37  Message* message;
38 
39  while ((message = m_inputMessageQueue.pop()) != 0)
40  {
41  if (handleMessage(*message))
42  {
43  delete message;
44  }
45  }
46 }
Message * pop()
Pop message from queue.
virtual bool handleMessage(const Message &cmd)=0
Processing of a message. Returns true if message has actually been processed.
MessageQueue m_inputMessageQueue
Queue for asynchronous inbound communication.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ handleMessage()

virtual bool BasebandSampleSource::handleMessage ( const Message cmd)
pure virtual

Processing of a message. Returns true if message has actually been processed.

Implemented in ATVMod, FileSource, FreeDVMod, SSBMod, NFMMod, WFMMod, AMMod, RemoteSource, LocalSource, UDPSource, and UpChannelizer.

Referenced by handleInputMessages(), ThreadedBasebandSampleSource::handleSourceMessage(), and DSPDeviceSinkEngine::handleSynchronousMessages().

+ Here is the caller graph for this function:

◆ handleWriteToDeviceFifo

void BasebandSampleSource::handleWriteToDeviceFifo ( int  nbSamples)
protectedslot

Definition at line 53 of file basebandsamplesource.cpp.

References handleWriteToFifo(), and m_deviceSampleFifo.

Referenced by setDeviceSampleSourceFifo().

54 {
56 }
void handleWriteToFifo(SampleSourceFifo *sampleFifo, int nbSamples)
SampleSourceFifo * m_deviceSampleFifo
Reference to the device FIFO for single channel processing.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ handleWriteToFifo() [1/2]

void BasebandSampleSource::handleWriteToFifo ( SampleSourceFifo sampleFifo,
int  nbSamples 
)
protected

Definition at line 58 of file basebandsamplesource.cpp.

References SampleSourceFifo::bumpIndex(), SampleSourceFifo::getWriteIterator(), i, pull(), and pullAudio().

Referenced by BasebandSampleSource(), handleWriteToDeviceFifo(), and handleWriteToFifo().

59 {
60  SampleVector::iterator writeAt;
61  sampleFifo->getWriteIterator(writeAt);
62  pullAudio(nbSamples); // Pre-fetch input audio samples this is mandatory to keep things running smoothly
63 
64  for (int i = 0; i < nbSamples; i++)
65  {
66  pull((*writeAt));
67  sampleFifo->bumpIndex(writeAt);
68  }
69 }
virtual void pullAudio(int nbSamples)
void bumpIndex(SampleVector::iterator &writeAt)
copy current item to second buffer and bump write index - write phase 2
virtual void pull(Sample &sample)=0
int32_t i
Definition: decimators.h:244
void getWriteIterator(SampleVector::iterator &writeAt)
get iterator to current item for update - write phase 1
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ handleWriteToFifo [2/2]

void BasebandSampleSource::handleWriteToFifo ( int  nbSamples)
protectedslot

Definition at line 48 of file basebandsamplesource.cpp.

References handleWriteToFifo(), and m_sampleFifo.

49 {
50  handleWriteToFifo(&m_sampleFifo, nbSamples);
51 }
void handleWriteToFifo(SampleSourceFifo *sampleFifo, int nbSamples)
SampleSourceFifo m_sampleFifo
Internal FIFO for multi-channel processing.
+ Here is the call graph for this function:

◆ pull()

virtual void BasebandSampleSource::pull ( Sample sample)
pure virtual

◆ pullAudio()

virtual void BasebandSampleSource::pullAudio ( int  nbSamples)
inlinevirtual

Reimplemented in ATVMod, FileSource, FreeDVMod, SSBMod, NFMMod, WFMMod, AMMod, RemoteSource, LocalSource, and UpChannelizer.

Definition at line 39 of file basebandsamplesource.h.

Referenced by handleWriteToFifo().

39 { (void) nbSamples; }
+ Here is the caller graph for this function:

◆ setDeviceSampleSourceFifo()

void BasebandSampleSource::setDeviceSampleSourceFifo ( SampleSourceFifo deviceSampleFifo)

Definition at line 72 of file basebandsamplesource.cpp.

References handleWriteToDeviceFifo(), and m_deviceSampleFifo.

73 {
74  if (m_deviceSampleFifo != deviceSampleFifo)
75  {
76  if (m_deviceSampleFifo) {
77  qDebug("BasebandSampleSource::setDeviceSampleSourceFifo: disconnect device FIFO %p", m_deviceSampleFifo);
78  disconnect(m_deviceSampleFifo, SIGNAL(dataWrite(int)), this, SLOT(handleWriteToDeviceFifo(int)));
79  }
80 
81  if (deviceSampleFifo) {
82  qDebug("BasebandSampleSource::setDeviceSampleSourceFifo: connect device FIFO %p", deviceSampleFifo);
83  connect(deviceSampleFifo, SIGNAL(dataWrite(int)), this, SLOT(handleWriteToDeviceFifo(int)));
84  }
85 
86  m_deviceSampleFifo = deviceSampleFifo;
87  }
88 }
void handleWriteToDeviceFifo(int nbSamples)
SampleSourceFifo * m_deviceSampleFifo
Reference to the device FIFO for single channel processing.
+ Here is the call graph for this function:

◆ setMessageQueueToGUI()

virtual void BasebandSampleSource::setMessageQueueToGUI ( MessageQueue queue)
inlinevirtual

◆ start()

virtual void BasebandSampleSource::start ( )
pure virtual

◆ stop()

virtual void BasebandSampleSource::stop ( )
pure virtual

Member Data Documentation

◆ m_deviceSampleFifo

SampleSourceFifo* BasebandSampleSource::m_deviceSampleFifo
protected

Reference to the device FIFO for single channel processing.

Definition at line 68 of file basebandsamplesource.h.

Referenced by handleWriteToDeviceFifo(), and setDeviceSampleSourceFifo().

◆ m_guiMessageQueue

MessageQueue* BasebandSampleSource::m_guiMessageQueue
protected

◆ m_inputMessageQueue

MessageQueue BasebandSampleSource::m_inputMessageQueue
protected

◆ m_sampleFifo

SampleSourceFifo BasebandSampleSource::m_sampleFifo
protected

Internal FIFO for multi-channel processing.

Definition at line 67 of file basebandsamplesource.h.

Referenced by BasebandSampleSource(), and handleWriteToFifo().


The documentation for this class was generated from the following files: