1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-04 16:01:14 -05:00

Tx ph.1: fixed read pointer management when getting new samples

This commit is contained in:
f4exb 2016-10-25 03:31:36 +02:00
parent ee55747c0b
commit 0fc6d95357
6 changed files with 24 additions and 20 deletions

View File

@ -27,6 +27,16 @@ These plugins come from the parent code base and have been maintained so that th
From version 2 SDRangel can integrate more than one hardware device running concurrently. From version 2 SDRangel can integrate more than one hardware device running concurrently.
<h2>Transmission support</h2>
Transmission or signal generation support for eligible devices (BladeRF and HackRF) will be progressively introduced with the following roadmap:
- Phase 1: version 2.2.0: generation to file (File Sink) with AM modulator with simple sine modulation. Fixed sample rate of 48 kS/s (no interpolation)
- Phase 2: version 2.2.x: full baseband interpolation chain: in AM modulator and Up Channelizer.
- Phase 3: version 2.3.0: FM and SSB modulators with audio file input
- Phase 4: version 2.3.x: Audio (Mic) input support
- phase 5: version 3.0.0: BladeRF and HackRF support including final interpolation stage.
<h2>Airspy</h2> <h2>Airspy</h2>
Airspy is supported through the libairspy library that should be installed in your system for proper build of the software and operation support. Add `libairspy-dev` to the list of dependencies to install. Airspy is supported through the libairspy library that should be installed in your system for proper build of the software and operation support. Add `libairspy-dev` to the list of dependencies to install.

View File

@ -26,7 +26,6 @@ FileSinkThread::FileSinkThread(std::ofstream *samplesStream, SampleSourceFifo* s
QThread(parent), QThread(parent),
m_running(false), m_running(false),
m_ofstream(samplesStream), m_ofstream(samplesStream),
m_buf(0),
m_bufsize(0), m_bufsize(0),
m_samplesChunkSize(0), m_samplesChunkSize(0),
m_sampleFifo(sampleFifo), m_sampleFifo(sampleFifo),
@ -43,10 +42,6 @@ FileSinkThread::~FileSinkThread()
if (m_running) { if (m_running) {
stopWork(); stopWork();
} }
if (m_buf != 0) {
free(m_buf);
}
} }
void FileSinkThread::startWork() void FileSinkThread::startWork()
@ -132,10 +127,11 @@ void FileSinkThread::tick()
m_throttleToggle = !m_throttleToggle; m_throttleToggle = !m_throttleToggle;
} }
SampleVector::iterator beginRead; SampleVector::iterator readUntil;
m_sampleFifo->readAndSignal(beginRead, m_samplesChunkSize); m_sampleFifo->readAdvance(readUntil, m_samplesChunkSize);
m_ofstream->write(reinterpret_cast<char*>(&(*beginRead)), m_samplesChunkSize*4); SampleVector::iterator beginRead = readUntil - m_samplesChunkSize;
m_ofstream->write(reinterpret_cast<char*>(&(*beginRead)), m_samplesChunkSize*sizeof(Sample));
m_samplesCount += m_samplesChunkSize; m_samplesCount += m_samplesChunkSize;
} }
} }

View File

@ -55,7 +55,6 @@ private:
bool m_running; bool m_running;
std::ofstream* m_ofstream; std::ofstream* m_ofstream;
quint8 *m_buf;
std::size_t m_bufsize; std::size_t m_bufsize;
unsigned int m_samplesChunkSize; unsigned int m_samplesChunkSize;
SampleSourceFifo* m_sampleFifo; SampleSourceFifo* m_sampleFifo;

View File

