mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-11-22 16:08:39 -05:00
Tx ph.1: fixed sample source FIFO
This commit is contained in:
parent
f87b714ac7
commit
8f70840561
@ -178,14 +178,14 @@ void DSPDeviceSinkEngine::work()
|
||||
|
||||
if ((m_threadedBasebandSampleSources.size() + m_basebandSampleSources.size()) > 0)
|
||||
{
|
||||
for (int is = 0; is < nbWriteSamples; is++, ++writeAt)
|
||||
for (int is = 0; is < nbWriteSamples; is++)
|
||||
{
|
||||
// pull data from threaded sources and merge them in the device sample FIFO
|
||||
for (ThreadedBasebandSampleSources::iterator it = m_threadedBasebandSampleSources.begin(); it != m_threadedBasebandSampleSources.end(); ++it)
|
||||
{
|
||||
(*it)->pull(s);
|
||||
s /= (m_threadedBasebandSampleSources.size() + m_basebandSampleSources.size());
|
||||
*writeAt += s;
|
||||
(*writeAt) += s;
|
||||
}
|
||||
|
||||
// pull data from direct sources and merge them in the device sample FIFO
|
||||
@ -193,8 +193,10 @@ void DSPDeviceSinkEngine::work()
|
||||
{
|
||||
(*it)->pull(s);
|
||||
s /= (m_threadedBasebandSampleSources.size() + m_basebandSampleSources.size());
|
||||
*writeAt += s;
|
||||
(*writeAt) += s;
|
||||
}
|
||||
|
||||
sampleFifo->bumpIndex(writeAt);
|
||||
}
|
||||
|
||||
// feed the mix to the sinks normally just the main spectrum vis
|
||||
|
@ -57,14 +57,14 @@ void SampleSourceFifo::read(SampleVector::iterator& beginRead, unsigned int nbSa
|
||||
}
|
||||
else if (i_delta > 0)
|
||||
{
|
||||
if (i_delta < m_samplesChunkSize)
|
||||
if (i_delta <= m_samplesChunkSize)
|
||||
{
|
||||
emit dataWrite();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (i_delta + m_size < m_samplesChunkSize)
|
||||
if (i_delta + m_size <= m_samplesChunkSize)
|
||||
{
|
||||
emit dataWrite();
|
||||
}
|
||||
@ -87,13 +87,14 @@ void SampleSourceFifo::getWriteIterator(SampleVector::iterator& writeAt)
|
||||
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_iw = (m_iw+1) % m_size;
|
||||
|
||||
{
|
||||
QMutexLocker mutexLocker(&m_mutex);
|
||||
m_iw = (m_iw+1) % m_size;
|
||||
}
|
||||
|
||||
writeAt = m_data.begin() + m_iw;
|
||||
}
|
||||
|
@ -38,7 +38,7 @@ public:
|
||||
void read(SampleVector::iterator& beginRead, unsigned int nbSamples);
|
||||
|
||||
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
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user