juicysfplugin/Source/SoundfontSynthVoice.h
2018-02-27 00:25:20 +00:00

40 lines
974 B
C++

//
// Created by Alex Birch on 07/09/2017.
//
#pragma once
#include<memory>
#include<fluidsynth.h>
#include "../JuceLibraryCode/JuceHeader.h"
using std::shared_ptr;
class SoundfontSynthVoice : public SynthesiserVoice {
public:
SoundfontSynthVoice(fluid_synth_t* synth);
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;
fluid_synth_t* synth;
};