-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSFSynth.h
52 lines (45 loc) · 1.17 KB
/
SFSynth.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
//
// Created by martin on 4/28/18.
//
#ifndef RTPIANO_SFSYNTH_H
#define RTPIANO_SFSYNTH_H
#include <cstring>
#include <cassert>
#include <cstdlib>
#include <iostream>
#include <thread>
#include <thread>
#include <chrono>
#include <iostream>
#include <future>
#include "json.hpp"
using json = nlohmann::json;
using namespace std;
class SFSynth {
public:
static long long tsfPtr;
static float bufferA[4096];
static float bufferB[4096];
static bool writingA;
static int bufferSize;
static int bufferCounter;
static int sustained[127];
static bool isSustaining;
static int tsfPreset;
static float gain;
static int presetCount;
static thread workerThread;
static std::future<void> future;
static void init(unsigned int sampleRate, unsigned int _bufferSize);
static void setPreset(int bank, int preset);
static void noteOn(int pitch, int velocity);
static void noteOff(int pitch);
static void sustainOn();
static void sustainOff();
static void setGain(float _gain);
static float getNextSample();
static void panic();
static json getInstruments();
static void renderWorker();
};
#endif //RTPIANO_SFSYNTH_H