mirror of
https://github.com/AlexandreRouma/SDRPlusPlus.git
synced 2025-06-26 04:17:50 +02:00
fixed soapy bug
This commit is contained in:
@ -31,6 +31,27 @@
|
||||
#include <signal_path/source.h>
|
||||
#include <gui/dialogs/loading_screen.h>
|
||||
|
||||
// const int FFTSizes[] = {
|
||||
// 65536,
|
||||
// 32768,
|
||||
// 16384,
|
||||
// 8192,
|
||||
// 4096,
|
||||
// 2048
|
||||
// };
|
||||
|
||||
// const char* FFTSizesStr[] = {
|
||||
// "65536",
|
||||
// "32768",
|
||||
// "16384",
|
||||
// "8192",
|
||||
// "4096",
|
||||
// "2048"
|
||||
// };
|
||||
|
||||
// int fftSizeId = 0;
|
||||
int fftSize = 8192 * 8;
|
||||
|
||||
std::thread worker;
|
||||
std::mutex fft_mtx;
|
||||
fftwf_complex *fft_in, *fft_out;
|
||||
@ -39,18 +60,15 @@ float* tempFFT;
|
||||
float* FFTdata;
|
||||
char buf[1024];
|
||||
|
||||
int fftSize = 8192 * 8;
|
||||
|
||||
|
||||
void fftHandler(dsp::complex_t* samples, int count, void* ctx) {
|
||||
if (count < fftSize) {
|
||||
return;
|
||||
}
|
||||
memcpy(fft_in, samples, count * sizeof(dsp::complex_t));
|
||||
fftwf_execute(p);
|
||||
int half = fftSize / 2;
|
||||
int half = count / 2;
|
||||
|
||||
volk_32fc_s32f_power_spectrum_32f(tempFFT, (lv_32fc_t*)fft_out, fftSize, fftSize);
|
||||
volk_32f_s32f_multiply_32f(FFTdata, tempFFT, 0.5f, fftSize);
|
||||
volk_32fc_s32f_power_spectrum_32f(tempFFT, (lv_32fc_t*)fft_out, count, count);
|
||||
volk_32f_s32f_multiply_32f(FFTdata, tempFFT, 0.5f, count);
|
||||
|
||||
memcpy(tempFFT, &FFTdata[half], half * sizeof(float));
|
||||
memmove(&FFTdata[half], FFTdata, half * sizeof(float));
|
||||
@ -62,7 +80,7 @@ void fftHandler(dsp::complex_t* samples, int count, void* ctx) {
|
||||
return;
|
||||
}
|
||||
float last = FFTdata[0];
|
||||
for (int i = 0; i < fftSize; i++) {
|
||||
for (int i = 0; i < count; i++) {
|
||||
last = (FFTdata[i] * 0.1f) + (last * 0.9f);
|
||||
fftBuf[i] = last;
|
||||
}
|
||||
@ -169,7 +187,6 @@ void windowInit() {
|
||||
|
||||
// TODO for 0.2.5
|
||||
// Add "select file" option for the file source
|
||||
// Add default main config to avoid having to ship one
|
||||
// Have a good directory system on both linux and windows
|
||||
// Switch to double buffering (should fix occassional underruns)
|
||||
// Fix gain not updated on startup, soapysdr
|
||||
|
@ -92,4 +92,20 @@ void SignalPath::bindIQStream(dsp::stream<dsp::complex_t>* stream) {
|
||||
|
||||
void SignalPath::unbindIQStream(dsp::stream<dsp::complex_t>* stream) {
|
||||
split.unbindStream(stream);
|
||||
}
|
||||
|
||||
void SignalPath::setFFTSize(int size) {
|
||||
fftSize = size;
|
||||
int skip = (sampleRate / fftRate) - fftSize;
|
||||
reshape.setSkip(skip);
|
||||
}
|
||||
|
||||
void SignalPath::startFFT() {
|
||||
reshape.start();
|
||||
fftHandlerSink.start();
|
||||
}
|
||||
|
||||
void SignalPath::stopFFT() {
|
||||
reshape.stop();
|
||||
fftHandlerSink.stop();
|
||||
}
|
@ -11,13 +11,15 @@ public:
|
||||
void start();
|
||||
void stop();
|
||||
void setSampleRate(double sampleRate);
|
||||
void setFFTRate(double rate);
|
||||
double getSampleRate();
|
||||
dsp::VFO* addVFO(std::string name, double outSampleRate, double bandwidth, double offset);
|
||||
void removeVFO(std::string name);
|
||||
void setInput(dsp::stream<dsp::complex_t>* input);
|
||||
void bindIQStream(dsp::stream<dsp::complex_t>* stream);
|
||||
void unbindIQStream(dsp::stream<dsp::complex_t>* stream);
|
||||
void setFFTSize(int size);
|
||||
void startFFT();
|
||||
void stopFFT();
|
||||
|
||||
private:
|
||||
struct VFO_t {
|
||||
|
Reference in New Issue
Block a user