looper/backends/playback/fluidsynth/fluidsynth_backend.hpp

47 lines
1.6 KiB
C++
Raw Normal View History

2024-10-24 11:33:08 -07:00
#pragma once
#include "playback_backend.hpp"
#include <omp.h>
#include <cstdint>
#include <stddef.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include <streambuf>
#include <vector>
#include <util.hpp>
#include <SDL.h>
#include "file_backend.hpp"
2024-10-26 09:01:06 -07:00
#include <fluidsynth.h>
2024-10-24 11:33:08 -07:00
class FluidSynthBackend : public PlaybackBackend {
File *file;
2024-10-26 09:01:06 -07:00
static void fluidsynth_get_property_list_wrapper(void *udata, const char *name, int type);
2024-10-24 11:33:08 -07:00
std::vector<Property> fluidsynth_properties;
fluid_settings_t *settings;
void fluidsynth_get_property_list(const char *name, int type);
public:
void set_fluidsynth_property_str(std::string path, std::string val);
void set_fluidsynth_property_num(std::string path, double val);
void set_fluidsynth_property_int(std::string path, int val);
std::string get_fluidsynth_property_str(std::string path);
double get_fluidsynth_property_num(std::string path);
int get_fluidsynth_property_int(std::string path);
inline std::string get_id() override {
return "fluidsynth";
}
inline std::string get_name() override {
return "MIDI player";
}
std::vector<Property> get_property_list() override;
void seek(double position) override;
void load(const char *filename) override;
void switch_stream(int idx) override;
void cleanup() override;
int get_stream_idx() override;
size_t render(void *buf, size_t maxlen) override;
double get_position() override;
inline double get_length() override {
return length;
}
2024-10-26 09:01:06 -07:00
inline ~FluidSynthBackend() override { }
2024-10-24 11:33:08 -07:00
};