2018-02-27 08:25:20 +08:00
|
|
|
//
|
|
|
|
// Created by Alex Birch on 07/09/2017.
|
|
|
|
//
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include<memory>
|
|
|
|
#include<fluidsynth.h>
|
|
|
|
#include "../JuceLibraryCode/JuceHeader.h"
|
|
|
|
|
2019-07-07 07:22:47 +08:00
|
|
|
using namespace std;
|
2018-02-27 08:25:20 +08:00
|
|
|
|
|
|
|
class SoundfontSynthVoice : public SynthesiserVoice {
|
|
|
|
public:
|
2019-07-07 07:22:47 +08:00
|
|
|
SoundfontSynthVoice(shared_ptr<fluid_synth_t> synth);
|
2018-02-27 08:25:20 +08:00
|
|
|
|
|
|
|
bool canPlaySound (SynthesiserSound* sound) override;
|
|
|
|
void startNote (
|
|
|
|
int midiNoteNumber,
|
|
|
|
float velocity,
|
|
|
|
SynthesiserSound* /*sound*/,
|
|
|
|
int /*currentPitchWheelPosition*/) override;
|
|
|
|
|
|
|
|
void stopNote (float /*velocity*/, bool allowTailOff) override;
|
|
|
|
void pitchWheelMoved (int /*newValue*/) override;
|
|
|
|
|
|
|
|
void controllerMoved (int /*controllerNumber*/, int /*newValue*/) override;
|
|
|
|
|
|
|
|
void renderNextBlock (AudioBuffer<float>& outputBuffer, int startSample, int numSamples) override;
|
|
|
|
|
|
|
|
private:
|
|
|
|
double tailOff;
|
|
|
|
double level;
|
|
|
|
double currentAngle;
|
|
|
|
double angleDelta;
|
|
|
|
int midiNoteNumber;
|
|
|
|
|
2019-07-07 07:22:47 +08:00
|
|
|
shared_ptr<fluid_synth_t> synth;
|
2018-02-27 08:25:20 +08:00
|
|
|
};
|