mirror of
https://github.com/AlexandreRouma/SDRPlusPlus.git
synced 2025-01-11 18:57:11 +01:00
Fixed other potential bug on OSX
This commit is contained in:
parent
bdce551a50
commit
a91ed266d5
@ -3,11 +3,6 @@
|
|||||||
#include <spdlog/spdlog.h>
|
#include <spdlog/spdlog.h>
|
||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
class Event {
|
|
||||||
public:
|
|
||||||
Event() {}
|
|
||||||
~Event() {}
|
|
||||||
|
|
||||||
struct EventHandler {
|
struct EventHandler {
|
||||||
EventHandler() {}
|
EventHandler() {}
|
||||||
EventHandler(void (*handler)(T, void*), void* ctx) {
|
EventHandler(void (*handler)(T, void*), void* ctx) {
|
||||||
@ -19,17 +14,23 @@ public:
|
|||||||
void* ctx;
|
void* ctx;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
template <class T>
|
||||||
|
class Event {
|
||||||
|
public:
|
||||||
|
Event() {}
|
||||||
|
~Event() {}
|
||||||
|
|
||||||
void emit(T value) {
|
void emit(T value) {
|
||||||
for (auto const& handler : handlers) {
|
for (auto const& handler : handlers) {
|
||||||
handler.handler(value, handler.ctx);
|
handler.handler(value, handler.ctx);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void bindHandler(const EventHandler& handler) {
|
void bindHandler(const EventHandler<T>& handler) {
|
||||||
handlers.push_back(handler);
|
handlers.push_back(handler);
|
||||||
}
|
}
|
||||||
|
|
||||||
void unbindHandler(const EventHandler& handler) {
|
void unbindHandler(const EventHandler<T>& handler) {
|
||||||
if (handlers.find(handler) == handlers.end()) {
|
if (handlers.find(handler) == handlers.end()) {
|
||||||
spdlog::error("Tried to remove a non-existant event handler");
|
spdlog::error("Tried to remove a non-existant event handler");
|
||||||
return;
|
return;
|
||||||
@ -38,6 +39,6 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::vector<EventHandler> handlers;
|
std::vector<EventHandler<T>> handlers;
|
||||||
|
|
||||||
};
|
};
|
@ -14,11 +14,11 @@ SinkManager::SinkManager() {
|
|||||||
registerSinkProvider("None", prov);
|
registerSinkProvider("None", prov);
|
||||||
}
|
}
|
||||||
|
|
||||||
SinkManager::Stream::Stream(dsp::stream<dsp::stereo_t>* in, const Event<float>::EventHandler& srChangeHandler, float sampleRate) {
|
SinkManager::Stream::Stream(dsp::stream<dsp::stereo_t>* in, const EventHandler<float>& srChangeHandler, float sampleRate) {
|
||||||
init(in, srChangeHandler, sampleRate);
|
init(in, srChangeHandler, sampleRate);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SinkManager::Stream::init(dsp::stream<dsp::stereo_t>* in, const Event<float>::EventHandler& srChangeHandler, float sampleRate) {
|
void SinkManager::Stream::init(dsp::stream<dsp::stereo_t>* in, const EventHandler<float>& srChangeHandler, float sampleRate) {
|
||||||
_in = in;
|
_in = in;
|
||||||
srChange.bindHandler(srChangeHandler);
|
srChange.bindHandler(srChangeHandler);
|
||||||
_sampleRate = sampleRate;
|
_sampleRate = sampleRate;
|
||||||
|
@ -25,9 +25,9 @@ public:
|
|||||||
class Stream {
|
class Stream {
|
||||||
public:
|
public:
|
||||||
Stream() {}
|
Stream() {}
|
||||||
Stream(dsp::stream<dsp::stereo_t>* in, const Event<float>::EventHandler& srChangeHandler, float sampleRate);
|
Stream(dsp::stream<dsp::stereo_t>* in, const EventHandler<float>& srChangeHandler, float sampleRate);
|
||||||
|
|
||||||
void init(dsp::stream<dsp::stereo_t>* in, const Event<float>::EventHandler& srChangeHandler, float sampleRate);
|
void init(dsp::stream<dsp::stereo_t>* in, const EventHandler<float>& srChangeHandler, float sampleRate);
|
||||||
|
|
||||||
void start();
|
void start();
|
||||||
void stop();
|
void stop();
|
||||||
|
@ -35,6 +35,7 @@ cp build/soapy_source/Release/soapy_source.dll sdrpp_windows_x64/modules/
|
|||||||
cp build/file_source/Release/file_source.dll sdrpp_windows_x64/modules/
|
cp build/file_source/Release/file_source.dll sdrpp_windows_x64/modules/
|
||||||
|
|
||||||
cp build/sdrplay_source/Release/sdrplay_source.dll sdrpp_windows_x64/modules/
|
cp build/sdrplay_source/Release/sdrplay_source.dll sdrpp_windows_x64/modules/
|
||||||
|
cp 'C:/Program Files/SDRplay/API/x64/sdrplay_api.dll' sdrpp_windows_x64/
|
||||||
|
|
||||||
cp build/meteor_demodulator/Release/meteor_demodulator.dll sdrpp_windows_x64/modules/
|
cp build/meteor_demodulator/Release/meteor_demodulator.dll sdrpp_windows_x64/modules/
|
||||||
|
|
||||||
|
@ -199,7 +199,7 @@ private:
|
|||||||
|
|
||||||
dsp::NullSink<dsp::complex_t> ns;
|
dsp::NullSink<dsp::complex_t> ns;
|
||||||
|
|
||||||
Event<float>::EventHandler srChangeHandler;
|
EventHandler<float> srChangeHandler;
|
||||||
SinkManager::Stream stream;
|
SinkManager::Stream stream;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user