Fixed windows bugs

This commit is contained in:
Ryzerth 2020-09-20 02:18:01 +02:00
parent ab8ce4c53f
commit 51ee02f9da
4 changed files with 47 additions and 50 deletions

View File

@ -119,7 +119,6 @@ int VFOManager::getOutputBlockSize(std::string name) {
void VFOManager::updateFromWaterfall(ImGui::WaterFall* wtf) { void VFOManager::updateFromWaterfall(ImGui::WaterFall* wtf) {
for (auto const& [name, vfo] : vfos) { for (auto const& [name, vfo] : vfos) {
if (vfo->wtfVFO->centerOffsetChanged) { if (vfo->wtfVFO->centerOffsetChanged) {
spdlog::info("UH OH: Change!");
vfo->wtfVFO->centerOffsetChanged = false; vfo->wtfVFO->centerOffsetChanged = false;
vfo->dspVFO->setOffset(vfo->wtfVFO->centerOffset); vfo->dspVFO->setOffset(vfo->wtfVFO->centerOffset);
} }

View File

@ -6,11 +6,10 @@
#include <dsp/stream.h> #include <dsp/stream.h>
#include <thread> #include <thread>
#include <ctime> #include <ctime>
#include <signal_path/audio.h>
#define CONCAT(a, b) ((std::string(a) + b).c_str()) #define CONCAT(a, b) ((std::string(a) + b).c_str())
mod::API_t* API;
struct RecorderContext_t { struct RecorderContext_t {
std::string name; std::string name;
dsp::stream<dsp::StereoFloat_t>* stream; dsp::stream<dsp::StereoFloat_t>* stream;
@ -60,7 +59,6 @@ void sampleRateChanged(void* ctx, float sampleRate, int blockSize) {
} }
MOD_EXPORT void* _INIT_(mod::API_t* _API, ImGuiContext* imctx, std::string _name) { MOD_EXPORT void* _INIT_(mod::API_t* _API, ImGuiContext* imctx, std::string _name) {
API = _API;
RecorderContext_t* ctx = new RecorderContext_t; RecorderContext_t* ctx = new RecorderContext_t;
ctx->recording = false; ctx->recording = false;
ctx->selectedStreamName = ""; ctx->selectedStreamName = "";
@ -77,7 +75,7 @@ MOD_EXPORT void _NEW_FRAME_(RecorderContext_t* ctx) {
MOD_EXPORT void _DRAW_MENU_(RecorderContext_t* ctx) { MOD_EXPORT void _DRAW_MENU_(RecorderContext_t* ctx) {
float menuColumnWidth = ImGui::GetContentRegionAvailWidth(); float menuColumnWidth = ImGui::GetContentRegionAvailWidth();
std::vector<std::string> streamNames = API->getStreamNameList(); std::vector<std::string> streamNames = audio::getStreamNameList();
std::string nameList; std::string nameList;
for (std::string name : streamNames) { for (std::string name : streamNames) {
nameList += name; nameList += name;
@ -124,7 +122,7 @@ MOD_EXPORT void _DRAW_MENU_(RecorderContext_t* ctx) {
ctx->samplesWritten = 0; ctx->samplesWritten = 0;
ctx->sampleRate = 48000; ctx->sampleRate = 48000;
ctx->writer = new WavWriter("recordings/" + genFileName("audio_"), 16, 2, 48000); ctx->writer = new WavWriter("recordings/" + genFileName("audio_"), 16, 2, 48000);
ctx->stream = API->bindToStreamStereo(ctx->selectedStreamName, streamRemovedHandler, sampleRateChanged, ctx); ctx->stream = audio::bindToStreamStereo(ctx->selectedStreamName, streamRemovedHandler, sampleRateChanged, ctx);
ctx->workerThread = std::thread(_writeWorker, ctx); ctx->workerThread = std::thread(_writeWorker, ctx);
ctx->recording = true; ctx->recording = true;
ctx->startTime = time(0); ctx->startTime = time(0);
@ -136,7 +134,7 @@ MOD_EXPORT void _DRAW_MENU_(RecorderContext_t* ctx) {
ctx->stream->stopReader(); ctx->stream->stopReader();
ctx->workerThread.join(); ctx->workerThread.join();
ctx->stream->clearReadStop(); ctx->stream->clearReadStop();
API->unbindFromStreamStereo(ctx->selectedStreamName, ctx->stream); audio::unbindFromStreamStereo(ctx->selectedStreamName, ctx->stream);
ctx->writer->close(); ctx->writer->close();
delete ctx->writer; delete ctx->writer;
ctx->recording = false; ctx->recording = false;

View File

@ -1,42 +1,42 @@
{ {
"audio": { "audio": {
"Radio": { "Radio": {
"device": "Speakers (Realtek High Definiti", "device": "Speakers (Realtek High Definiti",
"sampleRate": 48000.0, "sampleRate": 48000.0,
"volume": 0.3655914068222046 "volume": 0.602150559425354
} }
}, },
"bandPlan": "General", "bandPlan": "General",
"bandPlanEnabled": true, "bandPlanEnabled": true,
"fftHeight": 300, "fftHeight": 300,
"frequency": 96914040, "frequency": 99000000,
"max": 0.0, "max": 0.0,
"maximized": false, "maximized": false,
"menuWidth": 300, "menuWidth": 300,
"min": -51.47058868408203, "min": -51.47058868408203,
"showWaterfall": true, "showWaterfall": true,
"source": "HackRF One #0 901868dc282c8f8b", "source": "HackRF One #0 901868dc282c8f8b",
"sourceSettings": { "sourceSettings": {
"Generic RTL2832U OEM :: 00000001": { "Generic RTL2832U OEM :: 00000001": {
"gains": { "gains": {
"TUNER": 0.0 "TUNER": 0.0
}, },
"sampleRate": 2560000 "sampleRate": 2560000
}, },
"HackRF One #0 901868dc282c8f8b": { "HackRF One #0 901868dc282c8f8b": {
"gains": { "gains": {
"AMP": 0.0, "AMP": 0.0,
"LNA": 24.503000259399414, "LNA": 24.503000259399414,
"VGA": 16.229999542236328 "VGA": 16.229999542236328
}, },
"sampleRate": 8000000 "sampleRate": 8000000
}, },
"PulseAudio": { "PulseAudio": {
"sampleRate": 96000 "sampleRate": 96000
} }
}, },
"windowSize": { "windowSize": {
"h": 1053, "h": 720,
"w": 959 "w": 1280
} }
} }

View File

@ -1,4 +1,4 @@
{ {
"Radio": "./radio/radio.so", "Radio": "./radio/Release/radio.dll",
"Recorder": "./recorder/recorder.so" "Recorder": "./recorder/Release/recorder.dll"
} }