2020-08-07 14:29:06 +02:00
|
|
|
#pragma once
|
|
|
|
#include <string>
|
|
|
|
#include <map>
|
|
|
|
#include <filesystem>
|
|
|
|
#include <stdint.h>
|
|
|
|
#include <imgui.h>
|
|
|
|
#include <spdlog/spdlog.h>
|
2020-08-11 18:33:42 +02:00
|
|
|
#include <dsp/types.h>
|
|
|
|
#include <dsp/stream.h>
|
2020-08-07 14:29:06 +02:00
|
|
|
|
|
|
|
#ifdef _WIN32
|
|
|
|
#include <Windows.h>
|
|
|
|
#define MOD_EXPORT extern "C" \
|
|
|
|
__declspec(dllexport)
|
|
|
|
#else
|
2020-08-11 18:33:42 +02:00
|
|
|
#include <dlfcn.h>
|
2020-08-07 14:29:06 +02:00
|
|
|
#define MOD_EXPORT extern "C"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
namespace mod {
|
|
|
|
struct API_t {
|
2020-08-11 18:33:42 +02:00
|
|
|
dsp::stream<dsp::complex_t>* (*registerVFO)(std::string name, int reference, float offset, float bandwidth, float sampleRate, int blockSize);
|
|
|
|
void (*setVFOOffset)(std::string name, float offset);
|
|
|
|
void (*setVFOCenterOffset)(std::string name, float offset);
|
|
|
|
void (*setVFOBandwidth)(std::string name, float bandwidth);
|
|
|
|
void (*setVFOSampleRate)(std::string name, float sampleRate, float bandwidth);
|
|
|
|
int (*getVFOOutputBlockSize)(std::string name);
|
|
|
|
void (*setVFOReference)(std::string name, int ref);
|
|
|
|
void (*removeVFO)(std::string name);
|
2020-08-07 14:29:06 +02:00
|
|
|
|
2020-08-11 18:33:42 +02:00
|
|
|
enum {
|
|
|
|
REF_LOWER,
|
|
|
|
REF_CENTER,
|
|
|
|
REF_UPPER,
|
|
|
|
_REF_COUNT
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
enum {
|
|
|
|
EVENT_STREAM_PARAM_CHANGED,
|
|
|
|
_EVENT_COUNT
|
2020-08-07 14:29:06 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
struct Module_t {
|
|
|
|
#ifdef _WIN32
|
|
|
|
HINSTANCE inst;
|
|
|
|
#else
|
|
|
|
void* inst;
|
|
|
|
#endif
|
|
|
|
void* (*_INIT_)(API_t*, ImGuiContext*, std::string);
|
|
|
|
void (*_DRAW_MENU_)(void*);
|
2020-08-11 18:33:42 +02:00
|
|
|
void (*_HANDLE_EVENT_)(void*, int);
|
2020-08-07 14:29:06 +02:00
|
|
|
void (*_STOP_)(void*);
|
|
|
|
void* ctx;
|
|
|
|
};
|
|
|
|
|
2020-08-11 18:33:42 +02:00
|
|
|
void initAPI();
|
2020-08-07 14:29:06 +02:00
|
|
|
void loadModule(std::string path, std::string name);
|
2020-08-11 18:33:42 +02:00
|
|
|
void broadcastEvent(int eventId);
|
2020-08-07 14:29:06 +02:00
|
|
|
|
|
|
|
extern std::map<std::string, Module_t> modules;
|
|
|
|
extern std::vector<std::string> moduleNames;
|
2020-08-11 18:33:42 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
extern mod::API_t* API;
|