Bandplan system

This commit is contained in:
Ryzerth
2020-08-04 21:34:56 +02:00
parent cd7e5cf1bc
commit 022898c61d
155 changed files with 49138 additions and 107 deletions

View File

@ -4,6 +4,7 @@
#include <dsp/types.h>
#include <fstream>
#include <portaudio.h>
#include <spdlog/spdlog.h>
namespace io {
class AudioSink {
@ -40,9 +41,16 @@ namespace io {
outputParams.device = Pa_GetDefaultOutputDevice();
outputParams.suggestedLatency = Pa_GetDeviceInfo(outputParams.device)->defaultLowOutputLatency;
PaError err = Pa_OpenStream(&stream, NULL, &outputParams, 48000.0f, _bufferSize, paClipOff, _callback, this);
printf("%s\n", Pa_GetErrorText(err));
if (err != 0) {
spdlog::error("Error while opening audio stream: ({0}) => {1}", err, Pa_GetErrorText(err));
return;
}
err = Pa_StartStream(stream);
printf("%s\n", Pa_GetErrorText(err));
if (err != 0) {
spdlog::error("Error while starting audio stream: ({0}) => {1}", err, Pa_GetErrorText(err));
return;
}
spdlog::info("Audio device open.");
}
void stop() {

View File

@ -1,13 +1,16 @@
#include <string>
#include <SoapySDR/Device.hpp>
#include <SoapySDR/Modules.hpp>
#include <SoapySDR/Logger.hpp>
#include <dsp/stream.h>
#include <dsp/types.h>
#include <spdlog/spdlog.h>
namespace io {
class SoapyWrapper {
public:
SoapyWrapper() {
SoapySDR::registerLogHandler(_logHandler);
output.init(64000);
currentGains = new float[1];
refresh();
@ -131,10 +134,21 @@ namespace io {
}
_this->output.write(buf, res);
}
printf("Read worker terminated\n");
delete[] buf;
}
static void _logHandler(const SoapySDRLogLevel lvl, const char* message) {
if (lvl == SOAPY_SDR_FATAL || lvl == SOAPY_SDR_CRITICAL || lvl == SOAPY_SDR_ERROR) {
spdlog::error(message);
}
else if (lvl == SOAPY_SDR_WARNING) {
spdlog::warn(message);
}
else if (lvl == SOAPY_SDR_NOTICE | SOAPY_SDR_INFO) {
spdlog::info(message);
}
}
SoapySDR::Kwargs args;
SoapySDR::Device* dev;
SoapySDR::Stream* _stream;