Save before changes

This commit is contained in:
Ryzerth
2020-10-01 01:21:15 +02:00
parent 2c4d7cbf09
commit 524f20bc2f
16 changed files with 348 additions and 413 deletions

View File

@@ -29,45 +29,6 @@
#endif
namespace mod {
struct API_t {
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);
std::string (*getSelectedVFOName)(void);
void (*bindVolumeVariable)(float* vol);
void (*unbindVolumeVariable)(void);
float (*registerMonoStream)(dsp::stream<float>* stream, std::string name, std::string vfoName, int (*sampleRateChangeHandler)(void* ctx, float sampleRate), void* ctx);
float (*registerStereoStream)(dsp::stream<dsp::StereoFloat_t>* stream, std::string name, std::string vfoName, int (*sampleRateChangeHandler)(void* ctx, float sampleRate), void* ctx);
void (*startStream)(std::string name);
void (*stopStream)(std::string name);
void (*removeStream)(std::string name);
dsp::stream<float>* (*bindToStreamMono)(std::string name, void (*streamRemovedHandler)(void* ctx), void (*sampleRateChangeHandler)(void* ctx, float sampleRate, int blockSize), void* ctx);
dsp::stream<dsp::StereoFloat_t>* (*bindToStreamStereo)(std::string name, void (*streamRemovedHandler)(void* ctx), void (*sampleRateChangeHandler)(void* ctx, float sampleRate, int blockSize), void* ctx);
void (*setBlockSize)(std::string name, int blockSize);
void (*unbindFromStreamMono)(std::string name, dsp::stream<float>* stream);
void (*unbindFromStreamStereo)(std::string name, dsp::stream<dsp::StereoFloat_t>* stream);
std::vector<std::string> (*getStreamNameList)(void);
enum {
REF_LOWER,
REF_CENTER,
REF_UPPER,
_REF_COUNT
};
};
enum {
EVENT_STREAM_PARAM_CHANGED,
EVENT_SELECTED_VFO_CHANGED,
_EVENT_COUNT
};
struct Module_t {
#ifdef _WIN32
@@ -75,14 +36,20 @@ namespace mod {
#else
void* inst;
#endif
void* (*_INIT_)(API_t*, ImGuiContext*, std::string);
void (*_DRAW_MENU_)(void*);
void (*_NEW_FRAME_)(void*);
void (*_HANDLE_EVENT_)(void*, int);
void (*_STOP_)(void*);
void (*_INIT_)();
void* (*_CREATE_INSTANCE)(std::string);
void (*_DELETE_INSTANCE)();
void (*_STOP_)();
void* ctx;
};
struct ModuleInfo_t {
char* name;
char* description;
char* author;
char* version;
};
void initAPI(ImGui::WaterFall* wtf);
void loadModule(std::string path, std::string name);
void broadcastEvent(int eventId);
@@ -92,4 +59,4 @@ namespace mod {
extern std::vector<std::string> moduleNames;
};
extern mod::API_t* API;
#define MOD_INFO MOD_EXPORT const mod::ModuleInfo_t _INFO