mirror of
https://github.com/AlexandreRouma/SDRPlusPlus.git
synced 2025-02-28 15:03:56 +01:00
more work on network source and syntax cleanup in iq exporter
This commit is contained in:
parent
34171d4edc
commit
95052c34ff
@ -509,7 +509,7 @@ private:
|
|||||||
size = sizeof(int16_t)*2;
|
size = sizeof(int16_t)*2;
|
||||||
break;
|
break;
|
||||||
case SAMPLE_TYPE_INT32:
|
case SAMPLE_TYPE_INT32:
|
||||||
volk_32f_s32f_convert_32i((int32_t*)_this->buffer, (float*)data, (float)2147483647.0f, count*2);
|
volk_32f_s32f_convert_32i((int32_t*)_this->buffer, (float*)data, 2147483647.0f, count*2);
|
||||||
size = sizeof(int32_t)*2;
|
size = sizeof(int32_t)*2;
|
||||||
break;
|
break;
|
||||||
case SAMPLE_TYPE_FLOAT32:
|
case SAMPLE_TYPE_FLOAT32:
|
||||||
|
@ -244,31 +244,37 @@ private:
|
|||||||
}
|
}
|
||||||
|
|
||||||
void worker() {
|
void worker() {
|
||||||
|
// Compute sizes
|
||||||
int blockSize = samplerate / 200;
|
int blockSize = samplerate / 200;
|
||||||
int frameSize = blockSize*SAMPLE_TYPE_SIZE[sampType];
|
int sampleSize = SAMPLE_TYPE_SIZE[sampType];
|
||||||
|
int frameSize = blockSize*sampleSize;
|
||||||
|
|
||||||
|
// Allocate receive buffer
|
||||||
uint8_t* buffer = dsp::buffer::alloc<uint8_t>(frameSize);
|
uint8_t* buffer = dsp::buffer::alloc<uint8_t>(frameSize);
|
||||||
|
|
||||||
while (true) {
|
while (true) {
|
||||||
// Read samples from socket
|
// Read samples from socket
|
||||||
|
int bytes;
|
||||||
{
|
{
|
||||||
std::lock_guard lck(sockMtx);
|
std::lock_guard lck(sockMtx);
|
||||||
int bytes = sock->recv(buffer, frameSize, true);
|
bytes = sock->recv(buffer, frameSize, true);
|
||||||
|
if (bytes <= 0) { break; }
|
||||||
}
|
}
|
||||||
|
|
||||||
// Convert to CF32
|
// Convert to CF32 (note: problem if partial sample)
|
||||||
int count;
|
int count = bytes / sampleSize;
|
||||||
switch (sampType) {
|
switch (sampType) {
|
||||||
case SAMPLE_TYPE_INT8:
|
case SAMPLE_TYPE_INT8:
|
||||||
|
volk_8i_s32f_convert_32f((float*)stream.writeBuf, (int8_t*)buffer, 128.0f, count*2);
|
||||||
break;
|
break;
|
||||||
case SAMPLE_TYPE_INT16:
|
case SAMPLE_TYPE_INT16:
|
||||||
|
volk_16i_s32f_convert_32f((float*)stream.writeBuf, (int16_t*)buffer, 32768.0f, count*2);
|
||||||
break;
|
break;
|
||||||
case SAMPLE_TYPE_INT32:
|
case SAMPLE_TYPE_INT32:
|
||||||
|
volk_32i_s32f_convert_32f((float*)stream.writeBuf, (int32_t*)buffer, 2147483647.0f, count*2);
|
||||||
break;
|
break;
|
||||||
case SAMPLE_TYPE_FLOAT32:
|
case SAMPLE_TYPE_FLOAT32:
|
||||||
//memcpy(stream.writeBuf, buffer, )
|
memcpy(stream.writeBuf, buffer, bytes);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
@ -278,6 +284,7 @@ private:
|
|||||||
if (!stream.swap(count)) { break; }
|
if (!stream.swap(count)) { break; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Free receive buffer
|
||||||
dsp::buffer::free(buffer);
|
dsp::buffer::free(buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user