/* ============================================================================== This file was generated by user! ============================================================================== */ #ifndef _JAYSYNTHVOICE_H_ #define _JAYSYNTHVOICE_H_ #include "../JuceLibraryCode/JuceHeader.h" #include "synth/synth_defs.h" class JaySynthVoice { public: JaySynthVoice(voice_t *pVoice, int id, voice_common_t *pCom); ~JaySynthVoice(); void setSampleRate (synth_float_t sampleRate); void setBufsize (int bufsize); bool canPlaySound (SynthesiserSound* sound); void startNote (const int midiNoteNumber, const float velocity, SynthesiserSound* /*sound*/, const int /*currentPitchWheelPosition*/); void stopNote (const bool allowTailOff); void pitchWheelMoved (const int newValue); void controllerMoved (const int controllerNumber, const int newValue); void renderNextBlock (AudioSampleBuffer& outputBuffer, int startSample, int numSamples); void setParameter(int index, synth_float_t value); int getCurrentlyPlayingNote() const { return currentlyPlayingNote; } SynthesiserSound::Ptr getCurrentlyPlayingSound() const { return currentlyPlayingSound; } bool isPlayingChannel (int midiChannel) const { return currentlyPlayingSound != nullptr && currentlyPlayingSound->appliesToChannel (midiChannel); } void setCurrentPlaybackSampleRate (double newRate) { currentSampleRate = newRate; } double getSampleRate() const { return currentSampleRate; } void clearCurrentNote() { currentlyPlayingNote = -1; currentlyPlayingSound = nullptr; } private: friend class JaySynth; voice_t *m_pVoice; synth_float_t note_on_time; double currentSampleRate; int currentlyPlayingNote; uint32 noteOnTime; SynthesiserSound::Ptr currentlyPlayingSound; bool keyIsDown; // the voice may still be playing when the key is not down (i.e. sustain pedal) bool sostenutoPedalDown; }; #endif // _JAYSYNTHVOICE_H_