@ -50,15 +50,13 @@ void SampleSourceFifo::init()
m_init = true; m_init = true;
} }
void SampleSourceFifo::readAndSignal(SampleVector::iterator& beginRead, unsigned int nbSamples) void SampleSourceFifo::readAdvance(SampleVector::iterator& readUntil, unsigned int nbSamples)
{ {
QMutexLocker mutexLocker(&m_mutex); QMutexLocker mutexLocker(&m_mutex);
assert(nbSamples < m_samplesChunkSize/2); assert(nbSamples < m_samplesChunkSize/2);
beginRead = m_data.begin() + m_size + m_ir;
m_ir = (m_ir + nbSamples) % m_size; m_ir = (m_ir + nbSamples) % m_size;
readUntil = m_data.begin() + m_size + m_ir;
emit dataRead(nbSamples); emit dataRead(nbSamples);
int i_delta = m_iw - m_ir; int i_delta = m_iw - m_ir;

View File

@ -35,10 +35,10 @@ public:
void resize(uint32_t size, uint32_t samplesChunkSize); void resize(uint32_t size, uint32_t samplesChunkSize);
void init(); void init();
/** begin read at current read point for the given length and activate R/W signals */ /** advance read pointer for the given length and activate R/W signals */
void readAndSignal(SampleVector::iterator& beginRead, unsigned int nbSamples); void readAdvance(SampleVector::iterator& readUntil, unsigned int nbSamples);
void getReadIterator(SampleVector::iterator& readUntil); //!< get iterator past the last sample that was read by a read with signal (i.e. current read iterator) void getReadIterator(SampleVector::iterator& readUntil); //!< get iterator past the last sample of a read advance operation (i.e. current read iterator)
void getWriteIterator(SampleVector::iterator& writeAt); //!< get iterator to current item for update - write phase 1 void getWriteIterator(SampleVector::iterator& writeAt); //!< get iterator to current item for update - write phase 1
void bumpIndex(SampleVector::iterator& writeAt); //!< copy current item to second buffer and bump write index - write phase 2 void bumpIndex(SampleVector::iterator& writeAt); //!< copy current item to second buffer and bump write index - write phase 2

View File

@ -4,7 +4,7 @@
Starting with version 2 SDRangel supports several sampling devices simultaneously. Each concurrent device is associated to a slot with a set of tabbed windows in the UI. These tabs are marked R0, R1, R2... Starting with version 2 SDRangel supports several sampling devices simultaneously. Each concurrent device is associated to a slot with a set of tabbed windows in the UI. These tabs are marked R0, R1, R2...
The slots are arranged in a stacked fashion so that when a new device is added with the Acquisition -> Add device menu a new slot is allocated in the last position and when a devcie is removed with the Acquisition -> Remove device menu the slot in the last position is deleted. Slot 0 (R0) is created at initialization and cannot be deleted with the menu. The slots are arranged in a stacked fashion so that when a new device is added with the Acquisition -> Add device menu a new slot is allocated in the last position and when a devcie is removed with the Acquisition -> Remove device menu the slot in the last position is deleted. Slot 0 (R0) receiver slot is created at initialization and cannot be deleted with the menu. The letter "R" in the tab names indicates that the slot is for a receiver (source) device while "T" designates a tramsmitter (sink) device.
The tabbed windows are: The tabbed windows are:
@ -32,9 +32,10 @@ The following items are presented hierarchically from left to right:
- Exit (shortcut Ctl-Q): Exit the program - Exit (shortcut Ctl-Q): Exit the program
- View: - View:
- Fullscreen (Shortcut F11): Toggle full screen mode - Fullscreen (Shortcut F11): Toggle full screen mode
- Acquisition: - Devices:
- Add device: adds a new sampling device slot to the device stack (last position) - Add source device: adds a new source (receiver) device slot to the device stack (last position)
- Remove device: removes the last sampling device slot from thte device stack - Add sink device: adds a new sink (transmitter) device slot to the device stack (last position)
- Remove device: removes the last device slot from thte device stack
- Window: presents the list of dockable windows. Check to make it visible. Uncheck to hide. These windows are: - Window: presents the list of dockable windows. Check to make it visible. Uncheck to hide. These windows are:
- Sampling devices control: control of which sampling devices is used and add channels - Sampling devices control: control of which sampling devices is used and add channels
- Sampling devices: the sampling devices UIs - Sampling devices: the sampling devices UIs