mirror of
https://github.com/cjcliffe/CubicSDR.git
synced 2024-11-26 21:58:37 -05:00
Fix spectrum/waveform display when higher than audio rate
This commit is contained in:
parent
af2710ff37
commit
7e856988a2
@ -117,7 +117,10 @@ void DemodulatorThread::run() {
|
||||
|
||||
AudioThreadInput *ati = NULL;
|
||||
|
||||
if (cModem->getType() != "digital") {
|
||||
ModemAnalog *modemAnalog = (cModem->getType() == "analog")?((ModemAnalog *)cModem):nullptr;
|
||||
ModemDigital *modemDigital = (cModem->getType() == "digital")?((ModemDigital *)cModem):nullptr;
|
||||
|
||||
if (modemAnalog != nullptr) {
|
||||
ati = outputBuffers.getBuffer();
|
||||
|
||||
ati->sampleRate = audioSampleRate;
|
||||
@ -177,18 +180,19 @@ void DemodulatorThread::run() {
|
||||
} else {
|
||||
int numAudioWritten = ati->data.size();
|
||||
ati_vis->channels = 1;
|
||||
// if (numAudioWritten > bufSize) {
|
||||
ati_vis->inputRate = audioSampleRate;
|
||||
if (num_vis > numAudioWritten) {
|
||||
num_vis = numAudioWritten;
|
||||
std::vector<float> *demodOutData = (modemAnalog != nullptr)?modemAnalog->getDemodOutputData():nullptr;
|
||||
if ((numAudioWritten > bufSize) || (demodOutData == nullptr)) {
|
||||
ati_vis->inputRate = audioSampleRate;
|
||||
if (num_vis > numAudioWritten) {
|
||||
num_vis = numAudioWritten;
|
||||
}
|
||||
ati_vis->data.assign(ati->data.begin(), ati->data.begin() + num_vis);
|
||||
} else {
|
||||
if (num_vis > demodOutData->size()) {
|
||||
num_vis = demodOutData->size();
|
||||
}
|
||||
ati_vis->data.assign(demodOutData->begin(), demodOutData->begin() + num_vis);
|
||||
}
|
||||
ati_vis->data.assign(ati->data.begin(), ati->data.begin() + num_vis);
|
||||
// } else {
|
||||
// if (num_vis > bufSize) {
|
||||
// num_vis = bufSize;
|
||||
// }
|
||||
// ati_vis->data.assign(ati->data.begin(), ati->data.begin() + num_vis);
|
||||
// }
|
||||
|
||||
// std::cout << "Signal: " << agc_crcf_get_signal_level(agc) << " -- " << agc_crcf_get_rssi(agc) << "dB " << std::endl;
|
||||
}
|
||||
|
@ -81,3 +81,11 @@ void ModemAnalog::buildAudioOutput(ModemKitAnalog *akit, AudioThreadInput *audio
|
||||
audioOut->sampleRate = akit->audioSampleRate;
|
||||
audioOut->data.assign(resampledOutputData.begin(), resampledOutputData.begin() + numAudioWritten);
|
||||
}
|
||||
|
||||
std::vector<float> *ModemAnalog::getDemodOutputData() {
|
||||
return &demodOutputData;
|
||||
}
|
||||
|
||||
std::vector<float> *ModemAnalog::getResampledOutputData() {
|
||||
return &resampledOutputData;
|
||||
}
|
||||
|
@ -20,6 +20,8 @@ public:
|
||||
void disposeKit(ModemKit *kit);
|
||||
void initOutputBuffers(ModemKitAnalog *akit, ModemIQData *input);
|
||||
void buildAudioOutput(ModemKitAnalog *akit, AudioThreadInput *audioOut, bool autoGain);
|
||||
std::vector<float> *getDemodOutputData();
|
||||
std::vector<float> *getResampledOutputData();
|
||||
protected:
|
||||
int bufSize;
|
||||
std::vector<float> demodOutputData;
|
||||
|
Loading…
Reference in New Issue
Block a user