1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2025-02-03 09:44:01 -05:00

Tx ph.1: fixed sample source FIFO

This commit is contained in:
f4exb 2016-10-23 23:27:19 +02:00
parent f87b714ac7
commit 8f70840561
3 changed files with 554 additions and 551 deletions

File diff suppressed because it is too large Load Diff

View File

@ -57,14 +57,14 @@ void SampleSourceFifo::read(SampleVector::iterator& beginRead, unsigned int nbSa
} }
else if (i_delta > 0) else if (i_delta > 0)
{ {
if (i_delta < m_samplesChunkSize) if (i_delta <= m_samplesChunkSize)
{ {
emit dataWrite(); emit dataWrite();
} }
} }
else else
{ {
if (i_delta + m_size < m_samplesChunkSize) if (i_delta + m_size <= m_samplesChunkSize)
{ {
emit dataWrite(); emit dataWrite();
} }
@ -87,13 +87,14 @@ void SampleSourceFifo::getWriteIterator(SampleVector::iterator& writeAt)
writeAt = m_data.begin() + m_iw; writeAt = m_data.begin() + m_iw;
} }
void SampleSourceFifo::bumpIndex() void SampleSourceFifo::bumpIndex(SampleVector::iterator& writeAt)
{ {
m_data[m_iw+m_size] = m_data[m_iw]; m_data[m_iw+m_size] = m_data[m_iw];
m_iw = (m_iw+1) % m_size;
{ {
QMutexLocker mutexLocker(&m_mutex); QMutexLocker mutexLocker(&m_mutex);
m_iw = (m_iw+1) % m_size; m_iw = (m_iw+1) % m_size;
} }
writeAt = m_data.begin() + m_iw;
} }

View File

@ -38,7 +38,7 @@ public:
void read(SampleVector::iterator& beginRead, unsigned int nbSamples); void read(SampleVector::iterator& beginRead, unsigned int nbSamples);
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(); //!< 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
void write(const Sample& sample); //!< write directly - phase 1 + phase 2 void write(const Sample& sample); //!< write directly - phase 1 + phase 2