mirror of
https://github.com/AlexandreRouma/SDRPlusPlus.git
synced 2025-01-24 00:34:44 +01:00
fix recorder options not disabled during recording, increase rfnm source dsp frame size and fix long pause when stopping rfnm
This commit is contained in:
parent
123e34d250
commit
949fde022d
@ -249,7 +249,6 @@ private:
|
|||||||
}
|
}
|
||||||
ImGui::Columns(1, CONCAT("EndRecorderModeColumns##_", _this->name), false);
|
ImGui::Columns(1, CONCAT("EndRecorderModeColumns##_", _this->name), false);
|
||||||
ImGui::EndGroup();
|
ImGui::EndGroup();
|
||||||
if (_this->recording) { style::endDisabled(); }
|
|
||||||
|
|
||||||
// Recording path
|
// Recording path
|
||||||
if (_this->folderSelect.render("##_recorder_fold_" + _this->name)) {
|
if (_this->folderSelect.render("##_recorder_fold_" + _this->name)) {
|
||||||
@ -284,8 +283,11 @@ private:
|
|||||||
config.release(true);
|
config.release(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (_this->recording) { style::endDisabled(); }
|
||||||
|
|
||||||
// Show additional audio options
|
// Show additional audio options
|
||||||
if (_this->recMode == RECORDER_MODE_AUDIO) {
|
if (_this->recMode == RECORDER_MODE_AUDIO) {
|
||||||
|
if (_this->recording) { style::beginDisabled(); }
|
||||||
ImGui::LeftLabel("Stream");
|
ImGui::LeftLabel("Stream");
|
||||||
ImGui::FillWidth();
|
ImGui::FillWidth();
|
||||||
if (ImGui::Combo(CONCAT("##_recorder_stream_", _this->name), &_this->streamId, _this->audioStreams.txt)) {
|
if (ImGui::Combo(CONCAT("##_recorder_stream_", _this->name), &_this->streamId, _this->audioStreams.txt)) {
|
||||||
@ -294,6 +296,7 @@ private:
|
|||||||
config.conf[_this->name]["audioStream"] = _this->audioStreams.key(_this->streamId);
|
config.conf[_this->name]["audioStream"] = _this->audioStreams.key(_this->streamId);
|
||||||
config.release(true);
|
config.release(true);
|
||||||
}
|
}
|
||||||
|
if (_this->recording) { style::endDisabled(); }
|
||||||
|
|
||||||
_this->updateAudioMeter(_this->audioLvl);
|
_this->updateAudioMeter(_this->audioLvl);
|
||||||
ImGui::FillWidth();
|
ImGui::FillWidth();
|
||||||
|
@ -249,19 +249,6 @@ private:
|
|||||||
// Open the device
|
// Open the device
|
||||||
_this->openDev = new librfnm(librfnm_transport::LIBRFNM_TRANSPORT_USB, _this->selectedSerial);
|
_this->openDev = new librfnm(librfnm_transport::LIBRFNM_TRANSPORT_USB, _this->selectedSerial);
|
||||||
|
|
||||||
// Configure the device
|
|
||||||
_this->openDev->s->rx.ch[_this->currentPath.chId].enable = RFNM_CH_ON;
|
|
||||||
_this->openDev->s->rx.ch[_this->currentPath.chId].samp_freq_div_n = _this->samplerates[_this->srId];
|
|
||||||
_this->openDev->s->rx.ch[_this->currentPath.chId].freq = _this->freq;
|
|
||||||
_this->openDev->s->rx.ch[_this->currentPath.chId].gain = _this->gain;
|
|
||||||
_this->openDev->s->rx.ch[_this->currentPath.chId].rfic_lpf_bw = 100;
|
|
||||||
_this->openDev->s->rx.ch[_this->currentPath.chId].fm_notch = _this->fmNotch ? rfnm_fm_notch::RFNM_FM_NOTCH_ON : rfnm_fm_notch::RFNM_FM_NOTCH_OFF;
|
|
||||||
_this->openDev->s->rx.ch[_this->currentPath.chId].path = _this->currentPath.path;
|
|
||||||
rfnm_api_failcode fail = _this->openDev->set(_this->currentPath.appliesCh);
|
|
||||||
if (fail != rfnm_api_failcode::RFNM_API_OK) {
|
|
||||||
flog::error("Failed to configure device: {}", (int)fail);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Configure the stream
|
// Configure the stream
|
||||||
_this->bufferSize = -1;
|
_this->bufferSize = -1;
|
||||||
_this->openDev->rx_stream(librfnm_stream_format::LIBRFNM_STREAM_FORMAT_CS16, &_this->bufferSize);
|
_this->openDev->rx_stream(librfnm_stream_format::LIBRFNM_STREAM_FORMAT_CS16, &_this->bufferSize);
|
||||||
@ -276,6 +263,22 @@ private:
|
|||||||
_this->openDev->rx_qbuf(&_this->rxBuf[i]);
|
_this->openDev->rx_qbuf(&_this->rxBuf[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Flush buffers
|
||||||
|
_this->openDev->rx_flush();
|
||||||
|
|
||||||
|
// Configure the device
|
||||||
|
_this->openDev->s->rx.ch[_this->currentPath.chId].enable = RFNM_CH_ON;
|
||||||
|
_this->openDev->s->rx.ch[_this->currentPath.chId].samp_freq_div_n = _this->samplerates[_this->srId];
|
||||||
|
_this->openDev->s->rx.ch[_this->currentPath.chId].freq = _this->freq;
|
||||||
|
_this->openDev->s->rx.ch[_this->currentPath.chId].gain = _this->gain;
|
||||||
|
_this->openDev->s->rx.ch[_this->currentPath.chId].rfic_lpf_bw = 100;
|
||||||
|
_this->openDev->s->rx.ch[_this->currentPath.chId].fm_notch = _this->fmNotch ? rfnm_fm_notch::RFNM_FM_NOTCH_ON : rfnm_fm_notch::RFNM_FM_NOTCH_OFF;
|
||||||
|
_this->openDev->s->rx.ch[_this->currentPath.chId].path = _this->currentPath.path;
|
||||||
|
rfnm_api_failcode fail = _this->openDev->set(_this->currentPath.appliesCh);
|
||||||
|
if (fail != rfnm_api_failcode::RFNM_API_OK) {
|
||||||
|
flog::error("Failed to configure device: {}", (int)fail);
|
||||||
|
}
|
||||||
|
|
||||||
// Start worker
|
// Start worker
|
||||||
_this->run = true;
|
_this->run = true;
|
||||||
_this->workerThread = std::thread(&RFNMSourceModule::worker, _this);
|
_this->workerThread = std::thread(&RFNMSourceModule::worker, _this);
|
||||||
@ -295,12 +298,15 @@ private:
|
|||||||
if (_this->workerThread.joinable()) { _this->workerThread.join(); }
|
if (_this->workerThread.joinable()) { _this->workerThread.join(); }
|
||||||
_this->stream.clearWriteStop();
|
_this->stream.clearWriteStop();
|
||||||
|
|
||||||
|
// Stop the RX streaming
|
||||||
|
_this->openDev->rx_stream_stop();
|
||||||
|
|
||||||
// Disable channel
|
// Disable channel
|
||||||
_this->openDev->s->rx.ch[_this->currentPath.chId].enable = RFNM_CH_OFF;
|
_this->openDev->s->rx.ch[_this->currentPath.chId].enable = RFNM_CH_OFF;
|
||||||
_this->openDev->set(_this->currentPath.appliesCh);
|
_this->openDev->set(_this->currentPath.appliesCh);
|
||||||
|
|
||||||
// Stop the RX streaming
|
// Flush buffers
|
||||||
_this->openDev->rx_stream_stop();
|
_this->openDev->rx_flush();
|
||||||
|
|
||||||
// Close device
|
// Close device
|
||||||
delete _this->openDev;
|
delete _this->openDev;
|
||||||
@ -423,8 +429,13 @@ private:
|
|||||||
int sampCount = bufferSize/4;
|
int sampCount = bufferSize/4;
|
||||||
uint8_t ch = (1 << currentPath.chId);
|
uint8_t ch = (1 << currentPath.chId);
|
||||||
|
|
||||||
// TODO: Define number of buffers per swap to maintain 200 fps
|
// Define number of buffers per swap to maintain 200 fps
|
||||||
|
int maxBufCount = STREAM_BUFFER_SIZE / sampCount;
|
||||||
|
int bufCount = (sampleRate / sampCount) / 200;
|
||||||
|
if (bufCount <= 0) { bufCount = 1; }
|
||||||
|
if (bufCount > maxBufCount) { bufCount = maxBufCount; }
|
||||||
|
|
||||||
|
int count = 0;
|
||||||
while (run) {
|
while (run) {
|
||||||
// Receive a buffer
|
// Receive a buffer
|
||||||
auto fail = openDev->rx_dqbuf(&lrxbuf, ch, 1000);
|
auto fail = openDev->rx_dqbuf(&lrxbuf, ch, 1000);
|
||||||
@ -435,13 +446,17 @@ private:
|
|||||||
else if (fail) { break; }
|
else if (fail) { break; }
|
||||||
|
|
||||||
// Convert buffer to CF32
|
// Convert buffer to CF32
|
||||||
volk_16i_s32f_convert_32f((float*)stream.writeBuf, (int16_t*)lrxbuf->buf, 32768.0f, sampCount * 2);
|
volk_16i_s32f_convert_32f((float*)&stream.writeBuf[(count++)*sampCount], (int16_t*)lrxbuf->buf, 32768.0f, sampCount * 2);
|
||||||
|
|
||||||
// Reque buffer
|
// Reque buffer
|
||||||
openDev->rx_qbuf(lrxbuf);
|
openDev->rx_qbuf(lrxbuf);
|
||||||
|
|
||||||
// Swap data
|
// Swap data
|
||||||
if (!stream.swap(sampCount)) { break; }
|
if (count >= bufCount) {
|
||||||
|
if (!stream.swap(count*sampCount)) { break; }
|
||||||
|
count = 0;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
flog::debug("Worker exiting");
|
flog::debug("Worker exiting");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user